[PATCH] D154943: [ARM] Restructure MOVi32imm expansion to not do pointless instructions

John Brawn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 03:43:21 PDT 2023


john.brawn created this revision.
john.brawn added reviewers: stuij, simonwallis2, dmgreen.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
john.brawn requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The expansion of the various MOVi32imm pseudo-instructions works by splitting the operand into components (either halfwords or bytes) and  emitting instructions to combine those components into the final result. When the operand is an immediate with some components being zero this can result in pointless instructions that just add zero.

Avoid this by restructuring things so that a separate function handles splitting the operand into components, then don't emit the component if it is a zero immediate. This is straightforward for movw/movt, where we just don't emit the movt if it's zero, but the thumb1 expansion using mov/add/lsl is more complex, as even when we don't emit a given byte we still need to get the shift correct.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154943

Files:
  llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
  llvm/test/CodeGen/ARM/execute-only-big-stack-frame.ll
  llvm/test/CodeGen/ARM/execute-only.ll
  llvm/test/CodeGen/ARM/large-stack.ll
  llvm/test/CodeGen/Thumb2/segmented-stacks.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154943.539003.patch
Type: text/x-patch
Size: 15519 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230711/961283aa/attachment.bin>


More information about the llvm-commits mailing list