Skip to content

Commit 4c96822

Browse files
committedJul 29, 2023
Auto merge of #114148 - cuviper:drop-llvm-14, r=nikic
Update the minimum external LLVM to 15 With this change, we'll have stable support for LLVM 15 through 17 (pending release). For reference, the previous increase to LLVM 14 was #107573.
2 parents f9f674f + da47736 commit 4c96822

File tree

96 files changed

+293
-472
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+293
-472
lines changed
 

‎.github/workflows/ci.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- name: mingw-check-tidy
5656
os: ubuntu-20.04-16core-64gb
5757
env: {}
58-
- name: x86_64-gnu-llvm-14
58+
- name: x86_64-gnu-llvm-15
5959
os: ubuntu-20.04-16core-64gb
6060
env: {}
6161
- name: x86_64-gnu-tools
@@ -293,10 +293,6 @@ jobs:
293293
env:
294294
RUST_BACKTRACE: 1
295295
os: ubuntu-20.04-8core-32gb
296-
- name: x86_64-gnu-llvm-14
297-
env:
298-
RUST_BACKTRACE: 1
299-
os: ubuntu-20.04-8core-32gb
300296
- name: x86_64-gnu-nopt
301297
os: ubuntu-20.04-4core-16gb
302298
env: {}

‎compiler/rustc_codegen_llvm/src/attributes.rs

+28-34
Original file line numberDiff line numberDiff line change
@@ -363,50 +363,44 @@ pub fn from_fn_attrs<'ll, 'tcx>(
363363
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::ALLOCATOR)
364364
|| codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::ALLOCATOR_ZEROED)
365365
{
366-
if llvm_util::get_version() >= (15, 0, 0) {
367-
to_add.push(create_alloc_family_attr(cx.llcx));
368-
// apply to argument place instead of function
369-
let alloc_align = AttributeKind::AllocAlign.create_attr(cx.llcx);
370-
attributes::apply_to_llfn(llfn, AttributePlace::Argument(1), &[alloc_align]);
371-
to_add.push(llvm::CreateAllocSizeAttr(cx.llcx, 0));
372-
let mut flags = AllocKindFlags::Alloc | AllocKindFlags::Aligned;
373-
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::ALLOCATOR) {
374-
flags |= AllocKindFlags::Uninitialized;
375-
} else {
376-
flags |= AllocKindFlags::Zeroed;
377-
}
378-
to_add.push(llvm::CreateAllocKindAttr(cx.llcx, flags));
366+
to_add.push(create_alloc_family_attr(cx.llcx));
367+
// apply to argument place instead of function
368+
let alloc_align = AttributeKind::AllocAlign.create_attr(cx.llcx);
369+
attributes::apply_to_llfn(llfn, AttributePlace::Argument(1), &[alloc_align]);
370+
to_add.push(llvm::CreateAllocSizeAttr(cx.llcx, 0));
371+
let mut flags = AllocKindFlags::Alloc | AllocKindFlags::Aligned;
372+
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::ALLOCATOR) {
373+
flags |= AllocKindFlags::Uninitialized;
374+
} else {
375+
flags |= AllocKindFlags::Zeroed;
379376
}
377+
to_add.push(llvm::CreateAllocKindAttr(cx.llcx, flags));
380378
// apply to return place instead of function (unlike all other attributes applied in this function)
381379
let no_alias = AttributeKind::NoAlias.create_attr(cx.llcx);
382380
attributes::apply_to_llfn(llfn, AttributePlace::ReturnValue, &[no_alias]);
383381
}
384382
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::REALLOCATOR) {
385-
if llvm_util::get_version() >= (15, 0, 0) {
386-
to_add.push(create_alloc_family_attr(cx.llcx));
387-
to_add.push(llvm::CreateAllocKindAttr(
388-
cx.llcx,
389-
AllocKindFlags::Realloc | AllocKindFlags::Aligned,
390-
));
391-
// applies to argument place instead of function place
392-
let allocated_pointer = AttributeKind::AllocatedPointer.create_attr(cx.llcx);
393-
attributes::apply_to_llfn(llfn, AttributePlace::Argument(0), &[allocated_pointer]);
394-
// apply to argument place instead of function
395-
let alloc_align = AttributeKind::AllocAlign.create_attr(cx.llcx);
396-
attributes::apply_to_llfn(llfn, AttributePlace::Argument(2), &[alloc_align]);
397-
to_add.push(llvm::CreateAllocSizeAttr(cx.llcx, 3));
398-
}
383+
to_add.push(create_alloc_family_attr(cx.llcx));
384+
to_add.push(llvm::CreateAllocKindAttr(
385+
cx.llcx,
386+
AllocKindFlags::Realloc | AllocKindFlags::Aligned,
387+
));
388+
// applies to argument place instead of function place
389+
let allocated_pointer = AttributeKind::AllocatedPointer.create_attr(cx.llcx);
390+
attributes::apply_to_llfn(llfn, AttributePlace::Argument(0), &[allocated_pointer]);
391+
// apply to argument place instead of function
392+
let alloc_align = AttributeKind::AllocAlign.create_attr(cx.llcx);
393+
attributes::apply_to_llfn(llfn, AttributePlace::Argument(2), &[alloc_align]);
394+
to_add.push(llvm::CreateAllocSizeAttr(cx.llcx, 3));
399395
let no_alias = AttributeKind::NoAlias.create_attr(cx.llcx);
400396
attributes::apply_to_llfn(llfn, AttributePlace::ReturnValue, &[no_alias]);
401397
}
402398
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::DEALLOCATOR) {
403-
if llvm_util::get_version() >= (15, 0, 0) {
404-
to_add.push(create_alloc_family_attr(cx.llcx));
405-
to_add.push(llvm::CreateAllocKindAttr(cx.llcx, AllocKindFlags::Free));
406-
// applies to argument place instead of function place
407-
let allocated_pointer = AttributeKind::AllocatedPointer.create_attr(cx.llcx);
408-
attributes::apply_to_llfn(llfn, AttributePlace::Argument(0), &[allocated_pointer]);
409-
}
399+
to_add.push(create_alloc_family_attr(cx.llcx));
400+
to_add.push(llvm::CreateAllocKindAttr(cx.llcx, AllocKindFlags::Free));
401+
// applies to argument place instead of function place
402+
let allocated_pointer = AttributeKind::AllocatedPointer.create_attr(cx.llcx);
403+
attributes::apply_to_llfn(llfn, AttributePlace::Argument(0), &[allocated_pointer]);
410404
}
411405
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::CMSE_NONSECURE_ENTRY) {
412406
to_add.push(llvm::CreateAttrString(cx.llcx, "cmse_nonsecure_entry"));

0 commit comments

Comments
 (0)