Skip to content

Commit b498192

Browse files
committed
Add a -Z flag for LLVM align attributes on arguments
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.
1 parent 178becd commit b498192

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/librustc/session/config.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
12081208
"set the MIR optimization level (0-3, default: 1)"),
12091209
mutable_noalias: bool = (false, parse_bool, [UNTRACKED],
12101210
"emit noalias metadata for mutable references"),
1211+
arg_align_attributes: bool = (false, parse_bool, [UNTRACKED],
1212+
"emit align metadata for reference arguments"),
12111213
dump_mir: Option<String> = (None, parse_opt_string, [UNTRACKED],
12121214
"dump MIR state at various points in translation"),
12131215
dump_mir_dir: String = (String::from("mir_dump"), parse_string, [UNTRACKED],

src/librustc_trans/abi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ impl<'a, 'tcx> FnType<'tcx> {
778778

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

0 commit comments

Comments
 (0)