llvm.org GIT mirror llvm / c87b40b
Fix normalization and de-normalization of non-affine SCEVs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105480 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 9 years ago
2 changed file(s) with 32 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
104104 case NormalizeAutodetect:
105105 if (Instruction *OI = dyn_cast(OperandValToReplace))
106106 if (IVUseShouldUsePostIncValue(User, OI, L, &DT)) {
107 Result = SE.getMinusSCEV(Result, AR->getStepRecurrence(SE));
107 const SCEV *TransformedStep =
108 TransformForPostIncUse(Kind, AR->getStepRecurrence(SE),
109 User, OperandValToReplace, Loops, SE, DT);
110 Result = SE.getMinusSCEV(Result, TransformedStep);
108111 Loops.insert(L);
109112 }
110113 break;
111114 case Normalize:
112 if (Loops.count(L))
113 Result = SE.getMinusSCEV(Result, AR->getStepRecurrence(SE));
114 break;
115 case Denormalize:
116115 if (Loops.count(L)) {
117116 const SCEV *TransformedStep =
118117 TransformForPostIncUse(Kind, AR->getStepRecurrence(SE),
119118 User, OperandValToReplace, Loops, SE, DT);
120 Result = SE.getAddExpr(Result, TransformedStep);
119 Result = SE.getMinusSCEV(Result, TransformedStep);
121120 }
121 break;
122 case Denormalize:
123 if (Loops.count(L))
124 Result = SE.getAddExpr(Result, AR->getStepRecurrence(SE));
122125 break;
123126 }
124127 return Result;
0 ; RUN: llc -march=x86-64 < %s | FileCheck %s
1
2 ; LSR should compute the correct starting values for this loop. Note that
3 ; it's not necessarily LSR's job to compute loop exit expressions; that's
4 ; indvars' job.
5 ; CHECK: movl $12
6 ; CHECK: movl $42
7
8 define i32 @real_symmetric_eigen(i32 %n) nounwind {
9 while.body127: ; preds = %while.cond122
10 br label %while.cond141
11
12 while.cond141: ; preds = %while.cond141, %while.body127
13 %0 = phi i32 [ 7, %while.body127 ], [ %indvar.next67, %while.cond141 ] ; [#uses=3]
14 %indvar.next67 = add i32 %0, 1 ; [#uses=1]
15 %t = icmp slt i32 %indvar.next67, %n
16 br i1 %t, label %if.then171, label %while.cond141
17
18 if.then171: ; preds = %while.cond141
19 %mul150 = mul i32 %0, %0 ; [#uses=1]
20 %add174 = add i32 %mul150, %0 ; [#uses=1]
21 ret i32 %add174
22 }