<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63337>63337</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[NewGVN] wrong code at Os and above with -mllvm -enable-newgvn
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zhendongsu
</td>
</tr>
</table>
<pre>
It appears to be a recent regression as it does not reproduce with 16.0.0.
Compiler Explorer: https://godbolt.org/z/TbzdTvj99
```
[511] % clangtk -v
clang version 17.0.0 (https://github.com/llvm/llvm-project.git 09d6ee765780837d5156ac81f968465bdcec73ba)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/suz-local/opfuzz/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Candidate multilib: .;@m64
Selected multilib: .;@m64
[512] %
[512] % clangtk -O3 small.c; ./a.out
[513] % clangtk -O3 -mllvm -enable-newgvn small.c
[514] % timeout -s 9 5 ./a.out
Killed
[515] %
[515] % cat small.c
int a = 1, b, c, d;
static int *e;
int main() {
int f;
if (!d) {
f = 1 ^ a;
if (b) {
if (f) {
int g;
} else
*e = 0;
}
}
if (~f | c)
while (f)
;
return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VU1v4zYQ_TX0ZSBBor4POiTxarEosHvooteCHyOZuxRpkJSd5tDfXlCyHScNChRoAYMWZ9578zgYkMx7NRnEnlSPpNrv2BIO1vUvBzTSmskvO27lH_2XAOx4ROY8BAscgYFDgSaAw8mh98oaYB5UAGnRg7Exc3RWLgLhrMIB8jrN0iwl2Z5kD9v6ZOej0ujg0_NRW4eOFA9wCOHoSfFA6EDoMFnJrQ6pdROhwwuhw3f-Ir-ff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