-
Notifications
You must be signed in to change notification settings - Fork 12.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TableGen][GlobalISel] Add rule-wide type inference #66377
Conversation
@llvm/pr-subscribers-llvm-globalisel @llvm/pr-subscribers-backend-amdgpu ChangesNOTE: This is part of a stack. Please only review the last commit, see #66079 for the previous commit(s).The inference is trivial and leverages the MCOI OperandTypes encoded in We only try to infer untyped operands in apply patterns when they're temp This allows us to drop the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm with nit
llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
Outdated
Show resolved
Hide resolved
@arsenm can this land? Thanks |
The inference is trivial and leverages the MCOI OperandTypes encoded in CodeGenInstructions to infer types across patterns in a CombineRule. It's thus very limited and only supports CodeGenInstructions (but that's the main use case so it's fine). We only try to infer untyped operands in apply patterns when they're temp reg defs, or immediates. Inference always outputs a `TypeOf<$x>` where $x is a named operand from a match pattern.
@@ -151,7 +151,7 @@ def bad_imm_too_many_args : GICombineRule< | |||
(match (COPY $x, (i32 0, 0)):$d), | |||
(apply (COPY $x, $b):$d)>; | |||
|
|||
// CHECK: :[[@LINE+2]]:{{[0-9]+}}: error: cannot parse immediate '(COPY 0)', 'COPY' is not a ValueType | |||
// CHECK: :[[@LINE+2]]:{{[0-9]+}}: error: unknown type 'COPY' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a diagnostic quality regression
Otherwise llvm/test/TableGen/GlobalISelCombinerEmitter/type-inference.td could fail when llvm::hash_value(StringRef) changes. Fix #66377
Otherwise llvm/test/TableGen/GlobalISelCombinerEmitter/type-inference.td could fail when llvm::hash_value(StringRef) changes. Fix llvm#66377
NOTE: This is part of a stack. Please only review the last commit, see #66079 for the previous commit(s).
The inference is trivial and leverages the MCOI OperandTypes encoded in
CodeGenInstructions to infer types across patterns in a CombineRule. It's
thus very limited and only supports CodeGenInstructions (but that's the main
use case so it's fine).
We only try to infer untyped operands in apply patterns when they're temp
reg defs, or immediates. Inference always outputs a
TypeOf<$x>
where $x isa named operand from a match pattern.
This allows us to drop the
GITypeOf
in #66079 without errors.