[all-commits] [llvm/llvm-project] 4e2b53: [X86] Add tests for optimizing out zero-check in i...
goldsteinn via All-commits
all-commits at lists.llvm.org
Mon Jun 12 11:53:01 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4e2b532cb94150cddbc095e167a62f0b38538cc0
https://github.com/llvm/llvm-project/commit/4e2b532cb94150cddbc095e167a62f0b38538cc0
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-06-12 (Mon, 12 Jun 2023)
Changed paths:
A llvm/test/CodeGen/X86/ispow2.ll
Log Message:
-----------
[X86] Add tests for optimizing out zero-check in is_pow2 setcc pattern; NFC
Differential Revision: https://reviews.llvm.org/D152674
Commit: 5c8188c7bc524c3e4ea22762645fcbe43042aee9
https://github.com/llvm/llvm-project/commit/5c8188c7bc524c3e4ea22762645fcbe43042aee9
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-06-12 (Mon, 12 Jun 2023)
Changed paths:
M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
M llvm/test/CodeGen/X86/ispow2.ll
Log Message:
-----------
[DAGCombine] Use `IsKnownNeverZero` to see if we need zero-check in is_pow2 setcc patern
`ctpop(X) eq/ne 1` is checking if X is a non-zero power of 2. Power of
2 check including zero is `(X & (X-1)) eq/ne 0` and unfortunately
there is no good pattern for checking a power of 2 while excluding
zero. So, when lowering `ctpop(X) eq/ne 1`, explicitly check
`IsKnownNeverZero(X)` to maybe be able to optimize out the extra zero
check.
We need this explicitly as DAGCombiner does not re-analyze provable
setcc nodes, and the middle-end never finds it beneficially to broaden
`ctpop(X) eq/ne 1` -> `ctpop(X) ule/ugt 1` (power of 2 including
zero).
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D152675
Commit: 758ffdbfccff95a5e4b6bf9eaf227e27ca6ea116
https://github.com/llvm/llvm-project/commit/758ffdbfccff95a5e4b6bf9eaf227e27ca6ea116
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-06-12 (Mon, 12 Jun 2023)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
Log Message:
-----------
[InstCombine] Factor out power of 2 comparison patterns to helper; NFC
Differential Revision: https://reviews.llvm.org/D152728
Compare: https://github.com/llvm/llvm-project/compare/314d18141615...758ffdbfccff
More information about the All-commits
mailing list