1 ; RUN: opt < %s -early-cse-memssa -gvn-hoist -S | FileCheck %s
3 ; Make sure opt doesn't crash. On top of that, the instructions
4 ; of the side blocks should be hoisted to the entry block.
11 define void @foo(i32* %arg) {
13 %0 = bitcast i32* %arg to %S*
14 %call.idx.i = getelementptr %S, %S* %0, i64 0, i32 0, i32 0
15 %call.idx.val.i = load i32, i32* %call.idx.i
19 ;CHECK: %call264 = call zeroext i1 @bar
20 ;CHECK: store i32 %call.idx.val.i, i32* %call.idx.i
21 ;CHECK: %1 = getelementptr inbounds %S, %S* %0, i64 0, i32 0, i32 1
22 ;CHECK: store i64 undef, i64* %1
23 ;CHECK: br i1 %call264, label %bb2, label %bb3
26 %call264 = call zeroext i1 @bar()
27 br i1 %call264, label %bb2, label %bb3
30 ;CHECK-NOT: store i32 %call.idx.val.i, i32* %call.idx.i
31 ;CHECK-NOT: store i64 undef, i64* %{.*}
34 store i32 %call.idx.val.i, i32* %call.idx.i
35 %1 = getelementptr inbounds %S, %S* %0, i64 0, i32 0, i32 1
36 store i64 undef, i64* %1
40 ;CHECK-NOT: store i32 %call.idx.val.i, i32* %call.idx.i
41 ;CHECK-NOT: store i64 undef, i64* %{.*}
44 store i32 %call.idx.val.i, i32* %call.idx.i
45 %2 = getelementptr inbounds %S, %S* %0, i64 0, i32 0, i32 1
46 store i64 undef, i64* %2
50 declare zeroext i1 @bar()