Add a map from functions to load instructions that compute the profile bias. Previously we assumed that if the first instruction in the function was a load instruction, then it must be computing the bias. This was likely to work out because functions usually start with the llvm.instrprof.increment instruction, but optimizations could change this. For example, inlining into a non-profiled function.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Thanks, alternative solution we've implemented in D114383 is to name the load instruction and then check the name before reusing it, but this solution is more precise.
Comment Actions
LGTM
@ellis do you have time to land this change? This change should address https://github.com/llvm/llvm-project/issues/55125 so I'd like to see it landed.
llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h | ||
---|---|---|
61 | I'd prefer FunctionToProfileBiasMap to be consistent with other variables like ProfileDataMap. |
Comment Actions
@phosek I've landed this, but it does not seem to fix https://github.com/llvm/llvm-project/issues/55125
I believe the error is related to -do-counter-promotion since setting that to false makes the crash go away. I'll comment in the github issue.
I'd prefer FunctionToProfileBiasMap to be consistent with other variables like ProfileDataMap.