summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-09-05 21:27:34 +0000
committerDan Gohman <gohman@apple.com>2008-09-05 21:27:34 +0000
commitdb06a9923995d17cff07d1a563f1be4110aef128 (patch)
treeeb0d5c4c03c5642f4195a22abbf9db2b213e8fb1 /llvm/lib/Target
parentd4dac0e9eae825e2a6ea2cdec70405723fcb776d (diff)
downloadbcm5719-llvm-db06a9923995d17cff07d1a563f1be4110aef128.tar.gz
bcm5719-llvm-db06a9923995d17cff07d1a563f1be4110aef128.zip
Fix X86FastISel's shift and select code to reject illegal types.
llvm-svn: 55857
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/X86/X86FastISel.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86FastISel.cpp b/llvm/lib/Target/X86/X86FastISel.cpp
index a9003e83691..bf939ab0fb6 100644
--- a/llvm/lib/Target/X86/X86FastISel.cpp
+++ b/llvm/lib/Target/X86/X86FastISel.cpp
@@ -504,6 +504,10 @@ bool X86FastISel::X86SelectShift(Instruction *I) {
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::X86SelectShift(Instruction *I) {
}
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 @@ bool X86FastISel::X86SelectSelect(Instruction *I) {
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));
OpenPOWER on IntegriCloud