[llvm-branch-commits] [llvm] c7381b6 - [ARM] Skip debug during vpt block creation

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jun 25 20:20:55 PDT 2021


Author: David Green
Date: 2021-06-25T20:20:29-07:00
New Revision: c7381b628d63b4423617163ee1116e64f49d2265

URL: https://github.com/llvm/llvm-project/commit/c7381b628d63b4423617163ee1116e64f49d2265
DIFF: https://github.com/llvm/llvm-project/commit/c7381b628d63b4423617163ee1116e64f49d2265.diff

LOG: [ARM] Skip debug during vpt block creation

Debug info is currently preventing VPT block creation, leading to
different codegen. This patch attempts to skip any debug instructions
during vpt block creation, making sure they do not interfere.

Differential Revision: https://reviews.llvm.org/D103610

Added: 
    

Modified: 
    llvm/lib/Target/ARM/MVEVPTBlockPass.cpp
    llvm/test/CodeGen/Thumb2/mve-vpt-block-debug.mir

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/MVEVPTBlockPass.cpp b/llvm/lib/Target/ARM/MVEVPTBlockPass.cpp
index 9a710b784fd1..c7f451cba14f 100644
--- a/llvm/lib/Target/ARM/MVEVPTBlockPass.cpp
+++ b/llvm/lib/Target/ARM/MVEVPTBlockPass.cpp
@@ -107,6 +107,12 @@ static bool StepOverPredicatedInstrs(MachineBasicBlock::instr_iterator &Iter,
   NumInstrsSteppedOver = 0;
 
   while (Iter != EndIter) {
+    if (Iter->isDebugInstr()) {
+      // Skip debug instructions
+      ++Iter;
+      continue;
+    }
+
     NextPred = getVPTInstrPredicate(*Iter, PredReg);
     assert(NextPred != ARMVCC::Else &&
            "VPT block pass does not expect Else preds");
@@ -170,6 +176,8 @@ CreateVPTBlock(MachineBasicBlock::instr_iterator &Iter,
   LLVM_DEBUG(for (MachineBasicBlock::instr_iterator AddedInstIter =
                       std::next(BlockBeg);
                   AddedInstIter != Iter; ++AddedInstIter) {
+    if (AddedInstIter->isDebugInstr())
+      continue;
     dbgs() << "  adding: ";
     AddedInstIter->dump();
   });
@@ -197,7 +205,7 @@ CreateVPTBlock(MachineBasicBlock::instr_iterator &Iter,
     if (!IsVPRDefinedOrKilledByBlock(Iter, VPNOTBlockEndIter))
       break;
 
-    LLVM_DEBUG(dbgs() << "  removing VPNOT: "; Iter->dump(););
+    LLVM_DEBUG(dbgs() << "  removing VPNOT: "; Iter->dump());
 
     // Record the new size of the block
     BlockSize += ElseInstCnt;
@@ -211,6 +219,9 @@ CreateVPTBlock(MachineBasicBlock::instr_iterator &Iter,
     // Note that we are using "Iter" to iterate over the block so we can update
     // it at the same time.
     for (; Iter != VPNOTBlockEndIter; ++Iter) {
+      if (Iter->isDebugInstr())
+        continue;
+
       // Find the register in which the predicate is
       int OpIdx = findFirstVPTPredOperandIdx(*Iter);
       assert(OpIdx != -1);

diff  --git a/llvm/test/CodeGen/Thumb2/mve-vpt-block-debug.mir b/llvm/test/CodeGen/Thumb2/mve-vpt-block-debug.mir
index cb36f48934f1..ce540e506131 100644
--- a/llvm/test/CodeGen/Thumb2/mve-vpt-block-debug.mir
+++ b/llvm/test/CodeGen/Thumb2/mve-vpt-block-debug.mir
@@ -80,18 +80,14 @@ body:             |
     ; CHECK: DBG_VALUE $q2, $noreg, !19, !DIExpression(), debug-location !21
     ; CHECK: DBG_VALUE $q2, $noreg, !19, !DIExpression(), debug-location !21
     ; CHECK: DBG_VALUE $noreg, $noreg, !20, !DIExpression(), debug-location !21
-    ; CHECK: BUNDLE implicit-def $vpr, implicit-def $q2, implicit-def $d4, implicit-def $s8, implicit-def $s9, implicit-def $d5, implicit-def $s10, implicit-def $s11, implicit $q1, implicit $q0, implicit killed $q2, debug-location !23 {
-    ; CHECK:   MVE_VPTv4s32 8, renamable $q1, renamable $q0, 10, implicit-def $vpr, debug-location !23
+    ; CHECK: BUNDLE implicit-def dead $vpr, implicit-def $q2, implicit-def $d4, implicit-def $s8, implicit-def $s9, implicit-def $d5, implicit-def $s10, implicit-def $s11, implicit killed $q1, implicit killed $q0, implicit killed $q2, debug-location !23 {
+    ; CHECK:   MVE_VPTv4s32 12, renamable $q1, renamable $q0, 10, implicit-def $vpr, debug-location !23
     ; CHECK:   renamable $q2 = MVE_VADDi32 renamable $q0, renamable $q1, 1, internal renamable $vpr, killed renamable $q2, debug-location !23
+    ; CHECK:   DBG_VALUE $noreg, $noreg, !20, !DIExpression(), debug-location !21
+    ; CHECK:   DBG_VALUE internal $q2, $noreg, !19, !DIExpression(), debug-location !21
+    ; CHECK:   renamable $q2 = MVE_VADDi32 killed renamable $q0, killed renamable $q1, 2, internal killed renamable $vpr, internal killed renamable $q2, debug-location !25
+    ; CHECK:   DBG_VALUE internal $q2, $noreg, !19, !DIExpression(), debug-location !21
     ; CHECK: }
-    ; CHECK: DBG_VALUE $noreg, $noreg, !20, !DIExpression(), debug-location !21
-    ; CHECK: DBG_VALUE $q2, $noreg, !19, !DIExpression(), debug-location !21
-    ; CHECK: renamable $vpr = MVE_VPNOT killed renamable $vpr, 0, $noreg, debug-location !24
-    ; CHECK: BUNDLE implicit-def $q2, implicit-def $d4, implicit-def $s8, implicit-def $s9, implicit-def $d5, implicit-def $s10, implicit-def $s11, implicit killed $vpr, implicit killed $q0, implicit killed $q1, implicit killed $q2, debug-location !25 {
-    ; CHECK:   MVE_VPST 8, implicit $vpr, debug-location !25
-    ; CHECK:   renamable $q2 = MVE_VADDi32 killed renamable $q0, killed renamable $q1, 1, killed renamable $vpr, killed renamable $q2, debug-location !25
-    ; CHECK: }
-    ; CHECK: DBG_VALUE $q2, $noreg, !19, !DIExpression(), debug-location !21
     ; CHECK: $q0 = MVE_VORR killed $q2, killed $q2, 0, $noreg, undef $q0, debug-location !26
     ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $q0, debug-location !26
     DBG_VALUE $q0, $noreg, !17, !DIExpression(), debug-location !21


        


More information about the llvm-branch-commits mailing list