[llvm-bugs] [Bug 45783] New: Failure to propagate memset pattern from alloca to reads
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun May 3 03:29:38 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45783
Bug ID: 45783
Summary: Failure to propagate memset pattern from alloca to
reads
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: lebedev.ri at gmail.com
CC: llvm-bugs at lists.llvm.org
int match8(char *tpl)
{
char cmp[32] = {0};
int found = 0;
for (int at = 0; at < 32; at++) {
if (tpl[at] == cmp[at]) {
found = 1;
}
}
return found;
}
Results in
define dso_local i32 @match8(i8* nocapture readonly %0) local_unnamed_addr #0 {
%2 = alloca [32 x i8], align 16
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
call void @llvm.lifetime.start.p0i8(i64 32, i8* nonnull %3) #3
call void @llvm.memset.p0i8.i64(i8* nonnull align 16 dereferenceable(32) %3,
i8 0, i64 32, i1 false)
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 20
%5 = load i8, i8* %4, align 4, !tbaa !2
<...>
But that last load should fold to 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/20200503/bd4a3281/attachment.html>
More information about the llvm-bugs
mailing list