[llvm] [BOLT] [Passes] Fix two compile warnings in BOLT (PR #73086)

Rafael Auler via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 12:03:10 PST 2023


================
@@ -1467,7 +1466,7 @@ void IndirectCallPromotion::runOnFunctions(BinaryContext &BC) {
                                std::max<uint64_t>(TotalIndexBasedCandidates, 1))
          << "%\n";
 
-  (void)verifyProfile;
+  (void)verifyProfile(BFs);
----------------
rafaelauler wrote:

Github doesn't let me comment on unchanged code, but line 161 would look like this:

```
#ifndef NDEBUG
static bool verifyProfile(std::map<uint64_t, BinaryFunction> &BFs) {
  bool IsValid = true;
  for (auto &BFI : BFs) {
    BinaryFunction &BF = BFI.second;
    if (!BF.isSimple())
      continue;
    for (const BinaryBasicBlock &BB : BF) {
      auto BI = BB.branch_info_begin();
      for (BinaryBasicBlock *SuccBB : BB.successors()) {
        if (BI->Count != BinaryBasicBlock::COUNT_NO_PROFILE && BI->Count > 0) {
          if (BB.getKnownExecutionCount() == 0 ||
              SuccBB->getKnownExecutionCount() == 0) {
            errs() << "BOLT-WARNING: profile verification failed after ICP for "
                      "function "
                   << BF << '\n';
            IsValid = false;
          }
        }
        ++BI;
      }
    }
  }
  return IsValid;
}
#endif
```

https://github.com/llvm/llvm-project/pull/73086


More information about the llvm-commits mailing list