diff options
author | Davide Italiano <davide@freebsd.org> | 2018-01-07 22:09:44 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2018-01-07 22:09:44 +0000 |
commit | e15bffe9ea8743182f70f18d1a8720c21d28be18 (patch) | |
tree | e7e8ca5fd735805c55f5fc2c3bf77c65703e57c5 | |
parent | 4c39758a380054c90fe2063916c73a19219c5266 (diff) | |
download | bcm5719-llvm-e15bffe9ea8743182f70f18d1a8720c21d28be18.tar.gz bcm5719-llvm-e15bffe9ea8743182f70f18d1a8720c21d28be18.zip |
Revert "[SCCP] Manually fold branches on undef."
I thought this was responsible for PR35723, but I was
wrong, the issue lies elsewhere. Revert while I debug.
llvm-svn: 321975
-rw-r--r-- | llvm/lib/Transforms/Scalar/SCCP.cpp | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index 9dc550ceaec..df6053ac201 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -1927,32 +1927,9 @@ static bool runIPSCCP(Module &M, const DataLayout &DL, if (!I) continue; bool Folded = ConstantFoldTerminator(I->getParent()); - if (!Folded) { - // The constant folder may not have been able to fold the terminator - // if this is a branch or switch on undef. Fold it manually as a - // branch to the first successor. -#ifndef NDEBUG - if (auto *BI = dyn_cast<BranchInst>(I)) { - assert(BI->isConditional() && isa<UndefValue>(BI->getCondition()) && - "Branch should be foldable!"); - } else if (auto *SI = dyn_cast<SwitchInst>(I)) { - assert(isa<UndefValue>(SI->getCondition()) && "Switch should fold"); - } else { - llvm_unreachable("Didn't fold away reference to block!"); - } -#endif - - // Make this an uncond branch to the first successor. - TerminatorInst *TI = I->getParent()->getTerminator(); - BranchInst::Create(TI->getSuccessor(0), TI); - - // Remove entries in successor phi nodes to remove edges. - for (unsigned i = 1, e = TI->getNumSuccessors(); i != e; ++i) - TI->getSuccessor(i)->removePredecessor(TI->getParent()); - - // Remove the old terminator. - TI->eraseFromParent(); - } + assert(Folded && + "Expect TermInst on constantint or blockaddress to be folded"); + (void) Folded; } // Finally, delete the basic block. |