[llvm] [InstrProf] Support conditional counter updates (PR #102542)
Ellis Hoag via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 1 08:24:25 PDT 2024
================
@@ -1213,6 +1218,17 @@ Value *InstrLowerer::getBitmapAddress(InstrProfMCDCTVBitmapUpdate *I) {
void InstrLowerer::lowerCover(InstrProfCoverInst *CoverInstruction) {
auto *Addr = getCounterAddress(CoverInstruction);
IRBuilder<> Builder(CoverInstruction);
+ if (ConditionalCounterUpdate) {
+ Instruction *SplitBefore = CoverInstruction->getNextNode();
+ auto &Ctx = CoverInstruction->getParent()->getContext();
+ auto *Int8Ty = llvm::Type::getInt8Ty(Ctx);
+ Value *Load = Builder.CreateLoad(Int8Ty, Addr, "pgocount");
+ Value *Cmp = Builder.CreateIsNotNull(Load, "pgocount.ifnonzero");
+ Instruction *ThenBranch =
+ SplitBlockAndInsertIfThen(Cmp, SplitBefore, false);
----------------
ellishg wrote:
I think this is ok now because of a recent change. See my comment https://github.com/llvm/llvm-project/pull/102542#discussion_r1712261570
But thanks for bringing this up!
https://github.com/llvm/llvm-project/pull/102542
More information about the llvm-commits
mailing list