Skip to content

Commit

Permalink
[IVUsers] Don't bail out of normalizing non-affine add recs
Browse files Browse the repository at this point in the history
Summary:
In a previous change I changed SCEV's normalization / denormalization
to work with non-affine add recs.  So the bailout in IVUsers can be
removed.

Reviewers: atrick, efriedma

Reviewed By: atrick

Subscribers: davide, mcrosier, llvm-commits

Differential Revision: https://reviews.llvm.org/D32105

llvm-svn: 301298
  • Loading branch information
sanjoy committed Apr 25, 2017
1 parent d577561 commit 561247a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
12 changes: 1 addition & 11 deletions llvm/lib/Analysis/IVUsers.cpp
Expand Up @@ -253,18 +253,8 @@ bool IVUsers::AddUsersImpl(Instruction *I,
const SCEV *OriginalISE = ISE;

auto NormalizePred = [&](const SCEVAddRecExpr *AR) {
// We only allow affine AddRecs to be normalized, otherwise we would not
// be able to correctly denormalize.
// e.g. {1,+,3,+,2} == {-2,+,1,+,2} + {3,+,2}
// Normalized form: {-2,+,1,+,2}
// Denormalized form: {1,+,3,+,2}
//
// However, denormalization would use a different step expression than
// normalization (see getPostIncExpr), generating the wrong final
// expression: {-2,+,1,+,2} + {1,+,2} => {-1,+,3,+,2}
auto *L = AR->getLoop();
bool Result =
AR->isAffine() && IVUseShouldUsePostIncValue(User, I, L, DT);
bool Result = IVUseShouldUsePostIncValue(User, I, L, DT);
if (Result)
NewUse.PostIncLoops.insert(L);
return Result;
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Analysis/IVUsers/quadradic-exit-value.ll
Expand Up @@ -36,7 +36,7 @@ exit:
; sure they aren't marked as post-inc users.
;
; CHECK-LABEL: IV Users for loop %test2.loop
; CHECK-NO-LCSSA: %sext.us = {0,+,(16777216 + (-16777216 * %sub.us))<nuw><nsw>,+,33554432}<%test2.loop> in %f = ashr i32 %sext.us, 24
; CHECK-NO-LCSSA: %sext.us = {0,+,(16777216 + (-16777216 * %sub.us))<nuw><nsw>,+,33554432}<%test2.loop> (post-inc with loop %test2.loop) in %f = ashr i32 %sext.us, 24
define i32 @test2() {
entry:
br label %test2.loop
Expand Down

0 comments on commit 561247a

Please sign in to comment.