[PATCH] D76601: [GlobalISel] combine trunc(trunc) pattern

Dominik Montada via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 23 10:55:51 PDT 2020


gargaroff added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h:258-259
+      const LLT TruncSrcTy = MRI.getType(TruncSrc);
+      if (!isInstLegal({TargetOpcode::G_TRUNC, {DstTy, TruncSrcTy}}))
+        return false;
+
----------------
arsenm wrote:
> Scalar truncate always needs to be legal?
Maybe I misunderstood the official docs. There it says for the minimal rule set:

>G_TRUNC must be legal for all inputs from the producer type set and all smaller outputs from the consumer type set.

Is this out-of-date or misleading? If so, I'll remove the check (or maybe assert it). Downstream we were actually planning on making our G_TRUNC only legal if it fits our register size (with s1 being an exception), which is why we need this combine rule. If G_TRUNC always needs to be legal, should this be reflected in the documentation?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76601





More information about the llvm-commits mailing list