blob: 9407b5a68d6924c636e12cf99bc6da207826c0a5 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; This testcase contains a entire loop that should be removed. The only thing
2; left is the store instruction in BB0. The problem this testcase was running
3; into was that when the reg109 PHI was getting zero predecessors, it was
4; removed even though there were uses still around. Now the uses are filled
5; in with a dummy value before the PHI is deleted.
6;
Dan Gohman3c7d3082009-09-11 18:01:28 +00007; RUN: opt < %s -adce
Dan Gohmanf17a25c2007-07-18 16:29:46 +00008
Tanya Lattner4c4d0b82008-03-01 09:15:35 +00009 %node_t = type { double*, %node_t*, %node_t**, double**, double*, i32, i32 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +000010
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000011define void @localize_local(%node_t* %nodelist) {
12bb0:
13 %nodelist.upgrd.1 = alloca %node_t* ; <%node_t**> [#uses=2]
14 store %node_t* %nodelist, %node_t** %nodelist.upgrd.1
15 br label %bb1
Dan Gohmanf17a25c2007-07-18 16:29:46 +000016
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000017bb1: ; preds = %bb0
18 %reg107 = load %node_t** %nodelist.upgrd.1 ; <%node_t*> [#uses=2]
19 %cond211 = icmp eq %node_t* %reg107, null ; <i1> [#uses=1]
20 br i1 %cond211, label %bb3, label %bb2
Dan Gohmanf17a25c2007-07-18 16:29:46 +000021
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000022bb2: ; preds = %bb2, %bb1
23 %reg109 = phi %node_t* [ %reg110, %bb2 ], [ %reg107, %bb1 ] ; <%node_t*> [#uses=1]
24 %reg212 = getelementptr %node_t* %reg109, i64 0, i32 1 ; <%node_t**> [#uses=1]
25 %reg110 = load %node_t** %reg212 ; <%node_t*> [#uses=2]
26 %cond213 = icmp ne %node_t* %reg110, null ; <i1> [#uses=1]
27 br i1 %cond213, label %bb2, label %bb3
Dan Gohmanf17a25c2007-07-18 16:29:46 +000028
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000029bb3: ; preds = %bb2, %bb1
30 ret void
Dan Gohmanf17a25c2007-07-18 16:29:46 +000031}
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000032