Make sure PRE doesn't split crit edges from indirectbr.

llvm-svn: 85692
This commit is contained in:
Chris Lattner 2009-10-31 22:11:15 +00:00
parent 2c3e618a06
commit a546dcf418
1 changed files with 5 additions and 1 deletions

View File

@ -1810,7 +1810,7 @@ bool GVN::processBlock(BasicBlock *BB) {
/// performPRE - Perform a purely local form of PRE that looks for diamond
/// control flow patterns and attempts to perform simple PRE at the join point.
bool GVN::performPRE(Function& F) {
bool GVN::performPRE(Function &F) {
bool Changed = false;
SmallVector<std::pair<TerminatorInst*, unsigned>, 4> toSplit;
DenseMap<BasicBlock*, Value*> predMap;
@ -1876,6 +1876,10 @@ bool GVN::performPRE(Function& F) {
if (NumWithout != 1 || NumWith == 0)
continue;
// Don't do PRE across indirect branch.
if (isa<IndirectBrInst>(PREPred->getTerminator()))
continue;
// We can't do PRE safely on a critical edge, so instead we schedule
// the edge to be split and perform the PRE the next time we iterate
// on the function.