Revert "[CodeGenPrepare] Scan past debug intrinsics to find select candidates (NFC)"

This causes crashes due to the interleaved dbg.value intrinsics being
left at the end of basic blocks, causing the actual terminators (br,
etc) to be not where they should be (not at the end of the block),
leading to later crashes.

Further discussion on the original commit thread.

This reverts commit r340368.

llvm-svn: 340794
This commit is contained in:
David Blaikie 2018-08-28 00:55:19 +00:00
parent af6dad54c0
commit cfd04c50e1

View File

@ -5602,10 +5602,9 @@ bool CodeGenPrepare::optimizeSelectInst(SelectInst *SI) {
// Find all consecutive select instructions that share the same condition.
SmallVector<SelectInst *, 2> ASI;
ASI.push_back(SI);
for (Instruction *NextInst = SI->getNextNonDebugInstruction();
NextInst != SI->getParent()->getTerminator();
NextInst = NextInst->getNextNonDebugInstruction()) {
SelectInst *I = dyn_cast<SelectInst>(NextInst);
for (BasicBlock::iterator It = ++BasicBlock::iterator(SI);
It != SI->getParent()->end(); ++It) {
SelectInst *I = dyn_cast<SelectInst>(&*It);
if (I && SI->getCondition() == I->getCondition()) {
ASI.push_back(I);
} else {