Open GkvJwa opened 2 months ago
@llvm/issue-subscribers-clang-frontend
Author: None (GkvJwa)
Can help me look at this problem(@sdkrystian @erichkeane @katzdm @cor3ntin) How can I prevent this code (_Literal_zero_is_expected) from being generated when the code is valid
CC @cor3ntin
Add @dtcxzyw
cc @frederick-vs-ja
Found that using msvc's stl to compile chromium(https://github.com/microsoft/STL/issues/4359#issuecomment-2042911928)
The cause of the error is as described in this link(https://github.com/oneapi-src/oneDPL/pull/1568#issue-2283898641), mscv(cl.exe) will optimize the if expr here, therefore cef specially patched chromum(https://github.com/chromiumembedded/cef/commit/cb1830e16ccf54cfb676933c35d189864f02a276), make the compilation pass
But recently I continued to analyze this compilation error.
I found that it was caused
so I reproduced it with the following code
What is very interesting is that if override operator<(commented code)
will not generate the symbols of std::_Literal_zero::_Literal_zero in base::operator<=>
For this reason, I debugged and found that it was not InImmediateFunctionContext https://github.com/llvm/llvm-project/blob/4066a3206012cded6de2e286732dca721d37bcd3/clang/include/clang/Sema/Sema.h#L10309-L10315 of course, it also means that there will be no compilation error before this commit
After that, without overriding the operator, I want to optimize this expression
But reading code, it is not very good to process it in buildIfStmt, so should it be processed in IR Gen?