From: Simon Pilgrim Date: Tue, 24 Jan 2017 11:07:41 +0000 (+0000) Subject: [InstCombine][X86] MULDQ/MULUDQ undef -> zero X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=52cd722eec0d8a934e0ffd6dbfc00d70ab803e0a;p=llvm [InstCombine][X86] MULDQ/MULUDQ undef -> zero Added early out for single undef input - we were already supporting (and testing) this in the constant folding code, we just do it quicker now Drop undef handling from demanded elts code now that we handle it fully in InstCombiner::visitCallInst git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292913 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp index 07ee3c032c2..6b03b682bca 100644 --- a/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -520,7 +520,7 @@ static Value *simplifyX86muldq(const IntrinsicInst &II, ResTy->getScalarSizeInBits() == 64 && "Unexpected muldq/muludq types"); // muldq/muludq(undef, undef) -> zero (matches generic mul behavior) - if (isa(Arg0) && isa(Arg1)) + if (isa(Arg0) || isa(Arg1)) return ConstantAggregateZero::get(ResTy); // Constant folding. diff --git a/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp index e625f804a23..fb7177f1ddb 100644 --- a/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp +++ b/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp @@ -1469,12 +1469,6 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, APInt DemandedElts, Depth + 1); if (TmpV) { II->setArgOperand(1, TmpV); MadeChange = true; } - // Output elements are undefined if both are undefined. Consider things - // like undef*0. The result is known zero, not undef. - for (unsigned i = 0; i != VWidth; ++i) - if (UndefElts2[i * 2] && UndefElts3[i * 2]) - UndefElts.setBit(i); - break; }