[llvm-branch-commits] [llvm] [OpenMPOpt] Make parallel regions reachable from new DeviceRTL loop functions (PR #150927)

Scott Linder via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Feb 24 09:38:34 PST 2026


================
@@ -1403,7 +1403,15 @@ bool PEIImpl::replaceFrameIndexDebugInstr(MachineFunction &MF, MachineInstr &MI,
            "Frame indices can only appear as a debug operand in a DBG_VALUE*"
            " machine instruction");
     Register Reg;
-    unsigned FrameIdx = Op.getIndex();
+    int FrameIdx = Op.getIndex();
+
+    // If the frame object has been removed (e.g., dead object elimination),
+    // the debug value is undefined. Replace with $noreg.
+    if (MF.getFrameInfo().isDeadObjectIndex(FrameIdx)) {
----------------
slinder1 wrote:

It seems like this is likely the right thing to do in this case, but I don't think this is the right place to do it.

For example, `StackColoring` fixes up debug-info when merging slots, see `StackColoring::remapInstructions`. If we forcibly `$noreg` the debug value in PEI then we would miss bugs in code like `StackColoring` where e.g. the debug info could have been retained if a bit of work was done when enough info was available.

I would suggest tracing compilation of a minimal reproducer to find where the referenced stack index dies, and make the changes there.

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


More information about the llvm-branch-commits mailing list