[llvm] [GlobalISel] Combine G_MERGE_VALUES of undef (PR #113381)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 23 06:10:26 PDT 2024


================
@@ -420,7 +420,8 @@ def unary_undef_to_zero: GICombineRule<
 // replaced with undef.
 def propagate_undef_any_op: GICombineRule<
   (defs root:$root),
-  (match (wip_match_opcode G_ADD, G_FPTOSI, G_FPTOUI, G_SUB, G_XOR, G_TRUNC, G_BITCAST, G_ANYEXT):$root,
+  (match (wip_match_opcode G_ADD, G_FPTOSI, G_FPTOUI, G_SUB, G_XOR, G_TRUNC, G_BITCAST,
+                           G_ANYEXT, G_MERGE_VALUES):$root,
----------------
tschuett wrote:

If you try the `ag` command in the heading, the pattern occurs several times in existing tests.

The other question is how to interpret an G_MERGE_VALUES of undef.
```
 %0:(s32) = G_MERGE_VALUES %bits_0_7:(s8), %bits_8_15:(s8),  %bits_16_23:(s8), %bits_24_31:(s8)
```
What does it mean if `%bits_24_31` is undef? Is a subrange of the output invalid or is the complete output invalid? What happens if the output is used by other operations? In the exampled `MV` is used by the G_AND. Is a subrange of `MV` invalid?

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


More information about the llvm-commits mailing list