diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2024-07-20 10:44:30 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-20 10:44:30 +0900 |
commit | cfc22605f61baf83035dba2e7c6db547a3fb7c62 (patch) | |
tree | 0ed3a1a7f71be92175e99a464d77e77f094878e9 /llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp | |
parent | 52c08d7ffd380f4abd819c20bec76252272f6337 (diff) | |
download | llvm-cfc22605f61baf83035dba2e7c6db547a3fb7c62.zip llvm-cfc22605f61baf83035dba2e7c6db547a3fb7c62.tar.gz llvm-cfc22605f61baf83035dba2e7c6db547a3fb7c62.tar.bz2 |
InstrProf: Mark BiasLI as invariant. (#95588)
Bias doesn't change after startup.
The test is enhanced for optimized sequences and atomic ops.
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp index f994f8a..09c56eb 100644 --- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -945,6 +945,9 @@ Value *InstrLowerer::getCounterAddress(InstrProfCntrInstBase *I) { IRBuilder<> EntryBuilder(&Fn->getEntryBlock().front()); auto *Bias = getOrCreateBiasVar(getInstrProfCounterBiasVarName()); BiasLI = EntryBuilder.CreateLoad(Int64Ty, Bias, "profc_bias"); + // Bias doesn't change after startup. + BiasLI->setMetadata(LLVMContext::MD_invariant_load, + MDNode::get(M.getContext(), std::nullopt)); } auto *Add = Builder.CreateAdd(Builder.CreatePtrToInt(Addr, Int64Ty), BiasLI); return Builder.CreateIntToPtr(Add, Addr->getType()); |