From 5cfb4619458713d368aaec97558708257a2dd46e Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Fri, 24 Feb 2023 07:38:48 -0800 Subject: [PATCH] Only emit ISLE/egraph terms for single-value insts (#5848) For instructions with no results (such as branches and stores) or instructions with multiple results (such as add with carry), we have assertions checking that an optimization rule doesn't try to match on or construct such instructions. When we generate terms for matching or constructing instructions, the terms for these instructions are guaranteed to panic if they're ever used. So let's just not generate them. In the future we may wish to generate terms with different types for these instructions, to make them usable in ISLE rules for optimization that fall outside our current egraph constraints. --- cranelift/codegen/meta/src/gen_inst.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cranelift/codegen/meta/src/gen_inst.rs b/cranelift/codegen/meta/src/gen_inst.rs index db43caef62..01ccefb7e0 100644 --- a/cranelift/codegen/meta/src/gen_inst.rs +++ b/cranelift/codegen/meta/src/gen_inst.rs @@ -1405,7 +1405,9 @@ fn gen_common_isle( IsleTarget::Opt => "Value", }; for inst in instructions { - if isle_target == IsleTarget::Opt && inst.format.has_value_list { + if isle_target == IsleTarget::Opt + && (inst.format.has_value_list || inst.value_results.len() != 1) + { continue; }