[llvm] [GlobalIsel] Add Gallery to MIR Patterns (PR #89974)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 24 23:31:22 PDT 2024
================
@@ -514,3 +514,21 @@ of operands.
(match (does_not_bind $tmp, $x)
(G_MUL $dst, $x, $tmp)),
(apply (COPY $dst, $x))>;
+
+
+ Gallery
+----------------
+
+We should use precise patterns that state our intentions. Please avoid
+using wip_match_opcode in patterns.
+
+.. code-block:: text
+ :caption: Example fold ext(trunc)
+
+(match (wip_match_opcode G_ZEXT):$root,
+
+(match (G_TRUNC $src, $x),
+ (G_ZEXT $root, $src),
+
+(match (G_TRUNC $src, $x, (MIFlags NoUWrap)),
+ (G_ZEXT $root, $src),
----------------
arsenm wrote:
Not sure why this is showing 2 nearly identical patterns. What is the MIFlags doing if the first pattern didn't need flag checks?
https://github.com/llvm/llvm-project/pull/89974
More information about the llvm-commits
mailing list