Skip to content

Commit 0a5d644

Browse files
committed
Address review 3
- Add debug statement to getLatencySavingsForKnownConstants
1 parent b9336f2 commit 0a5d644

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

llvm/lib/Transforms/IPO/FunctionSpecialization.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ Cost InstCostVisitor::getCodeSizeSavingsForArg(Argument *A, Constant *C) {
194194
/// have visited and found to be constant.
195195
Cost InstCostVisitor::getLatencySavingsForKnownConstants() {
196196
auto &BFI = GetBFI(*F);
197-
Cost Latency = 0;
197+
Cost TotalLatency = 0;
198198

199199
for (auto Pair : KnownConstants) {
200200
Instruction *I = dyn_cast<Instruction>(Pair.first);
@@ -203,11 +203,17 @@ Cost InstCostVisitor::getLatencySavingsForKnownConstants() {
203203

204204
uint64_t Weight = BFI.getBlockFreq(I->getParent()).getFrequency() /
205205
BFI.getEntryFreq().getFrequency();
206-
Latency +=
206+
207+
Cost Latency =
207208
Weight * TTI.getInstructionCost(I, TargetTransformInfo::TCK_Latency);
209+
210+
LLVM_DEBUG(dbgs() << "FnSpecialization: {Latency = " << Latency
211+
<< "} for instruction " << *I << "\n");
212+
213+
TotalLatency += Latency;
208214
}
209215

210-
return Latency;
216+
return TotalLatency;
211217
}
212218

213219
Cost InstCostVisitor::getCodeSizeSavingsForUser(Instruction *User, Value *Use,

0 commit comments

Comments
 (0)