<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 - incorrect code generated in llvm Early CSE w/ MemorySSA phase"
href="https://bugs.llvm.org/show_bug.cgi?id=41918">41918</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>incorrect code generated in llvm Early CSE w/ MemorySSA phase
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ys114321@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=21959" name="attach_21959" title="test.sh">attachment 21959</a> <a href="attachment.cgi?id=21959&action=edit" title="test.sh">[details]</a></span>
test.sh
The original issue is reported at bcc mailing list.
<a href="https://github.com/iovisor/bcc/issues/2352">https://github.com/iovisor/bcc/issues/2352</a>
Incorrect code is generated for a bpf C program.
After some analysis, it looks the error in Early CSE w/ MemorySSA pass.
Before:
%27 = call i32 inttoptr (i64 4 to i32 (i8*, i64, i8*)*)(i8* nonnull %13, i64
65, i8* nonnull %26) #6, !dbg !1627
%28 = getelementptr inbounds [65 x i8], [65 x i8]* %3, i64 0, i64 0, !dbg
!1628
call void @llvm.lifetime.end.p0i8(i64 65, i8* nonnull %13) #6, !dbg !1629
call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 16 %10, i8* nonnull
align 16 %28, i64 64, i1 false), !dbg !1630
After
%25 = call i32 inttoptr (i64 4 to i32 (i8*, i64, i8*)*)(i8* nonnull %11, i64
65, i8* nonnull %24) #6, !dbg !1627
call void @llvm.lifetime.end.p0i8(i64 65, i8* nonnull %11) #6, !dbg !1628
call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 16 %10, i8* nonnull
align 16 %11, i64 64, i1 false), !dbg !1629
After Early CSE pass, the variable %11 is marked as lifetime.end, but it still
used afterwards. Eventually wrong code is generated.
Based on the bcc issue, the bug exists in earlier llvm versions as well.
I have created a stand alone test case, test.sh and bug.i. Run through the code
and check the IR, you will see the incorrect IR generated.</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>