This is an archive of the discontinued LLVM Phabricator instance.

[Spill2Reg][4/9] Added x86 profitability model.
Needs ReviewPublic

Authored by vporpo on Jan 26 2022, 5:52 PM.

Details

Reviewers
Carrot
arsenm
Summary

This is a simple model for checking when Spill2Reg is profitable in x86.
It walks through instructions in the proximity of the spill or reload and
counts the number of memory and vector instructions. If the count of
memory instructions is greater than a threshold and the count of vector
instructions less than a threshold, then we consider it to be profitable.

Diff Detail

Event Timeline

vporpo created this revision.Jan 26 2022, 5:52 PM
vporpo requested review of this revision.Jan 26 2022, 5:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 26 2022, 5:52 PM
wxiao3 added a subscriber: wxiao3.Jan 26 2022, 7:19 PM
vporpo retitled this revision from [Spill2Reg] Added x86 profitability model. to [Spill2Reg][4/9] Added x86 profitability model..Feb 4 2022, 9:49 AM
vporpo updated this revision to Diff 438036.Jun 17 2022, 2:19 PM

Rebased.

Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2022, 2:19 PM
Herald added a subscriber: jsji. · View Herald Transcript
Carrot added inline comments.Jun 22 2022, 12:08 PM
llvm/include/llvm/CodeGen/TargetInstrInfo.h
2046

Use the same format as the messages in other callback functions.

2055

same

2064

same

llvm/lib/Target/X86/X86InstrInfo.cpp
82

'the'

87

Be consistent with other description.

9792

Instead of checking register size, can you check if MO.getReg() belongs to any vector register class explicitly?

9846

I don't understand this statement. Kill flag means the last use of a register, but DstReg will be used to move the value back to integer register.

vporpo updated this revision to Diff 439159.Jun 22 2022, 2:31 PM
vporpo marked 6 inline comments as done.

Addressed comments.

vporpo updated this revision to Diff 441840.Jul 1 2022, 6:31 PM

The profitability function now checks a radius around the instruction and the mem threshold is now a percentage.

vporpo updated this revision to Diff 450084.Aug 4 2022, 11:33 AM

Using Spill2RegVecInstrsThreshold == 0 as a reserved value that returns true.

Matt added a subscriber: Matt.Sep 27 2022, 11:43 AM