This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add test describing constant materialisation problem in loops
AbandonedPublic

Authored by luke on Apr 27 2023, 6:08 AM.

Details

Summary

As @alexey-bataev noticed, with the current cost model we account for
the cost of constant materialisation through the user's instruction
cost.
For straight line code this is usually fine, but inside a loop these
constants are usually hoisted out by LICM.
They should probably not be accounted for in these cases.

Diff Detail

Event Timeline

luke created this revision.Apr 27 2023, 6:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 27 2023, 6:08 AM
luke requested review of this revision.Apr 27 2023, 6:08 AM
luke abandoned this revision.Apr 27 2023, 8:40 AM

The cost model will probably need a bit of reworking, and I'm not sure if these constant materialisation costs will end up being factored out of getInstructionCost or if there will be some other interface, so these tests are not that useful as it stands.