1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 13:11:39 +01:00

Hoist this loop-invariant logic out of the loop.

llvm-svn: 96614
This commit is contained in:
Dan Gohman 2010-02-18 21:34:02 +00:00
parent 5b9d14b55e
commit f0d7b5df4b

View File

@ -241,15 +241,17 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L,
while ((PN = dyn_cast<PHINode>(BBI++))) {
if (PN->use_empty())
continue; // dead use, don't replace it
// SCEV only supports integer expressions for now.
if (!PN->getType()->isIntegerTy() && !PN->getType()->isPointerTy())
continue;
// Iterate over all of the values in all the PHI nodes.
for (unsigned i = 0; i != NumPreds; ++i) {
// If the value being merged in is not integer or is not defined
// in the loop, skip it.
Value *InVal = PN->getIncomingValue(i);
if (!isa<Instruction>(InVal) ||
// SCEV only supports integer expressions for now.
(!InVal->getType()->isIntegerTy() &&
!InVal->getType()->isPointerTy()))
if (!isa<Instruction>(InVal))
continue;
// If this pred is for a subloop, not L itself, skip it.