[LLVMbugs] [Bug 8701] New: Completely overlapping memcpys not eliminated
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Nov 27 06:09:46 PST 2010
http://llvm.org/bugs/show_bug.cgi?id=8701
Summary: Completely overlapping memcpys not eliminated
Product: libraries
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
AssignedTo: unassignedbugs at nondot.org
ReportedBy: benny.kra at gmail.com
CC: llvmbugs at cs.uiuc.edu
This C code:
===
#include <string.h>
char string1[12];
void foo() {
memcpy(string1, "Hello World", 12);
memcpy(string1, "Hello World", 12);
}
===
optimizes to:
===
@string1 = common global [12 x i8] zeroinitializer, align 1
@.str = private constant [12 x i8] c"Hello World\00"
define void @foo() nounwind ssp {
entry:
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* getelementptr inbounds ([12 x
i8]* @string1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8]* @.str, i64
0, i64 0), i64 12, i32 1, i1 false)
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* getelementptr inbounds ([12 x
i8]* @string1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8]* @.str, i64
0, i64 0), i64 12, i32 1, i1 false)
ret void
}
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32,
i1) nounwind
===
the first memcpy is completely superfluous and should be eliminated.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list