aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/IndVarSimplify.cpp
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
commit814f2b2d1927a5397c0e923588527277b9f67d6b (patch)
treeab88be16f5254ef5bf02dc838ba0874ad310aa31 /lib/Transforms/Scalar/IndVarSimplify.cpp
parent352d352c023ed411d9e4357ea01f3ec468ff87dc (diff)
downloadexternal_llvm-814f2b2d1927a5397c0e923588527277b9f67d6b.tar.gz
external_llvm-814f2b2d1927a5397c0e923588527277b9f67d6b.tar.bz2
external_llvm-814f2b2d1927a5397c0e923588527277b9f67d6b.zip
Hoist this loop-invariant logic out of the loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96614 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/IndVarSimplify.cpp')
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index 432e7ea091..e699261b27 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/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.