[PATCH] D156832: [GlobalISel] Handle sequences of trunc(sext/zext/anyext...) in artifact combiner

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 23:12:42 PDT 2023


aemerson added a comment.

Some more comments, otherwise LGTM with some nice codegen improvements.



================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h:330
+    ArtifactValueFinder Finder(MRI, Builder, LI);
+    if (auto FoundReg =
+            Finder.findValueFromDef(DstReg, 0, DstTy.getSizeInBits())) {
----------------
Can just use `Register` here since it auto doesn't buy much.


================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h:760-766
+      if (StartBit + Size <= SrcSize) {
+        if (StartBit == 0 && SrcType.getSizeInBits() == Size)
+          CurrentBest = SrcReg;
+        return findValueFromDefImpl(SrcReg, StartBit, Size);
+      }
+
+      return CurrentBest;
----------------
Can invert this condition to early-exit if StartBit + Size > SrcSize


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156832



More information about the llvm-commits mailing list