[PATCH] D97479: BPF: Implement TTI.getCmpSelInstrCost() properly
Yonghong Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 25 14:01:17 PST 2021
yonghong-song updated this revision to Diff 326494.
yonghong-song edited the summary of this revision.
yonghong-song added a comment.
Herald added a subscriber: javed.absar.
- change Select insn cost from 4 to SCEVCheapExpansionBudget. Using SCEVCheapExpansionBudget is more adaptive in that its value is changed in the future.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97479/new/
https://reviews.llvm.org/D97479
Files:
llvm/lib/Target/BPF/BPFTargetTransformInfo.h
Index: llvm/lib/Target/BPF/BPFTargetTransformInfo.h
===================================================================
--- llvm/lib/Target/BPF/BPFTargetTransformInfo.h
+++ llvm/lib/Target/BPF/BPFTargetTransformInfo.h
@@ -18,6 +18,7 @@
#include "BPFTargetMachine.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/CodeGen/BasicTTIImpl.h"
+#include "llvm/Transforms/Utils/ScalarEvolutionExpander.h"
namespace llvm {
class BPFTTIImpl : public BasicTTIImplBase<BPFTTIImpl> {
@@ -42,6 +43,17 @@
return TTI::TCC_Basic;
}
+
+ int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
+ CmpInst::Predicate VecPred,
+ TTI::TargetCostKind CostKind,
+ const llvm::Instruction *I = nullptr) {
+ if (Opcode == Instruction::Select)
+ return SCEVCheapExpansionBudget;
+
+ return BaseT::getCmpSelInstrCost(Opcode, ValTy, CondTy, VecPred, CostKind,
+ I);
+ }
};
} // end namespace llvm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97479.326494.patch
Type: text/x-patch
Size: 1035 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210225/9e81a9e3/attachment.bin>
More information about the llvm-commits
mailing list