[PATCH] D111668: [LoopPredication] Calculate profitability without BPI

Evgeniy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 19 01:25:25 PDT 2021


ebrevnov added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopPredication.cpp:971
+
+  auto ComputeBranchProbability =
+      [&](const BasicBlock *ExitingBlock,
----------------
This looks like a natural generalization of "bool Instruction::extractProfMetadata(uint64_t &TrueVal, uint64_t &FalseVal) const". Why don't we extend existing implementation of "extractProfMetadata" to handle more than 2 operands and overloaded existing API with "bool Instruction::extractProfMetadata(SmallVectorImpl<uint64_t> &) const"?

PS: Looks tempting to place total weight as a first element in the resulting vector. WDYT?


================
Comment at: llvm/lib/Transforms/Scalar/LoopPredication.cpp:977
+    unsigned NumSucc = Term->getNumSuccessors();
+    if (isValidProfileData(ProfileData, Term)) {
+      uint64_t Numerator = 0, Denominator = 0, ProfVal = 0;
----------------
Looks like we already check that there is a "valid" profile at line 968. Why do it again?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111668/new/

https://reviews.llvm.org/D111668



More information about the llvm-commits mailing list