[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
Fri Nov 6 08:31:23 PST 2015


On Tue, Nov 3, 2015 at 2:50 PM, Diego Novillo <dnovillo at google.com> wrote:

> I don't see how this is any different from volatile markers on
> loads/stores or memory barriers or several other optimizer blocking
> devices.  They generally end up crippling the optimizers without much added
> benefit.
>

Volatile must touch memory (right?). Memory is slow.


> Would it be possible to stop the code motion you want to block by
> explicitly exposing data dependencies?  Or simply disabling some
> optimizations with pragmas?
>
>
Code motion would be fine in theory, though as has been proposed, this
intrinsic would prevent it (because there isn't an attribute that doesn't
allow dead code removal but still permits reordering, as far as I'm aware).
Rust doesn't have pragmas, and besides, that would also affect the whole
module (or the whole crate, to use Rust's vernacular), whereas this
intrinsic would be used in a much more targeted manner (ie at the SSA value
level) by the developer and leave the rest of the module unmolested.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151106/f0d8f5e9/attachment.html>


More information about the llvm-dev mailing list