[llvm] r292913 - [InstCombine][X86] MULDQ/MULUDQ undef -> zero

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 03:07:42 PST 2017


Author: rksimon
Date: Tue Jan 24 05:07:41 2017
New Revision: 292913

URL: http://llvm.org/viewvc/llvm-project?rev=292913&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
    llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=292913&r1=292912&r2=292913&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Tue Jan 24 05:07:41 2017
@@ -520,7 +520,7 @@ static Value *simplifyX86muldq(const Int
          ResTy->getScalarSizeInBits() == 64 && "Unexpected muldq/muludq types");
 
   // muldq/muludq(undef, undef) -> zero (matches generic mul behavior)
-  if (isa<UndefValue>(Arg0) && isa<UndefValue>(Arg1))
+  if (isa<UndefValue>(Arg0) || isa<UndefValue>(Arg1))
     return ConstantAggregateZero::get(ResTy);
 
   // Constant folding.

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp?rev=292913&r1=292912&r2=292913&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp Tue Jan 24 05:07:41 2017
@@ -1469,12 +1469,6 @@ Value *InstCombiner::SimplifyDemandedVec
                                         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;
     }
 




More information about the llvm-commits mailing list