This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner] Remove overzealous assertion when folding assert+trunc+assert (PR55846)
ClosedPublic

Authored by nikic on Jun 3 2022, 2:22 AM.

Details

Summary

These assert that there are no "useless" assertzext/assertsext nodes (that assert a wider width than a following trunc), but I don't think there is anything preventing such nodes from reaching this code. I don't think the assertion is relevant for correctness of this transform either -- if such an assert is present, then the other one will always be to a smaller width, and we'll pick that one. The assertion dates back to D37017.

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

Diff Detail

Event Timeline

nikic created this revision.Jun 3 2022, 2:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 3 2022, 2:22 AM
nikic requested review of this revision.Jun 3 2022, 2:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 3 2022, 2:22 AM
spatel accepted this revision.Jun 3 2022, 5:48 AM

LGTM

llvm/test/CodeGen/X86/pr55846.ll
5

Put a comment on this test, so we don't have to dig for its purpose?

; After legalization, this could be: "i8 truncate (i64 AssertZext X, Type: i9)"
; The AssertZext does not add information, so it should be eliminated,
; but that must not trigger a compile-time assert.
This revision is now accepted and ready to land.Jun 3 2022, 5:48 AM
This revision was automatically updated to reflect the committed changes.
nikic marked an inline comment as done.