Clean this up, based on Evan's suggestions.
authorOwen Anderson <resistor@mac.com>
Tue, 9 Sep 2008 20:47:17 +0000 (20:47 +0000)
committerOwen Anderson <resistor@mac.com>
Tue, 9 Sep 2008 20:47:17 +0000 (20:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56009 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/FastISel.cpp

index d73bce74e6b005e9b54546de2129d15d1ca25b25..912dc322ff2646c66be098ec6eac95e4005d26b3 100644 (file)
@@ -33,14 +33,14 @@ unsigned FastISel::getRegForValue(Value *V) {
     return Reg;
 
   MVT::SimpleValueType VT = TLI.getValueType(V->getType()).getSimpleVT();
+  if (!TLI.isTypeLegal(VT))
+    return 0;
   if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
     if (CI->getValue().getActiveBits() > 64)
       return TargetMaterializeConstant(CI,
                                        MBB->getParent()->getConstantPool());
     // Don't cache constant materializations.  To do so would require
     // tracking what uses they dominate.
-    if (!TLI.isTypeLegal(VT))
-      return false;
     Reg = FastEmit_i(VT, VT, ISD::Constant, CI->getZExtValue());
   } else if (isa<GlobalValue>(V)) {
     return TargetMaterializeConstant(dyn_cast<Constant>(V),