1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00

[InstCombine] fix binop (shuffle X), C --> shuffle (binop X, C') to check uses

llvm-svn: 332407
This commit is contained in:
Sanjay Patel 2018-05-15 22:00:37 +00:00
parent c52f903824
commit f00312f0b4
2 changed files with 4 additions and 5 deletions

View File

@ -1395,7 +1395,7 @@ Value *InstCombiner::SimplifyVectorOp(BinaryOperator &Inst) {
// transforms.
Constant *C;
if (match(&Inst, m_c_BinOp(
m_ShuffleVector(m_Value(V1), m_Undef(), m_Constant(Mask)),
m_OneUse(m_ShuffleVector(m_Value(V1), m_Undef(), m_Constant(Mask))),
m_Constant(C))) &&
V1->getType() == Inst.getType()) {
// Find constant NewC that has property:

View File

@ -420,15 +420,14 @@ define <4 x i32> @sub_const(<4 x i32> %v) {
ret <4 x i32> %r
}
; FIXME: Math before shuffle requires an extra shuffle.
; Math before shuffle requires an extra shuffle.
define <2 x float> @fadd_const_multiuse(<2 x float> %v) {
; CHECK-LABEL: @fadd_const_multiuse(
; CHECK-NEXT: [[T1:%.*]] = shufflevector <2 x float> [[V:%.*]], <2 x float> undef, <2 x i32> <i32 1, i32 0>
; CHECK-NEXT: [[TMP1:%.*]] = fadd <2 x float> [[V]], <float 4.200000e+01, float 4.100000e+01>
; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x float> [[TMP1]], <2 x float> undef, <2 x i32> <i32 1, i32 0>
; CHECK-NEXT: [[R:%.*]] = fadd <2 x float> [[T1]], <float 4.100000e+01, float 4.200000e+01>
; CHECK-NEXT: call void @use(<2 x float> [[T1]])
; CHECK-NEXT: ret <2 x float> [[TMP2]]
; CHECK-NEXT: ret <2 x float> [[R]]
;
%t1 = shufflevector <2 x float> %v, <2 x float> undef, <2 x i32> <i32 1, i32 0>
%r = fadd <2 x float> %t1, <float 41.0, float 42.0>