diff options
| author | Yan Chen <ychen2@futurewei.com> | 2022-08-08 16:58:27 -0700 |
|---|---|---|
| committer | Yan Chen <ychen2@futurewei.com> | 2022-09-09 08:00:47 -0700 |
| commit | 052887e4b4c86426423ecd6f244e3e25cd71dd49 (patch) | |
| tree | 947937120338bbc19454a6e57f5f4045f4cfe5aa /compiler/rustc_codegen_llvm/src/attributes.rs | |
| parent | 24d69920201563f0ee7b530f1cda0f171b205cc2 (diff) | |
| download | rust-052887e4b4c86426423ecd6f244e3e25cd71dd49.tar.gz rust-052887e4b4c86426423ecd6f244e3e25cd71dd49.zip | |
Add inline-llvm option for disabling/enabling LLVM inlining
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/attributes.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/attributes.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index b38684a63e4..eff2436d41c 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -35,6 +35,10 @@ pub fn apply_to_callsite(callsite: &Value, idx: AttributePlace, attrs: &[&Attrib /// Get LLVM attribute for the provided inline heuristic. #[inline] fn inline_attr<'ll>(cx: &CodegenCx<'ll, '_>, inline: InlineAttr) -> Option<&'ll Attribute> { + if !cx.tcx.sess.opts.unstable_opts.inline_llvm { + // disable LLVM inlining + return Some(AttributeKind::NoInline.create_attr(cx.llcx)); + } match inline { InlineAttr::Hint => Some(AttributeKind::InlineHint.create_attr(cx.llcx)), InlineAttr::Always => Some(AttributeKind::AlwaysInline.create_attr(cx.llcx)), |
