diff options
| author | Noah Goldstein <goldstein.w.n@gmail.com> | 2023-04-17 19:49:36 -0500 |
|---|---|---|
| committer | Noah Goldstein <goldstein.w.n@gmail.com> | 2023-04-17 22:39:06 -0500 |
| commit | 57590d1dd47bbe9aa4b79a0f93cc3ec62cc5d060 (patch) | |
| tree | 1b7570ca560d743665b5becad87781e6eaaea9bb /llvm/lib/Support/VirtualFileSystem.cpp | |
| parent | 107a5e2bc7b0388c6c3c46dcdafae9d019911deb (diff) | |
| download | llvm-57590d1dd47bbe9aa4b79a0f93cc3ec62cc5d060.zip llvm-57590d1dd47bbe9aa4b79a0f93cc3ec62cc5d060.tar.gz llvm-57590d1dd47bbe9aa4b79a0f93cc3ec62cc5d060.tar.bz2 | |
[ValueTracking] Apply the isKnownNonZero techniques in `ashr`/`lshl` to `shl` and vice-versa
For all shifts we can apply the same two optimizations.
1) `ShiftOp(KnownVal.One, Max(KnownCnt)) != 0`
-> result is non-zero
2) If already known `Val != 0` and we only shift out zeros (based
on `Max(KnownCnt)`)
-> result is non-zero
The former exists for `shl` and the latter (for constant `Cnt`) exists
for `ashr`/`lshr`.
This patch improves the latter to use `Max(KnownCnt)` instead of
relying on a constant shift `Cnt` and applies both techniques for all
shift ops.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D148404
Diffstat (limited to 'llvm/lib/Support/VirtualFileSystem.cpp')
0 files changed, 0 insertions, 0 deletions
