This is an archive of the discontinued LLVM Phabricator instance.

[DAG] Improve combineCarryDiamond to accept (uaddo_carry X, 0, Carry)
Needs ReviewPublic

Authored by deadalnix on Jul 5 2023, 9:30 AM.

Details

Summary

It turns out that (uaddo X, Carry) is tranformed into (uaddo_carry X, 0, Carry) whenever the carry is an actual carry. This defeats the pattern matched by combineCarryDiamond when the uaddo is combined before combineCarryDiamond had the chance to do its magic.

This is exhibited in D152928 but I have not been able to reliably tirgger that error on main.

Diff Detail

Event Timeline

deadalnix created this revision.Jul 5 2023, 9:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2023, 9:30 AM
deadalnix requested review of this revision.Jul 5 2023, 9:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2023, 9:30 AM
deadalnix added inline comments.Jul 5 2023, 9:33 AM
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
3589–3599

idk if I shall keep this? This was tremendously useful when debugging.

deadalnix updated this revision to Diff 546805.Aug 3 2023, 4:52 AM

Rebase, ping?

chfast added a comment.Aug 3 2023, 7:50 AM

Are you able to add any tests supporting this?

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
3550
3579

This is a came back for this TODO? What exactly does it mean?

RKSimon added inline comments.Aug 7 2023, 2:12 AM
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
3589–3599

Sure, but please can you tweak the "Combine carry diamond" top line to explain the position of each of the operands listed below