[PATCH] D105674: [GlobalISel] Use GCDTy when extracting GCD ty from leftover regs in insertParts
Jessica Paquette via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 8 17:16:14 PDT 2021
paquette created this revision.
paquette added reviewers: arsenm, aemerson.
Herald added subscribers: hiraditya, rovka.
paquette requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.
`LegalizerHelper::insertParts` uses `extractGCDType` on registers split into a desired type and a smaller leftover type. This is used to populate a list of registers. Each register in the list will have the same type as returned by `extractGCDType`.
If we have
- `ResultTy` = s792
- `PartTy` = s64
- `LeftoverTy` = s24
When we call `extractGCDType`, we'll end up with two different types appended to the list:
Part: gcd(792, 64, 24) => s8
Leftover: gcd(792, 24, 24) => s24
When this happens, we'll hit an assert while trying to build a G_MERGE_VALUES.
This patch changes the code for the leftover type so that we reuse the GCD from the desired type.
e.g.
Leftover: gcd(792, 8, 24) => s8
It also adds an assert that the types we get from both calls to `extractGCDType` are actually the same.
https://llvm.godbolt.org/z/137Kqxj6j
https://reviews.llvm.org/D105674
Files:
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
llvm/test/CodeGen/AArch64/GlobalISel/legalize-constant.mir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105674.357393.patch
Type: text/x-patch
Size: 10776 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210709/ec950029/attachment.bin>
More information about the llvm-commits
mailing list