[PATCH] D68004: [InstCombine] Fix call guard difference with dbg

Chris Ye via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 05:28:45 PDT 2019


yechunliang updated this revision to Diff 223828.
yechunliang added a comment.

Added one more RUN command line with "-debugify-each" in existed call-guard.ll, needn't duplicate another same test case file.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68004/new/

https://reviews.llvm.org/D68004

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/test/Transforms/InstCombine/call-guard.ll


Index: llvm/test/Transforms/InstCombine/call-guard.ll
===================================================================
--- llvm/test/Transforms/InstCombine/call-guard.ll
+++ llvm/test/Transforms/InstCombine/call-guard.ll
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -instcombine -S | FileCheck %s
+; RUN: opt < %s -instcombine -S -debugify-each | FileCheck %s
 
 declare void @llvm.experimental.guard(i1, ...)
 
Index: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -4018,12 +4018,12 @@
     // Is this guard followed by another guard?  We scan forward over a small
     // fixed window of instructions to handle common cases with conditions
     // computed between guards.
-    Instruction *NextInst = II->getNextNode();
+    Instruction *NextInst = II->getNextNonDebugInstruction();
     for (unsigned i = 0; i < GuardWideningWindow; i++) {
       // Note: Using context-free form to avoid compile time blow up
       if (!isSafeToSpeculativelyExecute(NextInst))
         break;
-      NextInst = NextInst->getNextNode();
+      NextInst = NextInst->getNextNonDebugInstruction();
     }
     Value *NextCond = nullptr;
     if (match(NextInst,
@@ -4035,10 +4035,10 @@
         return eraseInstFromFunction(*NextInst);
 
       // Otherwise canonicalize guard(a); guard(b) -> guard(a & b).
-      Instruction* MoveI = II->getNextNode();
+      Instruction* MoveI = II->getNextNonDebugInstruction();
       while (MoveI != NextInst) {
         auto *Temp = MoveI;
-        MoveI = MoveI->getNextNode();
+        MoveI = MoveI->getNextNonDebugInstruction();
         Temp->moveBefore(II);
       }
       II->setArgOperand(0, Builder.CreateAnd(CurrCond, NextCond));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68004.223828.patch
Type: text/x-patch
Size: 1848 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191008/b77fb8d2/attachment.bin>


More information about the llvm-commits mailing list