summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/TargetTransformInfo.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2018-07-11 17:51:27 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2018-07-11 17:51:27 +0000
commit667a5b541fac4930898b2a75541781f4201f106d (patch)
tree63bc76eb8b550c3943d50ded1b2f969e7be8e540 /llvm/lib/Analysis/TargetTransformInfo.cpp
parenta2125b12ec22e073f5b300b395a4bcc47d79153d (diff)
downloadbcm5719-llvm-667a5b541fac4930898b2a75541781f4201f106d.tar.gz
bcm5719-llvm-667a5b541fac4930898b2a75541781f4201f106d.zip
[TargetTransformInfo] Add pow2 analysis for scalar constants
Add ConstantInt analysis to getOperandInfo so we get more realistic div/rem expansion costs comparable to the vector costs. llvm-svn: 336827
Diffstat (limited to 'llvm/lib/Analysis/TargetTransformInfo.cpp')
-rw-r--r--llvm/lib/Analysis/TargetTransformInfo.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp
index 2bbc074186a..9de2f789c89 100644
--- a/llvm/lib/Analysis/TargetTransformInfo.cpp
+++ b/llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -636,6 +636,12 @@ getOperandInfo(Value *V, TargetTransformInfo::OperandValueProperties &OpProps) {
TargetTransformInfo::OK_AnyValue;
OpProps = TargetTransformInfo::OP_None;
+ if (auto *CI = dyn_cast<ConstantInt>(V)) {
+ if (CI->getValue().isPowerOf2())
+ OpProps = TargetTransformInfo::OP_PowerOf2;
+ return TargetTransformInfo::OK_UniformConstantValue;
+ }
+
const Value *Splat = getSplatValue(V);
// Check for a splat of a constant or for a non uniform vector of constants
OpenPOWER on IntegriCloud