<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - [DAGCombine] wrong result on -O3 -fuse-ld=lld -flto=full"
href="https://bugs.llvm.org/show_bug.cgi?id=51321">51321</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[DAGCombine] wrong result on -O3 -fuse-ld=lld -flto=full
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: AArch64
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>zhongyunde@tom.com
</td>
</tr>
<tr>
<th>CC</th>
<td>arnaud.degrandmaison@arm.com, llvm-bugs@lists.llvm.org, smithp352@googlemail.com, Ties.Stuij@arm.com
</td>
</tr></table>
<p>
<div>
<pre>base on the newest commit 41cedb1c, dag combine generate wrong code with the
attached test code. we expect the the run result is `c=1,h=49`, while now is
`c=0,h=49`, and disable the optimization of DAGCombiner::visitANDLike can get
expected right result.
clang -mcpu=tsv110 -O3 -fuse-ld=lld -Wall issue.c -save-temps
~/llvm-project-upstream(main) ยป install/bin/clang -v
Huawei Bisheng Compiler clang version 14.0.0
(ssh://<a href="mailto:git@gitlab.huawei.com">git@gitlab.huawei.com</a>:2222/boole-compiler/llvm-project
41cedb1c9a380628ac162bf76148cbd143f41450)
======= test case =========
int printf(const char *, ...);
static int c = 2, d;
short g, h;
int main() {
g ^= 50; // 50
c = 0 || g; // 1
h = g - 1; // 49
d = h & 1; // 1
c &= d; // 1
printf("c=%d,h=%d\n", c, h);
// CHECK-RESULT: c=1,h=49
return 0;
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>