diff options
author | Yaxun (Sam) Liu <yaxun.liu@amd.com> | 2025-04-23 12:50:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-23 12:50:28 -0400 |
commit | 83c309b90550aa768ff9aa11b70898ee2c56b71e (patch) | |
tree | 25ca8d7844eb8491a36ad657547fb7195813a862 /clang/lib/AST/ByteCode/Compiler.cpp | |
parent | d7215c0ee2e4bca1ce87b956335ef6a2cddaf16f (diff) | |
download | llvm-83c309b90550aa768ff9aa11b70898ee2c56b71e.zip llvm-83c309b90550aa768ff9aa11b70898ee2c56b71e.tar.gz llvm-83c309b90550aa768ff9aa11b70898ee2c56b71e.tar.bz2 |
[CUDA][HIP] capture possible ODR-used var (#136645)
In a lambda function, a call of a function may
resolve to host and device functions with different
signatures. Especially, a constexpr local variable may
be passed by value by the device function and
passed by reference by the host function, which
will cause the constexpr variable captured by
the lambda function in host compilation but
not in the device compilation. The discrepancy
in the lambda captures will violate ODR and
causes UB for kernels using these lambdas.
This PR fixes the issue by identifying
discrepancy of ODR/non-ODR usages of constexpr
local variables passed to host/device functions
and conservatively capture them.
Fixes: https://github.com/llvm/llvm-project/issues/132068
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
0 files changed, 0 insertions, 0 deletions