This is an archive of the discontinued LLVM Phabricator instance.

[X86] Don't transform atomic-load-add into an inc/dec when inc/dec is slow
ClosedPublic

Authored by morisset on Oct 8 2014, 11:54 AM.

Details

Reviewers
nadav
jfb
Summary

I had to move code around and turn a static function into a method to get
access to Subtarget, but the only "real" change is the extra check for
!Subtarget->slowIncDec().

Diff Detail

Event Timeline

morisset updated this revision to Diff 14589.Oct 8 2014, 11:54 AM
morisset retitled this revision from to [X86] Don't transform atomic-load-add into an inc/dec when inc/dec is slow.
morisset updated this object.
morisset edited the test plan for this revision. (Show Details)
morisset added reviewers: jfb, nadav.
morisset added a subscriber: Unknown Object (MLST).
jfb added inline comments.Oct 8 2014, 3:36 PM
lib/Target/X86/X86ISelDAGToDAG.cpp
1711

Can you keep this static and pass in the Subtarget?

morisset added inline comments.Oct 8 2014, 3:45 PM
lib/Target/X86/X86ISelDAGToDAG.cpp
1711

I could easily do that. I don't see how exactly it would be better, could you explain it to me ?

jfb added inline comments.Oct 8 2014, 3:50 PM
lib/Target/X86/X86ISelDAGToDAG.cpp
1711

It makes it easier to understand the side-effects that the function can have: it can't access or modify any of the class' internals. It makes it harder to inadvertently add things like this to the function: you have to pass them in as parameters.

morisset updated this revision to Diff 14608.Oct 8 2014, 4:10 PM

Follow jfb suggestion.

jfb accepted this revision.Oct 8 2014, 4:25 PM
jfb edited edge metadata.

lgtm

This revision is now accepted and ready to land.Oct 8 2014, 4:25 PM
morisset closed this revision.Oct 8 2014, 5:43 PM

r219357