76 lines · plain
1; RUN: opt < %s -passes=instcombine -S | FileCheck %s2 3; PR45033: Don't try to insert a cast into a catchswich block.4 5target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"6target triple = "x86_64-pc-windows-msvc"7 8%struct.intrusive_ptr = type { ptr }9%struct.C = type { %struct.intrusive_ref_counter }10%struct.intrusive_ref_counter = type { i32 }11 12declare dso_local ptr @"?mk@@YAPEAUC@@XZ"() #313declare dso_local void @"?intrusive_ptr_release@@YAXPEBUintrusive_ref_counter@@@Z"(ptr) #314declare dso_local void @"?terminate@@YAXXZ"()15declare dso_local i32 @__CxxFrameHandler3(...)16 17define dso_local void @"?crash@@YAXXZ"() local_unnamed_addr #0 personality ptr @__CxxFrameHandler3 {18entry:19 %call1 = invoke ptr @"?mk@@YAPEAUC@@XZ"()20 to label %invoke.cont2 unwind label %catch.dispatch21 22invoke.cont2: ; preds = %entry23 %0 = ptrtoint ptr %call1 to i6424 %call5 = invoke ptr @"?mk@@YAPEAUC@@XZ"()25 to label %try.cont unwind label %catch.dispatch26 27catch.dispatch: ; preds = %invoke.cont2, %entry28 %a.sroa.0.0 = phi i64 [ %0, %invoke.cont2 ], [ 0, %entry ]29 %1 = catchswitch within none [label %catch] unwind label %ehcleanup30 31catch: ; preds = %catch.dispatch32 %2 = catchpad within %1 [ptr null, i32 64, ptr null]33 catchret from %2 to label %try.cont34 35try.cont: ; preds = %invoke.cont2, %catch36 %a.sroa.0.1 = phi i64 [ %0, %invoke.cont2 ], [ %a.sroa.0.0, %catch ]37 %3 = inttoptr i64 %a.sroa.0.1 to ptr38 %tobool.i3 = icmp eq ptr %3, null39 br i1 %tobool.i3, label %"??1?$intrusive_ptr@UC@@@@QEAA@XZ.exit6", label %if.then.i440 41if.then.i4: ; preds = %try.cont42 invoke void @"?intrusive_ptr_release@@YAXPEBUintrusive_ref_counter@@@Z"(ptr %3)43 to label %"??1?$intrusive_ptr@UC@@@@QEAA@XZ.exit6" unwind label %terminate.i544 45terminate.i5: ; preds = %if.then.i446 %4 = cleanuppad within none []47 call void @"?terminate@@YAXXZ"() #4 [ "funclet"(token %4) ]48 unreachable49 50"??1?$intrusive_ptr@UC@@@@QEAA@XZ.exit6": ; preds = %try.cont, %if.then.i451 ret void52 53ehcleanup: ; preds = %catch.dispatch54 %5 = cleanuppad within none []55 %6 = inttoptr i64 %a.sroa.0.0 to ptr56 %tobool.i = icmp eq ptr %6, null57 br i1 %tobool.i, label %"??1?$intrusive_ptr@UC@@@@QEAA@XZ.exit", label %if.then.i58 59if.then.i: ; preds = %ehcleanup60 invoke void @"?intrusive_ptr_release@@YAXPEBUintrusive_ref_counter@@@Z"(ptr %6) [ "funclet"(token %5) ]61 to label %"??1?$intrusive_ptr@UC@@@@QEAA@XZ.exit" unwind label %terminate.i62 63terminate.i: ; preds = %if.then.i64 %7 = cleanuppad within %5 []65 call void @"?terminate@@YAXXZ"() #4 [ "funclet"(token %7) ]66 unreachable67 68"??1?$intrusive_ptr@UC@@@@QEAA@XZ.exit": ; preds = %ehcleanup, %if.then.i69 cleanupret from %5 unwind to caller70}71 72; CHECK-LABEL: define dso_local void @"?crash@@YAXXZ"73; CHECK: catch.dispatch:74; CHECK-NEXT: %a.sroa.0.0 = phi i6475; CHECK-NEXT: catchswitch within none [label %catch] unwind label %ehcleanup76