[PATCH] D23824: [ADCE] Add handling of PHI nodes when removing control flow
David Callahan via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 6 15:30:27 PDT 2016
david2050 added a comment.
I ran this test:
int foo(int a, int b, int N) {
int j = 0;
if (b) {
int i;
for (i = 0; i < N; i++)
;
j = 1;
}
return j;
}
compiled to bc and then processed: opt -sroa -adce -adce-remove-loops and it did successfully remove the loop. I also tried this variant
int foo(int b, int N) {
int j = 0;
if (b) {
int i;
j = 1;
for (i = 0; i < N; i++)
;
}
return j;
}
The final output for that one looked like:
define i32 @foo(i32 %b, i32 %N) #0 {
%1 = icmp ne i32 %b, 0
br i1 %1, label %2, label %3
; <label>:2: ; preds = %0
br label %3
; <label>:3: ; preds = %2, %0
%j.0 = phi i32 [ 0, %0 ], [ 1, %2 ]
ret i32 %j.0
}
https://reviews.llvm.org/D23824
More information about the llvm-commits
mailing list