1 ; RUN: opt < %s -passes=gvn-hoist -S | FileCheck %s
3 @g = external constant ptr
5 declare i32 @gxx_personality(...)
10 ; Make sure opt won't crash and that the load
11 ; is not hoisted from label6 to label4
15 define void @func(i1 %arg) personality ptr @gxx_personality {
17 to label %3 unwind label %1
20 %2 = landingpad { ptr, i32 }
26 br i1 %arg, label %4, label %10
29 ;CHECK-NEXT: %5 = load ptr, ptr undef, align 8
30 ;CHECK-NEXT: invoke void @f1()
33 %5 = load ptr, ptr undef, align 8
35 to label %6 unwind label %1
38 ;CHECK-NEXT: %7 = load ptr, ptr undef, align 8
39 ;CHECK-NEXT: %8 = load ptr, ptr undef, align 8
42 %7 = load ptr, ptr undef, align 8
43 %8 = load ptr, ptr undef, align 8
44 br i1 true, label %9, label %17
48 to label %10 unwind label %1
52 to label %11 unwind label %1
55 %12 = invoke signext i32 undef(ptr null, i32 signext undef, i1 zeroext undef)
56 to label %13 unwind label %14
62 %15 = landingpad { ptr, i32 }
73 ; uselistorder directives
74 uselistorder ptr @f0, { 1, 0 }
75 uselistorder label %1, { 0, 3, 1, 2 }