1 ; RUN: opt -gvn-sink -S < %s | FileCheck %s
3 %struct = type {i32, i32}
4 %struct2 = type { [ 2 x i32], i32 }
6 ; Struct indices cannot be variant.
10 ; CHECK: getelementptr
13 br i1 undef, label %bb2, label %bb1
16 %tmp = getelementptr inbounds %struct, %struct* null, i64 0, i32 1
20 %tmp3 = getelementptr inbounds %struct, %struct* null, i64 0, i32 0
23 bb4: ; preds = %bb2, %bb1
24 %tmp5 = phi i32 [ 1, %bb1 ], [ 0, %bb2 ]
28 ; Struct indices cannot be variant.
31 ; CHECK: getelementptr
32 ; CHECK: getelementptr
35 br i1 undef, label %bb2, label %bb1
38 %tmp = getelementptr inbounds %struct2, %struct2* null, i64 0, i32 0, i32 1
42 %tmp3 = getelementptr inbounds %struct2, %struct2* null, i64 0, i32 0, i32 0
45 bb4: ; preds = %bb2, %bb1
46 %tmp5 = phi i32 [ 1, %bb1 ], [ 0, %bb2 ]
51 ; ... but the first parameter to a GEP can.
54 ; CHECK: getelementptr
55 ; CHECK-NOT: getelementptr
58 br i1 undef, label %bb2, label %bb1
61 %tmp = getelementptr inbounds %struct, %struct* null, i32 0, i32 0
65 %tmp3 = getelementptr inbounds %struct, %struct* null, i32 1, i32 0
68 bb4: ; preds = %bb2, %bb1
69 %tmp5 = phi i32 [ 0, %bb1 ], [ 1, %bb2 ]