1; RUN: opt < %s -gvn-hoist -S | FileCheck %s 2 3@g = external constant i8* 4 5declare i32 @gxx_personality(...) 6declare void @f0() 7declare void @f1() 8declare void @f2() 9 10; Make sure opt won't crash and that the load 11; is not hoisted from label6 to label4 12 13;CHECK-LABEL: @func 14 15define void @func() personality i8* bitcast (i32 (...)* @gxx_personality to i8*) { 16 invoke void @f0() 17 to label %3 unwind label %1 18 191: 20 %2 = landingpad { i8*, i32 } 21 catch i8* bitcast (i8** @g to i8*) 22 catch i8* null 23 br label %16 24 253: 26 br i1 undef, label %4, label %10 27 28;CHECK: 4: 29;CHECK-NEXT: %5 = load i32*, i32** undef, align 8 30;CHECK-NEXT: invoke void @f1() 31 324: 33 %5 = load i32*, i32** undef, align 8 34 invoke void @f1() 35 to label %6 unwind label %1 36 37;CHECK: 6: 38;CHECK-NEXT: %7 = load i32*, i32** undef, align 8 39;CHECK-NEXT: %8 = load i32*, i32** undef, align 8 40 416: 42 %7 = load i32*, i32** undef, align 8 43 %8 = load i32*, i32** undef, align 8 44 br i1 true, label %9, label %17 45 469: 47 invoke void @f0() 48 to label %10 unwind label %1 49 5010: 51 invoke void @f2() 52 to label %11 unwind label %1 53 5411: 55 %12 = invoke signext i32 undef(i32* null, i32 signext undef, i1 zeroext undef) 56 to label %13 unwind label %14 57 5813: 59 unreachable 60 6114: 62 %15 = landingpad { i8*, i32 } 63 catch i8* bitcast (i8** @g to i8*) 64 catch i8* null 65 br label %16 66 6716: 68 unreachable 69 7017: 71 ret void 72 73; uselistorder directives 74 uselistorder void ()* @f0, { 1, 0 } 75 uselistorder label %1, { 0, 3, 1, 2 } 76} 77