summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2017-05-02 18:02:18 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2017-05-02 18:02:18 +0000
commit9ac7d6be3c4a3426d4b0a0f75a1d27f80d6ed304 (patch)
tree9d737557339da65f31d5cbfe091328ed0a1123f5 /llvm/lib/Transforms
parent49f7e0a98bb88aa3c1244b9c7f6dfff90c0123b2 (diff)
downloadbcm5719-llvm-9ac7d6be3c4a3426d4b0a0f75a1d27f80d6ed304.tar.gz
bcm5719-llvm-9ac7d6be3c4a3426d4b0a0f75a1d27f80d6ed304.zip
SpeculativeExecution: Stop using whitelist for costs
Just let TTI's cost do this instead of arbitrarily restricting this. llvm-svn: 301950
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp43
1 files changed, 1 insertions, 42 deletions
diff --git a/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp b/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
index a7c308b5987..a0fc966cee2 100644
--- a/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
+++ b/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
@@ -208,47 +208,6 @@ bool SpeculativeExecutionPass::runOnBasicBlock(BasicBlock &B) {
return false;
}
-static unsigned ComputeSpeculationCost(const Instruction *I,
- const TargetTransformInfo &TTI) {
- switch (Operator::getOpcode(I)) {
- case Instruction::GetElementPtr:
- case Instruction::Add:
- case Instruction::Mul:
- case Instruction::And:
- case Instruction::Or:
- case Instruction::Select:
- case Instruction::Shl:
- case Instruction::Sub:
- case Instruction::LShr:
- case Instruction::AShr:
- case Instruction::Xor:
- case Instruction::ZExt:
- case Instruction::SExt:
- case Instruction::Call:
- case Instruction::BitCast:
- case Instruction::PtrToInt:
- case Instruction::IntToPtr:
- case Instruction::AddrSpaceCast:
- case Instruction::FPToUI:
- case Instruction::FPToSI:
- case Instruction::UIToFP:
- case Instruction::SIToFP:
- case Instruction::FPExt:
- case Instruction::FPTrunc:
- case Instruction::FAdd:
- case Instruction::FSub:
- case Instruction::FMul:
- case Instruction::FDiv:
- case Instruction::FRem:
- case Instruction::ICmp:
- case Instruction::FCmp:
- return TTI.getUserCost(I);
-
- default:
- return UINT_MAX; // Disallow anything not whitelisted.
- }
-}
-
bool SpeculativeExecutionPass::considerHoistingFromTo(
BasicBlock &FromBlock, BasicBlock &ToBlock) {
SmallSet<const Instruction *, 8> NotHoisted;
@@ -264,7 +223,7 @@ bool SpeculativeExecutionPass::considerHoistingFromTo(
unsigned TotalSpeculationCost = 0;
for (auto& I : FromBlock) {
- const unsigned Cost = ComputeSpeculationCost(&I, *TTI);
+ const unsigned Cost = TTI->getUserCost(&I);
if (Cost != UINT_MAX && isSafeToSpeculativelyExecute(&I) &&
AllPrecedingUsesFromBlockHoisted(&I)) {
TotalSpeculationCost += Cost;
OpenPOWER on IntegriCloud