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

Richard Diamond via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 2 17:23:55 PST 2015


On Mon, Nov 2, 2015 at 7:19 PM, Sanjoy Das <sanjoy at playingwithpointers.com>
wrote:

> Why does this need to be an intrinsic (as opposed to generic "unknown
> function" to llvm)?
>
> Secondly, have you looked into a volatile store / load to an alloca? That
> should work with PNaCl and WebAssembly.
>
> E.g.
>
> define i32 @blackbox(i32 %arg) {
>  entry:
>   %p = alloca i32
>   store volatile i32 10, i32* %p  ;; or store %arg
>   %v = load volatile i32, i32* %p
>   ret i32 %v
> }


That volatility would have a negative performance impact.

Richard Diamond
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151102/c969d51d/attachment-0001.html>


More information about the llvm-dev mailing list