xref: /aosp_15_r20/external/llvm/test/Transforms/ADCE/2002-05-23-ZeroArgPHITest.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; This testcase contains a entire loop that should be removed.  The only thing
2*9880d681SAndroid Build Coastguard Worker; left is the store instruction in BB0.  The problem this testcase was running
3*9880d681SAndroid Build Coastguard Worker; into was that when the reg109 PHI was getting zero predecessors, it was
4*9880d681SAndroid Build Coastguard Worker; removed even though there were uses still around.  Now the uses are filled
5*9880d681SAndroid Build Coastguard Worker; in with a dummy value before the PHI is deleted.
6*9880d681SAndroid Build Coastguard Worker;
7*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -adce
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker        %node_t = type { double*, %node_t*, %node_t**, double**, double*, i32, i32 }
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Workerdefine void @localize_local(%node_t* %nodelist) {
12*9880d681SAndroid Build Coastguard Workerbb0:
13*9880d681SAndroid Build Coastguard Worker        %nodelist.upgrd.1 = alloca %node_t*             ; <%node_t**> [#uses=2]
14*9880d681SAndroid Build Coastguard Worker        store %node_t* %nodelist, %node_t** %nodelist.upgrd.1
15*9880d681SAndroid Build Coastguard Worker        br label %bb1
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workerbb1:            ; preds = %bb0
18*9880d681SAndroid Build Coastguard Worker        %reg107 = load %node_t*, %node_t** %nodelist.upgrd.1              ; <%node_t*> [#uses=2]
19*9880d681SAndroid Build Coastguard Worker        %cond211 = icmp eq %node_t* %reg107, null               ; <i1> [#uses=1]
20*9880d681SAndroid Build Coastguard Worker        br i1 %cond211, label %bb3, label %bb2
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Workerbb2:            ; preds = %bb2, %bb1
23*9880d681SAndroid Build Coastguard Worker        %reg109 = phi %node_t* [ %reg110, %bb2 ], [ %reg107, %bb1 ]             ; <%node_t*> [#uses=1]
24*9880d681SAndroid Build Coastguard Worker        %reg212 = getelementptr %node_t, %node_t* %reg109, i64 0, i32 1          ; <%node_t**> [#uses=1]
25*9880d681SAndroid Build Coastguard Worker        %reg110 = load %node_t*, %node_t** %reg212                ; <%node_t*> [#uses=2]
26*9880d681SAndroid Build Coastguard Worker        %cond213 = icmp ne %node_t* %reg110, null               ; <i1> [#uses=1]
27*9880d681SAndroid Build Coastguard Worker        br i1 %cond213, label %bb2, label %bb3
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Workerbb3:            ; preds = %bb2, %bb1
30*9880d681SAndroid Build Coastguard Worker        ret void
31*9880d681SAndroid Build Coastguard Worker}
32*9880d681SAndroid Build Coastguard Worker
33