Skip to content

Commit a812b4a

Browse files
committed
assert_instr check for failed inlining
1 parent c5b3483 commit a812b4a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

stdsimd-test/src/lib.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,21 @@ pub fn assert(fnptr: usize, fnname: &str, expected: &str) {
293293
}
294294
}
295295

296+
let mut inlining_failed = false;
297+
for instr in &function.instrs {
298+
if let Some(part) = instr.parts.get(0) {
299+
if part.contains("call") {
300+
inlining_failed = true;
301+
break;
302+
}
303+
}
304+
}
305+
296306
let instruction_limit = 30;
297307
let probably_only_one_instruction =
298308
function.instrs.len() < instruction_limit;
299309

300-
if found && probably_only_one_instruction {
310+
if found && probably_only_one_instruction && !inlining_failed {
301311
return;
302312
}
303313

@@ -323,6 +333,8 @@ pub fn assert(fnptr: usize, fnname: &str, expected: &str) {
323333
} else if !probably_only_one_instruction {
324334
panic!("instruction found, but the disassembly contains too many instructions: #instructions = {} !< {} (limit)",
325335
function.instrs.len(), instruction_limit);
336+
} else if inlining_failed {
337+
panic!("instruction found, but the disassembly contains `call` instructions, which hint that inlining failed");
326338
}
327339
}
328340

0 commit comments

Comments
 (0)