-
Notifications
You must be signed in to change notification settings - Fork 13.5k
clang crashes on valid code at -O1 and above on x86_64-linux-gnu: Assertion `N1.getValueType().bitsGT(VT) && "Invalid truncate node, src < dst!"' failed #92720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
Reduced IR: https://godbolt.org/z/KTbfnYnET
I will post a fix. |
This was referenced May 20, 2024
@llvm/issue-subscribers-backend-x86 Author: Zhendong Su (zhendongsu)
Compiler Explorer: https://godbolt.org/z/vcTf6fxWY
|
dtcxzyw
added a commit
that referenced
this issue
May 22, 2024
…mandedOp` (#92753) In `TargetLowering::ShrinkDemandedOp`, types of lhs and rhs may differ before legalization. In the original case, `VT` is `i64` and `SmallVT` is `i32`, but the type of rhs is `i8`. Then invalid truncate nodes will be created. See the description of ISD::SHL for further information: > After legalization, the type of the shift amount is known to be TLI.getShiftAmountTy(). Before legalization, the shift amount can be any type, but care must be taken to ensure it is large enough. https://github.com/llvm/llvm-project/blob/605ae4e93be8976095c7eedf5c08bfdb9ff71257/llvm/include/llvm/CodeGen/ISDOpcodes.h#L691-L712 This patch stops handling ISD::SHL in `TargetLowering::ShrinkDemandedOp` and duplicates the logic in `TargetLowering::SimplifyDemandedBits`. Additionally, it adds some additional checks like `isNarrowingProfitable` and `isTypeDesirableForOp` to improve the codegen on AArch64. Fixes #92720.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler Explorer: https://godbolt.org/z/vcTf6fxWY
The text was updated successfully, but these errors were encountered: