150
|
1 ; RUN: opt < %s -debugify -licm -S -o /dev/null
|
|
2 ;
|
|
3 ; The following test is from https://bugs.llvm.org/show_bug.cgi?id=36238
|
|
4 ; This test should pass (not assert or fault). The error that originally
|
|
5 ; provoked this test was regarding the LCSSA pass trying to insert a dbg.value
|
|
6 ; intrinsic into a catchswitch block.
|
|
7
|
|
8 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
|
|
9 target triple = "x86_64-pc-windows-msvc19.11.0"
|
|
10
|
|
11 %struct.e = type { i32 }
|
|
12 %struct.d = type { i8 }
|
|
13 %class.f = type { %class.b }
|
|
14 %class.b = type { i8 }
|
|
15 %struct.k = type opaque
|
|
16
|
|
17 @"\01?l@@3HA" = local_unnamed_addr global i32 0, align 4
|
|
18
|
|
19 define i32 @"\01?m@@YAJXZ"() personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
|
|
20 entry:
|
|
21 %n = alloca %struct.e, align 4
|
|
22 %db = alloca i32, align 4
|
|
23 %o = alloca %struct.d, align 1
|
|
24 %q = alloca i8*, align 8
|
|
25 %r = alloca i32, align 4
|
|
26 %u = alloca i64, align 8
|
|
27 %s = alloca %class.f, align 1
|
|
28 %offset = alloca i64, align 8
|
|
29 %t = alloca i64, align 8
|
|
30 %status = alloca i32, align 4
|
|
31 call void (...) @llvm.localescape(%class.f* nonnull %s, i32* nonnull %status)
|
|
32 %0 = bitcast %struct.e* %n to i8*
|
|
33 %1 = bitcast i32* %db to i8*
|
|
34 %2 = getelementptr inbounds %struct.d, %struct.d* %o, i64 0, i32 0
|
|
35 %3 = bitcast i8** %q to i8*
|
|
36 %4 = bitcast i32* %r to i8*
|
|
37 %5 = bitcast i64* %u to i8*
|
|
38 %6 = getelementptr inbounds %class.f, %class.f* %s, i64 0, i32 0, i32 0
|
|
39 %7 = load i32, i32* @"\01?l@@3HA", align 4, !tbaa !3
|
|
40 %call = call %class.f* @"\01??0f@@QEAA@H@Z"(%class.f* nonnull %s, i32 %7)
|
|
41 %8 = bitcast i64* %offset to i8*
|
|
42 %9 = bitcast i64* %t to i8*
|
|
43 %10 = bitcast i32* %status to i8*
|
|
44 %11 = bitcast %class.f* %s to %struct.d*
|
|
45 %c = getelementptr inbounds %struct.e, %struct.e* %n, i64 0, i32 0
|
|
46 br label %for.cond
|
|
47
|
|
48 for.cond: ; preds = %cleanup.cont, %entry
|
|
49 %p.0 = phi i32 [ undef, %entry ], [ %call2, %cleanup.cont ]
|
|
50 invoke void @"\01?h@@YAXPEAH0HPEAIPEAPEAEPEA_K33PEAUd@@4@Z"(i32* nonnull %db, i32* nonnull %c, i32 undef, i32* nonnull %r, i8** nonnull %q, i64* nonnull %u, i64* nonnull %offset, i64* nonnull %t, %struct.d* nonnull %11, %struct.d* nonnull %o)
|
|
51 to label %__try.cont unwind label %catch.dispatch
|
|
52
|
|
53 catch.dispatch: ; preds = %for.cond
|
|
54 %12 = catchswitch within none [label %__except.ret] unwind label %ehcleanup
|
|
55
|
|
56 __except.ret: ; preds = %catch.dispatch
|
|
57 %13 = catchpad within %12 [i8* bitcast (i32 (i8*, i8*)* @"\01?filt$0@0@m@@" to i8*)]
|
|
58 catchret from %13 to label %cleanup7
|
|
59
|
|
60 __try.cont: ; preds = %for.cond
|
|
61 %tobool = icmp eq i32 %p.0, 0
|
|
62 br i1 %tobool, label %if.end, label %cleanup7
|
|
63
|
|
64 if.end: ; preds = %__try.cont
|
|
65 %call2 = invoke i32 @"\01?a@@YAJXZ"()
|
|
66 to label %cleanup.cont unwind label %ehcleanup
|
|
67
|
|
68 cleanup.cont: ; preds = %if.end
|
|
69 br label %for.cond
|
|
70
|
|
71 ehcleanup: ; preds = %if.end, %catch.dispatch
|
|
72 %14 = cleanuppad within none []
|
|
73 %g.i = getelementptr inbounds %class.f, %class.f* %s, i64 0, i32 0
|
|
74 call void @"\01??1b@@QEAA@XZ"(%class.b* nonnull %g.i) [ "funclet"(token %14) ]
|
|
75 cleanupret from %14 unwind to caller
|
|
76
|
|
77 cleanup7: ; preds = %__try.cont, %__except.ret
|
|
78 %p.2.ph = phi i32 [ 7, %__except.ret ], [ %p.0, %__try.cont ]
|
|
79 %g.i32 = getelementptr inbounds %class.f, %class.f* %s, i64 0, i32 0
|
|
80 call void @"\01??1b@@QEAA@XZ"(%class.b* nonnull %g.i32)
|
|
81 ret i32 %p.2.ph
|
|
82 }
|
|
83
|
|
84 declare %class.f* @"\01??0f@@QEAA@H@Z"(%class.f* returned, i32) unnamed_addr
|
|
85
|
|
86 define internal i32 @"\01?filt$0@0@m@@"(i8* %exception_pointers, i8* %frame_pointer) personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
|
|
87 entry:
|
|
88 %0 = tail call i8* @llvm.eh.recoverfp(i8* bitcast (i32 ()* @"\01?m@@YAJXZ" to i8*), i8* %frame_pointer)
|
|
89 %1 = tail call i8* @llvm.localrecover(i8* bitcast (i32 ()* @"\01?m@@YAJXZ" to i8*), i8* %0, i32 0)
|
|
90 %2 = tail call i8* @llvm.localrecover(i8* bitcast (i32 ()* @"\01?m@@YAJXZ" to i8*), i8* %0, i32 1)
|
|
91 %status = bitcast i8* %2 to i32*
|
|
92 %agg.tmp = alloca %class.f, align 1
|
|
93 %3 = bitcast i8* %exception_pointers to i32**
|
|
94 %4 = load i32*, i32** %3, align 8
|
|
95 %5 = load i32, i32* %4, align 4
|
|
96 %6 = bitcast i8* %exception_pointers to %struct.k*
|
|
97 %7 = getelementptr inbounds %class.f, %class.f* %agg.tmp, i64 0, i32 0, i32 0
|
|
98 %8 = load i8, i8* %1, align 1
|
|
99 store i8 %8, i8* %7, align 1
|
|
100 %call = invoke i32 @"\01?j@@YAJVf@@JPEAUk@@PEAH@Z"(i8 %8, i32 %5, %struct.k* %6, i32* %status)
|
|
101 to label %invoke.cont unwind label %ehcleanup
|
|
102
|
|
103 invoke.cont: ; preds = %entry
|
|
104 %g.i = getelementptr inbounds %class.f, %class.f* %agg.tmp, i64 0, i32 0
|
|
105 call void @"\01??1b@@QEAA@XZ"(%class.b* nonnull %g.i)
|
|
106 ret i32 %call
|
|
107
|
|
108 ehcleanup: ; preds = %entry
|
|
109 %9 = cleanuppad within none []
|
|
110 %g.i2 = getelementptr inbounds %class.f, %class.f* %agg.tmp, i64 0, i32 0
|
|
111 call void @"\01??1b@@QEAA@XZ"(%class.b* nonnull %g.i2) [ "funclet"(token %9) ]
|
|
112 cleanupret from %9 unwind to caller
|
|
113 }
|
|
114
|
|
115 declare i8* @llvm.eh.recoverfp(i8*, i8*)
|
|
116 declare i8* @llvm.localrecover(i8*, i8*, i32)
|
|
117 declare i32 @"\01?j@@YAJVf@@JPEAUk@@PEAH@Z"(i8, i32, %struct.k*, i32*) local_unnamed_addr
|
|
118 declare i32 @__C_specific_handler(...)
|
|
119 declare void @"\01?h@@YAXPEAH0HPEAIPEAPEAEPEA_K33PEAUd@@4@Z"(i32*, i32*, i32, i32*, i8**, i64*, i64*, i64*, %struct.d*, %struct.d*) local_unnamed_addr
|
|
120 declare i32 @"\01?a@@YAJXZ"() local_unnamed_addr
|
|
121 declare void @llvm.localescape(...)
|
|
122 declare void @"\01??1b@@QEAA@XZ"(%class.b*) unnamed_addr
|
|
123
|
|
124 !llvm.module.flags = !{!0, !1}
|
|
125 !llvm.ident = !{!2}
|
|
126
|
|
127 !0 = !{i32 1, !"wchar_size", i32 2}
|
|
128 !1 = !{i32 7, !"PIC Level", i32 2}
|
|
129 !2 = !{!"clang"}
|
|
130 !3 = !{!4, !4, i64 0}
|
|
131 !4 = !{!"int", !5, i64 0}
|
|
132 !5 = !{!"omnipotent char", !6, i64 0}
|
|
133 !6 = !{!"Simple C++ TBAA"}
|