[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.

llvm-svn: 340368
This commit is contained in:
Vedant Kumar 2018-08-21 23:42:38 +00:00
parent fbc3873be9
commit 00e7558edd
1 changed files with 4 additions and 3 deletions

View File

@ -5599,9 +5599,10 @@ bool CodeGenPrepare::optimizeSelectInst(SelectInst *SI) {
// 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 {