[PATCH] D97479: BPF: Implement TTI.getCmpSelInstrCost() properly

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 25 14:57:35 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1959ead525b8: BPF: Implement TTI.getCmpSelInstrCost() properly (authored by yonghong-song).

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.326522.patch
Type: text/x-patch
Size: 1035 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210225/dd6a1d4a/attachment.bin>


More information about the llvm-commits mailing list