diff options
author | Dan Gohman <gohman@apple.com> | 2007-06-18 19:30:09 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2007-06-18 19:30:09 +0000 |
commit | eed125f315f576944388f7c6872d4f580bb07267 (patch) | |
tree | 3f5a81cbe4267c177afc26517e5a1073c3db459e /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | 02b0997b2870cb5be477f0cc27658ac43802b1be (diff) | |
download | bcm5719-llvm-eed125f315f576944388f7c6872d4f580bb07267.tar.gz bcm5719-llvm-eed125f315f576944388f7c6872d4f580bb07267.zip |
In SCEVAddExpr::get, skip over any cast operands before looking for nested
add operands after constant operands. The recent change to recognize
sign-extend expressions caused this to be exposed more often.
llvm-svn: 37628
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 3ae65286fa7..ed8ea327678 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -685,8 +685,11 @@ SCEVHandle SCEVAddExpr::get(std::vector<SCEVHandle> &Ops) { return SCEVAddExpr::get(Ops); } - // Okay, now we know the first non-constant operand. If there are add - // operands they would be next. + // Now we know the first non-constant operand. Skip past any cast SCEVs. + while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scAddExpr) + ++Idx; + + // If there are add operands they would be next. if (Idx < Ops.size()) { bool DeletedAdd = false; while (SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Ops[Idx])) { |