1 ; This test makes sure that these instructions are properly eliminated.
3 ; RUN: opt < %s -instcombine -S | not grep load
5 @X = constant i32 42 ; <i32*> [#uses=2]
6 @X2 = constant i32 47 ; <i32*> [#uses=1]
7 @Y = constant [2 x { i32, float }] [ { i32, float } { i32 12, float 1.000000e+00 }, { i32, float } { i32 37, float 0x3FF3B2FEC0000000 } ] ; <[2 x { i32, float }]*> [#uses=2]
8 @Z = constant [2 x { i32, float }] zeroinitializer ; <[2 x { i32, float }]*> [#uses=1]
11 %B = load i32* @X ; <i32> [#uses=1]
15 define float @test2() {
16 %A = getelementptr [2 x { i32, float }]* @Y, i64 0, i64 1, i32 1 ; <float*> [#uses=1]
17 %B = load float* %A ; <float> [#uses=1]
22 %A = getelementptr [2 x { i32, float }]* @Y, i64 0, i64 0, i32 0 ; <i32*> [#uses=1]
23 %B = load i32* %A ; <i32> [#uses=1]
28 %A = getelementptr [2 x { i32, float }]* @Z, i64 0, i64 1, i32 0 ; <i32*> [#uses=1]
29 %B = load i32* %A ; <i32> [#uses=1]
33 define i32 @test5(i1 %C) {
34 %Y = select i1 %C, i32* @X, i32* @X2 ; <i32*> [#uses=1]
35 %Z = load i32* %Y ; <i32> [#uses=1]
39 define i32 @test7(i32 %X) {
40 %V = getelementptr i32* null, i32 %X ; <i32*> [#uses=1]
41 %R = load i32* %V ; <i32> [#uses=1]
45 define i32 @test8(i32* %P) {
47 %X = load i32* %P ; <i32> [#uses=1]
51 define i32 @test9(i32* %P) {
52 %X = load i32* %P ; <i32> [#uses=1]
53 %Y = load i32* %P ; <i32> [#uses=1]
54 %Z = sub i32 %X, %Y ; <i32> [#uses=1]
58 define i32 @test10(i1 %C.upgrd.1, i32* %P, i32* %Q) {
59 br i1 %C.upgrd.1, label %T, label %F
68 %V = load i32* %P ; <i32> [#uses=1]
72 define double @test11(double* %p) {
73 %t0 = getelementptr double* %p, i32 1
74 store double 2.0, double* %t0
75 %t1 = getelementptr double* %p, i32 1