blob: 75875ff642d252225a9f26e23641b43efe3f6ec5 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; This test makes sure that these instructions are properly constant propagated.
2
Dan Gohman3c7d3082009-09-11 18:01:28 +00003; RUN: opt < %s -ipsccp -S | not grep load
4; RUN: opt < %s -ipsccp -S | not grep add
5; RUN: opt < %s -ipsccp -S | not grep phi
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006
7
8@Y = constant [2 x { i212, float }] [ { i212, float } { i212 12, float 1.0 },
9 { i212, float } { i212 37, float 2.0 } ]
10
11define internal float @test2() {
12 %A = getelementptr [2 x { i212, float}]* @Y, i32 0, i32 1, i32 1
13 %B = load float* %A
14 ret float %B
15}
16
17define internal float @test3() {
18 %A = getelementptr [2 x { i212, float}]* @Y, i32 0, i32 0, i32 1
19 %B = load float* %A
20 ret float %B
21}
22
23define internal float @test()
24{
25 %A = call float @test2()
26 %B = call float @test3()
27
28 %E = fdiv float %B, %A
29 ret float %E
30}
31
32define float @All()
33{
34 %A = call float @test()
35 %B = fcmp oge float %A, 1.0
36 br i1 %B, label %T, label %F
37T:
Dan Gohman7ce405e2009-06-04 22:49:04 +000038 %C = fadd float %A, 1.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +000039 br label %exit
40F:
Dan Gohman7ce405e2009-06-04 22:49:04 +000041 %D = fadd float %A, 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +000042 br label %exit
43exit:
44 %E = phi float [%C, %T], [%D, %F]
45 ret float %E
46}
47
48
49