[PATCH] D65440: GlobalISel: Add widenScalar for G_UNMERGE_VALUES sources

Daniel Sanders via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 18:06:33 PDT 2019


dsanders added inline comments.


================
Comment at: lib/CodeGen/GlobalISel/LegalizerHelper.cpp:1084-1098
+  if (TypeIdx == 1) {
+    Register Cast = MIRBuilder.buildAnyExt(WideTy, SrcReg).getReg(0);
+    MIRBuilder.buildTrunc(MI.getOperand(0), Cast);
+
+    const unsigned DstSize = DstTy.getSizeInBits();
+    unsigned Offset = DstSize;
+    for (unsigned I = 1; I != NumDst; ++I, Offset += DstSize) {
----------------
This feels more like lower than widenScalar as it replaces the G_UNMERGE_VALUES with G_LSHR+G_TRUNC. I would have expected widenScalar to change something like:
    %1, %2 = G_UNMERGE_VALUES %0
into:
    %5 = G_ANYEXT %0
    %1, %2, %3, %4 = G_UNMERGE_VALUES %5
where %3 and %4 are unused. The main limitation with that is that sizeof(%5) would have to be a multiple of sizeof(%1). If that's not true then it would have to lower instead as G_UNMERGE_VALUES wouldn't be able to handle it.

What was the reason for emitting G_LSHR+G_TRUNC?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65440/new/

https://reviews.llvm.org/D65440





More information about the llvm-commits mailing list