llvm.org GIT mirror llvm / 224408d
Merging r340900: ------------------------------------------------------------------------ r340900 | hans | 2018-08-29 08:55:27 +0200 (Wed, 29 Aug 2018) | 6 lines LoopSink: Don't sink into blocks without an insertion point (PR38462) In the PR, LoopSink was trying to sink into a catchswitch block, which doesn't have a valid insertion point. Differential Revision: https://reviews.llvm.org/D51307 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_70@341048 91177308-0d34-0410-b5e6-96231b3b80d8 Hans Wennborg 2 years ago
2 changed file(s) with 73 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
148148 BBsToSinkInto.erase(DominatedBB);
149149 }
150150 BBsToSinkInto.insert(ColdestBB);
151 }
152 }
153
154 // Can't sink into blocks that have no valid insertion point.
155 for (BasicBlock *BB : BBsToSinkInto) {
156 if (BB->getFirstInsertionPt() == BB->end()) {
157 BBsToSinkInto.clear();
158 break;
151159 }
152160 }
153161
0 ; RUN: opt -S -loop-sink < %s | FileCheck %s
1
2 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
3 target triple = "x86_64-pc-windows-msvc19.13.26128"
4
5 %struct.FontInfoData = type { i32 (...)** }
6 %struct.S = type { i8 }
7
8 ; CHECK: @pr38462
9 ; Make sure not to assert by trying to sink into catch.dispatch.
10
11 define void @pr38462(%struct.FontInfoData* %this) personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) !prof !1 {
12 entry:
13 %s = alloca %struct.S
14 %call6 = call i32 @f()
15 %tobool7 = icmp eq i32 %call6, 0
16 br i1 %tobool7, label %for.body.lr.ph, label %for.cond.cleanup
17
18 for.body.lr.ph:
19 %0 = getelementptr inbounds %struct.S, %struct.S* %s, i64 0, i32 0
20 br label %for.body
21
22 for.cond.cleanup.loopexit:
23 br label %for.cond.cleanup
24
25 for.cond.cleanup:
26 ret void
27
28 for.body:
29 %call2 = invoke i32 @f() to label %__try.cont unwind label %catch.dispatch
30
31 catch.dispatch:
32 %1 = catchswitch within none [label %__except] unwind to caller
33
34 __except:
35 %2 = catchpad within %1 [i8* null]
36 catchret from %2 to label %__except3
37
38 __except3:
39 call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull %0)
40 %call.i = call zeroext i1 @g(%struct.S* nonnull %s)
41 br i1 %call.i, label %if.then.i, label %exit
42
43 if.then.i:
44 %call2.i = call i32 @f()
45 br label %exit
46
47 exit:
48 call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %0)
49 br label %__try.cont
50
51 __try.cont:
52 %call = call i32 @f()
53 %tobool = icmp eq i32 %call, 0
54 br i1 %tobool, label %for.body, label %for.cond.cleanup.loopexit
55 }
56
57 declare i32 @__C_specific_handler(...)
58 declare i32 @f()
59 declare zeroext i1 @g(%struct.S*)
60 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
61 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
62
63 !1 = !{!"function_entry_count", i64 1}
64