<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=http://email.email.llvm.org/c/eJztWVlv2zgQ_jXyCyFBJHU--KG2m8UCBbrb7rvBSzZTHa5EuUl__Q4pWZGdoE3aortALAiWOBe_Gc2MSIs38n7pJaFgBgnWqUAgj9A4JXkEVC_ceOEbL145lrkzXrzxSLY35tB59I1HbuDcabPveSCaCgZleTxd_EPb3CphYFjoUnVwTfMwxWkCd5NBko-TwGzuFMO4bOod4h5ZI-nR1UDrDDNaIF0bpJBHN8jH76zEbpI4NlqiomkApLV8RuasxckWOHY059qpgMwsjWRu4j3cIy9doVaZvq2RvwdpIGwGjb7u9K5WEglQEHvWWoU1cnf6QnWPfKDNta0Y6BXDfN9V98ibCwM2ABXT9eCllR7oaDBxO3mGkPPm04wwBC6cUaa4zGOC0K0TBJCZsuDyc6503PlMnxwFgpjJc9GdY9hIpdbQJweZri9h6AI8zXZTQiA4Hj9JgOvMPSTFFJUpg6ahKFm98wuSkzhhScQExqKIc6FYlmYik5izPKap5FERE2qnN21fO4D-ewoGoCRqVDeQbqWudM0MRC8JLSrg8d6gaRKb8E278zENwiCcqQcjmtmv_8LjzMLPeoX8j8hvgHoj1RF-OyOb_lT7D8Gja6kM02UH0X4Lo66vKtbew-CDkr2A1Gddpype3ttHCWYmPowP9nIOejhZVw0Ul73UPePvHJ51IQqdwmgyD0Sht9AMWgMtZuwXTo7EnAeh7Uwn0UPf7T_DFVgtuzu3IFWxFQXbNkXRKYNwMrGr5sidUoRtyiqXhHGrDw_tKswFK0treqyfme5XXsLNuRaYgYGaYSgVG5BlIziynm6yB5U5bCbloBL5T7Fh6pmvrnU-Cbw6lKOV9Alct7WyEXq3WtEtuQwungf3rmkHQ07_saVThGzBXGCUTwRncuU092yqR67xJ137HqJDcziZEd_OhmziQiP-fMJV9LXYqlrSObag019tyIaWvEYzMX-WtxftyZXNYSgYV42u3C4q55e0ise96doEXn0TuBbU7373Hp9TWO97c-jNS8ppXFNaYOio2k43NcKRq_QXL9UDEEDP9W5Kk39Yu1PGVvJdlmyTyAeP6-ZL7Ze67u_8Xd2PcvtWMYmqRqrSSh-aTo8582cNlVyWSm50a1mA66tkhtmdQlMdYPvQbgUTe2UJL3oGoMBPGXPT9LW0izKppV3L_bFew2bCzQwbi6YeZ-671sZFcxsxAQvXm9Gvg5i5RG4wDnAQ_pjpJHqB8Y-qhIcD7faXWl1PYKu-NNr6C-YCu7CGVgumviFFyShGyQXEb9n6_7wCf2ct0p-oRZnyJMk5ZTSkUSwKITkppCKsSIooYyzieZRFsfxva1HJKKQqEpyoWOQiwZIUnEcRZyqkIk5CSvKQF_hai6-5Fm0vtida6Q7w2ZA5xjAEuKaxQAWNJI7TQqQ0jyOaJDTFjAmWkBwDKSc4p1Rl4zpt3VSVNlab37snEIWsNk3ts4LVrLuH5e2v7iXPBXhdaF8X2tfd9mvZHPzVqqNu-g4J15FsuZE0hVegxJhEBMcxdAmO44gVgscRrFThLKKERtHczNRlnqt87TLXLvO6KnYhl1TmNGcL1pt90y7_7lnb80XflssXf5nSXde7T1MxpThf7JcCUxrGLC9EnHHCVYrTAjaWjEO5pVSJRcm4KrulF688Qmr1BTkTcO_Fm8XPI9BLEhISYjhTHJE8oJzgkAsiaZxkMqRQOAqiVgbWTgCbmkW7dCZ5v-uAWerOdA9MKGn7qUo5wIDQaFOq5cYu_tew-Edvxy8bdqvyQe1a1bldCzOusZz-wEDHLhh3MpBOC4d56QD_C0Pkn0g>53319</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Dead Code Elimination Regression at -O3 (trunk vs. 13.0.0)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Quarub
</td>
</tr>
</table>
<pre>
`cat case.c #57294`
[case.txt](https://github.com/llvm/llvm-project/files/7907176/case.txt)
```c
long b, d;
static int e = -1L, g;
void foo();
void bar16_(void);
long(a)(long h) { return -h; }
unsigned c(char h, char i) { return h - i; }
char(f)(char h, char i) { return h * i; }
int main() {
char j;
long k;
e = 0;
bar16_();
j = f(e, 9);
d = j;
k = a(d);
g = c(7, k) <= 0;
if (g)
foo();
b = d;
}
```
`clang-f29256a64ac11cf59cea878c8d1ba9537db4f523 (trunk) -O3` can not eliminate `foo` but `clang-llvmorg-13.0.0 -O3` can.
------------------------------------------------
`clang-f29256a64ac11cf59cea878c8d1ba9537db4f523 (trunk) -O3 -S -o /dev/stdout case.c`
<details ><summary>Reduced assembly</summary><p>
```asm
main: # @main
.cfi_startproc
# %bb.0:
pushq %rax
.cfi_def_cfa_offset 16
movb $1, e(%rip)
callq bar16_
movzbl e(%rip), %eax
leaq (%rax,%rax,8), %rax
addq $-9, %rax
movq %rax, d(%rip)
cmpl $-7, %eax
jne .LBB3_2
# %bb.1:
xorl %eax, %eax
callq foo
movq d(%rip), %rax
.LBB3_2:
movq %rax, b(%rip)
xorl %eax, %eax
popq %rcx
.cfi_def_cfa_offset 8
retq
.Lfunc_end3:
.size main, .Lfunc_end3-main
```
</p></details>
------------------------------------------------
`clang-llvmorg-13.0.0 -O3 -S -o /dev/stdout case.c`
<details ><summary>Reduced assembly</summary><p>
```asm
main: # @main
.cfi_startproc
# %bb.0:
pushq %rax
.cfi_def_cfa_offset 16
movb $1, e(%rip)
callq bar16_
movzbl e(%rip), %eax
leaq (%rax,%rax,8), %rax
addq $-9, %rax
movq %rax, d(%rip)
movq %rax, b(%rip)
xorl %eax, %eax
popq %rcx
.cfi_def_cfa_offset 8
retq
.Lfunc_end3:
.size main, .Lfunc_end3-main
```
</p></details>
------------------------------------------------
`clang-f29256a64ac11cf59cea878c8d1ba9537db4f523 (trunk) -v`
<details ><summary>Output</summary><p>
```
clang version 14.0.0 (https://github.com/llvm/llvm-project.git f29256a64ac11cf59cea878c8d1ba9537db4f523)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /zdata/compiler_cache/clang-f29256a64ac11cf59cea878c8d1ba9537db4f523/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/11.1.0
Selected GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/11.1.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
```
</p></details>
------------------------------------------------
`clang-llvmorg-13.0.0 -v`
<details ><summary>Output</summary><p>
```
clang version 13.0.0 (https://github.com/llvm/llvm-project.git d7b669b3a30345cfcdb2fde2af6f48aa4b94845d)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /zdata/compiler_cache/clang-ed403e4cb2e5c9c61d2fbb44bae03c5603290bf1/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/11.1.0
Selected GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/11.1.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
```
</p></details>
------------------------------------------------
### Bisection
Bisected to: c34d157fc73954366371aaca6291739921933e86
Committed by: @anton-afanasyev
------------------------------------------------
`clang-c34d157fc73954366371aaca6291739921933e86 -O3 -S -o /dev/stdout case.c`
<details ><summary>Reduced assembly</summary><p>
```asm
main: # @main
.cfi_startproc
# %bb.0:
pushq %rax
.cfi_def_cfa_offset 16
movb $1, e(%rip)
callq bar16_
movzbl e(%rip), %eax
leaq (%rax,%rax,8), %rax
addq $-9, %rax
movq %rax, d(%rip)
cmpl $-7, %eax
jne .LBB3_2
# %bb.1:
xorl %eax, %eax
callq foo
movq d(%rip), %rax
.LBB3_2:
movq %rax, b(%rip)
xorl %eax, %eax
popq %rcx
.cfi_def_cfa_offset 8
retq
.Lfunc_end3:
.size main, .Lfunc_end3-main
```
</p></details>
------------------------------------------------
Previous commit: 2774bad1124215571ab154afcb5478c78cf46344
`clang-2774bad1124215571ab154afcb5478c78cf46344 -O3 -S -o /dev/stdout case.c`
<details ><summary>Reduced assembly</summary><p>
```asm
main: # @main
.cfi_startproc
# %bb.0:
pushq %rax
.cfi_def_cfa_offset 16
movb $1, e(%rip)
callq bar16_
movzbl e(%rip), %eax
leaq (%rax,%rax,8), %rax
addq $-9, %rax
movq %rax, d(%rip)
movq %rax, b(%rip)
xorl %eax, %eax
popq %rcx
.cfi_def_cfa_offset 8
retq
.Lfunc_end3:
.size main, .Lfunc_end3-main
```
</p></details>
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztWVlv2zgQ_jXyCyFBJHU--KG2m8UCBbrb7rvBSzZTHa5EuUl__Q4pWZGdoE3aortAbAiROOc3I854GPNG3i-9JBTMIME6FQjkERqnJI-A6oUbL3zjxSvHMnfGizceyfbGHDqPvvHIDVw7bfY9D0RTwaIsj6ebf2ibWyUMLAtdqg7uaR6mOE3gaTJI8tEJeHOXGNZlU-8Q98gaSY-uBlpnmNEC6doghTy6QT5-ZyV2k8Sx0RIVTQMgreUzMmctTrbAsas517oCMrM0kjnHe3hGXrpCrTJ9WyN_D9JA2Awafd3pXa0kEqAg9qy1CmvknvSF6h75QJtrWzHQKwZ_31X3yJsLAzYBFdP1EKWVHuhoMHE7RYaQi-bTjDAkLpxRprzMc4LQrRMEkJmy4PJzrnTcuadPjgJJzOS56M4xbKZSa-iTg0zXlzB0AZFmu2lDIPg8fpMA15l72BRTVqYdNC1FyeqdX5CcxAlLIiYwFkWcC8WyNBOZxJzlMU0lj4qYUOvetH3tAPrvKRiAkqhR3cB2K3Wla2Yge0loUQGP9wZNTuyGb9qdj2kQBuFMPRjRzP76L_ycWfjZqJD_EfkNUG-kOsLfzsimP9X-Q_LoWirDdNlBtt_CquurirX3sPigZC9g67OuUxUv7-2rBDMTH9YHezsHPVysqwaK273UvePvfDwbQhQ6hdFkHohCb6EZtAZazNgvnByJOQ9C25lOooe-23-GO7BadnduQapiKwq2bYqiUwbhZGJXzZE7pQjbLavc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