Minor cleanups.
authorNadav Rotem <nrotem@apple.com>
Thu, 25 Oct 2012 18:17:48 +0000 (18:17 +0000)
committerNadav Rotem <nrotem@apple.com>
Thu, 25 Oct 2012 18:17:48 +0000 (18:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166706 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/TargetTransformImpl.cpp

index 382eecb766577033bd3f471fc39b60eb999e9ad7..c8bd80ea2569396bfdcbcf1360f57b3b507088cf 100644 (file)
@@ -123,7 +123,7 @@ int InstructionOpcodeToISD(unsigned Opcode) {
   return OpToISDTbl[Opcode - 1];
 }
 
-std::pair<unsigned, EVT> 
+std::pair<unsigned, EVT>
 VectorTargetTransformImpl::getTypeLegalizationCost(LLVMContext &C,
                                                          EVT Ty) const {
   unsigned Cost = 1;
@@ -150,17 +150,17 @@ VectorTargetTransformImpl::getInstrCost(unsigned Opcode, Type *Ty1,
   // Check if any of the operands are vector operands.
   int ISD = InstructionOpcodeToISD(Opcode);
 
+  // If we don't have any information about this instruction assume it costs 1.
+  if (ISD == 0)
+    return 1;
+
   // Selects on vectors are actually vector selects.
   if (ISD == ISD::SELECT) {
-    assert(Ty2 && "Ty2 must hold the select type");
+    assert(Ty2 && "Ty2 must hold the condition type");
     if (Ty2->isVectorTy())
     ISD = ISD::VSELECT;
   }
 
-  // If we don't have any information about this instruction assume it costs 1.
-  if (ISD == 0)
-    return 1;
-
   assert(Ty1 && "We need to have at least one type");
 
   // From this stage we look at the legalized type.
@@ -174,7 +174,7 @@ VectorTargetTransformImpl::getInstrCost(unsigned Opcode, Type *Ty1,
   }
 
   unsigned NumElem =
-  (LT.second.isVector() ? LT.second.getVectorNumElements() : 1);
+    (LT.second.isVector() ? LT.second.getVectorNumElements() : 1);
 
   // We will probably scalarize this instruction. Assume that the cost is the
   // number of the vector elements.