[llvm] r179714 - X86 cost model: Exit before calling getSimpleVT on non-simple VTs

Arnold Schwaighofer aschwaighofer at apple.com
Wed Apr 17 13:04:54 PDT 2013


Author: arnolds
Date: Wed Apr 17 15:04:53 2013
New Revision: 179714

URL: http://llvm.org/viewvc/llvm-project?rev=179714&view=rev
Log:
X86 cost model: Exit before calling getSimpleVT on non-simple VTs

getSimpleVT can only handle simple value types.

radar://13676022

Modified:
    llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp
    llvm/trunk/test/Analysis/CostModel/X86/uitofp.ll

Modified: llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp?rev=179714&r1=179713&r2=179714&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp Wed Apr 17 15:04:53 2013
@@ -371,6 +371,10 @@ unsigned X86TTI::getCastInstrCost(unsign
   EVT SrcTy = TLI->getValueType(Src);
   EVT DstTy = TLI->getValueType(Dst);
 
+  // The function getSimpleVT only handles simple value types.
+  if (!SrcTy.isSimple() || !DstTy.isSimple())
+    return TargetTransformInfo::getCastInstrCost(Opcode, Dst, Src);
+
   static const TypeConversionCostTblEntry<MVT> AVXConversionTbl[] = {
     { ISD::SIGN_EXTEND, MVT::v8i32, MVT::v8i16, 1 },
     { ISD::ZERO_EXTEND, MVT::v8i32, MVT::v8i16, 1 },

Modified: llvm/trunk/test/Analysis/CostModel/X86/uitofp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/CostModel/X86/uitofp.ll?rev=179714&r1=179713&r2=179714&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/CostModel/X86/uitofp.ll (original)
+++ llvm/trunk/test/Analysis/CostModel/X86/uitofp.ll Wed Apr 17 15:04:53 2013
@@ -1,6 +1,11 @@
 ; RUN: llc -mtriple=x86_64-apple-darwin -mcpu=core2 < %s | FileCheck --check-prefix=SSE2-CODEGEN %s
 ; RUN: opt -mtriple=x86_64-apple-darwin -mcpu=core2 -cost-model -analyze < %s | FileCheck --check-prefix=SSE2 %s
 
+; In X86TargetTransformInfo::getCastInstrCost we have code that depends on
+; getSimpleVT on a value type. On AVX2 we execute this code. Make sure we exit
+; early if the type is not a simple value type before we call this function.
+; RUN: opt -mtriple=x86_64-apple-darwin -mcpu=core-avx2 -cost-model -analyze < %s
+
 define <2 x double> @uitofpv2i8v2double(<2 x i8> %a) {
   ; SSE2: uitofpv2i8v2double
   ; SSE2: cost of 20 {{.*}} uitofp
@@ -360,3 +365,4 @@ define <32 x float> @uitofpv32i64v32floa
   %1 = uitofp <32 x i64> %a to <32 x float>
   ret <32 x float> %1
 }
+





More information about the llvm-commits mailing list