[PATCH] D147114: [LV] Use BFI to adjust cost of predicated instructions
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 29 09:56:51 PDT 2023
fhahn added a comment.
Do we have a test with profile info? Might be worth having dedicated tests for this feature with a range of branch probabilities if possible
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:4538
// Scale the cost by the probability of executing the predicated blocks.
// This assumes the predicated block for each vector lane is equally
// likely.
----------------
this needs updating now I think
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5596
+ InstructionCost &Cost, const BasicBlock *BB) const {
+ assert(Cost.isValid() && "Can't scale invalid cost");
+
----------------
dmgreen wrote:
> Could invalid cost handling be pushed into this function. It would help not needing it at all the call sites.
Yeah I think that would help readability
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5602
+ auto HeaderFreq = BFI->getBlockFreq(TheLoop->getHeader()).getFrequency();
+ if (HeaderFreq == 0)
+ return Cost;
----------------
Could you explain the reasoning here? Maybe fall back to the original code using `getReciprocalPredBlockProb` here?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147114/new/
https://reviews.llvm.org/D147114
More information about the llvm-commits
mailing list