[llvm] r340368 - [CodeGenPrepare] Scan past debug intrinsics to find select candidates (NFC)
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 21 16:42:38 PDT 2018
Author: vedantk
Date: Tue Aug 21 16:42:38 2018
New Revision: 340368
URL: http://llvm.org/viewvc/llvm-project?rev=340368&view=rev
Log:
[CodeGenPrepare] Scan past debug intrinsics to find select candidates (NFC)
In optimizeSelectInst, when scanning for candidate selects to rewrite
into branches, scan past debug intrinsics. This makes the debug-enabled
and non-debug paths through optimizeSelectInst more congruent.
NFC because every select is eventually visited either way.
Modified:
llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
Modified: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=340368&r1=340367&r2=340368&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp Tue Aug 21 16:42:38 2018
@@ -5599,9 +5599,10 @@ bool CodeGenPrepare::optimizeSelectInst(
// Find all consecutive select instructions that share the same condition.
SmallVector<SelectInst *, 2> ASI;
ASI.push_back(SI);
- for (BasicBlock::iterator It = ++BasicBlock::iterator(SI);
- It != SI->getParent()->end(); ++It) {
- SelectInst *I = dyn_cast<SelectInst>(&*It);
+ for (Instruction *NextInst = SI->getNextNonDebugInstruction();
+ NextInst != SI->getParent()->getTerminator();
+ NextInst = NextInst->getNextNonDebugInstruction()) {
+ SelectInst *I = dyn_cast<SelectInst>(NextInst);
if (I && SI->getCondition() == I->getCondition()) {
ASI.push_back(I);
} else {
More information about the llvm-commits
mailing list