[PATCH] D64377: [AArch64][GlobalISel] Optimize compare and branch cases with G_INTTOPTR and unknown values
Amara Emerson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 8 16:09:49 PDT 2019
aemerson created this revision.
aemerson added reviewers: paquette, qcolombet, aditya_nandakumar.
Herald added subscribers: Petar.Avramovic, volkan, hiraditya, kristof.beyls, javed.absar, rovka.
Herald added a project: LLVM.
Since we have distinct types for pointers and scalars, G_INTTOPTRs can sometimes obstruct attempts to find constant source values. These usually come about when try to do some kind of null pointer check. Teaching getConstantVRegValWithLookThrough about this operation allows the CBZ/CBNZ optimization to catch more cases.
This change also improves the case where we can't find a constant source at all. Previously we would emit a cmp, cset and tbnz for that. Now we try to just emit a cmp and conditional branch, saving an instruction.
The cumulative code size improvement of this change plus D64354 <https://reviews.llvm.org/D64354> is 5.5% geomean on arm64 CTMark -O0.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D64377
Files:
llvm/lib/CodeGen/GlobalISel/Utils.cpp
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
llvm/test/CodeGen/AArch64/GlobalISel/select-cbz.mir
llvm/test/CodeGen/AArch64/GlobalISel/select-jump-table-brjt.mir
llvm/test/CodeGen/AArch64/GlobalISel/swifterror.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64377.208532.patch
Type: text/x-patch
Size: 9712 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190708/fdd5d024/attachment.bin>
More information about the llvm-commits
mailing list