[all-commits] [llvm/llvm-project] 107a5e: [ValueTracking] Add more tests for `isKnownNonZero...
goldsteinn via All-commits
all-commits at lists.llvm.org
Mon Apr 17 20:39:22 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 107a5e2bc7b0388c6c3c46dcdafae9d019911deb
https://github.com/llvm/llvm-project/commit/107a5e2bc7b0388c6c3c46dcdafae9d019911deb
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-04-17 (Mon, 17 Apr 2023)
Changed paths:
M llvm/test/Analysis/ValueTracking/known-non-zero.ll
Log Message:
-----------
[ValueTracking] Add more tests for `isKnownNonZero(Shift)`; NFC
Differential Revision: https://reviews.llvm.org/D148403
Commit: 57590d1dd47bbe9aa4b79a0f93cc3ec62cc5d060
https://github.com/llvm/llvm-project/commit/57590d1dd47bbe9aa4b79a0f93cc3ec62cc5d060
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-04-17 (Mon, 17 Apr 2023)
Changed paths:
M llvm/lib/Analysis/ValueTracking.cpp
M llvm/test/Analysis/ValueTracking/known-non-zero.ll
M llvm/test/Transforms/InstCombine/ctpop-pow2.ll
Log Message:
-----------
[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
Commit: 7c5cc22b55673e451b5643c3b921d1fea0a41d30
https://github.com/llvm/llvm-project/commit/7c5cc22b55673e451b5643c3b921d1fea0a41d30
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-04-17 (Mon, 17 Apr 2023)
Changed paths:
A llvm/test/Transforms/InstCombine/icmp-of-xor-x.ll
Log Message:
-----------
[InstCombine] Add tests for transforming `(icmp (xor X, Y), X)`; NFC
Differential Revision: https://reviews.llvm.org/D144607
Commit: a3fd060d4223c6a7470554561bc479d4b8e423f4
https://github.com/llvm/llvm-project/commit/a3fd060d4223c6a7470554561bc479d4b8e423f4
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-04-17 (Mon, 17 Apr 2023)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
M llvm/test/Transforms/InstCombine/icmp-of-xor-x.ll
Log Message:
-----------
[InstCombine] Add transforms for `(icmp {u|s}ge/le (xor X, Y), X)`
If Y is non-zero we can simplify the ge/le -> gt/lt
`(X ^ Y_NonZero) u>= X` --> `(X ^ Y_NonZero) u> X`
- https://alive2.llvm.org/ce/z/k482NQ
`(X ^ Y_NonZero) u<= X` --> `(X ^ Y_NonZero) u< X`
- https://alive2.llvm.org/ce/z/TuUDGy
`(X ^ Y_NonZero) s>= X` --> `(X ^ Y_NonZero) s> X`
- https://alive2.llvm.org/ce/z/vXQypR
`(X ^ Y_NonZero) s<= X` --> `(X ^ Y_NonZero) s< X `
- https://alive2.llvm.org/ce/z/fbUq-z
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D144608
Compare: https://github.com/llvm/llvm-project/compare/528b25c64a04...a3fd060d4223
More information about the All-commits
mailing list