[llvm] r195455 - [mips][msa] Fix corner case for integer constant splats with undef values.

Daniel Sanders daniel.sanders at imgtec.com
Fri Nov 22 05:14:07 PST 2013


Author: dsanders
Date: Fri Nov 22 07:14:06 2013
New Revision: 195455

URL: http://llvm.org/viewvc/llvm-project?rev=195455&view=rev
Log:
[mips][msa] Fix corner case for integer constant splats with undef values.

lowerBUILD_VECTOR() was treating integer constant splats as being legal
regardless of whether they had undef values. This caused instruction
selection failures when the undefs were legalized to zero, making the
constant non-splat.

Fixed this by requiring HasAnyUndef to be false for a integer constant
splat to be legal. If it is true, a new node is generated with the undefs
replaced with the necessary values to remain a splat.


Modified:
    llvm/trunk/lib/Target/Mips/MipsSEISelLowering.cpp

Modified: llvm/trunk/lib/Target/Mips/MipsSEISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSEISelLowering.cpp?rev=195455&r1=195454&r2=195455&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsSEISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsSEISelLowering.cpp Fri Nov 22 07:14:06 2013
@@ -2211,8 +2211,9 @@ SDValue MipsSETargetLowering::lowerBUILD
 
     // If the value fits into a simm10 then we can use ldi.[bhwd]
     // However, if it isn't an integer type we will have to bitcast from an
-    // integer type first.
-    if (ResTy.isInteger() && SplatValue.isSignedIntN(10))
+    // integer type first. Also, it there are any undefs, we must lower them
+    // to defined values first.
+    if (ResTy.isInteger() && !HasAnyUndefs && SplatValue.isSignedIntN(10))
       return Op;
 
     EVT ViaVecTy;





More information about the llvm-commits mailing list