[PATCH] D148210: [InstCombine] icmp(MulC * X * Y, C) --> icmp(X * Y, C)

Jun Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 03:25:57 PDT 2023

junaire created this revision.
junaire added reviewers: RKSimon, spatel, nikic, goldstein.w.n, bcl5980.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
junaire requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

We can eliminate an mul operation, based on the below assumptions:

1. All The two mul instructions all have nsw flag.
2. MulC > 0

Pred == slt/sge && C is 0 or  1
Pred == sgt/sle && C is 0 or -1

slt: https://alive2.llvm.org/ce/z/k5VDfy
sge: https://alive2.llvm.org/ce/z/6iyGHX
sgt: https://alive2.llvm.org/ce/z/A6KiBf
sle: https://alive2.llvm.org/ce/z/g5r-X6

Related issue: https://github.com/llvm/llvm-project/issues/61538

Signed-off-by: Jun Zhang <jun at junz.org>

  rG LLVM Github Monorepo



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148210.513152.patch
Type: text/x-patch
Size: 10496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230413/86038c9b/attachment.bin>

More information about the llvm-commits mailing list