[llvm-dev] [RFC] A new intrinsic, `llvm.blackbox`, to explicitly prevent constprop, die, etc optimizations

Björn Steinbrink via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 3 16:04:47 PST 2015


2015-11-04 0:09 GMT+01:00 Philip Reames via llvm-dev <llvm-dev at lists.llvm.org>:
> What I'm not clear on is why this needs to be an intrinsic.  Why does a call
> to an external function or a volatile store not suffice?

I wonder the same. Richard, maybe we just need something more specific
in Rust? Like something that only clobbers memory? Or just the
variable? Seems like we could do with specialized "block_box`
functions. AIUI our `black_box` got extended to prevent more
optimizations as it became obvious that the compiler could still
"defeat" it. Maybe we need to take a step back and say "ok, we'll have
to think a bit harder and decide how hard we'll be on the optimizer"?
Is there anything that speaks against that and requires an intrinsic?

Cheers,
Björn


More information about the llvm-dev mailing list