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

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 25 13:47:48 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.
----------------
aemerson wrote:

> The AArch64 legalizer disagrees/is nonconforming.
> 
> I see the legalizer as the ground-truth for legality questions. I prefer to query the legalizer and not enforce rules on the legalizer.

You're welcome to see things how you like. That has no relation to reality however.

> https://github.com/llvm/llvm-project/blob/bb88fd171a6be892cec36969860a9034b48b8656/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp#L95
> 
> 
> G_IMPLICIT_DEF is not legal for scalable vectors!

That sounds like something we should fix at some point. Were you under the impression that scalable vector support was complete?

> I am more worried about illegal MIR than how hard it is to select G_IMPLICIT_DEF.

We are clarifying the definition what is assumed to be legal, and therefore it is not illegal MIR. Any complaints about illegal MIR are therefore bugs or missing support in the target implementation.

Are we clear now?

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


More information about the llvm-commits mailing list