[clang] [Clang][HIP] Warn when __AMDGCN_WAVEFRONT_SIZE is used in host code without relying on target-dependent overload resolution (PR #109663)
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 1 10:01:13 PDT 2024
yxsamliu wrote:
`__AMDGCN_WAVEFRONT_SIZE__` could also be used in other offloading languages e.g. OpenMP. The check for non-constantness is not specific to HIP.
It is a constant when the triple is amdgcn and -target-cpu is specified. Otherwise it should not be treated as constant.
I think you could refactor the code to introduce one more function Sema::isMacroTargetSpecificConstant, which returns whether a macro is constant based on triple and CPU. Then diagnose it in HIP like the current patch does. In this way, the check may be used by other languages.
https://github.com/llvm/llvm-project/pull/109663
More information about the cfe-commits
mailing list