1; RUN: opt < %s -instcombine -S 2; no crash 3 4%A = type { %B } 5%B = type { %C *} 6%C = type <{ i32 (...)**, i32, [4 x i8] }> 7 8$foo = comdat any 9 10@bar= external thread_local global %A, align 8 11 12declare i32 @__gxx_personality_v0(...) 13 14; Function Attrs: inlinehint sanitize_memory uwtable 15define void @foo() local_unnamed_addr #0 comdat align 2 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { 16entry: 17 %0 = load %C*, %C** getelementptr inbounds (%A, %A* @bar, i64 0, i32 0, i32 0), align 8 18 %1 = ptrtoint %C* %0 to i64 19 %count.i.i.i23 = getelementptr inbounds %C, %C* %0, i64 0, i32 1 20 store i32 0, i32* %count.i.i.i23, align 8 21 %2 = invoke i8* @_Znwm() #3 22 to label %invoke.cont unwind label %lpad 23 24invoke.cont: ; preds = %entry 25 %call.i25 = invoke i8* @_Znwm() #3 26 to label %call.i.noexc unwind label %lpad4 27 28call.i.noexc: ; preds = %invoke.cont 29 invoke void @lazy() 30 to label %invoke.cont5 unwind label %lpad.i 31 32lpad.i: ; preds = %call.i.noexc 33 %3 = landingpad { i8*, i32 } 34 cleanup 35 br label %ehcleanup 36 37invoke.cont5: ; preds = %call.i.noexc 38 %4 = ptrtoint i8* %call.i25 to i64 39 invoke void @scale() 40 to label %invoke.cont16 unwind label %lpad15 41 42invoke.cont16: ; preds = %invoke.cont5 43 ret void 44 45lpad: ; preds = %entry 46 %5 = landingpad { i8*, i32 } 47 cleanup 48 unreachable 49 50lpad4: ; preds = %invoke.cont 51 %6 = landingpad { i8*, i32 } 52 cleanup 53 unreachable 54 55ehcleanup: ; preds = %lpad.i 56 br label %ehcleanup21 57 58lpad15: ; preds = %invoke.cont5 59 %7 = landingpad { i8*, i32 } 60 cleanup 61 br label %ehcleanup21 62 63ehcleanup21: ; preds = %lpad15, %ehcleanup 64 %actual_other.sroa.0.0 = phi i64 [ %1, %ehcleanup ], [ %4, %lpad15 ] 65 %8 = inttoptr i64 %actual_other.sroa.0.0 to %C* 66 br i1 undef, label %_ZN4CGAL6HandleD2Ev.exit, label %land.lhs.true.i 67 68land.lhs.true.i: ; preds = %ehcleanup21 69 %count.i = getelementptr inbounds %C, %C* %8, i64 0, i32 1 70 %9 = load i32, i32* %count.i, align 8 71 unreachable 72 73_ZN4CGAL6HandleD2Ev.exit: ; preds = %ehcleanup21 74 resume { i8*, i32 } undef 75} 76 77; Function Attrs: nobuiltin 78declare noalias nonnull i8* @_Znwm() local_unnamed_addr #1 79 80; Function Attrs: sanitize_memory uwtable 81declare void @scale() local_unnamed_addr #2 align 2 82 83; Function Attrs: sanitize_memory uwtable 84declare void @lazy() unnamed_addr #2 align 2 85 86attributes #0 = { inlinehint sanitize_memory uwtable} 87attributes #1 = { nobuiltin } 88attributes #2 = { sanitize_memory uwtable } 89attributes #3 = { builtin } 90 91