This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add test case for miscompile caused by treating ANY_EXTEND of constants as SIGN_EXTEND.
ClosedPublic

Authored by craig.topper on Mar 18 2022, 6:24 PM.

Details

Summary

The code that inserts AssertZExt based on predecessor information assumes
constants are zero extended for phi incoming values this allows
AssertZExt to be created in blocks consuming a Phi.
SelectionDAG::getNode treats any_extend of i32 constants as sext for RISCV.
The code that creates phi incoming values in the predecessors creates an
any_extend for the constants which then gets treated as a sext by getNode.
This makes the AssertZExt incorrect and can cause zexts to be
incorrectly removed.

This bug was introduced by D105918

Diff Detail