[llvm] [LV] Scale block costs using BranchFrequencyInfo (PR #71793)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 9 03:10:37 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 1b1c81772fe50a1cb2b2adf8d8cf442c0b73602f 3c1c49b20083d3b3ffa645b7e26a795ecbf37b3d -- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index bfc91b7dd95c..529af846409b 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -401,14 +401,14 @@ static bool hasIrregularType(Type *Ty, const DataLayout &DL) {
return DL.getTypeAllocSizeInBits(Ty) != DL.getTypeSizeInBits(Ty);
}
-/// A helper function that returns the reciprocal of the block probability of a
+/// A helper function that returns the reciprocal of the block probability of a
/// predicated block. Without further information, we assume a prob. of 50%.
static unsigned getReciprocalPredBlockProb() { return 2; }
-/// A helper function that returns the reciprocal of the block probability of a
+/// A helper function that returns the reciprocal of the block probability of a
// predicated block by comparing its BlockFrequency to that of the loop header.
-static unsigned getReciprocalPredBlockProb(BlockFrequencyInfo *BFI,
- Loop *L, BasicBlock *BB) {
+static unsigned getReciprocalPredBlockProb(BlockFrequencyInfo *BFI, Loop *L,
+ BasicBlock *BB) {
if (BFI == nullptr)
return getReciprocalPredBlockProb();
auto HeaderFreq = BFI->getBlockFreq(L->getHeader()).getFrequency();
@@ -1206,16 +1206,13 @@ using InstructionVFPair = std::pair<Instruction *, ElementCount>;
/// different operations.
class LoopVectorizationCostModel {
public:
- LoopVectorizationCostModel(ScalarEpilogueLowering SEL, Loop *L,
- PredicatedScalarEvolution &PSE, LoopInfo *LI,
- LoopVectorizationLegality *Legal,
- const TargetTransformInfo &TTI,
- const TargetLibraryInfo *TLI, DemandedBits *DB,
- AssumptionCache *AC,
- OptimizationRemarkEmitter *ORE, const Function *F,
- const LoopVectorizeHints *Hints,
- InterleavedAccessInfo &IAI,
- BlockFrequencyInfo *BFI)
+ LoopVectorizationCostModel(
+ ScalarEpilogueLowering SEL, Loop *L, PredicatedScalarEvolution &PSE,
+ LoopInfo *LI, LoopVectorizationLegality *Legal,
+ const TargetTransformInfo &TTI, const TargetLibraryInfo *TLI,
+ DemandedBits *DB, AssumptionCache *AC, OptimizationRemarkEmitter *ORE,
+ const Function *F, const LoopVectorizeHints *Hints,
+ InterleavedAccessInfo &IAI, BlockFrequencyInfo *BFI)
: ScalarEpilogueStatus(SEL), TheLoop(L), PSE(PSE), LI(LI), Legal(Legal),
TTI(TTI), TLI(TLI), DB(DB), AC(AC), ORE(ORE), TheFunction(F),
Hints(Hints), InterleaveInfo(IAI), BFInfo(BFI) {}
``````````
</details>
https://github.com/llvm/llvm-project/pull/71793
More information about the llvm-commits
mailing list