Issue 144301
Summary PDB shows wrong calling convention when compiling static functions on Windows x86
Labels new issue
Assignees
Reporter momo5502
    Compiling the following sample for Windows x86 with -O3 shows that `static_func` will have `fastcc` applied to it:

```C++
static __declspec(noinline) int static_func(int arg1){
	
	return arg1 * 2;
}

int main(int argc, char* argv[]) {
	return static_func(argc);
}
```

https://godbolt.org/z/Pcroj66c4

The PDB however shows `NearC`, so cdecl, instead of `FastCall`.

The reason this happens is because GlobalOpt updates the CC, but not the debug info:

https://github.com/llvm/llvm-project/blob/aa8a1fa6f515f45db55365b9c1f8453ded24ed32/llvm/lib/Transforms/IPO/GlobalOpt.cpp#L2022

I feel like the `DISubroutineType` should be updated to `DW_CC_BORLAND_msfastcall` for Windows x86. So that the PDB depicts the correct CC.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to