[PATCH] D148237: [BPI] Add method to swap outgoing edges probabilities
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 13 22:10:03 PDT 2023
mkazantsev added inline comments.
================
Comment at: llvm/lib/Analysis/BranchProbabilityInfo.cpp:1184
+ std::swap(Probs[std::make_pair(Src, 0)], Probs[std::make_pair(Src, 1)]);
+}
+
----------------
Why do you need this, exactly? I see that `swapSuccessors` is already updating the metadata:
```
void BranchInst::swapSuccessors() {
assert(isConditional() &&
"Cannot swap successors of an unconditional branch");
Op<-1>().swap(Op<-2>());
// Update profile metadata if present and it matches our structural
// expectations.
swapProfMetadata();
}
```
Is analysis returning invalid result after that?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148237/new/
https://reviews.llvm.org/D148237
More information about the llvm-commits
mailing list