about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2018-12-21 00:30:35 +0100
committerNikita Popov <nikita.ppv@gmail.com>2018-12-21 00:31:18 +0100
commitdb24d8e8e25192703eb8f2ad6864207e92979443 (patch)
tree68aeac009a3153404d7684f852060a0b4a34aecd /src/librustc_codegen_llvm
parent0a4a4ffc69f2d05eb8b8a32eaf9bd0607b69fe38 (diff)
downloadrust-db24d8e8e25192703eb8f2ad6864207e92979443.tar.gz
rust-db24d8e8e25192703eb8f2ad6864207e92979443.zip
Enable emission of alignment attrs for pointer params
Instead disable creation of assumptions during inlining using an
LLVM opt flag.

The -Z arg-align-attributes option which previously controlled this
behavior is removed.
Diffstat (limited to 'src/librustc_codegen_llvm')
-rw-r--r--src/librustc_codegen_llvm/abi.rs6
-rw-r--r--src/librustc_codegen_llvm/llvm_util.rs4
2 files changed, 4 insertions, 6 deletions
diff --git a/src/librustc_codegen_llvm/abi.rs b/src/librustc_codegen_llvm/abi.rs
index b8954dee794..71b75525a5a 100644
--- a/src/librustc_codegen_llvm/abi.rs
+++ b/src/librustc_codegen_llvm/abi.rs
@@ -489,12 +489,6 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
                     attrs.pointee_size = pointee.size;
                     attrs.pointee_align = Some(pointee.align);
 
-                    // HACK(eddyb) LLVM inserts `llvm.assume` calls when inlining functions
-                    // with align attributes, and those calls later block optimizations.
-                    if !is_return && !cx.tcx.sess.opts.debugging_opts.arg_align_attributes {
-                        attrs.pointee_align = None;
-                    }
-
                     // `Box` pointer parameters never alias because ownership is transferred
                     // `&mut` pointer parameters never alias other parameters,
                     // or mutable global data
diff --git a/src/librustc_codegen_llvm/llvm_util.rs b/src/librustc_codegen_llvm/llvm_util.rs
index 82b1d7e8b40..090ff83ecc1 100644
--- a/src/librustc_codegen_llvm/llvm_util.rs
+++ b/src/librustc_codegen_llvm/llvm_util.rs
@@ -74,6 +74,10 @@ unsafe fn configure_llvm(sess: &Session) {
             add("-mergefunc-use-aliases");
         }
 
+        // HACK(eddyb) LLVM inserts `llvm.assume` calls to preserve align attributes
+        // during inlining. Unfortunately these may block other optimizations.
+        add("-preserve-alignment-assumptions-during-inlining=false");
+
         for arg in &sess.opts.cg.llvm_args {
             add(&(*arg));
         }