llvm.org GIT mirror llvm / 3cc48a0
Make sure we don't emit instructions before a landingpad instruction. PR14782 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171846 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 6 years ago
3 changed file(s) with 95 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
123123 }
124124
125125 // Insert a load in place of the PHI and replace all uses.
126 Value *V = new LoadInst(Slot, P->getName()+".reload", P);
126 BasicBlock::iterator InsertPt = P;
127
128 for (; isa(InsertPt) || isa(InsertPt); ++InsertPt)
129 /* empty */; // Don't insert before PHI nodes or landingpad instrs.
130
131 Value *V = new LoadInst(Slot, P->getName()+".reload", InsertPt);
127132 P->replaceAllUsesWith(V);
128133
129134 // Delete PHI.
0 ; RUN: opt -reg2mem -disable-output < %s
1 ; PR14782
2
3 declare void @f1()
4
5 declare i32 @__gxx_personality_sj0(...)
6
7 declare void @f2()
8
9 declare void @f3()
10
11 declare void @f4_()
12
13 declare void @_Z12xxxdtsP10xxxpq()
14
15 define hidden void @_ZN12xxxyzIi9xxxwLi29ELi0EE4f3NewES0_i() ssp align 2 {
16 bb:
17 invoke void @f4_()
18 to label %bb1 unwind label %.thread
19
20 .thread: ; preds = %bb
21 %tmp = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
22 cleanup
23 br label %bb13
24
25 bb1: ; preds = %bb
26 invoke void @f1()
27 to label %.noexc unwind label %bb10
28
29 .noexc: ; preds = %bb1
30 invoke void @f4_()
31 to label %bb6 unwind label %bb2
32
33 bb2: ; preds = %.noexc
34 %tmp3 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
35 cleanup
36 invoke void @f3()
37 to label %.body unwind label %bb4
38
39 bb4: ; preds = %bb2
40 %tmp5 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
41 catch i8* null
42 unreachable
43
44 bb6: ; preds = %.noexc
45 invoke void @_Z12xxxdtsP10xxxpq()
46 to label %_ZN6xxxdIN12xxxyzIi9xxxwLi29ELi0EE4fr1jS3_.exit unwind label %bb10
47
48 _ZN6xxxdIN12xxxyzIi9xxxwLi29ELi0EE4fr1jS3_.exit: ; preds = %bb6
49 invoke void @f2()
50 to label %bb7 unwind label %bb8
51
52 bb7: ; preds = %_ZN6xxxdIN12xxxyzIi9xxxwLi29ELi0EE4fr1jS3_.exit
53 ret void
54
55 bb8: ; preds = %_ZN6xxxdIN12xxxyzIi9xxxwLi29ELi0EE4fr1jS3_.exit
56 %tmp9 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
57 cleanup
58 br label %_ZN10xxxpqdlev.exit
59
60 bb10: ; preds = %bb6, %bb1
61 %.1 = phi i1 [ true, %bb1 ], [ false, %bb6 ]
62 %tmp11 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
63 cleanup
64 br label %.body
65
66 .body: ; preds = %bb10, %bb2
67 %.1.lpad-body = phi i1 [ %.1, %bb10 ], [ true, %bb2 ]
68 invoke void @f2()
69 to label %bb12 unwind label %bb14
70
71 bb12: ; preds = %.body
72 br i1 %.1.lpad-body, label %bb13, label %_ZN10xxxpqdlev.exit
73
74 bb13: ; preds = %bb12, %.thread
75 invoke void @xxx_MemFree()
76 to label %_ZN10xxxpqdlev.exit unwind label %bb14
77
78 _ZN10xxxpqdlev.exit: ; preds = %bb13, %bb12, %bb8
79 resume { i8*, i32 } undef
80
81 bb14: ; preds = %bb13, %.body
82 %tmp15 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
83 catch i8* null
84 unreachable
85 }
86
87 declare void @xxx_MemFree()
0 config.suffixes = ['.ll', '.c', '.cpp']