This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] change getConstant() to use the input SDLoc when building splat vectors
ClosedPublic

Authored by spatel on Feb 7 2016, 11:36 AM.

Details

Summary

The change is simple enough (assuming it's what we want): instead of attaching an anonymous SDLoc to splatted vector constants, use the scalar constant's existing SDLoc since that is what is passed into getConstant() as a param. The changes in instruction scheduling seem harmless to me, but I'll explain why that happens.

The motivation for this patch starts near:
http://reviews.llvm.org/rL258833
...I made a note to myself that x86's getZeroVector() could be similarly cleaned up and thought it would be 'NFC' as well. But when I made that change locally, several x86 codegen tests wiggled.

It turns out that the lack of SDLoc consistency in getConstant() changes the way ScheduleDAGRRList behaves. This is because the SDLoc contains 'IROrder' and some DAG scheduler algorithms use IROrder for tie-breaking. I suppose this is working as intended, although it's a bit surprising to me that SDLoc's can have this effect on codegen.

Diff Detail

Event Timeline

spatel updated this revision to Diff 47139.Feb 7 2016, 11:36 AM
spatel retitled this revision from to [SelectionDAG] change getConstant() to use the input SDLoc when building splat vectors.
spatel updated this object.
spatel added reviewers: hfinkel, qcolombet, sunfish.
spatel added a subscriber: llvm-commits.
qcolombet accepted this revision.Feb 10 2016, 4:01 PM
qcolombet edited edge metadata.

Hi Sanjay,

The change makes sense to me.

Cheers,
-Quentin

This revision is now accepted and ready to land.Feb 10 2016, 4:01 PM
This revision was automatically updated to reflect the committed changes.