This is an archive of the discontinued LLVM Phabricator instance.

Custom IR printer for SLP that prints the cost after each vectorized instruction
Needs ReviewPublic

Authored by vporpo on May 2 2022, 1:30 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary
NOTE: This is WIP and not ready for reaview.

If we use a custom printer we could annotate the instructions with their cost.
This could prove useful for keeping track of cost model changes.
We could use that in existing lit tests and get something like:

%6 = add <4 x i32> %shuffle, %4            Cost: -3
%7 = bitcast i32* %idxS0 to <4 x i32>*
store <4 x i32> %6, <4 x i32>* %7, align 8 Cost: -3
ret void

There are some issues though:

  • The cost of inserts/extracts is not currently being mapped well to the generated instructions, so this needs more work
  • The dump contains dead instructions that are not being removed by SLP.

Diff Detail

Event Timeline

vporpo created this revision.May 2 2022, 1:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2022, 1:30 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
vporpo requested review of this revision.May 2 2022, 1:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2022, 1:30 PM

I like this, although why not just put it as a trailing comment so we can include it usable IR?