[PATCH] D68004: [InstCombine] Fix call guard difference with dbg
Chris Ye via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 19:46:00 PDT 2019
yechunliang updated this revision to Diff 221659.
yechunliang added a comment.
[InstCombine] Fix call guard difference with dbg
While using "opt -debugify-each", the dbg instructions will exceed GuardWideningWindow, so that the instructions will be different with and without "-debugify-each" after optimization. We should just skip debug instructions while looking for the guard in the window. Just use getNextNonDebugInstruction instead of current getNextNode.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68004/new/
https://reviews.llvm.org/D68004
Files:
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
Index: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -4007,12 +4007,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,
@@ -4024,10 +4024,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.221659.patch
Type: text/x-patch
Size: 1445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190925/9638f7af/attachment.bin>
More information about the llvm-commits
mailing list