[PATCH] D115029: [AArch64] Try to fold lsl + ldr/str

JinGu Kang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 3 01:31:16 PST 2021


jaykang10 created this revision.
jaykang10 added reviewers: dmgreen, efriedma, t.p.northover.
Herald added subscribers: hiraditya, kristof.beyls.
jaykang10 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

On ISelDAG level, if there are multiple uses of `lsl`, the ldr/str, which are uses of  the `lsl`, are not folded.
Additionaly, if the `lsl` is not in same block with `ldr/str`, they are not folded too.
ldr/str can be folded with `lsl 2` for 32 bit and `lsl 3` for 64 bit as below.

  %7:gpr64 = UBFMXri killed %6:gpr64, 62, 61
  %8:gpr32 = LDRWroX %1:gpr64common, %7:gpr64, 0, 0
  STRWroX killed %9:gpr32, %1:gpr64common, %7:gpr64, 0, 0
  ==>
  %8:gpr32 = LDRWroX %1:gpr64common, %6:gpr64, 0, 1
  STRWroX killed %9:gpr32, %1:gpr64common, %6:gpr64, 0, 1


https://reviews.llvm.org/D115029

Files:
  llvm/lib/Target/AArch64/AArch64MIPeepholeOpt.cpp
  llvm/test/CodeGen/AArch64/aarch64-split-and-bitmask-immediate.ll
  llvm/test/CodeGen/AArch64/extract-bits.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115029.391579.patch
Type: text/x-patch
Size: 4248 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211203/667d0827/attachment.bin>


More information about the llvm-commits mailing list