zmodem wrote:

Maybe that's the best place to approach this from. Consider:

```
float f(float x, float y) {
  return __builtin_hypotf(x, y);
}
```

Compiling (on Windows) with `clang -Os -S -emit-llvm -target i686-pc-win32 -o - 
\src\temp\a.c -D_MT -D_DLL` gives

```
; Function Attrs: nounwind optsize
define dso_local float @f(float noundef %0, float noundef %1) 
local_unnamed_addr #0 {
  %3 = tail call float @hypotf(float noundef %0, float noundef %1) #2
  ret float %3
}

; Function Attrs: nounwind optsize
declare dso_local float @hypotf(float noundef, float noundef) 
local_unnamed_addr #1
```

if we include `math.h` first:

```
#include <math.h>
float f(float x, float y) {
  return __builtin_hypotf(x, y);
}
```

I get:

```
; Function Attrs: nounwind optsize
define dso_local float @f(float noundef %0, float noundef %1) 
local_unnamed_addr #0 {
  %3 = tail call float @_hypotf(float noundef %0, float noundef %1) #2, 
!inline_history !6
  ret float %3
}

; Function Attrs: optsize
declare dllimport float @_hypotf(float noundef, float noundef) 
local_unnamed_addr #1
```

I think we want the latter result regardless of whether the header was 
included. The modules issue is just a more complicated version of the same 
problem.


https://github.com/llvm/llvm-project/pull/204792
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to