This begins using the predicateinfo pass in NewGVN.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
We don't yet pass edge.ll because we don't handle switch statements in predicateinfo.
condprop.ll also has one silly testcase :)
THis needs some tests (unless there are some which are are XFAIL'D and now pass). Other than that, great to see this making progress =)
Some comments inline.
lib/Transforms/Scalar/NewGVN.cpp | ||
---|---|---|
867–895 ↗ | (On Diff #88092) | I starred at this for long, and I think it's correct. I do also think you can simplify this to make it *slightly* more readable, at least in my opinion, removing the else after return. |
903 ↗ | (On Diff #88092) | s/Things/intrinsics/ (or instructions)? Also, full stop at the end of the comment I think (nit) |
1110–1113 ↗ | (On Diff #88092) | I'm not sure this is entirely right, do you have a test where this triggers so I can take a look? |
1841 ↗ | (On Diff #88092) | Any chance you can use something like unique_ptr<> instead of naked new (or something similar)? |
2480–2481 ↗ | (On Diff #88092) | s/it's/its/ |
Marking as request changes so that I can keep track of what I need to review from the Phab UI
lib/Transforms/Scalar/NewGVN.cpp | ||
---|---|---|
867–895 ↗ | (On Diff #88092) | Yeah, i think, over time, we should try to move a lot of this logic to some central place. Simplify* knows how to do a *lot* of it (and sadly, does it's own walking to try to figure out some cases), but it's a complex maze of twisty passages, and it's not clear to me how to shove predicate info into it in a sane way. Most of these tests are covered by edge.ll, which we'll pass once the switch stuff goes in |
903 ↗ | (On Diff #88092) | Fixed. |
1110–1113 ↗ | (On Diff #88092) | This is from GVN: 02244 // If "A >= B" is known true, replace "A < B" with false everywhere. It does not restrict itself to equality predicates. I'll grab the appropriate testcases, but the only cases i believe this could be false is somewhere in the land of floating point. I also thought it was weird, but: Looking at it from the perspective of truth tables, inverse predicate just returns a truth table that has true and false swapped. So if the other comparison is false, and it has the same operands, the inverse predicate must be true (because every place that predicate has false in the truth table, this one has true) |
1841 ↗ | (On Diff #88092) | Yes, i'll fix |
Also, i was kind of hoping to be able to make the testcases a non-issue by just passing them, but instead, for most, we are now passing 9/10 in a file, and there's no way to xfail the single testcase :(
I may move them into -xfail.ll tests for now or something, just so we have passing testcases.
Other suggestions welcome.
This LGTM with the comments addressed. Feel free to commit without updating the review to phab.
lib/Transforms/Scalar/NewGVN.cpp | ||
---|---|---|
882 ↗ | (On Diff #88092) | For the record: The above part is true, but this is wrong. %tmp5 is false when equal. The more i stare at this, the more unhappy i am that all this logic is not somewhere else. |