[llvm] [GlobalISel] Document minimum legality requirements for G_IMPLICIT_DEF. (PR #117609)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 25 13:08:29 PST 2024


================
@@ -338,8 +338,8 @@ G_BUILD_VECTOR_TRUNC, G_CONCAT_VECTORS, G_UNMERGE_VALUES, G_PTRTOINT, and
 G_INTTOPTR have already been noted above. In addition to those, the following
 operations have requirements:
 
-* At least one G_IMPLICIT_DEF must be legal. This is usually trivial as it
-  requires no code to be selected.
+* For every type that can be produced by any instruction, G_IMPLICIT_DEF must be
+  legal. This is usually trivial as it requires no code to be selected.
----------------
arsenm wrote:

`as it requires no code to be selected.` is not really true. G_IMPLICIT_DEF should select to IMPLICIT_DEF. 

My concern was reliance on introduction of new G_IMPLICIT_DEFs in the artifact combiner, such that not having a legal option could fail. I'm not actually seeing where that might happen. 

However targets are doing a disservice to themselves by not having G_IMPLICIT_DEF as legal for every possible register type. I know SelectionDAG has an anti-feature that I've run into before where the default expansion of UNDEF turns into a zero 

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


More information about the llvm-commits mailing list