llvm.org GIT mirror llvm / b243808
PR2659 was fixed by r61847. Add the testcase as a regression test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61986 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 11 years ago
1 changed file(s) with 33 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: llvm-as < %s | llc -march=x86 -mtriple=i686-apple-darwin9.4.0 | grep movl | count 5
1 ; PR2659
2
3 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
4 target triple = "i686-apple-darwin9.4.0"
5
6 define i32 @binomial(i32 %n, i32 %k) nounwind {
7 entry:
8 %cmp = icmp ugt i32 %k, %n ; [#uses=1]
9 br i1 %cmp, label %ifthen, label %forcond.preheader
10
11 forcond.preheader: ; preds = %entry
12 %cmp44 = icmp eq i32 %k, 0 ; [#uses=1]
13 br i1 %cmp44, label %afterfor, label %forbody
14
15 ifthen: ; preds = %entry
16 ret i32 0
17
18 forbody: ; preds = %forbody, %forcond.preheader
19 %indvar = phi i32 [ 0, %forcond.preheader ], [ %divisor.02, %forbody ] ; [#uses=3]
20 %accumulator.01 = phi i32 [ 1, %forcond.preheader ], [ %div, %forbody ] ; [#uses=1]
21 %divisor.02 = add i32 %indvar, 1 ; [#uses=2]
22 %n.addr.03 = sub i32 %n, %indvar ; [#uses=1]
23 %mul = mul i32 %n.addr.03, %accumulator.01 ; [#uses=1]
24 %div = udiv i32 %mul, %divisor.02 ; [#uses=2]
25 %inc = add i32 %indvar, 2 ; [#uses=1]
26 %cmp4 = icmp ugt i32 %inc, %k ; [#uses=1]
27 br i1 %cmp4, label %afterfor, label %forbody
28
29 afterfor: ; preds = %forbody, %forcond.preheader
30 %accumulator.0.lcssa = phi i32 [ 1, %forcond.preheader ], [ %div, %forbody ] ; [#uses=1]
31 ret i32 %accumulator.0.lcssa
32 }