[PATCH] D107305: [GlobalISel] Combine G_ASSERT_*EXT + G_LOAD -> G_S/ZEXTLOAD
Jessica Paquette via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 2 13:22:04 PDT 2021
paquette created this revision.
paquette added reviewers: aemerson, arsenm.
Herald added subscribers: jfb, hiraditya, rovka.
paquette requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.
CallLowering can emit hint instructions (G_ASSERT_ZEXT, G_ASSERT_SEXT) to communicate whether or not a parameter/return value is expected to be sign or zero extended.
When we run into one of these along with a G_LOAD, we need to be careful to select the correct type of extended load.
e.g.
https://godbolt.org/z/x3oG4s3MT
In the above example, without this patch, GISel will not emit a sign-extended load. SDAG has the correct behaviour here.
The work here is identical to how we already combine G_SEXT_INREG with G_LOAD. However, because this can be important for ABI-conformance, it needs to run at all optimization levels. So, this is split out into its own combine which runs under `combines_for_extload`.
https://reviews.llvm.org/D107305
Files:
llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
llvm/include/llvm/Target/GlobalISel/Combine.td
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/test/CodeGen/AArch64/GlobalISel/combine-hint-extload.mir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107305.363557.patch
Type: text/x-patch
Size: 10752 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210802/abdd0426/attachment.bin>
More information about the llvm-commits
mailing list