llvm.org GIT mirror llvm / 8f4d5eb
Don't crash analyzing certain quadratics (addrec of {X,+,Y,+,1}). We're still waiting on code that actually analyzes them properly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58592 91177308-0d34-0410-b5e6-96231b3b80d8 Nick Lewycky 11 years ago
2 changed file(s) with 26 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
26032603 // The divisions must be performed as signed divisions.
26042604 APInt NegB(-B);
26052605 APInt TwoA( A << 1 );
2606 if (TwoA.isMinValue()) {
2607 SCEV *CNC = new SCEVCouldNotCompute();
2608 return std::make_pair(CNC, CNC);
2609 }
2610
26062611 ConstantInt *Solution1 = ConstantInt::get((NegB + SqrtVal).sdiv(TwoA));
26072612 ConstantInt *Solution2 = ConstantInt::get((NegB - SqrtVal).sdiv(TwoA));
26082613
0 ; RUN: llvm-as < %s | opt -analyze -scalar-evolution
1 ; PR1827
2
3 declare void @use(i32)
4
5 define void @foo() {
6 entry:
7 br label %loop_1
8
9 loop_1: ; preds = %loop_1, %entry
10 %a = phi i32 [ 2, %entry ], [ %b, %loop_1 ] ; [#uses=2]
11 %c = phi i32 [ 5, %entry ], [ %d, %loop_1 ] ; [#uses=1]
12 %b = add i32 %a, 1 ; [#uses=1]
13 %d = add i32 %c, %a ; [#uses=3]
14 %A = icmp ult i32 %d, 50 ; [#uses=1]
15 br i1 %A, label %loop_1, label %endloop
16
17 endloop: ; preds = %loop_1
18 call void @use(i32 %d)
19 ret void
20 }