49 lines · plain
1; RUN: opt < %s -passes='early-cse<memssa>,gvn-hoist' -earlycse-debug-hash -S | FileCheck %s2 3; Make sure opt doesn't crash. On top of that, the instructions4; of the side blocks should be hoisted to the entry block.5 6%s = type { i32, i64 }7%S = type { %s, i32 }8 9;CHECK-LABEL: @foo10 11define void @foo(ptr %arg) {12bb0:13 %call.idx.val.i = load i32, ptr %arg14 br label %bb115 16;CHECK: bb1:17;CHECK: %call264 = call zeroext i1 @bar18;CHECK: store i32 %call.idx.val.i, ptr %arg19;CHECK: %0 = getelementptr inbounds %S, ptr %arg, i64 0, i32 0, i32 120;CHECK: store i64 undef, ptr %021;CHECK: br i1 %call264, label %bb2, label %bb322 23bb1:24 %call264 = call zeroext i1 @bar()25 br i1 %call264, label %bb2, label %bb326 27;CHECK: bb2:28;CHECK-NOT: store i32 %call.idx.val.i, ptr %arg29;CHECK-NOT: store i64 undef, ptr %{.*}30 31bb2:32 store i32 %call.idx.val.i, ptr %arg33 %0 = getelementptr inbounds %S, ptr %arg, i64 0, i32 0, i32 134 store i64 undef, ptr %035 ret void36 37;CHECK: bb3:38;CHECK-NOT: store i32 %call.idx.val.i, ptr %arg39;CHECK-NOT: store i64 undef, ptr %{.*}40 41bb3:42 store i32 %call.idx.val.i, ptr %arg43 %1 = getelementptr inbounds %S, ptr %arg, i64 0, i32 0, i32 144 store i64 undef, ptr %145 ret void46}47 48declare zeroext i1 @bar()49