I wanted to check and cross reference which heuristics we have implemented and didn't find it very easy to extract that information because everything is inlined in different functions. That's why I have created different lookup tables that should make this clearer.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This doesn't really look better than the previous code to me personally, but I'm not involved with BPI either...
llvm/lib/Analysis/BranchProbabilityInfo.cpp | ||
---|---|---|
132–133 | not needed |
instead of storing a bool value (swap the probability or not) it would be better to store final array of branch probabilities to set so it would not need to define probabilities every time and optionally swap them.
auto Search = PointerTable.find(CI->getPredicate()); if (Search == PointerTable.end()) return false; setEdgeProbability(BB, Search->second); return true;
llvm/lib/Analysis/BranchProbabilityInfo.cpp | ||
---|---|---|
87 | +const |
Thanks for the suggestion, the probabilities are now encoded directly into the tables.
I thought this table based approach to be compacter and thus easier to check. If this is not the case, we can revisit it, or I can abandon change as as I don't have too strong opinions (but again, I thought it would help a bit) . And while doing this, I noticed tests for pointer heuristics are missing, so added them.
+const