This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombine] Combine composition of ADDC(ADDE)
AbandonedPublic

Authored by deadalnix on Feb 2 2017, 4:27 AM.

Details

Summary

fold (add X, (adde Y, 0, Carry)) -> (adde X, Y, Carry)
fold (addc X, (adde Y, 0, Carry)) -> (adde X, Y, Carry) when Y + 1 cannot overflow.
fold (adde (add|adc X, Y), 0, Carry) -> (adde X, Y, Carry) when carry isn't used.
fold (adde X, (adde 0, 0, Y:Carry), (adde Y, 0, Z):Carry) with Y = (addc A, B) into (adde X, 0, (adde A, B, Z):Carry)

Improves the situation for bug 31719

Event Timeline

deadalnix created this revision.Feb 2 2017, 4:27 AM
deadalnix updated this revision to Diff 87066.Feb 3 2017, 6:33 PM

Rebase and use better test case.

deadalnix updated this revision to Diff 87145.Feb 5 2017, 7:02 AM

Reabse and fix rebase conflict.
Some style improvement.

More generally, what should I do with that one ? Is it too big and I should split it is smaller pieces ?

zvi edited edge metadata.Feb 5 2017, 7:55 AM

Is it possible to break this patch to a patch for visitADD + 1 or 2 patches for visitADDE. It would make it easier to review the code and verify the tests give coverage.

I split the visitADD part away, the visitADDE patterns are not exposed without the visitADD ones, so they'll come in time :)

aaboud added a subscriber: aaboud.Feb 6 2017, 7:26 AM
aaboud added inline comments.
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
1919

Is it worth checking that Carry != A:Carry, where A = add X, Y (or A = addc X, Y) ?

deadalnix abandoned this revision.Jun 1 2017, 3:57 AM

This is not relevent anymore.