Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IR] Convert from nocapture to captures(none) #123181

Merged
merged 2 commits into from
Jan 29, 2025
Merged

Conversation

nikic
Copy link
Contributor

@nikic nikic commented Jan 16, 2025

This PR removes the old nocapture attribute, replacing it with the new captures attribute introduced in #116990. This change is intended to be essentially NFC, replacing existing uses of nocapture with captures(none) without adding any new analysis capabilities. Making use of non-none values is left for a followup.

Some notes:

  • nocapture will be upgraded to captures(none) by the bitcode reader.
  • nocapture will also be upgraded by the textual IR reader. This is to make it easier to use old IR files and somewhat reduce the test churn in this PR.
  • Helper APIs like doesNotCapture() will check for captures(none).
  • MLIR import will convert captures(none) into an llvm.nocapture attribute. The representation in the LLVM IR dialect should be updated separately.

@llvmbot
Copy link
Member

llvmbot commented Jan 16, 2025

@llvm/pr-subscribers-flang-fir-hlfir
@llvm/pr-subscribers-mlir-llvm
@llvm/pr-subscribers-hlsl
@llvm/pr-subscribers-llvm-transforms
@llvm/pr-subscribers-backend-nvptx
@llvm/pr-subscribers-llvm-ir
@llvm/pr-subscribers-backend-directx
@llvm/pr-subscribers-llvm-analysis
@llvm/pr-subscribers-coroutines
@llvm/pr-subscribers-mlir
@llvm/pr-subscribers-clang-codegen

@llvm/pr-subscribers-backend-aarch64

Author: Nikita Popov (nikic)

Changes

This PR removes the old nocapture attribute, replacing it with the new captures attribute introduced in #116990. This change is intended to be essentially NFC, replacing existing uses of nocapture with captures(none) without adding any new analysis capabilities. Making use of non-none values is left for a followup.

Some notes:

  • nocapture will be upgraded to captures(none) by the bitcode reader.
  • nocapture will also be upgraded by the textual IR reader. This is to make it easier to use old IR files and somewhat reduce the test churn in this PR.
  • Helper APIs like doesNotCapture() will check for captures(none).
  • MLIR import will convert captures(none) into an llvm.nocapture attribute. The representation in the LLVM IR dialect should be updated separately.

Patch is 1.86 MiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/123181.diff

