1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=instcombine -S < %s | FileCheck %s
4 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-pc-windows-msvc18.0.0"
7 %struct.B = type { i64, i64 }
9 define void @test1(ptr %p) personality ptr @__CxxFrameHandler3 {
10 ; CHECK-LABEL: @test1(
11 ; CHECK-NEXT: invoke.cont:
12 ; CHECK-NEXT: [[TMP0:%.*]] = load <2 x i64>, ptr [[P:%.*]], align 8
13 ; CHECK-NEXT: [[TMP1:%.*]] = extractelement <2 x i64> [[TMP0]], i64 0
14 ; CHECK-NEXT: invoke void @throw()
15 ; CHECK-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[CATCH_DISPATCH:%.*]]
16 ; CHECK: catch.dispatch:
17 ; CHECK-NEXT: [[CS:%.*]] = catchswitch within none [label %invoke.cont1] unwind label [[EHCLEANUP:%.*]]
18 ; CHECK: invoke.cont1:
19 ; CHECK-NEXT: [[CATCH:%.*]] = catchpad within [[CS]] [ptr null, i32 64, ptr null]
20 ; CHECK-NEXT: invoke void @throw() [ "funclet"(token [[CATCH]]) ]
21 ; CHECK-NEXT: to label [[UNREACHABLE]] unwind label [[EHCLEANUP]]
23 ; CHECK-NEXT: [[PHI:%.*]] = phi i64 [ [[TMP1]], [[CATCH_DISPATCH]] ], [ 9, [[INVOKE_CONT1:%.*]] ]
24 ; CHECK-NEXT: [[CLEANUP:%.*]] = cleanuppad within none []
25 ; CHECK-NEXT: call void @release(i64 [[PHI]]) [ "funclet"(token [[CLEANUP]]) ]
26 ; CHECK-NEXT: cleanupret from [[CLEANUP]] unwind to caller
28 ; CHECK-NEXT: unreachable
31 %0 = load <2 x i64>, ptr %p, align 8
32 %1 = extractelement <2 x i64> %0, i32 0
34 to label %unreachable unwind label %catch.dispatch
36 catch.dispatch: ; preds = %invoke.cont
37 %cs = catchswitch within none [label %invoke.cont1] unwind label %ehcleanup
39 invoke.cont1: ; preds = %catch.dispatch
40 %catch = catchpad within %cs [ptr null, i32 64, ptr null]
41 invoke void @throw() [ "funclet"(token %catch) ]
42 to label %unreachable unwind label %ehcleanup
44 ehcleanup: ; preds = %invoke.cont1, %catch.dispatch
45 %phi = phi i64 [ %1, %catch.dispatch ], [ 9, %invoke.cont1 ]
46 %cleanup = cleanuppad within none []
47 call void @release(i64 %phi) [ "funclet"(token %cleanup) ]
48 cleanupret from %cleanup unwind to caller
50 unreachable: ; preds = %invoke.cont1, %invoke.cont
54 declare i32 @__CxxFrameHandler3(...)
56 declare void @release(i64)