[llvm] [MoveAutoInit] Don't move auto-init instructions into EH pad blocks (PR #222100)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 00:23:24 PDT 2026


================
@@ -178,9 +178,10 @@ static bool runMoveAutoInit(Function &F, DominatorTree &DT, MemorySSA &MSSA) {
       UsersDominator = DominatingPredecessor;
     }
 
-    // CatchSwitchInst blocks can only have one instruction, so they are not
-    // good candidates for insertion.
-    while (isa<CatchSwitchInst>(UsersDominator->getFirstNonPHIIt())) {
+    // EH pad blocks are not good candidates for insertion: CatchSwitchInst
+    // blocks can only have one instruction, and for other pads we risk
+    // re-ordering memory access instructions and violating MemorySSA rules.
+    while (UsersDominator->isEHPad()) {
----------------
serge-sans-paille wrote:

Nice generalization, thanks for spotting this.

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


More information about the llvm-commits mailing list