This is an archive of the discontinued LLVM Phabricator instance.

[llvm][NFC] Refactor AutoUpgrade case 'c'
AcceptedPublic

Authored by urnathan on Aug 20 2023, 9:15 AM.

Details

Reviewers
nikic
arsenm
Summary

Here's a refactor of case 'c':, Both cttz and ctlz need the same upgrading, so they can be handled together. But we do split the mnemonic in the middle, rather than at a .. Even though we know the first letter is 'c', and so could have done Name[1] == 't', IMHO a consume_front("ct") conveys intent more clearly.

Diff Detail

Event Timeline

urnathan created this revision.Aug 20 2023, 9:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 20 2023, 9:15 AM
urnathan requested review of this revision.Aug 20 2023, 9:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 20 2023, 9:15 AM
nikic added a comment.Aug 20 2023, 9:50 AM

I'm not sure this is really an improvement. It seems better to repeat this small bit of code than do the awkward ct/lz, ct/tz split.

urnathan updated this revision to Diff 552104.Aug 21 2023, 12:39 PM

Fair point. How about this way round -- check the number of args before looking at the name. IMHO That's likely to be more efficient. Of course common handling for a match is also good.

arsenm accepted this revision.Sep 12 2023, 4:22 AM

Seems fine

This revision is now accepted and ready to land.Sep 12 2023, 4:22 AM