[llvm] [DebugInfo][SimpleLoopUnswitch] Fix missing debug location updates (PR #97662)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 8 04:31:58 PDT 2024


================
@@ -2334,21 +2338,25 @@ static void unswitchNontrivialInvariants(
   // nuke the initial terminator placed in the split block.
   SplitBB->getTerminator()->eraseFromParent();
   if (FullUnswitch) {
-    // Splice the terminator from the original loop and rewrite its
-    // successors.
-    TI.moveBefore(*SplitBB, SplitBB->end());
-
     // Keep a clone of the terminator for MSSA updates.
     Instruction *NewTI = TI.clone();
     NewTI->insertInto(ParentBB, ParentBB->end());
 
+    // Splice the terminator from the original loop and rewrite its
+    // successors.
+    TI.moveBefore(*SplitBB, SplitBB->end());
+    TI.dropLocation();
----------------
OCHyams wrote:

Why move this code down from where it was before?

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


More information about the llvm-commits mailing list