[llvm] InstrProfiling: Split creating Bias offset to getOrCreateBiasVar(Name). NFC. (PR #95692)
NAKAMURA Takumi via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 18 15:31:36 PDT 2024
================
@@ -885,6 +889,29 @@ void InstrLowerer::lowerValueProfileInst(InstrProfValueProfileInst *Ind) {
Ind->eraseFromParent();
}
+GlobalVariable *InstrLowerer::getOrCreateBiasVar(StringRef VarName) {
+ auto *Bias = M.getGlobalVariable(VarName);
+ if (Bias)
+ return Bias;
----------------
chapuni wrote:
It makes the scope of `Bias` smaller and causes errors.
Do you think I should introduce another variable for `new GlobalVariable`? I don't think so, because the characteristics of `Bias` is same here and it is tied to the return value.
That said, `auto` is lazy a bit. I'll rewrite shortly.
https://github.com/llvm/llvm-project/pull/95692
More information about the llvm-commits
mailing list