This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Constant fold (sext_inreg undef, VT) to 0 instead of undef.
ClosedPublic

Authored by craig.topper on Apr 29 2022, 1:45 PM.

Details

Summary

The result of sign_extend_inreg needs to have as many sign bits
as requested by the VT argument. The easiest way to guarantee this
is to fold it to 0.

Fixes https://github.com/llvm/llvm-project/issues/55178

Not sure if the SystemZ test is still testing the same thing it
was before.

Diff Detail

Event Timeline

craig.topper created this revision.Apr 29 2022, 1:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 29 2022, 1:45 PM
craig.topper requested review of this revision.Apr 29 2022, 1:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 29 2022, 1:45 PM
RKSimon added inline comments.Apr 29 2022, 1:49 PM
llvm/test/CodeGen/AArch64/pr55178.ll
20

worth pre-commiting with the broken codegen?

Rebase on pre-committed test

LGTM - but not sure if you want to wait for a SystemZ expert

Not sure if the SystemZ test is still testing the same thing it was before.

@qcolombet I think you added this test case - any comments?

FYI @jonpa

Replace undef with an argument in SystemZ test. Undef operands are a bad idea.

I have verified that reverting the change from https://www.llvm.org/PR46154
hits the original assertion failure on the modified test. That is the patch
that added the test. So I think it is still a valid test with this change.

SystemZ test change LGTM, thanks!

RKSimon accepted this revision.May 5 2022, 1:57 AM

LGTM

This revision is now accepted and ready to land.May 5 2022, 1:57 AM
This revision was landed with ongoing or failed builds.May 5 2022, 9:45 AM
This revision was automatically updated to reflect the committed changes.