Repository: rust
Issue: ICE with `--crate-type staticlib`: compiler/rustc_codegen_llvm/src/intrinsic.rs:306:18: unknown intrinsic 'rustc_peek'
Labels: I-ICE,T-compiler,C-bug,glacier

<!--
Thank you for finding an Internal Compiler Error! 🧊  If possible, try to provide
a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for
how to create smaller examples.

http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/

-->

### Code

```Rust
#![feature(core_intrinsics)]
use std::intrinsics::rustc_peek;
#[no_mangle]
fn foo() -> i32 {
    let x = 0;
    rustc_peek(x)
}
```


### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`:
```
rustc 1.55.0-nightly (a435b49e8 2021-06-28)
binary: rustc
commit-hash: a435b49e86d16e98dcc6595dd471f95e823f41aa
commit-date: 2021-06-28
host: x86_64-unknown-linux-gnu
release: 1.55.0-nightly
LLVM version: 12.0.1
```

### Error output

```
error: internal compiler error: compiler/rustc_codegen_llvm/src/intrinsic.rs:306:18: unknown intrinsic 'rustc_peek'

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1007:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.55.0-nightly (a435b49e8 2021-06-28) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type staticlib

query stack during panic:
end of query stack
error: aborting due to previous error
```

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

```
error: internal compiler error: compiler/rustc_codegen_llvm/src/intrinsic.rs:306:18: unknown intrinsic 'rustc_peek'

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1007:9
stack backtrace:
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_errors::HandlerInner::bug
   3: rustc_errors::Handler::bug
   4: rustc_middle::ty::context::tls::with_opt
   5: rustc_middle::util::bug::opt_span_bug_fmt
   6: rustc_middle::util::bug::bug_fmt
   7: rustc_codegen_llvm::intrinsic::<impl rustc_codegen_ssa::traits::intrinsic::IntrinsicCallMethods for rustc_codegen_llvm::builder::Builder>::codegen_intrinsic_call
   8: rustc_codegen_ssa::mir::intrinsic::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_intrinsic_call
   9: rustc_codegen_ssa::mir::block::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_terminator
  10: rustc_codegen_ssa::mir::codegen_mir
  11: rustc_codegen_ssa::base::codegen_instance
  12: <rustc_middle::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define
  13: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
  14: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  15: rustc_codegen_llvm::base::compile_codegen_unit
  16: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  17: rustc_interface::passes::QueryContext::enter
  18: rustc_interface::queries::Queries::ongoing_codegen
  19: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  20: rustc_span::with_source_map
  21: rustc_interface::interface::create_compiler_and_run
  22: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.55.0-nightly (a435b49e8 2021-06-28) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type staticlib

query stack during panic:
end of query stack
error: aborting due to previous error
```

</p>
</details>