For example if the sign extension is only used in for TBZ, and the value is used elsewhere with a zero extension, this can eliminate a sign extension.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Thank you for the review @resistor. I have implememted the
optimization also looking through a sign_extend node. Tests to cover
this have been added, but only for extending i32 into i64 because
illegal values like i8 are always sign extended inreg.
Comment Actions
Nit: I think the commit message could be improved such that the benefit is clear? Something referencing the fact you're modifying the behaviour of TBZ.
Suggestion: "Allow TB(N)Z to drop signext for sign bit tests"
With the body explaining why/circumstances this helps: "For example if the sign extension is only used in for TBZ, and the value is used elsewhere with a zero extension, this can eliminate a sign extension".
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | ||
---|---|---|
5810 | sp. returns |
sp. returns