Issue |
89699
|
Summary |
[clang/c++] Very strange/bad optimizer behavior.
|
Labels |
clang
|
Assignees |
|
Reporter |
no-more-secrets
|
Problem demo: https://godbolt.org/z/zfMohEMj7
The "good" variant produces perfectly optimized code, while the nearly-identical "bad" variant produces a giant explosion of seemingly unoptimized code.
```c++
static int len( char const* input ) {
return std::string( input ).size();
}
int test() {
return
#ifdef GOOD
len( "h" ) + len( "h" );
#else /*BAD*/
len( "h" ) + len( "" );
#endif
}
```
This (regression?) happened between Clang versions 13 and 14: https://godbolt.org/z/brhYEK4Eh
The problem does not exist in gcc: https://godbolt.org/z/Ed6z6j61a
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs