Skip to content

Commit 34bcc16

Browse files
committed
Add some more context to the CLIF verifier
Helps when debugging verifier failures.
1 parent 1ea710d commit 34bcc16

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cranelift/codegen/src/ir/instructions.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ impl OperandConstraint {
807807
// control type to construct the interval of [F16, ctrl_type).
808808
tys.floats = BitSet8::from_range(4, ctrl_type_bits as u8);
809809
} else {
810-
panic!("The Narrower constraint only operates on floats or ints");
810+
panic!("The Narrower constraint only operates on floats or ints, got {ctrl_type:?}");
811811
}
812812
ResolvedConstraint::Free(tys)
813813
}
@@ -838,7 +838,9 @@ impl OperandConstraint {
838838
tys.floats = BitSet8::from_range(lower_bound, 8);
839839
}
840840
} else {
841-
panic!("The Wider constraint only operates on floats or ints");
841+
panic!(
842+
"The Wider constraint only operates on floats or ints, got {ctrl_type:?}"
843+
);
842844
}
843845

844846
ResolvedConstraint::Free(tys)

cranelift/codegen/src/verifier/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,6 +1766,7 @@ impl<'a> Verifier<'a> {
17661766
return errors.fatal((block, format!("{block} cannot be empty")));
17671767
}
17681768
for inst in self.func.layout.block_insts(block) {
1769+
crate::trace!("verifying {inst:?}: {}", self.func.dfg.display_inst(inst));
17691770
self.block_integrity(block, inst, errors)?;
17701771
self.instruction_integrity(inst, errors)?;
17711772
self.typecheck(inst, errors)?;

0 commit comments

Comments
 (0)