1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -instcombine -S < %s | FileCheck %s 3 4target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" 5target triple = "x86_64-pc-windows-msvc18.0.0" 6 7%struct.B = type { i64, i64 } 8 9define 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]] 23; CHECK: 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 28; CHECK: unreachable: 29; CHECK-NEXT: unreachable 30; 31invoke.cont: 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 35 invoke void @throw() 36 to label %unreachable unwind label %catch.dispatch 37 38catch.dispatch: ; preds = %invoke.cont 39 %cs = catchswitch within none [label %invoke.cont1] unwind label %ehcleanup 40 41invoke.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 45 46ehcleanup: ; 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 51 52unreachable: ; preds = %invoke.cont1, %invoke.cont 53 unreachable 54} 55 56declare i32 @__CxxFrameHandler3(...) 57declare void @throw() 58declare void @release(i64) 59