1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: %if x86-registered-target %{ opt -passes=slp-vectorizer -S -mtriple=x86_64-pc-windows-msvc19.29.30145 < %s | FileCheck %s %}
3 ; RUN: %if aarch64-registered-target %{ opt -passes=slp-vectorizer -S -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s %}
5 ; This used to crash in SLP vectorization when attempting to set the
6 ; IRBuilder's insertion point to the end of a catchswitch block, which
7 ; is invalid. Only phis and the catchswitch may be present, so we must
8 ; avoid trying to insert shuffles into such a block.
10 %typeA = type { ptr, ptr, [20 x i8] }
11 @globalA = external global %typeA
13 declare i32 @__CxxFrameHandler3(...)
16 define void @important_func() personality ptr @__CxxFrameHandler3 {
17 ; CHECK-LABEL: @important_func(
19 ; CHECK-NEXT: br label [[LABELB:%.*]]
21 ; CHECK-NEXT: invoke void @funcA()
22 ; CHECK-NEXT: to label [[LABELC:%.*]] unwind label [[LABELD:%.*]]
24 ; CHECK-NEXT: invoke void @funcA()
25 ; CHECK-NEXT: to label [[LABELE:%.*]] unwind label [[LABELF:%.*]]
27 ; CHECK-NEXT: [[TMP0:%.*]] = cleanuppad within none []
28 ; CHECK-NEXT: unreachable
30 ; CHECK-NEXT: [[TMP1:%.*]] = extractelement <4 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0xFFF0000000000000>, i64 1
31 ; CHECK-NEXT: [[F:%.*]] = extractelement <4 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0xFFF0000000000000>, i64 2
32 ; CHECK-NEXT: invoke void @funcA()
33 ; CHECK-NEXT: to label [[LABELG:%.*]] unwind label [[CATCH_DISPATCH:%.*]]
35 ; CHECK-NEXT: [[TMP2:%.*]] = cleanuppad within none []
36 ; CHECK-NEXT: cleanupret from [[TMP2]] unwind to caller
38 ; CHECK-NEXT: [[G:%.*]] = extractelement <4 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0xFFF0000000000000>, i64 0
39 ; CHECK-NEXT: [[H:%.*]] = extractelement <4 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0xFFF0000000000000>, i64 3
40 ; CHECK-NEXT: invoke void @funcA()
41 ; CHECK-NEXT: to label [[LABELH:%.*]] unwind label [[CATCH_DISPATCH]]
43 ; CHECK-NEXT: unreachable
44 ; CHECK: catch.dispatch:
45 ; CHECK-NEXT: [[TMP3:%.*]] = phi float [ [[G]], [[LABELG]] ], [ [[TMP1]], [[LABELE]] ]
46 ; CHECK-NEXT: [[TMP4:%.*]] = phi float [ [[H]], [[LABELG]] ], [ [[F]], [[LABELE]] ]
47 ; CHECK-NEXT: [[TMP5:%.*]] = catchswitch within none [label %catch] unwind to caller
49 ; CHECK-NEXT: [[TMP6:%.*]] = catchpad within [[TMP5]] [ptr @globalA, i32 8, ptr null]
50 ; CHECK-NEXT: unreachable
57 to label %labelC unwind label %labelD
61 to label %labelE unwind label %labelF
64 %0 = cleanuppad within none []
68 %1 = extractelement <4 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0xFFF0000000000000>, i64 1
69 %f = extractelement <4 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0xFFF0000000000000>, i64 2
71 to label %labelG unwind label %catch.dispatch
74 %2 = cleanuppad within none []
75 cleanupret from %2 unwind to caller
78 %g = extractelement <4 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0xFFF0000000000000>, i64 0
79 %h = extractelement <4 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0xFFF0000000000000>, i64 3
81 to label %labelH unwind label %catch.dispatch
87 %3 = phi float [ %g, %labelG ], [ %1, %labelE ]
88 %4 = phi float [ %h, %labelG ], [ %f, %labelE ]
89 %5 = catchswitch within none [label %catch] unwind to caller
92 %6 = catchpad within %5 [ptr @globalA, i32 8, ptr null]