[llvm-commits] [llvm] r55857 - /llvm/trunk/lib/Target/X86/X86FastISel.cpp

Dan Gohman gohman at apple.com
Fri Sep 5 14:27:35 PDT 2008


Author: djg
Date: Fri Sep  5 16:27:34 2008
New Revision: 55857

URL: http://llvm.org/viewvc/llvm-project?rev=55857&view=rev
Log:
Fix X86FastISel's shift and select code to reject illegal types.

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

Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=55857&r1=55856&r2=55857&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Fri Sep  5 16:27:34 2008
@@ -504,6 +504,10 @@
     return false;
   }
 
+  MVT VT = MVT::getMVT(I->getType(), /*HandleUnknown=*/true);
+  if (VT == MVT::Other || !TLI.isTypeLegal(VT))
+    return false;
+
   unsigned Op0Reg = getRegForValue(I->getOperand(0));
   if (Op0Reg == 0) return false;
   unsigned Op1Reg = getRegForValue(I->getOperand(1));
@@ -516,7 +520,7 @@
 }
 
 bool X86FastISel::X86SelectSelect(Instruction *I) {
-  const Type *Ty = I->getOperand(1)->getType();
+  const Type *Ty = I->getType();
   if (isa<PointerType>(Ty))
     Ty = TLI.getTargetData()->getIntPtrType();
 
@@ -535,6 +539,10 @@
     return false; 
   }
 
+  MVT VT = MVT::getMVT(Ty, /*HandleUnknown=*/true);
+  if (VT == MVT::Other || !TLI.isTypeLegal(VT))
+    return false;
+
   unsigned Op0Reg = getRegForValue(I->getOperand(0));
   if (Op0Reg == 0) return false;
   unsigned Op1Reg = getRegForValue(I->getOperand(1));





More information about the llvm-commits mailing list