The behavior we're seeing is that when the only call site of a function gets removed, the function itself doesn't necessarily get removed from the SPIR-V code, which can cause some unexpected opcodes to stay in the final optimized SPIR-V code.
Here's an example:
unoptimized_spirv_with_used_function.txt
optimized_spirv_with_unused_function.txt
In this example, the function at %35 goes from used to unused, but isn't removed.