This is an archive of the discontinued LLVM Phabricator instance.

[GVN] Do local FRE for unordered atomic loads
ClosedPublic

Authored by reames on Apr 22 2016, 3:10 PM.

Details

Summary

This patch is the first in a small series teaching GVN to optimize unordered loads aggressively. This change just handles block local FRE because that's the simplest thing which lets me test MDA, and the AvailableValue pieces. Somewhat suprisingly, MDA appears fine and only a couple of small changes are needed in GVN.

Once this is in, I'll tackle non-local FRE and PRE. The former looks like a natural extension of this, the later will require a couple of minor changes.

Diff Detail

Repository
rL LLVM

Event Timeline

reames updated this revision to Diff 54736.Apr 22 2016, 3:10 PM
reames retitled this revision from to [GVN] Do local FRE for unordered atomic loads.
reames updated this object.
reames added reviewers: dberlin, jfb, sanjoy.
reames added a subscriber: llvm-commits.
mgrang added a subscriber: mgrang.Apr 22 2016, 4:11 PM
mgrang added inline comments.
lib/Transforms/Scalar/GVN.cpp
1308 ↗(On Diff #54736)

Comment is missing a period (.) at the end.

1324 ↗(On Diff #54736)

Comment is missing a period (.) at the end.

1774 ↗(On Diff #54736)

Comment is missing a period (.) at the end.

dberlin accepted this revision.Apr 22 2016, 5:34 PM
dberlin edited edge metadata.

Other than nits, looks good to me.

This revision is now accepted and ready to land.Apr 22 2016, 5:34 PM
jfb added inline comments.Apr 25 2016, 8:45 AM
lib/Transforms/Scalar/GVN.cpp
1231 ↗(On Diff #54736)

Why <= here and below? I'd like a comment explaining the rationale.

1774 ↗(On Diff #54736)

Typo "audited".

test/Transforms/GVN/atomic.ll
111 ↗(On Diff #54736)

What is this one testing? That unrelated loads stay there?

123 ↗(On Diff #54736)

So I understand: this isn't a new behavior, right? It's a good test, but your change doesn't make this test pass, it already did before. test13b is the new one :)

124 ↗(On Diff #54736)

%B is unused here and in tests below.

133 ↗(On Diff #54736)

CHECK-LABEL where and below should all have the starting paren (e.g. @test13b() because some of the tests otherwise have the same prefix and would match the wrong label.

208 ↗(On Diff #54736)

Also test with fence singlethread.

288 ↗(On Diff #54736)

Typo "widening".

reames added a comment.May 4 2016, 5:26 PM

Have addressed comments and will land the resulting patch shortly per previous LGTM

test/Transforms/GVN/atomic.ll
123 ↗(On Diff #54736)

Yes. I didn't actually confirm that it worked previously, I just copied my set of standard tests and started making them work for this pass. :)

This revision was automatically updated to reflect the committed changes.