llvm-project
llvm-project copied to clipboard
Function resolution should follow the same rule in global context as function body.
| Bugzilla Link | 44266 |
| Version | trunk |
| OS | Linux |
| Attachments | resolution under function gets the correct host function, sample code for function resolution in global initializers |
| CC | @dwblaikie,@jlebar,@Artem-B |
Extended Description
In the following sample code
__device__ float fn(int);
__host__ float fn(float);
float gvar = fn(1);
clang failed to find the correct candidate of fn. But, if we modify that to resolve fn under a function body. The correct one is used.
__device__ float fn(int);
__host__ float fn(float);
float gfunc() {
return fn(1);
}
For function resolution in (host-side) global initializers, we should follow the same rule as the one under a function body.
fix is submitted @ https://reviews.llvm.org/D71227 for review