summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-02-18 21:34:02 +0000
committerDan Gohman <gohman@apple.com>2010-02-18 21:34:02 +0000
commitc43d264cc014f09f50f7e1182ff3e8c92bc0b297 (patch)
tree04c4b46e20d2e7c3114831010b10817c4e709d4f
parentc953acbd7f611dbbdcbdf8d1b98db9834ae8dfd6 (diff)
downloadbcm5719-llvm-c43d264cc014f09f50f7e1182ff3e8c92bc0b297.tar.gz
bcm5719-llvm-c43d264cc014f09f50f7e1182ff3e8c92bc0b297.zip
Hoist this loop-invariant logic out of the loop.
llvm-svn: 96614
-rw-r--r--llvm/lib/Transforms/Scalar/IndVarSimplify.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index 432e7ea091a..e699261b277 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -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.
OpenPOWER on IntegriCloud