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