[PATCH] D72029: [LoopUtils][NFC] Minor refactoring in getLoopEstimatedTripCount.
Ayal Zaks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 31 05:38:29 PST 2019
Ayal added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/LoopUtils.cpp:718
// we exited the loop.
- uint64_t TrueVal, FalseVal;
- if (!LatchBR->extractProfMetadata(TrueVal, FalseVal))
+ uint64_t LatchCycleWeight, LatchExitWeight;
+ if (!LatchBR->extractProfMetadata(LatchCycleWeight, LatchExitWeight))
----------------
Can we agree on `BackedgeTakenWeight` and `LatchExitWeight`? They directly correspond to "the number of times the backedge was taken" and "the number of times we exited the loop" documented above, and the comment removed below.
================
Comment at: llvm/lib/Transforms/Utils/LoopUtils.cpp:726
+ if (!LatchCycleWeight || !LatchExitWeight)
return 0;
----------------
(Above early exit can precede the swap, but agree it's better to first set the variables to their correct meaning.)
================
Comment at: llvm/lib/Transforms/Utils/LoopUtils.cpp:727
return 0;
+ return llvm::divideNearest(LatchCycleWeight, LatchExitWeight);
----------------
Original "// Divide the count ..." comment removed deliberately?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72029/new/
https://reviews.llvm.org/D72029
More information about the llvm-commits
mailing list