[llvm-branch-commits] [llvm] [KeyInstr][SimplifyCFG] Remap atoms after duplication for threading (PR #133484)

Stephen Tozer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Apr 9 05:16:21 PDT 2025


================
@@ -3609,11 +3609,11 @@ foldCondBranchOnValueKnownInPredecessorImpl(BranchInst *BI, DomTreeUpdater *DTU,
         N->setName(BBI->getName() + ".c");
 
       // Update operands due to translation.
-      for (Use &Op : N->operands()) {
-        DenseMap<Value *, Value *>::iterator PI = TranslateMap.find(Op);
-        if (PI != TranslateMap.end())
-          Op = PI->second;
-      }
+      // Key Instructions: Remap all the atom groups.
+      if (const DebugLoc &DL = BBI->getDebugLoc())
+        mapAtomInstance(DL, TranslateMap);
+      RemapInstruction(N, TranslateMap,
+                       RF_IgnoreMissingLocals | RF_NoModuleLevelChanges);
----------------
SLTozer wrote:

If I understand right, `RemapInstruction` with these operands will never create a new value mapping, only ever return an existing mapping - is that correct?

https://github.com/llvm/llvm-project/pull/133484


More information about the llvm-branch-commits mailing list