374 Files Affected:

  • (modified) clang/lib/CodeGen/CGCall.cpp (+1-1)
  • (modified) clang/lib/CodeGen/CGObjCGNU.cpp (+3-1)
  • (modified) clang/test/CodeGen/AArch64/pure-scalable-args.c (+5-5)
  • (modified) clang/test/CodeGen/AArch64/sve-acle-__ARM_FEATURE_SVE_VECTOR_OPERATORS.c (+1-1)
  • (modified) clang/test/CodeGen/PowerPC/aix-vaargs.c (+2-2)
  • (modified) clang/test/CodeGen/SystemZ/systemz-inline-asm.c (+1-1)
  • (modified) clang/test/CodeGen/X86/ms-x86-intrinsics.c (+2-2)
  • (modified) clang/test/CodeGen/arm-cmse-attr.c (+2-2)
  • (modified) clang/test/CodeGen/arm-vfp16-arguments.c (+1-1)
  • (modified) clang/test/CodeGen/arm-vfp16-arguments2.cpp (+5-5)
  • (modified) clang/test/CodeGen/attr-counted-by-pr110385.c (+18-9)
  • (modified) clang/test/CodeGen/attr-counted-by.c (+138-138)
  • (modified) clang/test/CodeGen/isfpclass.c (+1-1)
  • (modified) clang/test/CodeGen/math-libcalls-tbaa-indirect-args.c (+9-9)
  • (modified) clang/test/CodeGen/math-libcalls-tbaa.c (+7-7)
  • (modified) clang/test/CodeGen/mips-vector-return.c (+3-3)
  • (modified) clang/test/CodeGen/mips64-nontrivial-return.cpp (+1-1)
  • (modified) clang/test/CodeGen/ms-intrinsics-other.c (+38-38)
  • (modified) clang/test/CodeGen/ms-intrinsics.c (+153-153)
  • (modified) clang/test/CodeGen/nofpclass.c (+2-2)
  • (modified) clang/test/CodeGen/sanitize-metadata-nosanitize.c (+21-4)
  • (modified) clang/test/CodeGen/struct-copy.c (+1-1)
  • (modified) clang/test/CodeGen/tbaa-struct-bitfield-endianness.cpp (+1-1)
  • (modified) clang/test/CodeGen/transparent-union-type.c (+3-3)
  • (modified) clang/test/CodeGen/union-tbaa1.c (+1-1)
  • (modified) clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu (+11-11)
  • (modified) clang/test/CodeGenCXX/bitfield-ir.cpp (+6-6)
  • (modified) clang/test/CodeGenCXX/inline-then-fold-variadics.cpp (+16-16)
  • (modified) clang/test/CodeGenCXX/noescape.cpp (+15-15)
  • (modified) clang/test/CodeGenCXX/wasm-args-returns.cpp (+1-1)
  • (modified) clang/test/CodeGenHLSL/inline-functions.hlsl (+1-1)
  • (modified) clang/test/CodeGenObjC/noescape.m (+13-13)
  • (modified) clang/test/CodeGenOpenCL/amdgpu-abi-struct-coerce.cl (+12-12)
  • (modified) clang/test/CodeGenOpenCL/amdgpu-call-kernel.cl (+1-1)
  • (modified) clang/test/CodeGenOpenCL/atomic-builtins-default-to-device-scope.cl (+34-34)
  • (modified) clang/test/CodeGenOpenCL/builtins-amdgcn-gfx950-read-tr.cl (+7-6)
  • (modified) clang/test/CodeGenOpenCL/kernel-param-alignment.cl (+6-6)
  • (modified) clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl (+7-7)
  • (modified) clang/test/CodeGenOpenCL/preserve_vec3.cl (+9-9)
  • (modified) clang/test/CodeGenOpenCLCXX/array-type-infinite-loop.clcpp (+1-1)
  • (modified) clang/test/OpenMP/barrier_codegen.cpp (+1-1)
  • (modified) clang/test/OpenMP/bug54082.c (+8-8)
  • (modified) llvm/docs/LangRef.rst (+8-26)
  • (modified) llvm/docs/ReleaseNotes.md (+2)
  • (modified) llvm/include/llvm/AsmParser/LLToken.h (+2-1)
  • (modified) llvm/include/llvm/Frontend/OpenMP/OMPKinds.def (+8-7)
  • (modified) llvm/include/llvm/IR/Attributes.h (+1)
  • (modified) llvm/include/llvm/IR/Attributes.td (-3)
  • (modified) llvm/include/llvm/IR/InstrTypes.h (+5-7)
  • (modified) llvm/include/llvm/Support/ModRef.h (+17)
  • (modified) llvm/include/llvm/Transforms/IPO/Attributor.h (+7-3)
  • (modified) llvm/lib/AsmParser/LLLexer.cpp (+1)
  • (modified) llvm/lib/AsmParser/LLParser.cpp (+6)
  • (modified) llvm/lib/Bitcode/Reader/BitcodeReader.cpp (+12-3)
  • (modified) llvm/lib/Bitcode/Writer/BitcodeWriter.cpp (-2)
  • (modified) llvm/lib/IR/Attributes.cpp (+4-1)
  • (modified) llvm/lib/IR/Function.cpp (+1-1)
  • (modified) llvm/lib/IR/Instructions.cpp (+19)
  • (modified) llvm/lib/Target/DirectX/DXILPrepare.cpp (-1)
  • (modified) llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp (-2)
  • (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+2-2)
  • (modified) llvm/lib/Transforms/Coroutines/SpillUtils.cpp (+2-2)
  • (modified) llvm/lib/Transforms/IPO/Attributor.cpp (+9-8)
  • (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+34-25)
  • (modified) llvm/lib/Transforms/IPO/FunctionAttrs.cpp (+8-4)
  • (modified) llvm/lib/Transforms/Utils/BuildLibCalls.cpp (+3-2)
  • (modified) llvm/lib/Transforms/Utils/CodeExtractor.cpp (-1)
  • (modified) llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp (+4-2)
  • (modified) llvm/test/Analysis/StackSafetyAnalysis/lifetime.ll (+4-4)
  • (modified) llvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll (+7-7)
  • (modified) llvm/test/Assembler/amdgcn-intrinsic-attributes.ll (+2-2)
  • (modified) llvm/test/Assembler/auto_upgrade_intrinsics.ll (+2-2)
  • (modified) llvm/test/Assembler/masked-load-store-intrinsics-attributes.ll (+6-5)
  • (modified) llvm/test/Bitcode/attributes-3.3.ll (+1-1)
  • (modified) llvm/test/Bitcode/attributes.ll (+1-1)
  • (modified) llvm/test/Bitcode/compatibility-3.6.ll (+1-1)
  • (modified) llvm/test/Bitcode/compatibility-3.7.ll (+1-1)
  • (modified) llvm/test/Bitcode/compatibility-3.8.ll (+1-1)
  • (modified) llvm/test/Bitcode/compatibility-3.9.ll (+1-1)
  • (modified) llvm/test/Bitcode/compatibility-4.0.ll (+1-1)
  • (modified) llvm/test/Bitcode/compatibility-5.0.ll (+1-1)
  • (modified) llvm/test/Bitcode/compatibility-6.0.ll (+1-1)
  • (modified) llvm/test/Bitcode/compatibility.ll (+1-1)
  • (modified) llvm/test/Bitcode/function-address-space-fwd-decl.ll (+2-2)
  • (modified) llvm/test/Bitcode/highLevelStructure.3.2.ll (+6-6)
  • (modified) llvm/test/Bitcode/upgrade-memory-intrinsics.ll (+3-3)
  • (modified) llvm/test/CodeGen/AArch64/sve2-vscale-sinking.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-libcall-sincos-pass-ordering.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-sincos.defined.ll (+4-4)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-sincos.defined.nobuiltin.ll (+1-1)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-sincos.defined.sin.cos.ll (+3-3)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-sincos.ll (+53-53)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-sincos.nobuiltins.ll (+8-8)
  • (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-sincos.weak.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/attributor-flatscratchinit.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/fract-match.ll (+32-32)
  • (modified) llvm/test/CodeGen/AMDGPU/inline-attr.ll (+1-1)
  • (modified) llvm/test/CodeGen/AMDGPU/lower-lds-struct-aa-memcpy.ll (+1-1)
  • (modified) llvm/test/CodeGen/AMDGPU/nested-loop-conditions.ll (+4-4)
  • (modified) llvm/test/CodeGen/AMDGPU/perfhint.ll (+18-18)
  • (modified) llvm/test/CodeGen/AMDGPU/promote-alloca-globals.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/rewrite-out-arguments.ll (+44-44)
  • (modified) llvm/test/CodeGen/AMDGPU/vni8-live-reg-opt.ll (+8-8)
  • (modified) llvm/test/CodeGen/BPF/loop-exit-cond.ll (+1-1)
  • (modified) llvm/test/CodeGen/BPF/preserve-static-offset/load-inline.ll (+1-1)
  • (modified) llvm/test/CodeGen/BPF/preserve-static-offset/load-simple.ll (+1-1)
  • (modified) llvm/test/CodeGen/BPF/preserve-static-offset/load-unroll-inline.ll (+1-1)
  • (modified) llvm/test/CodeGen/BPF/preserve-static-offset/load-unroll.ll (+1-1)
  • (modified) llvm/test/CodeGen/BPF/preserve-static-offset/store-align.ll (+1-1)
  • (modified) llvm/test/CodeGen/BPF/preserve-static-offset/store-atomic.ll (+1-1)
  • (modified) llvm/test/CodeGen/BPF/preserve-static-offset/store-chain-oob.ll (+1-1)
  • (modified) llvm/test/CodeGen/BPF/preserve-static-offset/store-chain-u8-oob.ll (+1-1)
  • (modified) llvm/test/CodeGen/BPF/preserve-static-offset/store-chain-u8.ll (+1-1)
  • (modified) llvm/test/CodeGen/BPF/preserve-static-offset/store-chain.ll (+1-1)
  • (modified) llvm/test/CodeGen/BPF/preserve-static-offset/store-simple.ll (+1-1)
  • (modified) llvm/test/CodeGen/BPF/preserve-static-offset/store-unroll-inline.ll (+1-1)
  • (modified) llvm/test/CodeGen/BPF/preserve-static-offset/store-volatile.ll (+1-1)
  • (modified) llvm/test/CodeGen/BPF/preserve-static-offset/store-zero.ll (+1-1)
  • (modified) llvm/test/CodeGen/Hexagon/autohvx/vector-align-bad-move2.ll (+1-1)
  • (modified) llvm/test/CodeGen/Hexagon/autohvx/vector-align-overapping-stores.ll (+1-1)
  • (modified) llvm/test/CodeGen/NVPTX/lower-args-gridconstant.ll (+1-13)
  • (modified) llvm/test/CodeGen/NVPTX/lower-byval-args.ll (+39-39)
  • (modified) llvm/test/CodeGen/X86/codegen-prepare-addrmode-sext.ll (+1-1)
  • (modified) llvm/test/CodeGen/X86/no-plt-libcalls.ll (+1-1)
  • (modified) llvm/test/Feature/OperandBundles/function-attrs.ll (+1-1)
  • (modified) llvm/test/Instrumentation/HWAddressSanitizer/mem-attr.ll (+4-4)
  • (modified) llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll (+60-60)
  • (modified) llvm/test/Instrumentation/SanitizerCoverage/gep-tracing.ll (+4-4)
  • (modified) llvm/test/LTO/X86/mix-opaque-typed.ll (+1-1)
  • (modified) llvm/test/Other/cgscc-devirt-iteration.ll (+1-1)
  • (modified) llvm/test/Other/optimize-inrange-gep.ll (+1-1)
  • (modified) llvm/test/ThinLTO/X86/funcattrs-prop-unknown.ll (+2-2)
  • (modified) llvm/test/Transforms/AlignmentFromAssumptions/alignment-from-assumptions-track-users.ll (+7-7)
  • (modified) llvm/test/Transforms/AlignmentFromAssumptions/simple.ll (+15-15)
  • (modified) llvm/test/Transforms/AlignmentFromAssumptions/simple32.ll (+11-11)
  • (modified) llvm/test/Transforms/ArgumentPromotion/BPF/argpromotion.ll (+1-1)
  • (modified) llvm/test/Transforms/ArgumentPromotion/actual-arguments.ll (+3-3)
  • (modified) llvm/test/Transforms/ArgumentPromotion/aliasing-and-non-aliasing-loads-with-clobber.ll (+2-2)
  • (modified) llvm/test/Transforms/ArgumentPromotion/variadic.ll (+2-2)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/2008-07-02-array-indexing.ll (+5-5)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/2008-09-07-CGUpdate.ll (+2-2)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/2008-09-08-CGUpdateSelfEdge.ll (+1-1)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/X86/attributes.ll (+14-14)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/X86/min-legal-vector-width.ll (+56-56)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/X86/thiscall.ll (+5-5)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/alignment.ll (+2-2)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/array.ll (+1-1)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/attrs.ll (+2-2)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/basictest.ll (+2-2)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/byval-2.ll (+2-2)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/control-flow.ll (+5-5)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/dbg.ll (+5-5)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/inalloca.ll (+4-4)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead_2.ll (+8-8)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/musttail.ll (+19-19)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/pr32917.ll (+4-4)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll (+1-1)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/sret.ll (+4-4)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/tail.ll (+2-2)
  • (modified) llvm/test/Transforms/Attributor/ArgumentPromotion/variadic.ll (+2-2)
  • (modified) llvm/test/Transforms/Attributor/IPConstantProp/PR26044.ll (+4-4)
  • (modified) llvm/test/Transforms/Attributor/IPConstantProp/dangling-block-address.ll (+1-1)
  • (modified) llvm/test/Transforms/Attributor/IPConstantProp/openmp_parallel_for.ll (+4-4)
  • (modified) llvm/test/Transforms/Attributor/IPConstantProp/pthreads.ll (+6-6)
  • (modified) llvm/test/Transforms/Attributor/IPConstantProp/thread_local_acs.ll (+3-3)
  • (modified) llvm/test/Transforms/Attributor/address_space_info.ll (+15-15)
  • (modified) llvm/test/Transforms/Attributor/align.ll (+52-52)
  • (modified) llvm/test/Transforms/Attributor/allocator.ll (+7-7)
  • (modified) llvm/test/Transforms/Attributor/call-simplify-pointer-info.ll (+21-21)
  • (modified) llvm/test/Transforms/Attributor/callbacks.ll (+30-30)
  • (modified) llvm/test/Transforms/Attributor/callgraph.ll (+1-1)
  • (modified) llvm/test/Transforms/Attributor/convergent.ll (+4-4)
  • (modified) llvm/test/Transforms/Attributor/dereferenceable-1.ll (+17-17)
  • (modified) llvm/test/Transforms/Attributor/dereferenceable-2-inseltpoison.ll (+27-27)
  • (modified) llvm/test/Transforms/Attributor/dereferenceable-2.ll (+27-27)
  • (modified) llvm/test/Transforms/Attributor/heap_to_stack.ll (+50-50)
  • (modified) llvm/test/Transforms/Attributor/heap_to_stack_gpu.ll (+63-63)
  • (modified) llvm/test/Transforms/Attributor/internal-noalias.ll (+22-22)
  • (modified) llvm/test/Transforms/Attributor/issue87856.ll (+3-3)
  • (modified) llvm/test/Transforms/Attributor/liveness.ll (+16-16)
  • (modified) llvm/test/Transforms/Attributor/memory_locations.ll (+34-34)
  • (modified) llvm/test/Transforms/Attributor/misc.ll (+5-5)
  • (modified) llvm/test/Transforms/Attributor/misc_crash.ll (+4-4)
  • (modified) llvm/test/Transforms/Attributor/noalias.ll (+53-53)
  • (modified) llvm/test/Transforms/Attributor/nocapture-1.ll (+53-53)
  • (modified) llvm/test/Transforms/Attributor/nocapture-2.ll (+20-20)
  • (modified) llvm/test/Transforms/Attributor/nofpclass.ll (+7-7)
  • (modified) llvm/test/Transforms/Attributor/nofree.ll (+21-21)
  • (modified) llvm/test/Transforms/Attributor/nonnull.ll (+45-45)
  • (modified) llvm/test/Transforms/Attributor/norecurse.ll (+4-4)
  • (modified) llvm/test/Transforms/Attributor/nosync.ll (+13-13)
  • (modified) llvm/test/Transforms/Attributor/noundef.ll (+1-1)
  • (modified) llvm/test/Transforms/Attributor/openmp_parallel.ll (+22-22)
  • (modified) llvm/test/Transforms/Attributor/phi_bug_pointer_info.ll (+13-1)
  • (modified) llvm/test/Transforms/Attributor/pointer-info.ll (+5-5)
  • (modified) llvm/test/Transforms/Attributor/range.ll (+21-21)
  • (modified) llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll (+15-15)
  • (modified) llvm/test/Transforms/Attributor/readattrs.ll (+21-21)
  • (modified) llvm/test/Transforms/Attributor/recursive_globals.ll (+3-3)
  • (modified) llvm/test/Transforms/Attributor/reduced/aapointer_info_map_invalidation.ll (+2-2)
  • (modified) llvm/test/Transforms/Attributor/reduced/clear_cached_analysis_for_deleted_functions.ll (+1-1)
  • (modified) llvm/test/Transforms/Attributor/reduced/missed_cached_entry_for_intra_reachability.ll (+1-1)
  • (modified) llvm/test/Transforms/Attributor/reduced/openmp_opt_constant_type_crash.ll (+1-1)
  • (modified) llvm/test/Transforms/Attributor/returned.ll (+32-32)
  • (modified) llvm/test/Transforms/Attributor/undefined_behavior.ll (+16-16)
  • (modified) llvm/test/Transforms/Attributor/value-simplify-assume.ll (+27-27)
  • (modified) llvm/test/Transforms/Attributor/value-simplify-dominance.ll (+4-4)
  • (modified) llvm/test/Transforms/Attributor/value-simplify-gpu.ll (+12-12)
  • (modified) llvm/test/Transforms/Attributor/value-simplify-instances.ll (+6-6)
  • (modified) llvm/test/Transforms/Attributor/value-simplify-local-remote.ll (+32-32)
  • (modified) llvm/test/Transforms/Attributor/value-simplify-pointer-info.ll (+86-86)
  • (modified) llvm/test/Transforms/Attributor/value-simplify-reachability.ll (+8-8)
  • (modified) llvm/test/Transforms/Attributor/value-simplify.ll (+20-20)
  • (modified) llvm/test/Transforms/Attributor/willreturn.ll (+5-5)
  • (modified) llvm/test/Transforms/CodeGenPrepare/AArch64/reduce-or-opt.ll (+4-4)
  • (modified) llvm/test/Transforms/Coroutines/coro-async.ll (+3-3)
  • (modified) llvm/test/Transforms/Coroutines/coro-noalias-param.ll (+1-1)
  • (modified) llvm/test/Transforms/DeadStoreElimination/trivial-dse-calls.ll (+10-10)
  • (modified) llvm/test/Transforms/ExpandMemCmp/AArch64/memcmp.ll (+32-32)
  • (modified) llvm/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll (+1-1)
  • (modified) llvm/test/Transforms/FunctionAttrs/arg_returned.ll (+2-2)
  • (modified) llvm/test/Transforms/FunctionAttrs/argmemonly.ll (+51-51)
  • (modified) llvm/test/Transforms/FunctionAttrs/convergent.ll (+2-2)
  • (modified) llvm/test/Transforms/FunctionAttrs/initializes.ll (+27-27)
  • (modified) llvm/test/Transforms/FunctionAttrs/make-buffer-rsrc.ll (+4-4)
  • (modified) llvm/test/Transforms/FunctionAttrs/nocapture.ll (+52-52)
  • (modified) llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll (+4-4)
  • (modified) llvm/test/Transforms/FunctionAttrs/nonnull.ll (+12-12)
  • (modified) llvm/test/Transforms/FunctionAttrs/norecurse.ll (+6-6)
  • (modified) llvm/test/Transforms/FunctionAttrs/optnone.ll (+1-1)
  • (modified) llvm/test/Transforms/FunctionAttrs/out-of-bounds-iterator-bug.ll (+4-4)
  • (modified) llvm/test/Transforms/FunctionAttrs/readattrs.ll (+84-84)
  • (modified) llvm/test/Transforms/FunctionAttrs/readnone.ll (+6-6)
  • (modified) llvm/test/Transforms/FunctionAttrs/willreturn.ll (+1-1)
  • (modified) llvm/test/Transforms/FunctionAttrs/writeonly.ll (+46-46)
  • (modified) llvm/test/Transforms/FunctionSpecialization/function-specialization2.ll (+7-7)
  • (modified) llvm/test/Transforms/GVN/PRE/invariant-load.ll (+8-8)
  • (modified) llvm/test/Transforms/GVNHoist/infinite-loop-indirect.ll (+12-12)
  • (modified) llvm/test/Transforms/IRCE/variable-loop-bounds.ll (+21-21)
  • (modified) llvm/test/Transforms/IndVarSimplify/ada-loops.ll (+4-4)
  • (modified) llvm/test/Transforms/IndVarSimplify/lftr.ll (+1-1)
  • (modified) llvm/test/Transforms/IndVarSimplify/preserve-nsw-during-expansion.ll (+1-1)
  • (modified) llvm/test/Transforms/InferAddressSpaces/AMDGPU/store-pointer-to-self.ll (+1-1)
  • (modified) llvm/test/Transforms/InferAddressSpaces/NVPTX/bug31948.ll (+1-1)
  • (modified) llvm/test/Transforms/InferFunctionAttrs/annotate.ll (+161-161)
  • (modified) llvm/test/Transforms/Inline/align.ll (+5-5)
  • (modified) llvm/test/Transforms/Inline/byref-align.ll (+2-2)
  • (modified) llvm/test/Transforms/Inline/byval-align.ll (+2-2)
  • (modified) llvm/test/Transforms/Inline/byval.ll (+1-1)
  • (modified) llvm/test/Transforms/Inline/noalias-calls.ll (+4-4)
  • (modified) llvm/test/Transforms/Inline/noalias.ll (+2-2)
  • (modified) llvm/test/Transforms/Inline/noalias2.ll (+13-13)
  • (modified) llvm/test/Transforms/InstCombine/AMDGPU/llvm.amdgcn.wavefrontsize.ll (+9-9)
  • (modified) llvm/test/Transforms/InstCombine/NVPTX/isspacep.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/RISCV/libcall-arg-exts.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/RISCV/memcmp.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/SystemZ/libcall-arg-exts.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/call-cast-attrs.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/compare-alloca.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/compare-unescaped.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/memcpy-from-global.ll (+2-2)
  • (modified) llvm/test/Transforms/InstCombine/memset2.ll (+1-1)
  • (modified) llvm/test/Transforms/InstCombine/simplify-libcalls-inreg.ll (+5-5)
  • (modified) llvm/test/Transforms/InstCombine/str-int-2.ll (+3-3)
  • (modified) llvm/test/Transforms/InstCombine/str-int.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/strcall-no-nul.ll (+4-4)
  • (modified) llvm/test/Transforms/InstCombine/strto-1.ll (+14-14)
  • (modified) llvm/test/Transforms/InstCombine/trivial-dse-calls.ll (+7-7)
  • (modified) llvm/test/Transforms/InstCombine/unused-nonnull.ll (+2-2)
  • (modified) llvm/test/Transforms/LICM/hoist-mustexec.ll (+10-10)
  • (modified) llvm/test/Transforms/LICM/strlen.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopDataPrefetch/RISCV/basic.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopIdiom/AArch64/ctlz.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopInterchange/interchange-no-deps.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopPredication/scale.ll (+6-6)
  • (modified) llvm/test/Transforms/LoopStrengthReduce/2011-10-06-ReusePhi.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopStrengthReduce/ARM/illegal-addr-modes.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopStrengthReduce/addrec-gep-address-space.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopStrengthReduce/addrec-gep.ll (+2-2)
  • (modified) llvm/test/Transforms/LoopStrengthReduce/shl.ll (+1-1)
  • (modified) llvm/test/Transforms/LoopUnroll/unroll-cleanup.ll (+1-1)
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index e0cf6ca69f0df2..64fd58542aea27 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -2881,7 +2881,7 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
     }
 
     if (FI.getExtParameterInfo(ArgNo).isNoEscape())
