This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Run redundant_sext_inreg in the post-legalizer combiner
ClosedPublic

Authored by paquette on Feb 17 2021, 3:39 PM.

Details

Summary

This is to ensure that we can eliminate G_ASSERT_SEXT.

In a follow-up patch, I'm going to make CallLowering emit G_ASSERT_SEXT for signext parameters.

Diff Detail

Event Timeline

paquette created this revision.Feb 17 2021, 3:39 PM
paquette requested review of this revision.Feb 17 2021, 3:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 17 2021, 3:39 PM
aemerson added inline comments.Feb 18 2021, 10:16 AM
llvm/test/CodeGen/AArch64/GlobalISel/combine-sext-trunc-sextload.mir
2–3

What happens if we don't restrict the combiner to this?

paquette added inline comments.Feb 18 2021, 2:42 PM
llvm/test/CodeGen/AArch64/GlobalISel/combine-sext-trunc-sextload.mir
2–3

test_combine_sext_of_sextload_not_matching ends up getting combined.

computeNumSignBits should give us 17 for the G_SEXTLOAD in that test. That's less than 24, so the G_SEXT_INREG ends up being eliminated.

aemerson accepted this revision.Feb 18 2021, 4:51 PM
aemerson added inline comments.
llvm/test/CodeGen/AArch64/GlobalISel/combine-sext-trunc-sextload.mir
2–3

That test is a bit redundant, I think it's fine to show the G_SEXT_INREG being combined away.

This revision is now accepted and ready to land.Feb 18 2021, 4:51 PM