diff --git a/cranelift/codegen/src/ir/dfg.rs b/cranelift/codegen/src/ir/dfg.rs index eb2d53265e..a7abe7e7d8 100644 --- a/cranelift/codegen/src/ir/dfg.rs +++ b/cranelift/codegen/src/ir/dfg.rs @@ -587,7 +587,7 @@ impl DataFlowGraph { /// Panics if the given instruction is not a (non-tail) call instruction. pub fn append_user_stack_map_entry(&mut self, inst: Inst, entry: UserStackMapEntry) { let opcode = self.insts[inst].opcode(); - assert!(opcode.is_call() && !opcode.is_return()); + assert!(opcode.is_safepoint()); self.user_stack_maps.entry(inst).or_default().push(entry); } } diff --git a/cranelift/codegen/src/ir/instructions.rs b/cranelift/codegen/src/ir/instructions.rs index 94280a0760..3b9b2f1c7c 100644 --- a/cranelift/codegen/src/ir/instructions.rs +++ b/cranelift/codegen/src/ir/instructions.rs @@ -193,6 +193,14 @@ impl Opcode { pub fn constraints(self) -> OpcodeConstraints { OPCODE_CONSTRAINTS[self as usize - 1] } + + /// Is this instruction a GC safepoint? + /// + /// Safepoints are all kinds of calls, except for tail calls. + #[inline] + pub fn is_safepoint(self) -> bool { + self.is_call() && !self.is_return() + } } // This trait really belongs in cranelift-reader where it is used by the `.clif` file parser, but since