[llvm] [GlobalISel] Combine [a, s, z]ext of undef into 0 or undef (PR #117439)

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 1 03:05:06 PST 2024


Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>,
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/117439 at github.com>


================
@@ -1857,6 +1857,26 @@ class integer_of_opcode<Instruction castOpcode> : GICombineRule <
 
 def integer_of_truncate : integer_of_opcode<G_TRUNC>;
 
+def anyext_undef: GICombineRule<
+   (defs root:$root),
+   (match (G_IMPLICIT_DEF $undef),
+          (G_ANYEXT $root, $undef):$Aext),
+   (apply [{ Helper.replaceInstWithUndef(*${Aext}); }])>;
----------------
aemerson wrote:

You can leave it where it is, and we can have another PR to convert `propagate_undef_any_op` into the new match syntax for *all* opcodes, not just undef. This PR is an optimization which is now mixing a refactoring. I'm going to approve this PR on the assumption that you leave undef combine where it is until we convert them en-mass.

https://github.com/llvm/llvm-project/pull/117439


More information about the llvm-commits mailing list