xref: /llvm-project/llvm/test/Transforms/LICM/loopsink-pr38462.ll (revision 80e8f2beeb954f8c241897099bb01b24da400e8a)
1; RUN: opt -S -verify-memoryssa -passes=loop-sink < %s | FileCheck %s
2; RUN: opt -S -verify-memoryssa -aa-pipeline=basic-aa -passes=loop-sink < %s | FileCheck %s
3
4target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
5target triple = "x86_64-pc-windows-msvc19.13.26128"
6
7%struct.FontInfoData = type { ptr }
8%struct.S = type { i8 }
9
10; CHECK: @pr38462
11; Make sure not to assert by trying to sink into catch.dispatch.
12
13define void @pr38462(ptr %this) personality ptr @__C_specific_handler !prof !1 {
14entry:
15  %s = alloca %struct.S
16  %call6 = call i32 @f()
17  %tobool7 = icmp eq i32 %call6, 0
18  br i1 %tobool7, label %for.body.lr.ph, label %for.cond.cleanup
19
20for.body.lr.ph:
21  br label %for.body
22
23for.cond.cleanup.loopexit:
24  br label %for.cond.cleanup
25
26for.cond.cleanup:
27  ret void
28
29for.body:
30  %call2 = invoke i32 @f() to label %__try.cont unwind label %catch.dispatch
31
32catch.dispatch:
33  %0 = catchswitch within none [label %__except] unwind to caller
34
35__except:
36  %1 = catchpad within %0 [ptr null]
37  catchret from %1 to label %__except3
38
39__except3:
40  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %s)
41  %call.i = call zeroext i1 @g(ptr nonnull %s)
42  br i1 %call.i, label %if.then.i, label %exit
43
44if.then.i:
45  %call2.i = call i32 @f()
46  br label %exit
47
48exit:
49  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %s)
50  br label %__try.cont
51
52__try.cont:
53  %call = call i32 @f()
54  %tobool = icmp eq i32 %call, 0
55  br i1 %tobool, label %for.body, label %for.cond.cleanup.loopexit
56}
57
58declare i32 @__C_specific_handler(...)
59declare i32 @f()
60declare zeroext i1 @g(ptr)
61declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
62declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
63
64!1 = !{!"function_entry_count", i64 1}
65
66