This is an archive of the discontinued LLVM Phabricator instance.

[TypePromotion] Avoid some unnecessary truncs
ClosedPublic

Authored by samparker on Dec 9 2021, 8:47 AM.

Details

Summary

Check for legal zext 'sinks' before inserting a trunc.

I think this resolves some/most/all of the issue in D111237. I won't have the time to fix this if it's broken though.

edit: I setup a stage 2 on my mac and this looks fine enough.

Diff Detail

Event Timeline

samparker created this revision.Dec 9 2021, 8:47 AM
samparker requested review of this revision.Dec 9 2021, 8:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 9 2021, 8:47 AM
samparker edited the summary of this revision. (Show Details)Dec 10 2021, 1:27 AM
dmgreen accepted this revision.Jan 31 2022, 5:42 AM

Sorry for the delay. This doesn't fix the original case unfortunately, as that version doesn't start with an icmp. The test case is a little different with the loads feeding the loop condition.
But sounds like it should be an improvement, so LGTM (I would suggest committing after the branch ;) )

This revision is now accepted and ready to land.Jan 31 2022, 5:42 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 13 2022, 1:46 AM
Herald added a subscriber: StephenFan. · View Herald Transcript