[PATCH] D118000: [AArch64][NFC] Abstracts shared behavior in MIPeepholeOpt for ADD, SUB, and AND.
Micah Weston via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 23 11:23:53 PST 2022
red1bluelost created this revision.
red1bluelost added reviewers: dmgreen, benshi001, jaykang10.
Herald added subscribers: Chia-hungDuan, rriddle, hiraditya, kristof.beyls.
red1bluelost requested review of this revision.
Herald added a subscriber: stephenneuendorffer.
Herald added a project: LLVM.
Non-functional change to abstract shared behavior in MIPeepholeOpt. Both
visitAND and visitADDSUB attempt to split an RR instruction with an immediate
operand into two RI instructions with the immediate split.
The differing behavior lies in how the immediate is split into two pieces and
how the new instructions are built. The rest of the behavior (adding new VRegs,
checking for the MOVImm, constraining reg classes, removing old intructions)
are shared between the operations.
The new helper function `splitTwoPartImm` implements the shared behavior and
delegates differing behavior to two function objects passed by the caller.
One function object splits the immediate into two values and returns the
opcode to use if it is a valid split. The other function object builds
the new instructions.
I felt this abstraction would help since I believe it will help reduce the
code repetition when adding new instructions of the pattern, such as
SUBS for this conditional optimization. <https://github.com/llvm/llvm-project/issues/51482>
Tested it locally by running check all with compiler-rt, mlir, clang-tools-extra,
flang, llvm, and clang enabled.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D118000
Files:
llvm/lib/Target/AArch64/AArch64MIPeepholeOpt.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118000.402358.patch
Type: text/x-patch
Size: 13477 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220123/0ffa6a8c/attachment.bin>
More information about the llvm-commits
mailing list