Page MenuHomePhabricator

[LoopVectorizer] Take into account call register pressure when selecting interleave count
Needs ReviewPublic

Authored by rob.lougher on Aug 15 2018, 12:41 PM.



This is a follow up patch to D48193. In the previous review an example of poor code generation was given, where the interleave count caused a loop containing a veclib call to generate excessive spills/reloads. The suggested fix was to simply use an IC of 1 when a veclib call is present.

Rather than use an IC of 1 for all platforms, this patch:

  1. Adds a call register pressure calculation.
  2. Adds calls to TargetTransformInfo to obtain information about the number of preserved registers.

At present only a basic implementation of the TTI calls is provided for x86. However, the default implementation means that this change will have no affect on other platforms.

Diff Detail

Event Timeline

rob.lougher created this revision.Aug 15 2018, 12:41 PM
grandinj added inline comments.

perhaps an

assert(hasNumberOfCallPreservedRegisters() && "you need to call hasNumberOfCallPreservedRegisters before calling this")

would be a good idea here, to catch incorrect usage?

rob.lougher added inline comments.Aug 16 2018, 10:42 AM

Yes, excellent idea. I'll add an assert to the function in TargetTransformInfo.cpp, before calling the TTIImpl.

rob.lougher marked 2 inline comments as done.

Added asserts to TTI functions to catch misuse.

dcaballe resigned from this revision.Oct 8 2021, 2:32 PM