aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorKrzysztof Drewniak <Krzysztof.Drewniak@amd.com>2024-06-03 14:37:08 -0700
committerGitHub <noreply@github.com>2024-06-03 16:37:08 -0500
commite31bfc040a240c4ba8b24df840290d6f31b83bfc (patch)
tree84111b1f5351b1ce7b083cd333f5720c627abe65 /clang/lib/CodeGen/CodeGenModule.cpp
parenta4bc44ad675a36c43eec9e08d5360f97ca97c389 (diff)
downloadllvm-e31bfc040a240c4ba8b24df840290d6f31b83bfc.zip
llvm-e31bfc040a240c4ba8b24df840290d6f31b83bfc.tar.gz
llvm-e31bfc040a240c4ba8b24df840290d6f31b83bfc.tar.bz2
[AMDGPU] Strengthen preload intrinsics to noundef and nonnull (#92801)
The various preloaded registers (workitem IDs, workgroup IDs, and various implicit pointers) always have a finite, invariant, well-defined value throughout a well-defined program. In cases where the compiler infers or the user declares that some implicit input will not be used (ex. via amdgcn-no-workitem-id-y), the behavior of the entire program is undefined, since that misdeclaration can cause arbitrary other preloaded-register intrinsics to access the wrong register. This case is not expected to arise in practice, but could occur when the no implicit argument attributes were not cleared correctly in the presence of external functions, indrect calls, or other means of executing un-analyzable code. Failure to detect that case would be a bug in the attributor. This commit updates the documentation to reflect this long-standing reality. Then, on the basis that all implicit arguments are defined in all correct programs, the intrinsics that return those values are annototated with `noundef``. Some implicit pointer arguments gain a `nonnull`, but the kernel argument segment pointer or implicit argument pointers don't necessarily have this property. This will prevent spurious calls to `freeze` in front-end optimizations that destroy user-provided ranges on built-in IDs. (While I'm here, this commit adds a test for `noundef` on kernel arguments which is currently unimplemented)
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions