[PATCH] D109758: [StackColoring] Fix a debug invariance problem

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 14 06:29:27 PDT 2021


bjope created this revision.
Herald added subscribers: pengfei, hiraditya.
bjope requested review of this revision.
Herald added a project: LLVM.

Ignore dbg instructions when collecting stack slot markers. This is
to make sure the coloring is invariant regarding presence of dbg
instructions (even in cases when the dbg instructions might be
badly placed in the input).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109758

Files:
  llvm/lib/CodeGen/StackColoring.cpp
  llvm/test/CodeGen/X86/StackColoring-dbg-invariance.mir


Index: llvm/test/CodeGen/X86/StackColoring-dbg-invariance.mir
===================================================================
--- llvm/test/CodeGen/X86/StackColoring-dbg-invariance.mir
+++ llvm/test/CodeGen/X86/StackColoring-dbg-invariance.mir
@@ -74,9 +74,9 @@
 
     ; CHECK-LABEL: name: test_1
     ; CHECK: liveins: $edi
-    ; CHECK: DBG_VALUE %stack.1.a4, $noreg, !9, !DIExpression(), debug-location !11
+    ; CHECK: DBG_VALUE %stack.0.a1, $noreg, !9, !DIExpression(), debug-location !11
     ; CHECK: [[LEA64r:%[0-9]+]]:gr64 = LEA64r %stack.0.a1, 1, $noreg, 0, $noreg
-    ; CHECK: [[LEA64r1:%[0-9]+]]:gr64 = LEA64r %stack.1.a4, 1, $noreg, 0, $noreg
+    ; CHECK: [[LEA64r1:%[0-9]+]]:gr64 = LEA64r %stack.0.a1, 1, $noreg, 0, $noreg
     ; CHECK: RET 0
     DBG_VALUE %stack.3.a4, $noreg, !9, !DIExpression(), debug-location !11
     LIFETIME_START %stack.3.a4
Index: llvm/lib/CodeGen/StackColoring.cpp
===================================================================
--- llvm/lib/CodeGen/StackColoring.cpp
+++ llvm/lib/CodeGen/StackColoring.cpp
@@ -712,7 +712,7 @@
         }
         Markers.push_back(&MI);
         MarkersFound += 1;
-      } else {
+      } else if (!MI.isDebugInstr()) {
         for (const MachineOperand &MO : MI.operands()) {
           if (!MO.isFI())
             continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109758.372469.patch
Type: text/x-patch
Size: 1316 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210914/348a8202/attachment.bin>


More information about the llvm-commits mailing list