================
@@ -258,6 +258,14 @@ def sext_trunc_sextload : GICombineRule<
          [{ return Helper.matchSextTruncSextLoad(*${d}); }]),
   (apply [{ Helper.applySextTruncSextLoad(*${d}); }])>;
 
+def sext_trunc_sextinreg : GICombineRule<
+  (defs root:$dst),
+  (match (G_SEXT_INREG $sir, $src, $width),
+         (G_TRUNC $trunc, $sir),
+         (G_SEXT $dst, $trunc),
+         [{ return (MRI.getType(${trunc}.getReg()).getScalarSizeInBits() >= 
${width}.getImm()); }]),
----------------
jayfoad wrote:

> That seems like a weird design. Surely all the checking of conditions should 
> be done in the "match" part? I didn't even know that an "apply" function was 
> allowed to fail.

... or maybe we should remove the distinction between the match and apply parts 
[as previously 
discussed](https://github.com/llvm/llvm-project/pull/92115#issuecomment-2110384992).

https://github.com/llvm/llvm-project/pull/131312
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to