llvm.org GIT mirror llvm / 958e292
Don't (unconditionally) use getSCEVAtScope to simplify the step expression in IVUsers, because in the case of a use of a non-linear addrec outside of a loop, this causes the addrec to be evaluated as a linear addrec. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73774 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 10 years ago
2 changed file(s) with 18 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
111111 SCEVHandle AddRecStart = AddRec->getStart();
112112 AddRecStart = SE->getSCEVAtScope(AddRecStart, UseLoop);
113113 SCEVHandle AddRecStride = AddRec->getStepRecurrence(*SE);
114 AddRecStride = SE->getSCEVAtScope(AddRecStride, UseLoop);
115114
116115 // FIXME: If Start contains an SCEVAddRecExpr from a different loop, other
117116 // than an outer loop of the current loop, reject it. LSR has no concept of
0 ; RUN: llvm-as < %s | opt -analyze -iv-users -disable-output | grep {Stride i64 {1,+,2}:}
1
2 ; The value of %r is dependent on a polynomial iteration expression.
3
4 define i64 @foo(i64 %n) {
5 entry:
6 br label %loop
7
8 loop:
9 %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %loop ]
10 %indvar.next = add i64 %indvar, 1
11 %c = icmp eq i64 %indvar.next, %n
12 br i1 %c, label %exit, label %loop
13
14 exit:
15 %r = mul i64 %indvar, %indvar
16 ret i64 %r
17 }