[llvm-commits] [llvm] r167401 - in /llvm/trunk: lib/Target/TargetTransformImpl.cpp test/Analysis/CostModel/X86/i32.ll
Nadav Rotem
nrotem at apple.com
Mon Nov 5 13:11:10 PST 2012
Author: nadav
Date: Mon Nov 5 15:11:10 2012
New Revision: 167401
URL: http://llvm.org/viewvc/llvm-project?rev=167401&view=rev
Log:
Cost Model: teach the cost model about expanding integers.
Added:
llvm/trunk/test/Analysis/CostModel/X86/i32.ll
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=167401&r1=167400&r2=167401&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetTransformImpl.cpp (original)
+++ llvm/trunk/lib/Target/TargetTransformImpl.cpp Mon Nov 5 15:11:10 2012
@@ -143,7 +143,8 @@
if (LK.first == TargetLowering::TypeLegal)
return std::make_pair(Cost, Ty.getSimpleVT());
- if (LK.first == TargetLowering::TypeSplitVector)
+ if (LK.first == TargetLowering::TypeSplitVector ||
+ LK.first == TargetLowering::TypeExpandInteger)
Cost *= 2;
// Keep legalizing the type.
@@ -300,7 +301,7 @@
unsigned Cost = getCmpSelInstrCost(Opcode, ValTy->getScalarType(),
CondTy);
- // return the cost of multiple scalar invocation plus the cost of inserting
+ // Return the cost of multiple scalar invocation plus the cost of inserting
// and extracting the values.
return getScalarizationOverhead(ValTy, true, false) + Num * Cost;
}
Added: llvm/trunk/test/Analysis/CostModel/X86/i32.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/CostModel/X86/i32.ll?rev=167401&view=auto
==============================================================================
--- llvm/trunk/test/Analysis/CostModel/X86/i32.ll (added)
+++ llvm/trunk/test/Analysis/CostModel/X86/i32.ll Mon Nov 5 15:11:10 2012
@@ -0,0 +1,9 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=i386 -mcpu=corei7-avx | FileCheck %s
+
+
+;CHECK: cost of 2 {{.*}} add
+;CHECK: cost of 1 {{.*}} ret
+define i32 @no_info(i32 %arg) {
+ %e = add i64 undef, undef
+ ret i32 undef
+}
More information about the llvm-commits
mailing list