1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -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(%struct.B* %p) personality i32 (...)* @__CxxFrameHandler3 {
10 ; CHECK-LABEL: @test1(
11 ; CHECK-NEXT: invoke.cont:
12 ; CHECK-NEXT: [[TMP0:%.*]] = bitcast %struct.B* [[P:%.*]] to <2 x i64>*
13 ; CHECK-NEXT: [[TMP1:%.*]] = load <2 x i64>, <2 x i64>* [[TMP0]], align 8
14 ; CHECK-NEXT: [[TMP2:%.*]] = extractelement <2 x i64> [[TMP1]], i32 0
15 ; CHECK-NEXT: invoke void @throw()
16 ; CHECK-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[CATCH_DISPATCH:%.*]]
17 ; CHECK: catch.dispatch:
18 ; CHECK-NEXT: [[CS:%.*]] = catchswitch within none [label %invoke.cont1] unwind label [[EHCLEANUP:%.*]]
19 ; CHECK: invoke.cont1:
20 ; CHECK-NEXT: [[CATCH:%.*]] = catchpad within [[CS]] [i8* null, i32 64, i8* null]
21 ; CHECK-NEXT: invoke void @throw() [ "funclet"(token [[CATCH]]) ]
22 ; CHECK-NEXT: to label [[UNREACHABLE]] unwind label [[EHCLEANUP]]
24 ; CHECK-NEXT: [[PHI:%.*]] = phi i64 [ [[TMP2]], [[CATCH_DISPATCH]] ], [ 9, [[INVOKE_CONT1:%.*]] ]
25 ; CHECK-NEXT: [[CLEANUP:%.*]] = cleanuppad within none []
26 ; CHECK-NEXT: call void @release(i64 [[PHI]]) [ "funclet"(token [[CLEANUP]]) ]
27 ; CHECK-NEXT: cleanupret from [[CLEANUP]] unwind to caller
29 ; CHECK-NEXT: unreachable
32 %0 = bitcast %struct.B* %p to <2 x i64>*
33 %1 = load <2 x i64>, <2 x i64>* %0, align 8
34 %2 = extractelement <2 x i64> %1, i32 0
36 to label %unreachable unwind label %catch.dispatch
38 catch.dispatch: ; preds = %invoke.cont
39 %cs = catchswitch within none [label %invoke.cont1] unwind label %ehcleanup
41 invoke.cont1: ; preds = %catch.dispatch
42 %catch = catchpad within %cs [i8* null, i32 64, i8* null]
43 invoke void @throw() [ "funclet"(token %catch) ]
44 to label %unreachable unwind label %ehcleanup
46 ehcleanup: ; preds = %invoke.cont1, %catch.dispatch
47 %phi = phi i64 [ %2, %catch.dispatch ], [ 9, %invoke.cont1 ]
48 %cleanup = cleanuppad within none []
49 call void @release(i64 %phi) [ "funclet"(token %cleanup) ]
50 cleanupret from %cleanup unwind to caller
52 unreachable: ; preds = %invoke.cont1, %invoke.cont
56 declare i32 @__CxxFrameHandler3(...)
58 declare void @release(i64)