]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_codegen_llvm/src/attributes.rs
Auto merge of #102417 - oli-obk:opaque_lifetimes2, r=jackh726
[rust.git] / compiler / rustc_codegen_llvm / src / attributes.rs
index b38684a63e410d103150011d9ab452dfde04503d..eff2436d41cac65adbe930d1cd7a3e845ebafa65 100644 (file)
@@ -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)),