[clang] [CodeGen] Apply 'readonly' to 'this' pointer argument. (PR #106499)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 28 23:36:04 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-coroutines
Author: Zhijin Zeng (zengdage)
<details>
<summary>Changes</summary>
As I known, 'this' pointer argument can't be changed in c++ instance method, and it always pointer to the current object itself, so maybe need to add 'readonly' attribute to it.
---
Patch is 5.41 MiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/106499.diff
190 Files Affected:
- (modified) clang/lib/CodeGen/CGCall.cpp (+1)
- (modified) clang/test/CodeGen/attr-counted-by-pr88931.cpp (+2-2)
- (modified) clang/test/CodeGen/attr-noundef.cpp (+3-3)
- (modified) clang/test/CodeGen/paren-list-agg-init.cpp (+8-8)
- (modified) clang/test/CodeGenCUDA/offload_via_llvm.cu (+2-2)
- (modified) clang/test/CodeGenCUDA/record-layout.cu (+14-14)
- (modified) clang/test/CodeGenCUDA/vtbl.cu (+1-1)
- (modified) clang/test/CodeGenCXX/LoongArch/abi-lp64d-struct-inherit.cpp (+1-1)
- (modified) clang/test/CodeGenCXX/amdgcn-automatic-variable.cpp (+2-2)
- (modified) clang/test/CodeGenCXX/amdgcn-func-arg.cpp (+4-4)
- (modified) clang/test/CodeGenCXX/attr-musttail.cpp (+6-6)
- (modified) clang/test/CodeGenCXX/attr-target-clones-aarch64.cpp (+12-12)
- (modified) clang/test/CodeGenCXX/attr-target-version.cpp (+14-14)
- (modified) clang/test/CodeGenCXX/control-flow-in-stmt-expr.cpp (+6-6)
- (modified) clang/test/CodeGenCXX/cxx2a-consteval.cpp (+1-1)
- (modified) clang/test/CodeGenCXX/cxx2b-deducing-this.cpp (+1-1)
- (modified) clang/test/CodeGenCXX/fcheck-new.cpp (+1-1)
- (modified) clang/test/CodeGenCXX/for-range.cpp (+18-18)
- (modified) clang/test/CodeGenCXX/gh62818.cpp (+2-2)
- (modified) clang/test/CodeGenCXX/ibm128-declarations.cpp (+4-4)
- (modified) clang/test/CodeGenCXX/lambda-to-function-pointer-conversion.cpp (+4-4)
- (modified) clang/test/CodeGenCXX/matrix-casts.cpp (+2-2)
- (modified) clang/test/CodeGenCXX/microsoft-abi-cdecl-method-sret.cpp (+1-1)
- (modified) clang/test/CodeGenCXX/nrvo.cpp (+255-255)
- (modified) clang/test/CodeGenCXX/pr13396.cpp (+6-6)
- (modified) clang/test/CodeGenCXX/ptrauth-apple-kext-indirect-call-2.cpp (+1-1)
- (modified) clang/test/CodeGenCXX/ptrauth-apple-kext-indirect-call.cpp (+2-2)
- (modified) clang/test/CodeGenCXX/ptrauth-apple-kext-indirect-virtual-dtor-call.cpp (+5-5)
- (modified) clang/test/CodeGenCXX/ptrauth-member-function-pointer.cpp (+5-5)
- (modified) clang/test/CodeGenCXX/ptrauth-virtual-function.cpp (+23-23)
- (modified) clang/test/CodeGenCXX/this-nonnull.cpp (+4-4)
- (modified) clang/test/CodeGenCXX/trivial_abi_debuginfo.cpp (+2-2)
- (modified) clang/test/CodeGenCXX/vtt-address-space.cpp (+12-12)
- (modified) clang/test/CodeGenCoroutines/coro-suspend-cleanups.cpp (+1-1)
- (modified) clang/test/CodeGenHLSL/this-assignment-overload.hlsl (+4-4)
- (modified) clang/test/CodeGenHLSL/this-assignment.hlsl (+2-2)
- (modified) clang/test/CodeGenHLSL/this-reference.hlsl (+2-2)
- (modified) clang/test/CodeGenObjCXX/objc-struct-cxx-abi.mm (+3-3)
- (modified) clang/test/OpenMP/distribute_firstprivate_codegen.cpp (+68-68)
- (modified) clang/test/OpenMP/distribute_lastprivate_codegen.cpp (+76-76)
- (modified) clang/test/OpenMP/distribute_parallel_for_codegen.cpp (+16-16)
- (modified) clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp (+76-76)
- (modified) clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp (+92-92)
- (modified) clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp (+56-56)
- (modified) clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp (+92-92)
- (modified) clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp (+18-18)
- (modified) clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp (+134-134)
- (modified) clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp (+166-166)
- (modified) clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp (+78-78)
- (modified) clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp (+166-166)
- (modified) clang/test/OpenMP/distribute_private_codegen.cpp (+76-76)
- (modified) clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp (+126-126)
- (modified) clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp (+150-150)
- (modified) clang/test/OpenMP/distribute_simd_private_codegen.cpp (+150-150)
- (modified) clang/test/OpenMP/distribute_simd_reduction_codegen.cpp (+3-3)
- (modified) clang/test/OpenMP/for_firstprivate_codegen.cpp (+85-85)
- (modified) clang/test/OpenMP/for_lastprivate_codegen.cpp (+117-117)
- (modified) clang/test/OpenMP/for_linear_codegen.cpp (+35-35)
- (modified) clang/test/OpenMP/for_private_codegen.cpp (+37-37)
- (modified) clang/test/OpenMP/for_reduction_codegen.cpp ()
- (modified) clang/test/OpenMP/for_reduction_codegen_UDR.cpp (+107-107)
- (modified) clang/test/OpenMP/irbuilder_for_iterator.cpp (+9-9)
- (modified) clang/test/OpenMP/irbuilder_for_rangefor.cpp (+11-11)
- (modified) clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp (+17-17)
- (modified) clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp (+25-25)
- (modified) clang/test/OpenMP/nvptx_target_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp (+26-26)
- (modified) clang/test/OpenMP/parallel_copyin_codegen.cpp (+122-122)
- (modified) clang/test/OpenMP/parallel_firstprivate_codegen.cpp (+160-160)
- (modified) clang/test/OpenMP/parallel_for_linear_codegen.cpp (+17-17)
- (modified) clang/test/OpenMP/parallel_master_codegen.cpp (+9-9)
- (modified) clang/test/OpenMP/parallel_master_taskloop_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/parallel_master_taskloop_firstprivate_codegen.cpp (+141-141)
- (modified) clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp (+50-50)
- (modified) clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp (+28-28)
- (modified) clang/test/OpenMP/parallel_master_taskloop_simd_firstprivate_codegen.cpp (+141-141)
- (modified) clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp (+95-95)
- (modified) clang/test/OpenMP/parallel_private_codegen.cpp (+59-59)
- (modified) clang/test/OpenMP/parallel_reduction_codegen.cpp (+100-100)
- (modified) clang/test/OpenMP/reduction_compound_op.cpp (+106-106)
- (modified) clang/test/OpenMP/reduction_implicit_map.cpp (+8-8)
- (modified) clang/test/OpenMP/reverse_codegen.cpp (+8-8)
- (modified) clang/test/OpenMP/sections_firstprivate_codegen.cpp (+87-87)
- (modified) clang/test/OpenMP/sections_lastprivate_codegen.cpp (+93-93)
- (modified) clang/test/OpenMP/sections_private_codegen.cpp (+41-41)
- (modified) clang/test/OpenMP/sections_reduction_codegen.cpp (+79-79)
- (modified) clang/test/OpenMP/simd_private_taskloop_codegen.cpp (+158-158)
- (modified) clang/test/OpenMP/single_codegen.cpp (+132-132)
- (modified) clang/test/OpenMP/single_firstprivate_codegen.cpp ()
- (modified) clang/test/OpenMP/single_private_codegen.cpp ()
- (modified) clang/test/OpenMP/target_data_no_device_codegen.cpp (+2-2)
- (modified) clang/test/OpenMP/target_data_use_device_ptr_inheritance_codegen.cpp (+16-16)
- (modified) clang/test/OpenMP/target_firstprivate_codegen.cpp (+24-24)
- (modified) clang/test/OpenMP/target_has_device_addr_codegen.cpp (+30-30)
- (modified) clang/test/OpenMP/target_has_device_addr_codegen_01.cpp (+12-12)
- (modified) clang/test/OpenMP/target_in_reduction_codegen.cpp (+17-17)
- (modified) clang/test/OpenMP/target_is_device_ptr_codegen.cpp (+48-48)
- (modified) clang/test/OpenMP/target_map_codegen_hold.cpp (+4-4)
- (modified) clang/test/OpenMP/target_map_member_expr_codegen.cpp (+10-10)
- (modified) clang/test/OpenMP/target_ompx_dyn_cgroup_mem_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_parallel_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_parallel_for_codegen.cpp (+8-8)
- (modified) clang/test/OpenMP/target_parallel_for_simd_codegen.cpp (+16-16)
- (modified) clang/test/OpenMP/target_parallel_generic_loop_codegen-1.cpp (+304-304)
- (modified) clang/test/OpenMP/target_parallel_generic_loop_codegen-2.cpp (+6-6)
- (modified) clang/test/OpenMP/target_parallel_if_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_parallel_num_threads_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_teams_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_teams_distribute_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_teams_distribute_collapse_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_teams_distribute_dist_schedule_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp (+128-128)
- (modified) clang/test/OpenMP/target_teams_distribute_lastprivate_codegen.cpp (+76-76)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_collapse_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_dist_schedule_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp (+261-261)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_lastprivate_codegen.cpp (+92-92)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_private_codegen.cpp (+161-161)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_reduction_codegen.cpp (+2-2)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_schedule_codegen.cpp (+8-8)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_collapse_codegen.cpp (+8-8)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_dist_schedule_codegen.cpp (+8-8)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_codegen.cpp (+332-332)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_codegen.cpp (+166-166)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_private_codegen.cpp (+248-248)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_reduction_codegen.cpp (+3-3)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_schedule_codegen.cpp (+12-12)
- (modified) clang/test/OpenMP/target_teams_distribute_private_codegen.cpp (+88-88)
- (modified) clang/test/OpenMP/target_teams_distribute_reduction_codegen.cpp (+20-20)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_codegen.cpp (+16-16)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_collapse_codegen.cpp (+8-8)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_dist_schedule_codegen.cpp (+8-8)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp (+199-199)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_lastprivate_codegen.cpp (+150-150)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_private_codegen.cpp (+175-175)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_reduction_codegen.cpp (+3-3)
- (modified) clang/test/OpenMP/target_teams_generic_loop_collapse_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_teams_generic_loop_private_codegen.cpp (+129-129)
- (modified) clang/test/OpenMP/target_teams_generic_loop_reduction_codegen.cpp (+2-2)
- (modified) clang/test/OpenMP/target_teams_num_teams_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_teams_thread_limit_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/task_codegen.cpp (+160-160)
- (modified) clang/test/OpenMP/task_in_reduction_codegen.cpp (+17-17)
- (modified) clang/test/OpenMP/task_member_call_codegen.cpp (+2-2)
- (modified) clang/test/OpenMP/taskloop_in_reduction_codegen.cpp (+17-17)
- (modified) clang/test/OpenMP/taskloop_simd_in_reduction_codegen.cpp (+25-25)
- (modified) clang/test/OpenMP/teams_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/teams_distribute_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/teams_distribute_collapse_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/teams_distribute_dist_schedule_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/teams_distribute_firstprivate_codegen.cpp (+128-128)
- (modified) clang/test/OpenMP/teams_distribute_lastprivate_codegen.cpp (+76-76)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_collapse_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_copyin_codegen.cpp (+2-2)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_dist_schedule_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp (+160-160)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_lastprivate_codegen.cpp (+92-92)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_num_threads_codegen.cpp (+34-34)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_private_codegen.cpp (+104-104)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_reduction_codegen.cpp (+2-2)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_schedule_codegen.cpp (+8-8)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_simd_codegen.cpp (+8-8)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_simd_collapse_codegen.cpp (+8-8)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_simd_dist_schedule_codegen.cpp (+8-8)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_codegen.cpp (+231-231)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_simd_lastprivate_codegen.cpp (+166-166)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_simd_num_threads_codegen.cpp (+48-48)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_simd_private_codegen.cpp (+191-191)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_simd_reduction_codegen.cpp (+3-3)
- (modified) clang/test/OpenMP/teams_distribute_parallel_for_simd_schedule_codegen.cpp (+12-12)
- (modified) clang/test/OpenMP/teams_distribute_private_codegen.cpp (+88-88)
- (modified) clang/test/OpenMP/teams_distribute_reduction_codegen.cpp (+2-2)
- (modified) clang/test/OpenMP/teams_distribute_simd_codegen.cpp (+16-16)
- (modified) clang/test/OpenMP/teams_distribute_simd_collapse_codegen.cpp (+8-8)
- (modified) clang/test/OpenMP/teams_distribute_simd_dist_schedule_codegen.cpp (+8-8)
- (modified) clang/test/OpenMP/teams_distribute_simd_firstprivate_codegen.cpp (+199-199)
- (modified) clang/test/OpenMP/teams_distribute_simd_lastprivate_codegen.cpp (+150-150)
- (modified) clang/test/OpenMP/teams_distribute_simd_private_codegen.cpp (+175-175)
- (modified) clang/test/OpenMP/teams_distribute_simd_reduction_codegen.cpp (+3-3)
- (modified) clang/test/OpenMP/teams_firstprivate_codegen.cpp (+128-128)
- (modified) clang/test/OpenMP/teams_generic_loop_codegen-1.cpp (+4-4)
- (modified) clang/test/OpenMP/teams_generic_loop_collapse_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/teams_generic_loop_private_codegen.cpp (+88-88)
- (modified) clang/test/OpenMP/teams_generic_loop_reduction_codegen.cpp (+2-2)
- (modified) clang/test/OpenMP/teams_private_codegen.cpp (+112-112)
- (modified) clang/test/OpenMP/threadprivate_codegen.cpp (+520-520)
- (modified) clang/test/OpenMP/tile_codegen.cpp (+8-8)
- (modified) clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected (+6-6)
- (modified) clang/test/utils/update_cc_test_checks/Inputs/explicit-template-instantiation.cpp.expected (+10-10)
``````````diff
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index ca2c79b51ac96b..7a3a3a8113e465 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -2673,6 +2673,7 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
/*TBAAInfo=*/nullptr, /*forPointeeType=*/true)
.getAsAlign();
Attrs.addAlignmentAttr(Alignment);
+ Attrs.addAttribute(llvm::Attribute::ReadOnly);
ArgAttrs[IRArgs.first] = llvm::AttributeSet::get(getLLVMContext(), Attrs);
}
diff --git a/clang/test/CodeGen/attr-counted-by-pr88931.cpp b/clang/test/CodeGen/attr-counted-by-pr88931.cpp
index 2a8cc1d07e50d9..4210b561ab0859 100644
--- a/clang/test/CodeGen/attr-counted-by-pr88931.cpp
+++ b/clang/test/CodeGen/attr-counted-by-pr88931.cpp
@@ -11,9 +11,9 @@ struct foo {
void init(void * __attribute__((pass_dynamic_object_size(0))));
// CHECK-LABEL: define dso_local void @_ZN3foo3barC1Ev(
-// CHECK-SAME: ptr noundef nonnull align 4 dereferenceable(1) [[THIS:%.*]]) unnamed_addr #[[ATTR0:[0-9]+]] align 2 {
+// CHECK-SAME: ptr noundef nonnull readonly align 4 dereferenceable(1) [[THIS:%.*]]) unnamed_addr #[[ATTR0:[0-9]+]] align 2 {
// CHECK-NEXT: entry:
-// CHECK-NEXT: tail call void @_Z4initPvU25pass_dynamic_object_size0(ptr noundef nonnull [[THIS]], i64 noundef -1) #[[ATTR2:[0-9]+]]
+// CHECK-NEXT: tail call void @_Z4initPvU25pass_dynamic_object_size0(ptr noundef nonnull readonly [[THIS]], i64 noundef -1) #[[ATTR2:[0-9]+]]
// CHECK-NEXT: ret void
//
foo::bar::bar() {
diff --git a/clang/test/CodeGen/attr-noundef.cpp b/clang/test/CodeGen/attr-noundef.cpp
index abdf9496bd3963..c9ea72814711fb 100644
--- a/clang/test/CodeGen/attr-noundef.cpp
+++ b/clang/test/CodeGen/attr-noundef.cpp
@@ -85,9 +85,9 @@ void use_object() {
obj.getData();
obj.getThis();
}
-// CHECK: define linkonce_odr void @{{.*}}Object{{.*}}(ptr noundef nonnull align 4 dereferenceable(1) %
-// CHECK: define linkonce_odr noundef i32 @{{.*}}Object{{.*}}getData{{.*}}(ptr noundef nonnull align 4 dereferenceable(1) %
-// CHECK: define linkonce_odr noundef ptr @{{.*}}Object{{.*}}getThis{{.*}}(ptr noundef nonnull align 4 dereferenceable(1) %
+// CHECK: define linkonce_odr void @{{.*}}Object{{.*}}(ptr noundef nonnull readonly align 4 dereferenceable(1) %
+// CHECK: define linkonce_odr noundef i32 @{{.*}}Object{{.*}}getData{{.*}}(ptr noundef nonnull readonly align 4 dereferenceable(1) %
+// CHECK: define linkonce_odr noundef ptr @{{.*}}Object{{.*}}getThis{{.*}}(ptr noundef nonnull readonly align 4 dereferenceable(1) %
} // namespace check_this
//************ Passing vector types
diff --git a/clang/test/CodeGen/paren-list-agg-init.cpp b/clang/test/CodeGen/paren-list-agg-init.cpp
index 235352382332a6..4686d34f64322d 100644
--- a/clang/test/CodeGen/paren-list-agg-init.cpp
+++ b/clang/test/CodeGen/paren-list-agg-init.cpp
@@ -390,13 +390,13 @@ namespace gh61145 {
// CHECK-NEXT: [[V:%.*v.*]] = alloca [[STRUCT_VEC]], align 1
// CHECK-NEXT: [[AGG_TMP_ENSURED:%.*agg.tmp.ensured.*]] = alloca [[STRUCT_S1]], align 1
// a.k.a. Vec::Vec()
- // CHECK-NEXT: call void @_ZN7gh611453VecC1Ev(ptr noundef nonnull align 1 dereferenceable(1) [[V]])
+ // CHECK-NEXT: call void @_ZN7gh611453VecC1Ev(ptr noundef nonnull readonly align 1 dereferenceable(1) [[V]])
// a.k.a. Vec::Vec(Vec&&)
- // CHECK-NEXT: call void @_ZN7gh611453VecC1EOS0_(ptr noundef nonnull align 1 dereferenceable(1) [[AGG_TMP_ENSURED]], ptr noundef nonnull align 1 dereferenceable(1) [[V]])
+ // CHECK-NEXT: call void @_ZN7gh611453VecC1EOS0_(ptr noundef nonnull readonly align 1 dereferenceable(1) [[AGG_TMP_ENSURED]], ptr noundef nonnull align 1 dereferenceable(1) [[V]])
// a.k.a. S1::~S1()
- // CHECK-NEXT: call void @_ZN7gh611452S1D1Ev(ptr noundef nonnull align 1 dereferenceable(1) [[AGG_TMP_ENSURED]])
+ // CHECK-NEXT: call void @_ZN7gh611452S1D1Ev(ptr noundef nonnull readonly align 1 dereferenceable(1) [[AGG_TMP_ENSURED]])
// a.k.a.Vec::~Vec()
- // CHECK-NEXT: call void @_ZN7gh611453VecD1Ev(ptr noundef nonnull align 1 dereferenceable(1) [[V]])
+ // CHECK-NEXT: call void @_ZN7gh611453VecD1Ev(ptr noundef nonnull readonly align 1 dereferenceable(1) [[V]])
// CHECK-NEXT: ret void
template <int I>
void make1() {
@@ -410,15 +410,15 @@ namespace gh61145 {
// CHECK-NEXT: [[V:%.*v.*]] = alloca [[STRUCT_VEC]], align 1
// CHECK-NEXT: [[AGG_TMP_ENSURED:%.*agg.tmp.ensured.*]] = alloca [[STRUCT_S2]], align 1
// a.k.a. Vec::Vec()
- // CHECK-NEXT: call void @_ZN7gh611453VecC1Ev(ptr noundef nonnull align 1 dereferenceable(1) [[V]])
+ // CHECK-NEXT: call void @_ZN7gh611453VecC1Ev(ptr noundef nonnull readonly align 1 dereferenceable(1) [[V]])
// a.k.a. Vec::Vec(Vec&&)
- // CHECK-NEXT: call void @_ZN7gh611453VecC1EOS0_(ptr noundef nonnull align 1 dereferenceable(1) [[AGG_TMP_ENSURED]], ptr noundef nonnull align 1 dereferenceable(1) [[V]])
+ // CHECK-NEXT: call void @_ZN7gh611453VecC1EOS0_(ptr noundef nonnull readonly align 1 dereferenceable(1) [[AGG_TMP_ENSURED]], ptr noundef nonnull align 1 dereferenceable(1) [[V]])
// CHECK-NEXT: [[C:%.*c.*]] = getelementptr inbounds nuw [[STRUCT_S2]], ptr [[AGG_TMP_ENSURED]], i32 0, i32
// CHECK-NEXT: store i8 0, ptr [[C]], align 1
// a.k.a. S2::~S2()
- // CHECK-NEXT: call void @_ZN7gh611452S2D1Ev(ptr noundef nonnull align 1 dereferenceable(2) [[AGG_TMP_ENSURED]])
+ // CHECK-NEXT: call void @_ZN7gh611452S2D1Ev(ptr noundef nonnull readonly align 1 dereferenceable(2) [[AGG_TMP_ENSURED]])
// a.k.a. Vec::~Vec()
- // CHECK-NEXT: call void @_ZN7gh611453VecD1Ev(ptr noundef nonnull align 1 dereferenceable(1) [[V]])
+ // CHECK-NEXT: call void @_ZN7gh611453VecD1Ev(ptr noundef nonnull readonly align 1 dereferenceable(1) [[V]])
// CHECK-NEXT: ret void
template <int I>
void make2() {
diff --git a/clang/test/CodeGenCUDA/offload_via_llvm.cu b/clang/test/CodeGenCUDA/offload_via_llvm.cu
index 434eba99c1795d..e729967949a0c8 100644
--- a/clang/test/CodeGenCUDA/offload_via_llvm.cu
+++ b/clang/test/CodeGenCUDA/offload_via_llvm.cu
@@ -72,8 +72,8 @@ __global__ void foo(int, short, void *, void *) {}
// HST-NEXT: [[AGG_TMP:%.*]] = alloca [[STRUCT_DIM3:%.*]], align 4
// HST-NEXT: [[AGG_TMP1:%.*]] = alloca [[STRUCT_DIM3]], align 4
// HST-NEXT: store ptr [[PTR]], ptr [[PTR_ADDR]], align 4
-// HST-NEXT: call void @_ZN4dim3C1Ejjj(ptr noundef nonnull align 4 dereferenceable(12) [[AGG_TMP]], i32 noundef 3, i32 noundef 1, i32 noundef 1)
-// HST-NEXT: call void @_ZN4dim3C1Ejjj(ptr noundef nonnull align 4 dereferenceable(12) [[AGG_TMP1]], i32 noundef 7, i32 noundef 1, i32 noundef 1)
+// HST-NEXT: call void @_ZN4dim3C1Ejjj(ptr noundef nonnull readonly align 4 dereferenceable(12) [[AGG_TMP]], i32 noundef 3, i32 noundef 1, i32 noundef 1)
+// HST-NEXT: call void @_ZN4dim3C1Ejjj(ptr noundef nonnull readonly align 4 dereferenceable(12) [[AGG_TMP1]], i32 noundef 7, i32 noundef 1, i32 noundef 1)
// HST-NEXT: [[CALL:%.*]] = call i32 @__llvmPushCallConfiguration(ptr noundef byval([[STRUCT_DIM3]]) align 4 [[AGG_TMP]], ptr noundef byval([[STRUCT_DIM3]]) align 4 [[AGG_TMP1]], i32 noundef 0, ptr noundef null)
// HST-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[CALL]], 0
// HST-NEXT: br i1 [[TOBOOL]], label %[[KCALL_END:.*]], label %[[KCALL_CONFIGOK:.*]]
diff --git a/clang/test/CodeGenCUDA/record-layout.cu b/clang/test/CodeGenCUDA/record-layout.cu
index 847a81d88d280c..781151dd1a6885 100644
--- a/clang/test/CodeGenCUDA/record-layout.cu
+++ b/clang/test/CodeGenCUDA/record-layout.cu
@@ -101,12 +101,12 @@ void test_C() {
// DEV: %vtable = load ptr addrspace(1), ptr %2, align 8
// DEV: %vfn = getelementptr inbounds ptr addrspace(1), ptr addrspace(1) %vtable, i64 1
// DEV: %3 = load ptr addrspace(1), ptr addrspace(1) %vfn, align 8
-// DEV: call addrspace(1) void %3(ptr noundef nonnull align 8 dereferenceable(24) %2)
+// DEV: call addrspace(1) void %3(ptr noundef nonnull readonly align 8 dereferenceable(24) %2)
// DEV: %4 = load ptr, ptr %j.addr.ascast, align 8
// DEV: %vtable2 = load ptr addrspace(1), ptr %4, align 8
// DEV: %vfn3 = getelementptr inbounds ptr addrspace(1), ptr addrspace(1) %vtable2, i64 2
// DEV: %5 = load ptr addrspace(1), ptr addrspace(1) %vfn3, align 8
-// DEV: call addrspace(1) void %5(ptr noundef nonnull align 8 dereferenceable(24) %4)
+// DEV: call addrspace(1) void %5(ptr noundef nonnull readonly align 8 dereferenceable(24) %4)
__device__ void J_dev(J *j) {
j->i = 2;
@@ -118,7 +118,7 @@ __device__ void J_dev(J *j) {
// DEV: define dso_local amdgpu_kernel void @_Z8J_kernelv()
// DEV: %j = alloca %struct.J, align 8, addrspace(5)
// DEV: %j.ascast = addrspacecast ptr addrspace(5) %j to ptr
-// DEV: call void @_ZN1JC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %j.ascast)
+// DEV: call void @_ZN1JC1Ev(ptr noundef nonnull readonly align 8 dereferenceable(24) %j.ascast)
// DEV: call void @_Z5J_devP1J(ptr noundef %j.ascast)
__global__ void J_kernel() {
@@ -137,12 +137,12 @@ __global__ void J_kernel() {
// HOST: %vtable = load ptr, ptr %2, align 8
// HOST: %vfn = getelementptr inbounds ptr, ptr %vtable, i64 0
// HOST: %3 = load ptr, ptr %vfn, align 8
-// HOST: call void %3(ptr noundef nonnull align 8 dereferenceable(24) %2)
+// HOST: call void %3(ptr noundef nonnull readonly align 8 dereferenceable(24) %2)
// HOST: %4 = load ptr, ptr %j.addr, align 8
// HOST: %vtable2 = load ptr, ptr %4, align 8
// HOST: %vfn3 = getelementptr inbounds ptr, ptr %vtable2, i64 2
// HOST: %5 = load ptr, ptr %vfn3, align 8
-// HOST: call void %5(ptr noundef nonnull align 8 dereferenceable(24) %4)
+// HOST: call void %5(ptr noundef nonnull readonly align 8 dereferenceable(24) %4)
void J_host(J *j) {
j->i = 12;
@@ -153,7 +153,7 @@ void J_host(J *j) {
// HOST: define dso_local void @"?test_J@@YAXXZ"()
// HOST: %j = alloca %struct.J, align 8
-// HOST: %call = call noundef ptr @"??0J@@QEAA at XZ"(ptr noundef nonnull align 8 dereferenceable(24) %j)
+// HOST: %call = call noundef ptr @"??0J@@QEAA at XZ"(ptr noundef nonnull readonly align 8 dereferenceable(24) %j)
// HOST: call void @"?J_host@@YAXPEAUJ@@@Z"(ptr noundef %j)
void test_J() {
@@ -162,37 +162,37 @@ void test_J() {
J_kernel<<<1, 1>>>();
}
-// HOST: define linkonce_odr dso_local noundef ptr @"??0J@@QEAA at XZ"(ptr noundef nonnull returned align 8 dereferenceable(24) %this)
+// HOST: define linkonce_odr dso_local noundef ptr @"??0J@@QEAA at XZ"(ptr noundef nonnull readonly returned align 8 dereferenceable(24) %this)
// HOST: %this.addr = alloca ptr, align 8
// HOST: store ptr %this, ptr %this.addr, align 8
// HOST: %this1 = load ptr, ptr %this.addr, align 8
-// HOST: %call = call noundef ptr @"??0I@@QEAA at XZ"(ptr noundef nonnull align 8 dereferenceable(16) %this1) #5
+// HOST: %call = call noundef ptr @"??0I@@QEAA at XZ"(ptr noundef nonnull readonly align 8 dereferenceable(16) %this1) #5
// HOST: store ptr @"??_7J@@6B@", ptr %this1, align 8
// HOST: ret ptr %this1
-// HOST: define linkonce_odr dso_local noundef ptr @"??0I@@QEAA at XZ"(ptr noundef nonnull returned align 8 dereferenceable(16) %this)
+// HOST: define linkonce_odr dso_local noundef ptr @"??0I@@QEAA at XZ"(ptr noundef nonnull readonly returned align 8 dereferenceable(16) %this)
// HOST: %this.addr = alloca ptr, align 8
// HOST: store ptr %this, ptr %this.addr, align 8
// HOST: %this1 = load ptr, ptr %this.addr, align 8
// HOST: store ptr @"??_7I@@6B@", ptr %this1, align 8
// HOST: ret ptr %this1
-// DEV: define linkonce_odr void @_ZN1JC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %this)
+// DEV: define linkonce_odr void @_ZN1JC1Ev(ptr noundef nonnull readonly align 8 dereferenceable(24) %this)
// DEV: %this.addr = alloca ptr, align 8, addrspace(5)
// DEV: %this.addr.ascast = addrspacecast ptr addrspace(5) %this.addr to ptr
// DEV: store ptr %this, ptr %this.addr.ascast, align 8
// DEV: %this1 = load ptr, ptr %this.addr.ascast, align 8
-// DEV: call void @_ZN1JC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %this1)
+// DEV: call void @_ZN1JC2Ev(ptr noundef nonnull readonly align 8 dereferenceable(24) %this1)
-// DEV: define linkonce_odr void @_ZN1JC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %this)
+// DEV: define linkonce_odr void @_ZN1JC2Ev(ptr noundef nonnull readonly align 8 dereferenceable(24) %this)
// DEV: %this.addr = alloca ptr, align 8, addrspace(5)
// DEV: %this.addr.ascast = addrspacecast ptr addrspace(5) %this.addr to ptr
// DEV: store ptr %this, ptr %this.addr.ascast, align 8
// DEV: %this1 = load ptr, ptr %this.addr.ascast, align 8
-// DEV: call void @_ZN1IC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %this1)
+// DEV: call void @_ZN1IC2Ev(ptr noundef nonnull readonly align 8 dereferenceable(16) %this1)
// DEV: store ptr addrspace(1) getelementptr inbounds inrange(-16, 24) ({ [5 x ptr addrspace(1)] }, ptr addrspace(1) @_ZTV1J, i32 0, i32 0, i32 2), ptr %this1, align 8
-// DEV: define linkonce_odr void @_ZN1IC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %this)
+// DEV: define linkonce_odr void @_ZN1IC2Ev(ptr noundef nonnull readonly align 8 dereferenceable(16) %this)
// DEV: %this.addr = alloca ptr, align 8, addrspace(5)
// DEV: %this.addr.ascast = addrspacecast ptr addrspace(5) %this.addr to ptr
// DEV: store ptr %this, ptr %this.addr.ascast, align 8
diff --git a/clang/test/CodeGenCUDA/vtbl.cu b/clang/test/CodeGenCUDA/vtbl.cu
index 4c3bb8436c49fe..32bfda0371a143 100644
--- a/clang/test/CodeGenCUDA/vtbl.cu
+++ b/clang/test/CodeGenCUDA/vtbl.cu
@@ -3,7 +3,7 @@
#include "Inputs/cuda.h"
-// CHECK-LABEL: define {{.*}}@_ZN1AC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %this)
+// CHECK-LABEL: define {{.*}}@_ZN1AC2Ev(ptr noundef nonnull readonly align 8 dereferenceable(8) %this)
// CHECK: store ptr %this, ptr %this.addr.ascast
// CHECK: %this1 = load ptr, ptr %this.addr.ascast
// CHECK: store ptr addrspace(1) {{.*}} @_ZTV1A{{.*}}, ptr %this1
diff --git a/clang/test/CodeGenCXX/LoongArch/abi-lp64d-struct-inherit.cpp b/clang/test/CodeGenCXX/LoongArch/abi-lp64d-struct-inherit.cpp
index 6d8018564bd6c7..8680a0a8fdfb01 100644
--- a/clang/test/CodeGenCXX/LoongArch/abi-lp64d-struct-inherit.cpp
+++ b/clang/test/CodeGenCXX/LoongArch/abi-lp64d-struct-inherit.cpp
@@ -69,7 +69,7 @@ struct child5_virtual_s : virtual parent5_virtual_s {
float f1;
};
-// CHECK-LABEL: define{{.*}} void @_ZN16child5_virtual_sC1EOS_(ptr noundef nonnull align 8 dereferenceable(12) %this, ptr noundef nonnull align 8 dereferenceable(12) %0)
+// CHECK-LABEL: define{{.*}} void @_ZN16child5_virtual_sC1EOS_(ptr noundef nonnull readonly align 8 dereferenceable(12) %this, ptr noundef nonnull align 8 dereferenceable(12) %0)
struct child5_virtual_s int32_float_virtual_struct_inheritance(struct child5_virtual_s a) {
return a;
}
diff --git a/clang/test/CodeGenCXX/amdgcn-automatic-variable.cpp b/clang/test/CodeGenCXX/amdgcn-automatic-variable.cpp
index c1f93101410006..816b088c200424 100644
--- a/clang/test/CodeGenCXX/amdgcn-automatic-variable.cpp
+++ b/clang/test/CodeGenCXX/amdgcn-automatic-variable.cpp
@@ -74,8 +74,8 @@ int x;
// CHECK-NEXT: entry:
// CHECK-NEXT: [[A:%.*]] = alloca [[CLASS_A:%.*]], align 4, addrspace(5)
// CHECK-NEXT: [[A_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[A]] to ptr
-// CHECK-NEXT: call void @_ZN1AC1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[A_ASCAST]])
-// CHECK-NEXT: call void @_ZN1AD1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[A_ASCAST]])
+// CHECK-NEXT: call void @_ZN1AC1Ev(ptr noundef nonnull readonly align 4 dereferenceable(4) [[A_ASCAST]])
+// CHECK-NEXT: call void @_ZN1AD1Ev(ptr noundef nonnull readonly align 4 dereferenceable(4) [[A_ASCAST]])
// CHECK-NEXT: ret void
//
void func3() {
diff --git a/clang/test/CodeGenCXX/amdgcn-func-arg.cpp b/clang/test/CodeGenCXX/amdgcn-func-arg.cpp
index a5f83dc91b0381..7ef65f430d4cd6 100644
--- a/clang/test/CodeGenCXX/amdgcn-func-arg.cpp
+++ b/clang/test/CodeGenCXX/amdgcn-func-arg.cpp
@@ -39,13 +39,13 @@ void func_with_indirect_arg(A a) {
// CHECK-NEXT: [[AGG_TMP:%.*]] = alloca [[CLASS_A]], align 4, addrspace(5)
// CHECK-NEXT: [[A_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[A]] to ptr
// CHECK-NEXT: [[AGG_TMP_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[AGG_TMP]] to ptr
-// CHECK-NEXT: call void @_ZN1AC1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[A_ASCAST]])
+// CHECK-NEXT: call void @_ZN1AC1Ev(ptr noundef nonnull readonly align 4 dereferenceable(4) [[A_ASCAST]])
// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[AGG_TMP_ASCAST]], ptr align 4 [[A_ASCAST]], i64 4, i1 false)
// CHECK-NEXT: [[AGG_TMP_ASCAST_ASCAST:%.*]] = addrspacecast ptr [[AGG_TMP_ASCAST]] to ptr addrspace(5)
// CHECK-NEXT: call void @_Z22func_with_indirect_arg1A(ptr addrspace(5) noundef [[AGG_TMP_ASCAST_ASCAST]])
-// CHECK-NEXT: call void @_ZN1AD1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[AGG_TMP_ASCAST]])
+// CHECK-NEXT: call void @_ZN1AD1Ev(ptr noundef nonnull readonly align 4 dereferenceable(4) [[AGG_TMP_ASCAST]])
// CHECK-NEXT: call void @_Z17func_with_ref_argR1A(ptr noundef nonnull align 4 dereferenceable(4) [[A_ASCAST]])
-// CHECK-NEXT: call void @_ZN1AD1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[A_ASCAST]])
+// CHECK-NEXT: call void @_ZN1AD1Ev(ptr noundef nonnull readonly align 4 dereferenceable(4) [[A_ASCAST]])
// CHECK-NEXT: ret void
//
void test_indirect_arg_auto() {
@@ -61,7 +61,7 @@ void test_indirect_arg_auto() {
// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[AGG_TMP_ASCAST]], ptr align 4 addrspacecast (ptr addrspace(1) @g_a to ptr), i64 4, i1 false)
// CHECK-NEXT: [[AGG_TMP_ASCAST_ASCAST:%.*]] = addrspacecast ptr [[AGG_TMP_ASCAST]] to ptr addrspace(5)
// CHECK-NEXT: call void @_Z22func_with_indirect_arg1A(ptr addrspace(5) noundef [[AGG_TMP_ASCAST_ASCAST]])
-// CHECK-NEXT: call void @_ZN1AD1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[AGG_TMP_ASCAST]])
+// CHECK-NEXT: call void @_ZN1AD1Ev(ptr noundef nonnull readonly align 4 dereferenceable(4) [[AGG_TMP_ASCAST]])
// CHECK-NEXT: call void @_Z17func_with_ref_argR1A(ptr noundef nonnull align 4 dereferenceable(4) addrspacecast (ptr addrspace(1) @g_a to ptr))
// CHECK-NEXT: ret void
//
diff --git a/clang/test/CodeGenCXX/attr-musttail.cpp b/clang/test/CodeGenCXX/attr-musttail.cpp
index c0081ec232e4a6..83705d7aa898ce 100644
--- a/clang/test/CodeGenCXX/attr-musttail.cpp
+++ b/clang/test/CodeGenCXX/attr-musttail.cpp
@@ -36,7 +36,7 @@ int Foo::TailFrom(int x) {
[[clang::musttail]] return MemberFunction(x);
}
-// CHECK: %call = musttail call noundef i32 @_ZN3Foo14MemberFunctionEi(ptr noundef nonnull align 1 dereferenceable(1) %this1, i32 noundef %0)
+// CHECK: %call = musttail call noundef i32 @_ZN3Foo14MemberFunctionEi(ptr noundef nonnull readonly align 1 dereferenceable(1) %this1, i32 noundef %0)
int Func3(int x) {
[[clang::musttail]] return Foo::StaticMethod(x);
@@ -57,13 +57,13 @@ int Foo::TailFrom2(int x) {
[[clang::musttail]] return ((*this).*pmf)(x);
}
-// CHECK: %call = musttail call noundef i32 %5(ptr noundef nonnull align 1 dereferenceable(1) %1, i32 noundef %6)
+// CHECK: %call = musttail call noundef i32 %5(ptr noundef nonnull readonly align 1 dereferenceable(1) %1, i32 noundef %6)
int Foo::TailFrom3(int x) {
[[clang::musttail]] return (this->*pmf)(x);
}
-// CHECK: %call = musttail call noundef i32 %5(ptr noundef nonnull align 1 dereferenceable(1) %1, i32 noundef %6)
+// CHECK: %call = musttail call noundef i32 %5(ptr noundef nonnull readonly align 1 dereferenceable(1) %1, i32 noundef %6)
void ReturnsVoid();
@@ -152,7 +152,7 @@ void Struct3::NonConstMemberFunction(int *i) {
[[clang::musttail]] return ConstMemberFunction(i);
}
-// CHECK: musttail call void @_ZNK7Struct319ConstMemberFunctionEPKi(ptr noundef nonnull align 1 dereferenceable(1) %this1, ptr noundef %0)
+// CHECK: musttail call void @_ZNK7Struct319ConstMemberFunctionEPKi(ptr noundef nonnull readonly align 1 dereferenceable(1) %this1, ptr noundef %0)
struct HasNonTrivialCopyConstructor {
HasNonTrivialCopyConstructor(const HasNonTrivialCopyConstructor &);
@@ -213,7 +213,7 @@ int TestNonCapturingLambda() {
[[clang::musttail]] return (+lambda)();
}
-// CHECK: %call = call noundef ptr @"_ZZ22TestNonCapturing...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/106499
More information about the cfe-commits
mailing list