diff options
author | Sebastian Pop <spop@codeaurora.org> | 2014-04-08 21:21:10 +0000 |
---|---|---|
committer | Sebastian Pop <spop@codeaurora.org> | 2014-04-08 21:21:10 +0000 |
commit | 9738e83a7da75d6f89d85e00ab915befe049882f (patch) | |
tree | f32169fefaf40c09fb7956717cb5381958f26c09 /llvm/lib/Analysis | |
parent | b5b84e0963a985d0e7b21b0aa5484a4b5a7d4768 (diff) | |
download | bcm5719-llvm-9738e83a7da75d6f89d85e00ab915befe049882f.tar.gz bcm5719-llvm-9738e83a7da75d6f89d85e00ab915befe049882f.zip |
handle special cases when findGCD returns 1
used to fail with 'Step should divide Start with no remainder.'
llvm-svn: 205801
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index d6165111dba..6ccf8aac3b8 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -7001,12 +7001,17 @@ public: const SCEV *Rem = Zero; const SCEV *Res = findGCD(SE, Expr->getOperand(0), GCD, &Rem); + if (Res == One || Res->isAllOnesValue()) { + Remainder = Expr; + return GCD; + } + if (Rem != Zero) Remainder = SE.getAddExpr(Remainder, Rem); Rem = Zero; Res = findGCD(SE, Expr->getOperand(1), Res, &Rem); - if (Rem != Zero) { + if (Rem != Zero || Res == One || Res->isAllOnesValue()) { Remainder = Expr; return GCD; } |