This is an archive of the discontinued LLVM Phabricator instance.

[TTI] NFC: Change getScalingFactorCost to return InstructionCost
ClosedPublic

Authored by sdesmalen on Apr 15 2021, 7:19 AM.

Details

Summary

This patch migrates the TTI cost interfaces to return an 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

sdesmalen created this revision.Apr 15 2021, 7:19 AM
sdesmalen requested review of this revision.Apr 15 2021, 7:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 15 2021, 7:19 AM
paulwalker-arm accepted this revision.Apr 19 2021, 5:01 AM

One comment about preexisting possibly redundant code so the patch looks good to me.

llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
1782–1783

I can see that TargetTransformInfo::getScalingFactorCost already performs the >=0 test and so I'm wondering if at this point you only need to assert the costs are valid?

This revision is now accepted and ready to land.Apr 19 2021, 5:01 AM
sdesmalen marked an inline comment as done.Apr 22 2021, 5:49 AM
sdesmalen added inline comments.
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
1782–1783

You're right, those checks seem redundant. I'll remove them before submitting the patch.

This revision was automatically updated to reflect the committed changes.
sdesmalen marked an inline comment as done.