blob: 66629d75ecafe4cf89340c7e2f347df4439791d3 [file] [log] [blame]
Reid Spencerc6b9efa2007-04-13 22:33:10 +00001; This test makes sure that these instructions are properly constant propagated.
Reid Spencerc6b9efa2007-04-13 22:33:10 +00002
Dan Gohmanb1e1e822009-09-08 16:50:01 +00003; RUN: opt %s -ipsccp | llvm-dis | not grep load
4; RUN: opt %s -ipsccp | llvm-dis | not grep fdiv
Reid Spencerc6b9efa2007-04-13 22:33:10 +00005
6@X = constant i212 42
7@Y = constant [2 x { i212, float }] [ { i212, float } { i212 12, float 1.0 },
Dale Johannesenc2ec2ba2007-09-05 17:50:36 +00008 { i212, float } { i212 37, float 0x3FF3B2FEC0000000 } ]
Reid Spencerc6b9efa2007-04-13 22:33:10 +00009define i212 @test1() {
10 %B = load i212* @X
11 ret i212 %B
12}
13
14define internal float @test2() {
15 %A = getelementptr [2 x { i212, float}]* @Y, i32 0, i32 1, i32 1
16 %B = load float* %A
17 ret float %B
18}
19
20define internal i212 @test3() {
21 %A = getelementptr [2 x { i212, float}]* @Y, i32 0, i32 0, i32 0
22 %B = load i212* %A
23 ret i212 %B
24}
25
26define float @All()
27{
28 %A = call float @test2()
29 %B = call i212 @test3()
30 %C = mul i212 %B, -1234567
31 %D = sitofp i212 %C to float
32 %E = fdiv float %A, %D
33 ret float %E
34}
35
36