From 088348c3d3056fb638e836d3861320d9712724a8 Mon Sep 17 00:00:00 2001 From: Zeinab Pourgheisari Date: Mon, 15 Dec 2025 15:15:39 +0100 Subject: [PATCH] GSA: Fix iterator invalidation when expanding gamma trees --- experimental/lib/Analysis/GSAAnalysis.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/experimental/lib/Analysis/GSAAnalysis.cpp b/experimental/lib/Analysis/GSAAnalysis.cpp index 5e9cda5eec..e1fdc88f69 100644 --- a/experimental/lib/Analysis/GSAAnalysis.cpp +++ b/experimental/lib/Analysis/GSAAnalysis.cpp @@ -413,8 +413,9 @@ void experimental::gsa::GSAAnalysis::convertPhiToGamma( mlir::DominanceInfo domInfo; mlir::CFGLoopInfo loopInfo(domInfo.getDomTree(®ion)); + auto gatesSnapshot = gatesPerBlock; // For each block - for (auto const &[phiBlock, phis] : gatesPerBlock) { + for (auto const &[phiBlock, phis] : gatesSnapshot) { // For each phi for (Gate *phi : phis) {