[llvm-bugs] [Bug 41918] New: incorrect code generated in llvm Early CSE w/ MemorySSA phase
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu May 16 22:15:57 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=41918
Bug ID: 41918
Summary: incorrect code generated in llvm Early CSE w/
MemorySSA phase
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: ys114321 at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
Created attachment 21959
--> https://bugs.llvm.org/attachment.cgi?id=21959&action=edit
test.sh
The original issue is reported at bcc mailing list.
https://github.com/iovisor/bcc/issues/2352
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190517/33c3ce03/attachment.html>
More information about the llvm-bugs
mailing list