[PATCH] D105161: [GlobalISel] Handle more types in narrowScalar for eq/ne G_ICMP

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 30 10:23:27 PDT 2021


paquette added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:1109
+        // to extend them to the desired size.
+        Parts.push_back(MIRBuilder.buildZExt(NarrowTy, XorH).getReg(0));
+      }
----------------
arsenm wrote:
> Could you instead use extractGCDParts/buildLCMMergePieces with zext padding?
I ran into some weird behaviour with s65 when I tried this and ended up with a really large testcase.

Maybe I'm doing something wrong?

```
        SmallVector<Register, 4> WidenedXors;
        ...
        LLT GCDTy = extractGCDType(WidenedXors, NarrowTy, LeftoverTy, Xor);
        buildLCMMergePieces(LeftoverTy, NarrowTy, GCDTy, WidenedXors,
                            /* PadStrategy = */ TargetOpcode::G_ZEXT);
        Parts.insert(Parts.end(), WidenedXors.begin(), WidenedXors.end());
```

It seemed to do the right thing with every other type.


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

https://reviews.llvm.org/D105161



More information about the llvm-commits mailing list