This is an archive of the discontinued LLVM Phabricator instance.

[NFC][GlobalISel] Don't return `bool` from apply functions
ClosedPublic

Authored by Pierre-vh on Jun 23 2023, 3:27 AM.

Details

Summary

There is no case where those functions return false. It's always return true.
Even if they were to return false, it's not really something we should rely on I think.
With the current combiner implementation, it would just make tryCombineAll return false without retrying anymore rules.

I also believe that if an applyer were to return false, it would mean that the match function is not good enough. Asserting on failure in an apply function is a better idea, IMO.

Diff Detail

Event Timeline

Pierre-vh created this revision.Jun 23 2023, 3:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2023, 3:27 AM
Pierre-vh requested review of this revision.Jun 23 2023, 3:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2023, 3:27 AM
arsenm accepted this revision.Jun 23 2023, 5:19 AM

LGTM. In theory this is good, though there may be cases where it's more complicated to have all the preconditions checked in the match

This revision is now accepted and ready to land.Jun 23 2023, 5:19 AM