Skip to content

Commit a512854

Browse files
authored
InstProfiling: Give the name to profc_bias. NFC. (#95587)
1 parent ad59921 commit a512854

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ Value *InstrLowerer::getCounterAddress(InstrProfCntrInstBase *I) {
931931
if (!BiasLI) {
932932
IRBuilder<> EntryBuilder(&Fn->getEntryBlock().front());
933933
auto *Bias = getOrCreateBiasVar(getInstrProfCounterBiasVarName());
934-
BiasLI = EntryBuilder.CreateLoad(Int64Ty, Bias);
934+
BiasLI = EntryBuilder.CreateLoad(Int64Ty, Bias, "profc_bias");
935935
}
936936
auto *Add = Builder.CreateAdd(Builder.CreatePtrToInt(Addr, Int64Ty), BiasLI);
937937
return Builder.CreateIntToPtr(Add, Addr->getType());

llvm/test/Instrumentation/InstrProfiling/runtime-counter-relocation.ll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ target triple = "x86_64-unknown-linux-gnu"
88
; RELOC: @__llvm_profile_counter_bias = linkonce_odr hidden global i64 0, comdat
99

1010
; CHECK-LABEL: define void @foo
11-
; CHECK-NEXT: %pgocount = load i64, ptr @__profc_foo
12-
; CHECK-NEXT: %1 = add i64 %pgocount, 1
13-
; CHECK-NEXT: store i64 %1, ptr @__profc_foo
11+
; CHECK-NEXT: %[[PGOCOUNT:.+]] = load i64, ptr @__profc_foo
12+
; CHECK-NEXT: %[[PGOCOUNTINC:.+]] = add i64 %[[PGOCOUNT]], 1
13+
; CHECK-NEXT: store i64 %[[PGOCOUNTINC]], ptr @__profc_foo
1414
; RELOC-LABEL: define void @foo
15-
; RELOC-NEXT: %1 = load i64, ptr @__llvm_profile_counter_bias
16-
; RELOC-NEXT: %2 = add i64 ptrtoint (ptr @__profc_foo to i64), %1
17-
; RELOC-NEXT: %3 = inttoptr i64 %2 to ptr
18-
; RELOC-NEXT: %pgocount = load i64, ptr %3
19-
; RELOC-NEXT: %4 = add i64 %pgocount, 1
20-
; RELOC-NEXT: store i64 %4, ptr %3
15+
; RELOC-NEXT: %[[BIAS:.+]] = load i64, ptr @__llvm_profile_counter_bias
16+
; RELOC-NEXT: %[[PROFC_BIAS:.+]] = add i64 ptrtoint (ptr @__profc_foo to i64), %[[BIAS]]
17+
; RELOC-NEXT: %[[PROFC_ADDR:.+]] = inttoptr i64 %[[PROFC_BIAS]] to ptr
18+
; RELOC-NEXT: %[[PGOCOUNT:.+]] = load i64, ptr %[[PROFC_ADDR]]
19+
; RELOC-NEXT: %[[PGOCOUNTINC:.+]] = add i64 %[[PGOCOUNT]], 1
20+
; RELOC-NEXT: store i64 %[[PGOCOUNTINC]], ptr %[[PROFC_ADDR]]
2121
define void @foo() {
2222
call void @llvm.instrprof.increment(ptr @__profn_foo, i64 0, i32 1, i32 0)
2323
ret void

llvm/test/Transforms/PGOProfile/counter_promo_with_bias.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ target triple = "x86_64-unknown-linux-gnu"
66

77
define void @foo(i1 %c) {
88
entry:
9-
; CHECK: %[[BIAS:[0-9]+]] = load i64, ptr @__llvm_profile_counter_bias
9+
; CHECK: %[[BIAS:.+]] = load i64, ptr @__llvm_profile_counter_bias
1010
br label %while.cond
1111

1212
while.cond: ; preds = %land.rhs, %while.cond.preheader

0 commit comments

Comments
 (0)