Page MenuHomePhabricator

GVN: If X > Y is true, then replace X == Y with false and X != Y with true
Needs ReviewPublic

Authored by aarzee on Jul 6 2016, 5:24 PM.
This revision needs review, but all specified reviewers are disabled or inactive.

Details

Reviewers
dberlin
Summary

Currently integer comparisons only.

Correctly optimizes this example file: https://ghostbin.com/paste/g382s

Diff Detail

Event Timeline

aarzee updated this revision to Diff 63001.Jul 6 2016, 5:24 PM
aarzee retitled this revision from to GVN: If X > Y is true, then replace X == Y with false and X != Y with true.
aarzee updated this object.
aarzee added a reviewer: dberlin.
aarzee added a subscriber: llvm-commits.

Please don't copy-paste code.

aarzee added a comment.Jul 7 2016, 3:42 PM

Should we create a function for this?

Yes, create a function for it. And in general, assume the answer to "should I create a function for this" is yes.

aarzee updated this revision to Diff 70348.Sep 5 2016, 2:37 PM

Outline replacement of instruction with constant. If X == Y is true, replace X >= Y with true and X > Y with false.

dberlin added inline comments.Sep 6 2016, 12:09 PM
lib/Transforms/Scalar/GVN.cpp
2030

This needs to be factored into a helper function of some sort, or something.
Adding 100 lines of dense duplicated code is ... bad :)