[llvm] [GlobalISel] Combine [a, s, z]ext of undef into 0 or undef (PR #117439)
Thorsten Schütt via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 1 00:38:52 PST 2024
================
@@ -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}); }])>;
----------------
tschuett wrote:
` Helper.matchAnyExplicitUseIsUndef` checks in C++, if there is an undef on the anyext. It will fail 99.999999999999% of the time. Now it is a correct pattern and the combiner takes care of the matching.
I said in the summary `Is there a limit on the number of patterns?`.
https://github.com/llvm/llvm-project/pull/117439
More information about the llvm-commits
mailing list