================
@@ -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()); }]),
----------------
Pierre-vh wrote:

Apply isn't allowed to fail. It's just that the presence of `GIReplaceReg` 
triggers emission of a `canReplaceReg` call during the matching portion of the 
match table rule.

> On a related note, couldn't you split this whole combine into two 
> independently useful parts:

Good idea, I can try that


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