diff options
author | Arnold Schwaighofer <aschwaighofer@apple.com> | 2013-10-29 01:33:53 +0000 |
---|---|---|
committer | Arnold Schwaighofer <aschwaighofer@apple.com> | 2013-10-29 01:33:53 +0000 |
commit | 7e8cebf22d170769b0bf0c2a69309faa0e36ac4c (patch) | |
tree | 64fe80f53f2b6d754f1f418ac3be688165263ee6 /lib/Target/ARM | |
parent | 4a6b3a9a770ec2064fb5975ff2d57419c1339a21 (diff) | |
download | external_llvm-7e8cebf22d170769b0bf0c2a69309faa0e36ac4c.tar.gz external_llvm-7e8cebf22d170769b0bf0c2a69309faa0e36ac4c.tar.bz2 external_llvm-7e8cebf22d170769b0bf0c2a69309faa0e36ac4c.zip |
ARM cost model: Account for zero cost scalar SROA instructions
By vectorizing a series of srl, or, ... instructions we have obfuscated the
intention so much that the backend does not know how to fold this code away.
radar://15336950
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193573 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM')
-rw-r--r-- | lib/Target/ARM/ARMTargetTransformInfo.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/Target/ARM/ARMTargetTransformInfo.cpp b/lib/Target/ARM/ARMTargetTransformInfo.cpp index 9dc1cd1fee..86b6215f09 100644 --- a/lib/Target/ARM/ARMTargetTransformInfo.cpp +++ b/lib/Target/ARM/ARMTargetTransformInfo.cpp @@ -523,8 +523,20 @@ unsigned ARMTTI::getArithmeticInstrCost(unsigned Opcode, Type *Ty, OperandValueK if (Idx != -1) return LT.first * CostTbl[Idx].Cost; - - return TargetTransformInfo::getArithmeticInstrCost(Opcode, Ty, Op1Info, - Op2Info); + unsigned Cost = + TargetTransformInfo::getArithmeticInstrCost(Opcode, Ty, Op1Info, Op2Info); + + // This is somewhat of a hack. The problem that we are facing is that SROA + // creates a sequence of shift, and, or instructions to construct values. + // These sequences are recognized by the ISel and have zero-cost. Not so for + // the vectorized code. Because we have support for v2i64 but not i64 those + // sequences look particularily beneficial to vectorize. + // To work around this we increase the cost of v2i64 operations to make them + // seem less beneficial. + if (LT.second == MVT::v2i64 && + Op2Info == TargetTransformInfo::OK_UniformConstantValue) + Cost += 4; + + return Cost; } |