[llvm-commits] [llvm] r166706 - /llvm/trunk/lib/Target/TargetTransformImpl.cpp

Nadav Rotem nrotem at apple.com
Thu Oct 25 11:17:48 PDT 2012


Author: nadav
Date: Thu Oct 25 13:17:48 2012
New Revision: 166706

URL: http://llvm.org/viewvc/llvm-project?rev=166706&view=rev
Log:
Minor cleanups.

Modified:
    llvm/trunk/lib/Target/TargetTransformImpl.cpp

Modified: llvm/trunk/lib/Target/TargetTransformImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetTransformImpl.cpp?rev=166706&r1=166705&r2=166706&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetTransformImpl.cpp (original)
+++ llvm/trunk/lib/Target/TargetTransformImpl.cpp Thu Oct 25 13:17:48 2012
@@ -123,7 +123,7 @@
   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 @@
   // 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 @@
   }
 
   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.





More information about the llvm-commits mailing list