diff options
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; } |

