Skip to content

Commit

Permalink
Add a -Z flag for LLVM align attributes on arguments
Browse files Browse the repository at this point in the history
LLVM seems to still put the assume calls in when inlining, so this probably isn't in a place where it can be turned on by default, but it's interesting to experiment with.

For example, this makes `swap::<u64x8>` be 8x `vmovaps	ymm` instead of 16x `vmovups	xmm`, on my cpu.
  • Loading branch information
scottmcm committed Mar 17, 2018
1 parent 178becd commit b498192
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"set the MIR optimization level (0-3, default: 1)"),
mutable_noalias: bool = (false, parse_bool, [UNTRACKED],
"emit noalias metadata for mutable references"),
arg_align_attributes: bool = (false, parse_bool, [UNTRACKED],
"emit align metadata for reference arguments"),
dump_mir: Option<String> = (None, parse_opt_string, [UNTRACKED],
"dump MIR state at various points in translation"),
dump_mir_dir: String = (String::from("mir_dump"), parse_string, [UNTRACKED],
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ impl<'a, 'tcx> FnType<'tcx> {

// HACK(eddyb) LLVM inserts `llvm.assume` calls when inlining functions
// with align attributes, and those calls later block optimizations.
if !is_return {
if !is_return && !cx.tcx.sess.opts.debugging_opts.arg_align_attributes {
attrs.pointee_align = None;
}

Expand Down

0 comments on commit b498192

Please sign in to comment.