[PATCH] [SROA] Fold a PHI node if all its incoming values are the same
Jingyue Wu
jingyue at google.com
Sun Jul 27 09:21:24 PDT 2014
Hi Duncan,
I tried SimplifyPHINode and it worked pretty well. Thanks!
That makes me consider using SimplifySelectInst on select instructions too. However, I found one regression test PR16651.2 would fail after this potential modification. We would transform
```
define void @PR16651.2() {
; This test case caused a crash due to failing to promote given a select that
; can't be speculated. It shouldn't be promoted, but we missed that fact when
; analyzing whether we could form a vector promotion because that code didn't
; bail on select instructions.
;
; CHECK-LABEL: @PR16651.2(
; CHECK: alloca <2 x float>
; CHECK: ret void
entry:
%tv1 = alloca { <2 x float>, <2 x float> }, align 8
%0 = getelementptr { <2 x float>, <2 x float> }* %tv1, i64 0, i32 1
store <2 x float> undef, <2 x float>* %0, align 8
%1 = getelementptr inbounds { <2 x float>, <2 x float> }* %tv1, i64 0, i32 1, i64 0
%cond105.in.i.i = select i1 undef, float* null, float* %1
%cond105.i.i = load float* %cond105.in.i.i, align 8
ret void
}
```
to
```
define void @PR16651.2() {
entry:
%cond105.in.i.i = select i1 undef, float* null, float* undef
%cond105.i.i = load float* %cond105.in.i.i, align 8
ret void
}
```
Is this transformation on PR16651.2 valid? If no, can somebody help me understand why it isn't?
Thanks,
Jingyue
http://reviews.llvm.org/D4659
More information about the llvm-commits
mailing list