This is an archive of the discontinued LLVM Phabricator instance.

[GlobalIsel] Handle carry output generated in narrowScalarAddSub legalize action
AbandonedPublic

Authored by yassingh on Nov 4 2022, 4:05 AM.

Details

Diff Detail

Event Timeline

yassingh created this revision.Nov 4 2022, 4:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 4 2022, 4:05 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
yassingh requested review of this revision.Nov 4 2022, 4:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 4 2022, 4:05 AM

Where should I add the tests for this change?

foad added a comment.Nov 4 2022, 7:25 AM

Where should I add the tests for this change?

Does AMDGPU use this code? If so you could put something in test/CodeGen/AMDGPU/GlobalISel/legalize-add.mir.

Where should I add the tests for this change?

Does AMDGPU use this code? If so you could put something in test/CodeGen/AMDGPU/GlobalISel/legalize-add.mir.

It doesn't. I am exploring the idea of legalizing wide G_UADDO instruction using this narrowScalarAddSub legalize action(as of now it is lowered to G_ADD first) and noticed it does not handle carry generated.

arsenm added inline comments.Nov 4 2022, 10:05 AM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
5128–5131

Changing the uses from here isn't the way the legalizer expects to work. Each instruction is legalized on its own without modifying other instructions, and using intermediate cast operations. The artifact combiner is then responsible for cleaning out illegal intermediate types

yassingh added inline comments.Nov 4 2022, 10:53 AM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
5128–5131

The artifact combiner is not automatically doing this. Can you direct where or how should I modify ArtifactCombiner?

arsenm added inline comments.Nov 4 2022, 4:08 PM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
5128–5131

Re-reading the comment, I think I misunderstood what you were trying to do. In any case, it's inappropriate to be looking through use_instructions here. You should only be modifying the original MI. If you're trying to only modify the one use in MI, you should change that operand directly

yassingh abandoned this revision.Nov 5 2022, 5:25 AM

Realized my mistake the carry output is properly updated (if condition, line 5104)

yassingh updated this revision to Diff 474150.Nov 8 2022, 9:46 PM
  • New changes abandon carry handling
  • updated tests for updated rule
  • clang format
yassingh abandoned this revision.Nov 8 2022, 10:02 PM

Sorry! Accidently reopened the review with another patch I'm working on. Closing again.