diff options
author | Narayan <32898329+vortex73@users.noreply.github.com> | 2025-03-06 14:00:36 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-06 08:30:36 +0000 |
commit | 6311e3fcc8539cf0f474b28f82a465e83013a792 (patch) | |
tree | 5fd170da362c741a24517b2598feba1d2f7fa6f6 /llvm/lib/CodeGen/StackProtector.cpp | |
parent | 1987d180125f77ca892bc93f108f9e23027725f5 (diff) | |
download | llvm-6311e3fcc8539cf0f474b28f82a465e83013a792.zip llvm-6311e3fcc8539cf0f474b28f82a465e83013a792.tar.gz llvm-6311e3fcc8539cf0f474b28f82a465e83013a792.tar.bz2 |
[ValueTracking] ComputeNumSignBitsImpl - add basic handling of BITCAST nodes (#127218)
When a wider scalar/vector type containing all sign bits is bitcast to a
narrower vector type, we can deduce that the resulting narrow elements
will also be all sign bits. This matches existing behavior in
SelectionDAG and helps optimize cases involving SSE intrinsics where
sign-extended values are bitcast between different vector types.
The current implementation fails to recognize that an arithmetic right
shift is redundant when applied to elements that are already known to be
all sign bits. This PR improves ComputeNumSignBitsImpl to track this
information through bitcasts, enabling the optimization of such cases.
```
%ext = sext <1 x i1> %cmp to <1 x i8>
%sub = bitcast <1 x i8> %ext to <4 x i2>
%sra = ashr <4 x i2> %sub, <i2 1, i2 1, i2 1, i2 1>
; Can be simplified to just:
%sub = bitcast <1 x i8> %ext to <4 x i2>
```
Closes #87624
Diffstat (limited to 'llvm/lib/CodeGen/StackProtector.cpp')
0 files changed, 0 insertions, 0 deletions