Disable optimizations of LLVM-IR generation

question

I am trying to output the llvmir of a crate. However, some functions present in the source code are omitted in the llvm-ir regardless of the optimization levels I pass to the cargo rustc command.
One of the commands I've tried to generate llvm-ir with:

cargo rustc -- -C opt-level=0 -C no-prepopulate-passes -C passes="" -C link-dead-code=yes --emit=llvm-ir

Does anybody know how I can fully disable LLVM-IR optimization passes in rustc?
Note that my use case requires rustc 1.64.0-nightly or rustc 1.64.0 and that heavily modifying the crates I am getting the LLVM-IR for is not an option.

See below for an example where the function my_entry() is optimized out

additional information

This problem seems to be related to the presence of generics.
If I emit MIR, my_entry is present in the MIR, so the optimizations occur somewhere after that.
Here is a Rust playground link with a (mostly) minimized example where the my_entry function is optimized out of the generated LLVM-IR: Rust Playground
Here is a link to the same example with generics removed from the code, and my_entry appears in the llvm-ir: Rust Playground

The translation to LLVM-IR presumably happens after monomorphization. If you never invoke Cookie::my_entry::<S> for a particular S, it never exists past some point of compilation.

Try making a call with the concrete types you want.

#[doc(hidden)]
pub fn _monomorphize_my_entry() {
    Cookie::my_entry::<Cow<'static, str>>();
}