[llvm-bugs] [Bug 49208] New: Wrong optimization around memset
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Feb 16 09:53:29 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49208
Bug ID: 49208
Summary: Wrong optimization around memset
Product: new-bugs
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: bogdan.gureev at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
Created attachment 24539
--> https://bugs.llvm.org/attachment.cgi?id=24539&action=edit
The input llvm code
The attached example should be run with the O2 optimization level. The 'memset'
memory pointer argument is replaced by the 'undef' which causes unexpected
behavior at runtime. I don't see any reason to replace it with 'undef' since
there are writers and external function calls that are related to this memory
pointer.
Command line:
"C:\Program Files\LLVM\bin\clang.exe" -S -emit-llvm d:\work\test.bc -o
d:\work\test_out.bc -O2
I compared the input and output and the only replacement is:
from:
```
%15 = load i8*, i8** %4, align 8, !tbaa !6
%16 = shl nsw i64 %14, 1
call void @llvm.memset.p0i8.i64(i8* align 2 %15, i8 0, i64 %16, i1 false) #0
```
to:
```
%15 = shl nsw i64 %14, 1
call void @llvm.memset.p0i8.i64(i8* align 2 undef, i8 0, i64 %15, i1 false)
#0
```
--
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/20210216/aad46cee/attachment-0001.html>
More information about the llvm-bugs
mailing list