[PATCH] D121355: [SelectionDAG] Fold shift constants into cmp

Allen zhong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 9 23:21:51 PST 2022


Allen created this revision.
Herald added subscribers: ecnelises, hiraditya.
Herald added a project: All.
Allen requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Perform the following transform for shift constants if legal

  X <  (NewC << ShiftBits)    -> X <  (NewC << ShiftBits)
  X >= (NewC << ShiftBits)    -> X >= (NewC << ShiftBits)
  X <= (NewC << ShiftBits) -1 -> X <  (NewC << ShiftBits)
  X >  (NewC << ShiftBits) -1 -> X >= (NewC << ShiftBits)


Fixes https://github.com/llvm/llvm-project/issues/54283


https://reviews.llvm.org/D121355

Files:
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  llvm/test/CodeGen/AArch64/icmp-shift-opt.ll
  llvm/test/CodeGen/ARM/and-cmpz.ll
  llvm/test/CodeGen/ARM/consthoist-icmpimm.ll
  llvm/test/CodeGen/ARM/icmp-shift-opt.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121355.414280.patch
Type: text/x-patch
Size: 10585 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220310/12720372/attachment.bin>


More information about the llvm-commits mailing list