@@ -15,8 +15,10 @@ def global_ptr_ty : LLVMQualPointerType<1>;
15
15
// The amdgpu-no-* attributes (ex amdgpu-no-workitem-id-z) typically inferred
16
16
// by the backend cause whole-program undefined behavior when violated, such as
17
17
// by causing all other preload register intrinsics to return arbitrarily incorrect
18
- // values. Outside of such IR-level UB, these preloaded registers are always set
19
- // to a well-defined value and are thus `noundef`.
18
+ // values. In non-entry-point functions, attempting to call a function that needs
19
+ // some preloaded register from a function that is known to not need it is a violation
20
+ // of the calling convention and also program-level UB. Outside of such IR-level UB,
21
+ // these preloaded registers are always set to a well-defined value and are thus `noundef`.
20
22
class AMDGPUReadPreloadRegisterIntrinsic
21
23
: DefaultAttrsIntrinsic<[llvm_i32_ty], [], [NoUndef<RetIndex>, IntrNoMem, IntrSpeculatable]>;
22
24
@@ -159,12 +161,12 @@ def int_amdgcn_queue_ptr :
159
161
def int_amdgcn_kernarg_segment_ptr :
160
162
ClangBuiltin<"__builtin_amdgcn_kernarg_segment_ptr">,
161
163
DefaultAttrsIntrinsic<[LLVMQualPointerType<4>], [],
162
- [Align<RetIndex, 4>, NoUndef<RetIndex>, NonNull<RetIndex>, IntrNoMem, IntrSpeculatable]>;
164
+ [Align<RetIndex, 4>, NoUndef<RetIndex>, IntrNoMem, IntrSpeculatable]>;
163
165
164
166
def int_amdgcn_implicitarg_ptr :
165
167
ClangBuiltin<"__builtin_amdgcn_implicitarg_ptr">,
166
168
DefaultAttrsIntrinsic<[LLVMQualPointerType<4>], [],
167
- [Align<RetIndex, 4>, NoUndef<RetIndex>, NonNull<RetIndex>, IntrNoMem, IntrSpeculatable]>;
169
+ [Align<RetIndex, 4>, NoUndef<RetIndex>, IntrNoMem, IntrSpeculatable]>;
168
170
169
171
// Returns the amount of LDS statically allocated for this program.
170
172
// This is no longer guaranteed to be a compile-time constant due to linking
@@ -184,8 +186,7 @@ def int_amdgcn_lds_kernel_id :
184
186
def int_amdgcn_implicit_buffer_ptr :
185
187
ClangBuiltin<"__builtin_amdgcn_implicit_buffer_ptr">,
186
188
DefaultAttrsIntrinsic<[LLVMQualPointerType<4>], [],
187
- [Align<RetIndex, 4>, Dereferenceable<RetIndex, 16>,
188
- NoUndef<RetIndex>, NonNull<RetIndex>,
189
+ [Align<RetIndex, 4>, NoUndef<RetIndex>,
189
190
IntrNoMem, IntrSpeculatable]>;
190
191
191
192
// Set EXEC to the 64-bit value given.
0 commit comments