This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Combine (G_*ADDO x, 0) -> x + no carry out
ClosedPublic

Authored by paquette on Jan 31 2022, 2:20 PM.

Details

Summary

Similar to the G_*MULO change.

The code for checking if a constant is legal/pre-legalize is shared between these, and is kind of hairy. So, factor it out into a new function: isConstantLegalOrBeforeLegalizer.

To make the refactoring clean, further refactor isLegalOrBeforeLegalizer into a wrapper for two functions:

  • isPreLegalize
  • isLegal

This is a bit easier to read in general.

https://godbolt.org/z/KW7oszP1o

Diff Detail

Event Timeline

paquette created this revision.Jan 31 2022, 2:20 PM
paquette requested review of this revision.Jan 31 2022, 2:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 31 2022, 2:20 PM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm accepted this revision.Feb 1 2022, 4:24 PM
arsenm added inline comments.
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
134

I think there's use in distinguishing no-LegalizeInfo and being pre-legalize but I guess that's a different problem

This revision is now accepted and ready to land.Feb 1 2022, 4:24 PM
This revision was automatically updated to reflect the committed changes.