Skip to content

Commit 5c68694

Browse files
authored
Check inlining and instruction count for assert_instr(nop) as well (#1218)
1 parent 1a7d0ce commit 5c68694

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

crates/stdarch-test/src/lib.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,16 @@ pub fn assert(shim_addr: usize, fnname: &str, expected: &str) {
7676
instrs = &instrs[..instrs.len() - 1];
7777
}
7878

79+
// Look for `expected` as the first part of any instruction in this
80+
// function, e.g., tzcntl in tzcntl %rax,%rax.
81+
//
7982
// There are two cases when the expected instruction is nop:
8083
// 1. The expected intrinsic is compiled away so we can't
8184
// check for it - aka the intrinsic is not generating any code.
8285
// 2. It is a mark, indicating that the instruction will be
8386
// compiled into other instructions - mainly because of llvm
8487
// optimization.
85-
if expected == "nop" {
86-
return;
87-
}
88-
89-
// Look for `expected` as the first part of any instruction in this
90-
// function, e.g., tzcntl in tzcntl %rax,%rax.
91-
let found = instrs.iter().any(|s| s.starts_with(expected));
88+
let found = expected == "nop" || instrs.iter().any(|s| s.starts_with(expected));
9289

9390
// Look for subroutine call instructions in the disassembly to detect whether
9491
// inlining failed: all intrinsics are `#[inline(always)]`, so calling one

0 commit comments

Comments
 (0)