mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-09 21:32:49 +00:00
Fix InstCombine/2007-02-23-PhiFoldInfLoop.ll and PR1217
llvm-svn: 34546
This commit is contained in:
parent
f222a6e498
commit
14217fb105
@ -1641,11 +1641,12 @@ Instruction *InstCombiner::FoldOpIntoPhi(Instruction &I) {
|
||||
|
||||
// Check to see if all of the operands of the PHI are constants. If there is
|
||||
// one non-constant value, remember the BB it is. If there is more than one
|
||||
// bail out.
|
||||
// or if *it* is a PHI, bail out.
|
||||
BasicBlock *NonConstBB = 0;
|
||||
for (unsigned i = 0; i != NumPHIValues; ++i)
|
||||
if (!isa<Constant>(PN->getIncomingValue(i))) {
|
||||
if (NonConstBB) return 0; // More than one non-const value.
|
||||
if (isa<PHINode>(PN->getIncomingValue(i))) return 0; // Itself a phi.
|
||||
NonConstBB = PN->getIncomingBlock(i);
|
||||
|
||||
// If the incoming non-constant value is in I's block, we have an infinite
|
||||
|
Loading…
Reference in New Issue
Block a user