This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] do not fold (sext i32 undef to i64) to 0
AbandonedPublic

Authored by mohammed-nurulhoque on Jun 27 2023, 2:07 AM.

Details

Summary

When sign-extending i32 undef to i64, previously it was folded to 0. Replace with i64 undef. This eliminates instructions that set undefined ABI registers to 0

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJun 27 2023, 2:07 AM
mohammed-nurulhoque requested review of this revision.Jun 27 2023, 2:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 27 2023, 2:07 AM
nikic requested changes to this revision.Jun 27 2023, 2:19 AM
nikic added a subscriber: nikic.

This is not legal, because the result of sext must have the top bits either all zero or all ones, which undef does not guarantee. This change will lead to miscompiles.

This revision now requires changes to proceed.Jun 27 2023, 2:19 AM