]> git.lizzy.rs Git - rust.git/commit
Workaround LLVM optimizer bug by not marking &mut pointers as noalias
authorBjörn Steinbrink <bsteinbr@gmail.com>
Fri, 29 Jan 2016 10:11:24 +0000 (11:11 +0100)
committerBjörn Steinbrink <bsteinbr@gmail.com>
Wed, 10 Feb 2016 22:09:47 +0000 (23:09 +0100)
commita17fb64fcecdc42c5e25dd1745e517db881f14e1
tree1e79a2d5b7f327f71233d4f8703ef9a9a7532ae9
parent052b3fd4a0c484638a8e8b30f9b628abfaeffde4
Workaround LLVM optimizer bug by not marking &mut pointers as noalias

LLVM's memory dependence analysis doesn't properly account for calls
that could unwind and thus effectively act as a branching point. This
can lead to stores that are only visible when the call unwinds being
removed, possibly leading to calls to drop() functions with b0rked
memory contents.

As there is no fix for this in LLVM yet and we want to keep
compatibility to current LLVM versions anyways, we have to workaround
this bug by omitting the noalias attribute on &mut function arguments.
Benchmarks suggest that the performance loss by this change is very
small.

Thanks to @RalfJung for pushing me towards not removing too many
noalias annotations and @alexcrichton for helping out with the test for
this bug.

Fixes #29485
src/librustc_trans/trans/attributes.rs
src/test/auxiliary/issue-29485.rs [new file with mode: 0644]
src/test/codegen/function-arguments.rs
src/test/run-pass/issue-29485.rs [new file with mode: 0644]