[all-commits] [llvm/llvm-project] e8e852: [InstCombine] Add tests for tranforming `(icmp pre...
goldsteinn via All-commits
all-commits at lists.llvm.org
Mon Jun 5 11:01:20 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e8e8528085ebdb2fb4395f07abdf6bcaf0348630
https://github.com/llvm/llvm-project/commit/e8e8528085ebdb2fb4395f07abdf6bcaf0348630
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-06-05 (Mon, 05 Jun 2023)
Changed paths:
A llvm/test/Transforms/InstCombine/icmp-shl.ll
Log Message:
-----------
[InstCombine] Add tests for tranforming `(icmp pred (shl {nsw and/or nuw} X, Y), C)`; NFC
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D145340
Commit: 73ce343125c5c86373ac3f883932f4ddbc2d307a
https://github.com/llvm/llvm-project/commit/73ce343125c5c86373ac3f883932f4ddbc2d307a
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-06-05 (Mon, 05 Jun 2023)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
M llvm/test/Transforms/InstCombine/icmp-shl.ll
Log Message:
-----------
[InstCombine] Add transform `(icmp pred (shl {nsw and/or nuw} X, Y), C)` -> `(icmp pred X, C)`
Three new transforms:
1) `(icmp pred (shl nsw nuw X, Y), C)` [if `C <= 0`] -> `(icmp pred X, C)`
- ugt: https://alive2.llvm.org/ce/z/K_57J_
- sgt: https://alive2.llvm.org/ce/z/BL8u_a
- sge: https://alive2.llvm.org/ce/z/yZZVYz
- uge: https://alive2.llvm.org/ce/z/R4jwwJ
- ule: https://alive2.llvm.org/ce/z/-gbmth
- sle: https://alive2.llvm.org/ce/z/ycZVsh
- slt: https://alive2.llvm.org/ce/z/4MzHYm
- sle: https://alive2.llvm.org/ce/z/fgNfex
- ult: https://alive2.llvm.org/ce/z/cXfvH5
- eq : https://alive2.llvm.org/ce/z/sZh_Ti
- ne : https://alive2.llvm.org/ce/z/UrqSWA
2) `(icmp eq/ne (shl {nsw|nuw} X, Y), 0)` -> `(icmp eq/ne X, 0)`
- eq+nsw: https://alive2.llvm.org/ce/z/aSJN6D
- eq+nuw: https://alive2.llvm.org/ce/z/r2_-br
- ne+nuw: https://alive2.llvm.org/ce/z/RkETtu
- ne+nsw: https://alive2.llvm.org/ce/z/8iSfW3
3) `(icmp slt (shl nsw X, Y), 0/1)` -> `(icmp pred X, 0/1)`
`(icmp sgt (shl nsw X, Y), 0/-1)` -> `(icmp pred X, 0/-1)`
- slt: https://alive2.llvm.org/ce/z/eZYRan
- sgt: https://alive2.llvm.org/ce/z/QQeP26
Transform 3) is really sle/slt/sge/sgt with 0, but sle/sge
canonicalize to slt/sgt respectively so its implemented as such.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D145341
Compare: https://github.com/llvm/llvm-project/compare/b14f95b988bb...73ce343125c5
More information about the All-commits
mailing list