diff options
author | Brendon Cahoon <bcahoon@codeaurora.org> | 2015-04-20 16:03:28 +0000 |
---|---|---|
committer | Brendon Cahoon <bcahoon@codeaurora.org> | 2015-04-20 16:03:28 +0000 |
commit | a57cc8bc817f3ff7a48bfd8221562e3cc2a2bc10 (patch) | |
tree | 0ceda8d4e9fcdf4f83b4cdd0feb7f10c4ced3932 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | 6779075c441b49304ba27d4a7373eaa0babb94f7 (diff) | |
download | bcm5719-llvm-a57cc8bc817f3ff7a48bfd8221562e3cc2a2bc10.tar.gz bcm5719-llvm-a57cc8bc817f3ff7a48bfd8221562e3cc2a2bc10.zip |
Recognize n/1 in the SCEV divide function
n/1 generates a quotient equal to n and a remainder of 0.
If this case is not recognized, then the SCEV divide() function
can return a remainder that is greater than or equal to the
denominator, which means the delinearized subscripts for the
test case will be incorrect.
Differential Revision: http://reviews.llvm.org/D9003
llvm-svn: 235311
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 37377f0b859..d88b0268651 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -726,6 +726,13 @@ public: return; } + // A simple case when N/1. The quotient is N. + if (Denominator->isOne()) { + *Quotient = Numerator; + *Remainder = D.Zero; + return; + } + // Split the Denominator when it is a product. if (const SCEVMulExpr *T = dyn_cast<const SCEVMulExpr>(Denominator)) { const SCEV *Q, *R; |