This is an archive of the discontinued LLVM Phabricator instance.

[NFC][InstructionCost] Use InstructionCost in lib/Transforms/IPO/IROutliner.cpp
ClosedPublic

Authored by david-arm on Jan 11 2021, 9:15 AM.

Details

Summary

In places where we call a TTI.getXXCost() function I have changed
the code to use InstructionCost instead of unsigned. This is in
preparation for later on when we will change the TTI interfaces
to return InstructionCost.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

Diff Detail

Event Timeline

david-arm created this revision.Jan 11 2021, 9:15 AM
david-arm requested review of this revision.Jan 11 2021, 9:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 11 2021, 9:16 AM
david-arm updated this revision to Diff 316067.Jan 12 2021, 5:08 AM
  • I realised that instead of calling getValue() and asserting the cost is valid I can just change a few functions to return InstructionCost instead. The code simply compares the benefit and cost and decides to outline based upon that.

This looks fine to me, just one small nit in getBenefit for consistency with the rest of the patch.

llvm/lib/Transforms/IPO/IROutliner.cpp
246–247

I know this isn't part of the patch, but should probably be fixed to match up with the rest of the changes..

david-arm updated this revision to Diff 317508.Jan 19 2021, 3:28 AM
david-arm marked an inline comment as done.
This revision is now accepted and ready to land.Jan 19 2021, 7:03 AM