[llvm] r321407 - [X86] In WidenMaskArithmetic, make sure we check the input type of a truncate on N1.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 23 10:53:03 PST 2017


Author: ctopper
Date: Sat Dec 23 10:53:03 2017
New Revision: 321407

URL: http://llvm.org/viewvc/llvm-project?rev=321407&view=rev
Log:
[X86] In WidenMaskArithmetic, make sure we check the input type of a truncate on N1.

Later in the code we explicitly bypass the truncate so we should be checking its type to make sure that it's safe.

Modified:
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=321407&r1=321406&r2=321407&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Dec 23 10:53:03 2017
@@ -33046,7 +33046,8 @@ static SDValue WidenMaskArithmetic(SDNod
     return SDValue();
 
   // The right side has to be a 'trunc' or a constant vector.
-  bool RHSTrunc = N1.getOpcode() == ISD::TRUNCATE;
+  bool RHSTrunc = N1.getOpcode() == ISD::TRUNCATE &&
+                  N1.getOperand(0).getValueType() == VT;
   ConstantSDNode *RHSConstSplat = nullptr;
   if (auto *RHSBV = dyn_cast<BuildVectorSDNode>(N1))
     RHSConstSplat = RHSBV->getConstantSplatNode();




More information about the llvm-commits mailing list