-      Attrs.addAttribute(llvm::Attribute::NoCapture);
+      Attrs.addCapturesAttr(llvm::CaptureInfo::none());
 
     if (Attrs.hasAttributes()) {
       unsigned FirstIRArg, NumIRArgs;
diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp
index cfc92be393940d..ebd88bb38849e1 100644
--- a/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -773,7 +773,9 @@ class CGObjCGNUstep : public CGObjCGNU {
 
       // The lookup function is guaranteed not to capture the receiver pointer.
       if (auto *LookupFn2 = dyn_cast<llvm::Function>(LookupFn.getCallee()))
-        LookupFn2->addParamAttr(0, llvm::Attribute::NoCapture);
+        LookupFn2->addParamAttr(
+            0, llvm::Attribute::getWithCaptureInfo(CGF.getLLVMContext(),
+                                                   llvm::CaptureInfo::none()));
 
       llvm::Value *args[] = {
           EnforceType(Builder, ReceiverPtr.getPointer(), PtrToIdTy),
diff --git a/clang/test/CodeGen/AArch64/pure-scalable-args.c b/clang/test/CodeGen/AArch64/pure-scalable-args.c
index b03011e70b6a6f..fecd370d09be3b 100644
--- a/clang/test/CodeGen/AArch64/pure-scalable-args.c
+++ b/clang/test/CodeGen/AArch64/pure-scalable-args.c
@@ -67,7 +67,7 @@ void test_argpass_simple(PST *p) {
     void argpass_simple_callee(PST);
     argpass_simple_callee(*p);
 }
-// CHECK-AAPCS:      define dso_local void @test_argpass_simple(ptr nocapture noundef readonly %p)
+// CHECK-AAPCS:      define dso_local void @test_argpass_simple(ptr noundef readonly captures(none) %p)
 // CHECK-AAPCS-NEXT: entry:
 // CHECK-AAPCS-NEXT: %0 = load <2 x i8>, ptr %p, align 16
 // CHECK-AAPCS-NEXT: %cast.scalable = tail call <vscale x 2 x i8> @llvm.vector.insert.nxv2i8.v2i8(<vscale x 2 x i8> poison, <2 x i8> %0, i64 0)
@@ -292,7 +292,7 @@ PST test_return(PST *p) {
     return *p;
 }
 // CHECK-AAPCS:  define dso_local <{ <vscale x 16 x i1>, <vscale x 2 x double>, <vscale x 4 x float>, <vscale x 4 x float>, <vscale x 16 x i8>, <vscale x 16 x i1> }> @test_return(ptr
-// CHECK-DARWIN: define void @test_return(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.PST) align 16 initializes((0, 96)) %agg.result, ptr nocapture noundef readonly %p)
+// CHECK-DARWIN: define void @test_return(ptr dead_on_unwind noalias writable writeonly sret(%struct.PST) align 16 captures(none) initializes((0, 96)) %agg.result, ptr noundef readonly captures(none) %p)
 
 // Corner case of 1-element aggregate
 //   p->x -> q0
@@ -300,7 +300,7 @@ SmallPST test_return_small_pst(SmallPST *p) {
     return *p;
 }
 // CHECK-AAPCS:  define dso_local <vscale x 4 x float> @test_return_small_pst(ptr
-// CHECK-DARWIN: define i128 @test_return_small_pst(ptr nocapture noundef readonly %p)
+// CHECK-DARWIN: define i128 @test_return_small_pst(ptr noundef readonly captures(none) %p)
 
 
 // Big PST, returned indirectly
@@ -308,8 +308,8 @@ SmallPST test_return_small_pst(SmallPST *p) {
 BigPST test_return_big_pst(BigPST *p) {
     return *p;
 }
-// CHECK-AAPCS:  define dso_local void @test_return_big_pst(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.BigPST) align 16 initializes((0, 176)) %agg.result, ptr nocapture noundef readonly %p)
-// CHECK-DARWIN: define void @test_return_big_pst(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.BigPST) align 16 initializes((0, 176)) %agg.result, ptr nocapture noundef readonly %p)
+// CHECK-AAPCS:  define dso_local void @test_return_big_pst(ptr dead_on_unwind noalias writable writeonly sret(%struct.BigPST) align 16 captures(none) initializes((0, 176)) %agg.result, ptr noundef readonly captures(none) %p)
+// CHECK-DARWIN: define void @test_return_big_pst(ptr dead_on_unwind noalias writable writeonly sret(%struct.BigPST) align 16 captures(none) initializes((0, 176)) %agg.result, ptr noundef readonly captures(none) %p)
 
 // Variadic arguments are unnamed, PST passed indirectly.
 // (Passing SVE types to a variadic function currently unsupported by
diff --git a/clang/test/CodeGen/AArch64/sve-acle-__ARM_FEATURE_SVE_VECTOR_OPERATORS.c b/clang/test/CodeGen/AArch64/sve-acle-__ARM_FEATURE_SVE_VECTOR_OPERATORS.c
index 28d69d52c9ae73..bbed683ac1fd7e 100644
--- a/clang/test/CodeGen/AArch64/sve-acle-__ARM_FEATURE_SVE_VECTOR_OPERATORS.c
+++ b/clang/test/CodeGen/AArch64/sve-acle-__ARM_FEATURE_SVE_VECTOR_OPERATORS.c
@@ -59,7 +59,7 @@ typedef int8_t vec_int8 __attribute__((vector_size(N / 8)));
 // CHECK128-NEXT:    ret <16 x i8> [[CASTFIXEDSVE]]
 
 // CHECK-LABEL: define{{.*}} void @f2(
-// CHECK-SAME:   ptr dead_on_unwind noalias nocapture writable writeonly sret(<[[#div(VBITS,8)]] x i8>) align 16 initializes((0, [[#div(VBITS,8)]])) %agg.result, ptr nocapture noundef readonly %0)
+// CHECK-SAME:   ptr dead_on_unwind noalias writable writeonly sret(<[[#div(VBITS,8)]] x i8>) align 16 captures(none) initializes((0, [[#div(VBITS,8)]])) %agg.result, ptr noundef readonly captures(none) %0)
 // CHECK-NEXT: entry:
 // CHECK-NEXT:   [[X:%.*]] = load <[[#div(VBITS,8)]] x i8>, ptr [[TMP0:%.*]], align 16, [[TBAA6:!tbaa !.*]]
 // CHECK-NEXT:   [[TMP1:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 31)
diff --git a/clang/test/CodeGen/PowerPC/aix-vaargs.c b/clang/test/CodeGen/PowerPC/aix-vaargs.c
index 724ba6560cdb97..8716a9e4698c48 100644
--- a/clang/test/CodeGen/PowerPC/aix-vaargs.c
+++ b/clang/test/CodeGen/PowerPC/aix-vaargs.c
@@ -68,8 +68,8 @@ void testva (int n, ...) {
 
 // CHECK: declare void @llvm.va_start.p0(ptr)
 
-// AIX32: declare void @llvm.memcpy.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32, i1 immarg)
-// AIX64: declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg)
+// AIX32: declare void @llvm.memcpy.p0.p0.i32(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i32, i1 immarg)
+// AIX64: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg)
 
 // CHECK: declare void @llvm.va_copy.p0(ptr, ptr)
 // CHECK: declare void @llvm.va_end.p0(ptr)
diff --git a/clang/test/CodeGen/SystemZ/systemz-inline-asm.c b/clang/test/CodeGen/SystemZ/systemz-inline-asm.c
index 2a9d6a5f874548..9e62b8e1079001 100644
--- a/clang/test/CodeGen/SystemZ/systemz-inline-asm.c
+++ b/clang/test/CodeGen/SystemZ/systemz-inline-asm.c
@@ -123,7 +123,7 @@ double test_f64(double f, double g) {
 long double test_f128(long double f, long double g) {
   asm("axbr %0, %2" : "=f" (f) : "0" (f), "f" (g));
   return f;
-// CHECK: define{{.*}} void @test_f128(ptr dead_on_unwind noalias nocapture writable writeonly sret(fp128) align 8 initializes((0, 16)) [[DEST:%.*]], ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1)
+// CHECK: define{{.*}} void @test_f128(ptr dead_on_unwind noalias writable writeonly sret(fp128) align 8 captures(none) initializes((0, 16)) [[DEST:%.*]], ptr noundef readonly captures(none) %0, ptr noundef readonly captures(none) %1)
 // CHECK: %f = load fp128, ptr %0
 // CHECK: %g = load fp128, ptr %1
 // CHECK: [[RESULT:%.*]] = tail call fp128 asm "axbr $0, $2", "=f,0,f"(fp128 %f, fp128 %g)
diff --git a/clang/test/CodeGen/X86/ms-x86-intrinsics.c b/clang/test/CodeGen/X86/ms-x86-intrinsics.c
index 94a1b372974b38..34cf690e6d5da1 100644
--- a/clang/test/CodeGen/X86/ms-x86-intrinsics.c
+++ b/clang/test/CodeGen/X86/ms-x86-intrinsics.c
@@ -171,7 +171,7 @@ __int64 test_mul128(__int64 Multiplier,
                     __int64 *HighProduct) {
   return _mul128(Multiplier, Multiplicand, HighProduct);
 }
-// CHECK-X64-LABEL: define dso_local i64 @test_mul128(i64 noundef %Multiplier, i64 noundef %Multiplicand, ptr{{[a-z_ ]*}} initializes((0, 8)) %HighProduct)
+// CHECK-X64-LABEL: define dso_local i64 @test_mul128(i64 noundef %Multiplier, i64 noundef %Multiplicand, ptr{{.*}} initializes((0, 8)) %HighProduct)
 // CHECK-X64: = sext i64 %Multiplier to i128
 // CHECK-X64: = sext i64 %Multiplicand to i128
 // CHECK-X64: = mul nsw i128 %
@@ -183,7 +183,7 @@ unsigned __int64 test_umul128(unsigned __int64 Multiplier,
                               unsigned __int64 *HighProduct) {
   return _umul128(Multiplier, Multiplicand, HighProduct);
 }
-// CHECK-X64-LABEL: define dso_local i64 @test_umul128(i64 noundef %Multiplier, i64 noundef %Multiplicand, ptr{{[a-z_ ]*}} initializes((0, 8)) %HighProduct)
+// CHECK-X64-LABEL: define dso_local i64 @test_umul128(i64 noundef %Multiplier, i64 noundef %Multiplicand, ptr{{.*}} initializes((0, 8)) %HighProduct)
 // CHECK-X64: = zext i64 %Multiplier to i128
 // CHECK-X64: = zext i64 %Multiplicand to i128
 // CHECK-X64: = mul nuw i128 %
diff --git a/clang/test/CodeGen/arm-cmse-attr.c b/clang/test/CodeGen/arm-cmse-attr.c
index 6322a82dfa4627..b01124a03df7b6 100644
--- a/clang/test/CodeGen/arm-cmse-attr.c
+++ b/clang/test/CodeGen/arm-cmse-attr.c
@@ -29,9 +29,9 @@ void f4(void) __attribute__((cmse_nonsecure_entry))
 {
 }
 
-// CHECK: define{{.*}} void @f1(ptr nocapture noundef readonly %fptr) {{[^#]*}}#0 {
+// CHECK: define{{.*}} void @f1(ptr noundef readonly captures(none) %fptr) {{[^#]*}}#0 {
 // CHECK: call void %fptr() #2
-// CHECK: define{{.*}} void @f2(ptr nocapture noundef readonly %fptr) {{[^#]*}}#0 {
+// CHECK: define{{.*}} void @f2(ptr noundef readonly captures(none) %fptr) {{[^#]*}}#0 {
 // CHECK: call void %fptr() #2
 // CHECK: define{{.*}} void @f3() {{[^#]*}}#1 {
 // CHECK: define{{.*}} void @f4() {{[^#]*}}#1 {
diff --git a/clang/test/CodeGen/arm-vfp16-arguments.c b/clang/test/CodeGen/arm-vfp16-arguments.c
index 3c6691df4747ab..c0bbb3df72bf3f 100644
--- a/clang/test/CodeGen/arm-vfp16-arguments.c
+++ b/clang/test/CodeGen/arm-vfp16-arguments.c
@@ -71,6 +71,6 @@ void test_hfa(hfa_t a) {}
 
 hfa_t ghfa;
 hfa_t test_ret_hfa(void) { return ghfa; }
-// CHECK-SOFT: define{{.*}} void @test_ret_hfa(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.hfa_t) align 8 initializes((0, 16)) %agg.result)
+// CHECK-SOFT: define{{.*}} void @test_ret_hfa(ptr dead_on_unwind noalias writable writeonly sret(%struct.hfa_t) align 8 captures(none) initializes((0, 16)) %agg.result)
 // CHECK-HARD: define{{.*}} arm_aapcs_vfpcc [2 x <2 x i32>] @test_ret_hfa()
 // CHECK-FULL: define{{.*}} arm_aapcs_vfpcc %struct.hfa_t @test_ret_hfa()
diff --git a/clang/test/CodeGen/arm-vfp16-arguments2.cpp b/clang/test/CodeGen/arm-vfp16-arguments2.cpp
index b810cfd0a6648f..6e9a24e70c141e 100644
--- a/clang/test/CodeGen/arm-vfp16-arguments2.cpp
+++ b/clang/test/CodeGen/arm-vfp16-arguments2.cpp
@@ -37,27 +37,27 @@ struct S5 : B1 {
   B1 M[1];
 };
 
-// CHECK-SOFT: define{{.*}} void @_Z2f12S1(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.S1) align 8 initializes((0, 16)) %agg.result, [2 x i64] %s1.coerce)
+// CHECK-SOFT: define{{.*}} void @_Z2f12S1(ptr dead_on_unwind noalias writable writeonly sret(%struct.S1) align 8 captures(none) initializes((0, 16)) %agg.result, [2 x i64] %s1.coerce)
 // CHECK-HARD: define{{.*}} arm_aapcs_vfpcc [2 x <2 x i32>] @_Z2f12S1([2 x <2 x i32>] returned %s1.coerce)
 // CHECK-FULL: define{{.*}} arm_aapcs_vfpcc %struct.S1 @_Z2f12S1(%struct.S1 returned %s1.coerce)
 struct S1 f1(struct S1 s1) { return s1; }
 
-// CHECK-SOFT: define{{.*}} void @_Z2f22S2(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.S2) align 8 initializes((0, 16)) %agg.result, [4 x i32] %s2.coerce)
+// CHECK-SOFT: define{{.*}} void @_Z2f22S2(ptr dead_on_unwind noalias writable writeonly sret(%struct.S2) align 8 captures(none) initializes((0, 16)) %agg.result, [4 x i32] %s2.coerce)
 // CHECK-HARD: define{{.*}} arm_aapcs_vfpcc [2 x <2 x i32>] @_Z2f22S2([2 x <2 x i32>] returned %s2.coerce)
 // CHECK-FULL: define{{.*}} arm_aapcs_vfpcc %struct.S2 @_Z2f22S2(%struct.S2 %s2.coerce)
 struct S2 f2(struct S2 s2) { return s2; }
 
-// CHECK-SOFT: define{{.*}} void @_Z2f32S3(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.S3) align 8 initializes((0, 16)) %agg.result, [2 x i64] %s3.coerce)
+// CHECK-SOFT: define{{.*}} void @_Z2f32S3(ptr dead_on_unwind noalias writable writeonly sret(%struct.S3) align 8 captures(none) initializes((0, 16)) %agg.result, [2 x i64] %s3.coerce)
 // CHECK-HARD: define{{.*}} arm_aapcs_vfpcc [2 x <2 x i32>] @_Z2f32S3([2 x <2 x i32>] returned %s3.coerce)
 // CHECK-FULL: define{{.*}} arm_aapcs_vfpcc %struct.S3 @_Z2f32S3(%struct.S3 %s3.coerce)
 struct S3 f3(struct S3 s3) { return s3; }
 
-// CHECK-SOFT: define{{.*}} void @_Z2f42S4(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.S4) align 8 initializes((0, 16)) %agg.result, [2 x i64] %s4.coerce)
+// CHECK-SOFT: define{{.*}} void @_Z2f42S4(ptr dead_on_unwind noalias writable writeonly sret(%struct.S4) align 8 captures(none) initializes((0, 16)) %agg.result, [2 x i64] %s4.coerce)
 // CHECK-HARD: define{{.*}} arm_aapcs_vfpcc [2 x <2 x i32>] @_Z2f42S4([2 x <2 x i32>] returned %s4.coerce)
 // CHECK-FULL: define{{.*}} arm_aapcs_vfpcc %struct.S4 @_Z2f42S4(%struct.S4 %s4.coerce)
 struct S4 f4(struct S4 s4) { return s4; }
 
-// CHECK-SOFT: define{{.*}} void @_Z2f52S5(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.S5) align 8 initializes((0, 16)) %agg.result, [2 x i64] %s5.coerce)
+// CHECK-SOFT: define{{.*}} void @_Z2f52S5(ptr dead_on_unwind noalias writable writeonly sret(%struct.S5) align 8 captures(none) initializes((0, 16)) %agg.result, [2 x i64] %s5.coerce)
 // CHECK-HARD: define{{.*}} arm_aapcs_vfpcc %struct.S5 @_Z2f52S5(%struct.S5 %s5.coerce)
 // CHECK-FULL: define{{.*}} arm_aapcs_vfpcc %struct.S5 @_Z2f52S5(%struct.S5 %s5.coerce)
 struct S5 f5(struct S5 s5) { return s5; }
diff --git a/clang/test/CodeGen/attr-counted-by-pr110385.c b/clang/test/CodeGen/attr-counted-by-pr110385.c
index c2ff032334fe27..412c12cb687c42 100644
--- a/clang/test/CodeGen/attr-counted-by-pr110385.c
+++ b/clang/test/CodeGen/attr-counted-by-pr110385.c
@@ -26,16 +26,16 @@ struct bucket2 {
 void init(void * __attribute__((pass_dynamic_object_size(0))));
 
 // CHECK-LABEL: define dso_local void @test1(
-// CHECK-SAME: ptr nocapture noundef readonly [[FOO:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
+// CHECK-SAME: ptr noundef readonly captures(none) [[FOO:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    [[GROWABLE:%.*]] = getelementptr inbounds nuw i8, ptr [[FOO]], i64 8
 // CHECK-NEXT:    [[TMP0:%.*]] = load ptr, ptr [[GROWABLE]], align 8, !tbaa [[TBAA2:![0-9]+]]
 // CHECK-NEXT:    [[ARRAY:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP0]], i64 12
-// CHECK-NEXT:    [[DOT_COUNTED_BY_GEP:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP0]], i64 8
-// CHECK-NEXT:    [[DOT_COUNTED_BY_LOAD:%.*]] = load i32, ptr [[DOT_COUNTED_BY_GEP]], align 4
-// CHECK-NEXT:    [[TMP1:%.*]] = sext i32 [[DOT_COUNTED_BY_LOAD]] to i64
+// CHECK-NEXT:    [[COUNTED_BY_GEP:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP0]], i64 8
+// CHECK-NEXT:    [[COUNTED_BY_LOAD:%.*]] = load i32, ptr [[COUNTED_BY_GEP]], align 4
+// CHECK-NEXT:    [[TMP1:%.*]] = sext i32 [[COUNTED_BY_LOAD]] to i64
 // CHECK-NEXT:    [[TMP2:%.*]] = shl nsw i64 [[TMP1]], 1
-// CHECK-NEXT:    [[TMP3:%.*]] = icmp sgt i32 [[DOT_COUNTED_BY_LOAD]], -1
+// CHECK-NEXT:    [[TMP3:%.*]] = icmp sgt i32 [[COUNTED_BY_LOAD]], -1
 // CHECK-NEXT:    [[TMP4:%.*]] = select i1 [[TMP3]], i64 [[TMP2]], i64 0
 // CHECK-NEXT:    tail call void @init(ptr noundef nonnull [[ARRAY]], i64 noundef [[TMP4]]) #[[ATTR2:[0-9]+]]
 // CHECK-NEXT:    ret void
@@ -48,11 +48,11 @@ void test1(struct bucket *foo) {
 // CHECK-SAME: ptr noundef [[FOO:%.*]]) local_unnamed_addr #[[ATTR0]] {
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    [[ARRAY:%.*]] = getelementptr inbounds nuw i8, ptr [[FOO]], i64 16
-// CHECK-NEXT:    [[DOT_COUNTED_BY_GEP:%.*]] = getelementptr inbounds nuw i8, ptr [[FOO]], i64 12
-// CHECK-NEXT:    [[DOT_COUNTED_BY_LOAD:%.*]] = load i32, ptr [[DOT_COUNTED_BY_GEP]], align 4
-// CHECK-NEXT:    [[TMP0:%.*]] = sext i32 [[DOT_COUNTED_BY_LOAD]] to i64
+// CHECK-NEXT:    [[COUNTED_BY_GEP:%.*]] = getelementptr inbounds nuw i8, ptr [[FOO]], i64 12
+// CHECK-NEXT:    [[COUNTED_BY_LOAD:%.*]] = load i32, ptr [[COUNTED_BY_GEP]], align 4
+// CHECK-NEXT:    [[TMP0:%.*]] = sext i32 [[COUNTED_BY_LOAD]] to i64
 // CHECK-NEXT:    [[TMP1:%.*]] = shl nsw i64 [[TMP0]], 1
-// CHECK-NEXT:    [[TMP2:%.*]] = icmp sgt i32 [[DOT_COUNTED_BY_LOAD]], -1
+// CHECK-NEXT:    [[TMP2:%.*]] = icmp sgt i32 [[COUNTED_BY_LOAD]], -1
 // CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[TMP2]], i64 [[TMP1]], i64 0
 // CHECK-NEXT:    tail call void @init(ptr noundef nonnull [[ARRAY]], i64 noundef [[TMP3]]) #[[ATTR2]]
 // CHECK-NEXT:    ret void
@@ -60,3 +60,12 @@ void test1(struct bucket *foo) {
 void test2(struct bucket2 *foo) {
         init(foo->growable.array);
 }
+//.
+// CHECK: [[TBAA2]] = !{[[META3:![0-9]+]], [[META7:![0-9]+]], i64 8}
+// CHECK: [[META3]] = !{!"bucket", [[META4:![0-9]+]], i64 0, [[META7]], i64 8, [[META4]], i64 16}
+// CHECK: [[META4]] = !{!"int", [[META5:![0-9]+]], i64 0}
+// CHECK: [[META5]] = !{!"omnipotent char", [[META6:![0-9]+]], i64 0}
+// CHECK: [[META6]] = !{!"Simple C/C++ TBAA"}
+// CHECK: [[META7]] = !{!"p1 _ZTS8variable", [[META8:![0-9]+]], i64 0}
+// CHECK: [[META8]] = !{!"any pointer", [[META5]], i64 0}
+//.
diff --git a/clang/test/CodeGen/attr-counted-by.c b/clang/test/CodeGen/attr-counted-by.c
index 6b3cad5708835b..71fc6c5da2b854 100644
--- a/clang/test/CodeGen/attr-counted-by.c
+++ b/clang/test/CodeGen/attr-counted-by.c
@@ -75,7 +75,7 @@ struct anon_struct {
 // SANITIZE-WITH-ATTR-NEXT:    ret void
 //
 // NO-SANITIZE-WITH-ATTR-LABEL: define dso_local void @test1(
-// NO-SANITIZE-WITH-ATTR-SAME: ptr nocapture noundef writeonly [[P:%.*]], i32 noundef [[INDEX:%.*]], i32 noundef [[VAL:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
+// NO-SANITIZE-WITH-ATTR-SAME: ptr noundef writeonly captures(none) [[P:%.*]], i32 noundef [[INDEX:%.*]], i32 noundef [[VAL:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
 // NO-SANITIZE-WITH-ATTR-NEXT:  entry:
 // NO-SANITIZE-WITH-ATTR-NEXT:    [[ARRAY:%.*]] = getelementptr inbounds nuw i8, ptr [[P]], i64 12
 // NO-SANITIZE-WITH-ATTR-NEXT:    [[IDXPROM:%.*]] = sext i32 [[INDEX]] to i64
@@ -93,7 +93,7 @@ struct anon_struct {
 // SANITIZE-WITHOUT-ATTR-NEXT:    ret void
 //
 // NO-SANITIZE-WITHOUT-ATTR-LABEL: define dso_local void @test1(
-// NO-SANITIZE-WITHOUT-ATTR-SAME: ptr nocapture noundef writeonly [[P:%.*]], i32 noundef [[INDEX:%.*]], i32 noundef [[VAL:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
+// NO-SANITIZE-WITHOUT-ATTR-SAME: ptr noundef writeonly captures(none) [[P:%.*]], i32 noundef [[INDEX:%.*]], i32 noundef [[VAL:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
 // NO-SANITIZE-WITHOUT-ATTR-NEXT:  entry:
 // NO-SANITIZE-WITHOUT-ATTR-NEXT:    [[ARRAY:%.*]] = getelementptr inbounds nuw i8, ptr [[P]], i64 12
 // NO-SANITIZE-WITHOUT-ATTR-NEXT:    [[IDXPROM:%.*]] = sext i32 [[INDEX]] to i64
@@ -108,9 +108,9 @@ void test1(struct annotated *p, int index, int val) {
 // SANITIZE-WITH-ATTR-LABEL: define dso_local void @test2(
 // SANITIZE-WITH-ATTR-SAME: ptr noundef [[P:%.*]], i64 noundef [[INDEX:%.*]]) local_unnamed_addr #[[ATTR0]] {
 // SANITIZE-WITH-ATTR-NEXT:  entry:
-// SANITIZE-WITH-ATTR-NEXT:    [[DOT_COUNTED_BY_GEP:%.*]] = getelementptr inbounds nuw i8, ptr [[P]], i64 8
-// SANITIZE-WITH-ATTR-NEXT:    [[DOT_COUNTED_BY_LOAD:%.*]] = load i32, ptr [[DOT_COUNTED_BY_GEP]], align 4
-// SANITIZE-WITH-ATTR-NEXT:    [[TMP0:%.*]] = zext i32 [[DOT_COUNTED_BY_LOAD]] to i64, !nosanitize [[META2]]
+// SANITIZE-WITH-ATTR-NEXT:    [[COUNTED_BY_GEP:%.*]] = getelementptr inbounds nuw i8, ptr [[P]], i64 8
+// SANITIZE-WITH-ATTR-NEXT:    [[COUNTED_BY_LOAD:%.*]] = load i32, ptr [[COUNTED_BY_GEP]], align 4
+// SANITIZE-WITH-ATTR-NEXT:    [[TMP0:%.*]] = zext i32 [[COUNTED_BY_LOAD]] to i64, !nosanitize [[META2]]
 // SANITIZE-WITH-ATTR-NEXT:    [[TMP1:%.*]] = icmp ult i64 [[INDEX]], [[TMP0]], !nosanitize [[META2]]
 // SANITIZE-WITH-ATTR-NEXT:    br i1 [[TMP1]], label [[CONT3:%.*]], label [[HANDLER_OUT_OF_BOUNDS:%.*]], !prof [[PROF3]], !nosanitize [[META2]]
 // SANITIZE-WITH-ATTR:       handler.out_of_bounds:
@@ -119,17 +1...
[truncated]

// If the argument is passed byval, the callee does not have access to the
// original pointer and thus cannot capture it.
if (OpNo < arg_size() && isByValArgument(OpNo))
return true;
Copy link
Contributor

@goldsteinn goldsteinn Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why drop this code? I see now.

@@ -1986,6 +1986,12 @@ static void decodeLLVMAttributesForBitcode(AttrBuilder &B,
B.addMemoryAttr(ME);
}

// Upgrade nocapture to captures(none).
if (Attrs & (1ULL << 21)) {
Attrs &= ~(1ULL << 21);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also mention that 1 << 21 is NoCapture here.

@goldsteinn
Copy link
Contributor

This LGTM, although think needs other approvals.

Copy link
Contributor

@fhahn fhahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checking, do we have a test for the auto-upgrade?

@@ -1015,7 +1015,7 @@ struct OperandBundleUse {
/// has the attribute A.
bool operandHasAttr(unsigned Idx, Attribute::AttrKind A) const {
if (isDeoptOperandBundle())
if (A == Attribute::ReadOnly || A == Attribute::NoCapture)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case is now handled by getCaptureInfo, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

@nikic
Copy link
Contributor Author

nikic commented Jan 21, 2025

Just double checking, do we have a test for the auto-upgrade?

All the compatibility-*.ll tests test auto-upgrade.

@@ -526,6 +526,11 @@ static AttributeSet getIntrinsicArgAttributeSet(LLVMContext &C, unsigned ID) {
)",
ID);
for (const CodeGenIntrinsic::ArgAttribute &Attr : Attrs) {
if (Attr.Kind == CodeGenIntrinsic::NoCapture) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should NoCapture->CapturesNone (or something like that) here as well for consistency? Although might further increase the diff :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer doing that in a followup, to avoid a mass-change of Intrinsic.td files in this PR. I think we'll also want to expose at least CapturesRetOnly, as some intrinsics want those semantics. Not sure if any intrinsics need something other than CapturesNone/CapturesRetOnly -- exposing the attribute in full generality in TableGen would probably be rather annoying.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, as long as it will be renamed eventually.

Copy link
Contributor

@fhahn fhahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@@ -526,6 +526,11 @@ static AttributeSet getIntrinsicArgAttributeSet(LLVMContext &C, unsigned ID) {
)",
ID);
for (const CodeGenIntrinsic::ArgAttribute &Attr : Attrs) {
if (Attr.Kind == CodeGenIntrinsic::NoCapture) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, as long as it will be renamed eventually.

@nikic
Copy link
Contributor Author

nikic commented Jan 21, 2025

Thanks for the reviews! I plan to land this after LLVM 20 branches next week, to avoid unnecessary last-minute disruption for the release.

@nikic nikic force-pushed the replace-nocapture branch from e7c0b49 to 1acfbaa Compare January 29, 2025 13:45
@nikic nikic merged commit 29441e4 into llvm:main Jan 29, 2025
10 checks passed
@nikic nikic deleted the replace-nocapture branch January 29, 2025 15:56
nikic added a commit that referenced this pull request Jan 29, 2025
This case is intended to check the callee argument, not the call-site.

Fixes an issue introduced in #123181.
zmodem added a commit to zmodem/rust that referenced this pull request Jan 30, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Jan 31, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
LLVM changed the nocapture attribute to captures(none)

This updates RustWrapper.cpp and tests after
llvm/llvm-project#123181
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 31, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Rollup merge of rust-lang#136287 - zmodem:nocapture, r=nikic

LLVM changed the nocapture attribute to captures(none)

This updates RustWrapper.cpp and tests after
llvm/llvm-project#123181
kzhuravl pushed a commit to ROCm/llvm-project that referenced this pull request Jan 31, 2025
kzhuravl pushed a commit to ROCm/llvm-project that referenced this pull request Jan 31, 2025
This PR removes the old `nocapture` attribute, replacing it with the new
`captures` attribute introduced in llvm#116990. This change is
intended to be essentially NFC, replacing existing uses of `nocapture`
with `captures(none)` without adding any new analysis capabilities.
Making use of non-`none` values is left for a followup.

Some notes:
* `nocapture` will be upgraded to `captures(none)` by the bitcode
   reader.
* `nocapture` will also be upgraded by the textual IR reader. This is to
   make it easier to use old IR files and somewhat reduce the test churn in
   this PR.
* Helper APIs like `doesNotCapture()` will check for `captures(none)`.
* MLIR import will convert `captures(none)` into an `llvm.nocapture`
   attribute. The representation in the LLVM IR dialect should be updated
   separately.
kzhuravl pushed a commit to ROCm/llvm-project that referenced this pull request Jan 31, 2025
This case is intended to check the callee argument, not the call-site.

Fixes an issue introduced in llvm#123181.
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Feb 1, 2025

Unverified

The signature in this commit could not be verified. Someone may be trying to trick you.
LLVM changed the nocapture attribute to captures(none)

This updates RustWrapper.cpp and tests after
llvm/llvm-project#123181
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Feb 1, 2025

Unverified

The signature in this commit could not be verified. Someone may be trying to trick you.
LLVM changed the nocapture attribute to captures(none)

This updates RustWrapper.cpp and tests after
llvm/llvm-project#123181
fifield added a commit to Xilinx/mlir-aie that referenced this pull request Feb 6, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
llvm/llvm-project#123181 replaces `nocapture` with `capture(none)`, which causes a problem for chess. For example https://github.com/Xilinx/mlir-aie/actions/runs/13077904662/job/36494451051
searlmc1 pushed a commit to ROCm/llvm-project that referenced this pull request Mar 1, 2025
This PR removes the old `nocapture` attribute, replacing it with the new
`captures` attribute introduced in llvm#116990. This change is
intended to be essentially NFC, replacing existing uses of `nocapture`
with `captures(none)` without adding any new analysis capabilities.
Making use of non-`none` values is left for a followup.

Some notes:
* `nocapture` will be upgraded to `captures(none)` by the bitcode
   reader.
* `nocapture` will also be upgraded by the textual IR reader. This is to
   make it easier to use old IR files and somewhat reduce the test churn in
   this PR.
* Helper APIs like `doesNotCapture()` will check for `captures(none)`.
* MLIR import will convert `captures(none)` into an `llvm.nocapture`
   attribute. The representation in the LLVM IR dialect should be updated
   separately.
searlmc1 pushed a commit to ROCm/llvm-project that referenced this pull request Mar 1, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:AArch64 backend:AMDGPU backend:DirectX backend:Hexagon backend:NVPTX backend:PowerPC backend:SystemZ backend:X86 clang:codegen IR generation bugs: mangling, exceptions, etc. clang:openmp OpenMP related changes to Clang clang Clang issues not falling into any other category coroutines C++20 coroutines flang:fir-hlfir flang:openmp flang Flang issues not falling into any other category function-specialization HLSL HLSL Language Support llvm:analysis llvm:instcombine llvm:ir llvm:support llvm:transforms LTO Link time optimization (regular/full LTO or ThinLTO) mlir:llvm mlir tablegen
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

4 participants