[all-commits] [llvm/llvm-project] bfe2f5: [InstCombine] Fix buggy `(mul X, Y)` -> `(shl X, L...
goldsteinn via All-commits
all-commits at lists.llvm.org
Tue Apr 18 15:18:20 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: bfe2f5d38bb14bf7ce4f44d3de558fbc076bdc1a
https://github.com/llvm/llvm-project/commit/bfe2f5d38bb14bf7ce4f44d3de558fbc076bdc1a
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-04-18 (Tue, 18 Apr 2023)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
M llvm/test/Transforms/InstCombine/div-shift.ll
M llvm/test/Transforms/InstCombine/mul-pow2.ll
Log Message:
-----------
[InstCombine] Fix buggy `(mul X, Y)` -> `(shl X, Log2(Y))` transform PR62175
Bug was because we recognized patterns like `(shl 4, Z)` as a power of
2 we could take Log2 of (`2 + Z`), but doing `(shl X, (2 + Z))` can
cause a poison shift.
https://alive2.llvm.org/ce/z/yuJm_k
The fix is to verify that `Log2(Y)` will be a non-poisonous shift
amount. We can do this with:
`nsw` flag:
- https://alive2.llvm.org/ce/z/yyyJBr
- https://alive2.llvm.org/ce/z/YgubD_
`nuw` flag:
- https://alive2.llvm.org/ce/z/-4mpyV
- https://alive2.llvm.org/ce/z/a6ik6r
Prove `Y != 0`:
- https://alive2.llvm.org/ce/z/ced4su
- https://alive2.llvm.org/ce/z/X-JJHb
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D148609
Commit: 726f8ecac23bf04b60f9f079ee922b8a7a30457f
https://github.com/llvm/llvm-project/commit/726f8ecac23bf04b60f9f079ee922b8a7a30457f
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-04-18 (Tue, 18 Apr 2023)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
M llvm/test/Transforms/InstCombine/icmp-of-xor-x.ll
Log Message:
-----------
Recommit "[InstCombine] Add transforms for `(icmp {u|s}ge/le (xor X, Y), X)`" (2nd Try)
Wasn't related to the bug it was original thought to be causing.
Commit: e846ec57cb80cd482b3a05b2b68c89775f806e6c
https://github.com/llvm/llvm-project/commit/e846ec57cb80cd482b3a05b2b68c89775f806e6c
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-04-18 (Tue, 18 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:
-----------
Recommit "[ValueTracking] Apply the isKnownNonZero techniques in `ashr`/`lshl` to `shl` and vice-versa" (2nd Try)
Wasn't related to the bug it was original thought to be causing.
Compare: https://github.com/llvm/llvm-project/compare/d771f54107c4...e846ec57cb80
More information about the All-commits
mailing list