diff options
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstructionCombining.cpp | 2 | ||||
-rw-r--r-- | llvm/test/Transforms/InstCombine/vec_shuffle.ll | 7 |
2 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 7f97b78986a..5dc63632691 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -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: diff --git a/llvm/test/Transforms/InstCombine/vec_shuffle.ll b/llvm/test/Transforms/InstCombine/vec_shuffle.ll index 7d6bca31b94..171907e28c7 100644 --- a/llvm/test/Transforms/InstCombine/vec_shuffle.ll +++ b/llvm/test/Transforms/InstCombine/vec_shuffle.ll @@ -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> |