Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit b5da8a4

Browse files
committed
Move the inline cost analysis's primary cost query to TTI instead of the
old CodeMetrics system. TTI has the specific advantage of being extensible and customizable by targets to reflect target-specific cost metrics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173032 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 8d6c0f4 commit b5da8a4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/Analysis/InlineCost.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ bool CallAnalyzer::visitPtrToInt(PtrToIntInst &I) {
422422
if (lookupSROAArgAndCost(I.getOperand(0), SROAArg, CostIt))
423423
SROAArgValues[&I] = SROAArg;
424424

425-
return isInstructionFree(&I, TD);
425+
return TargetTransformInfo::TCC_Free == TTI.getUserCost(&I);
426426
}
427427

428428
bool CallAnalyzer::visitIntToPtr(IntToPtrInst &I) {
@@ -452,7 +452,7 @@ bool CallAnalyzer::visitIntToPtr(IntToPtrInst &I) {
452452
if (lookupSROAArgAndCost(Op, SROAArg, CostIt))
453453
SROAArgValues[&I] = SROAArg;
454454

455-
return isInstructionFree(&I, TD);
455+
return TargetTransformInfo::TCC_Free == TTI.getUserCost(&I);
456456
}
457457

458458
bool CallAnalyzer::visitCastInst(CastInst &I) {
@@ -469,7 +469,7 @@ bool CallAnalyzer::visitCastInst(CastInst &I) {
469469
// Disable SROA in the face of arbitrary casts we don't whitelist elsewhere.
470470
disableSROA(I.getOperand(0));
471471

472-
return isInstructionFree(&I, TD);
472+
return TargetTransformInfo::TCC_Free == TTI.getUserCost(&I);
473473
}
474474

475475
bool CallAnalyzer::visitUnaryInstruction(UnaryInstruction &I) {
@@ -782,7 +782,7 @@ bool CallAnalyzer::visitCallSite(CallSite CS) {
782782
bool CallAnalyzer::visitInstruction(Instruction &I) {
783783
// Some instructions are free. All of the free intrinsics can also be
784784
// handled by SROA, etc.
785-
if (isInstructionFree(&I, TD))
785+
if (TargetTransformInfo::TCC_Free == TTI.getUserCost(&I))
786786
return true;
787787

788788
// We found something we don't understand or can't handle. Mark any SROA-able

0 commit comments

Comments
 (0)