Closed
Description
Reproducer: https://godbolt.org/z/GKzGEKE18
; bin/opt -passes=memcpyopt reduced.ll -S
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%struct.S1 = type { i64, i16, i32, %struct.S0, i8, i32, i8, i32, i8 }
%struct.S0 = type { i32, i32, i32, i32, i16 }
@g = external global i8
@g_265 = external global %struct.S1
define void @func() {
entry:
call void @llvm.memcpy.p0.p0.i64(ptr getelementptr inbounds (i8, ptr @g_265, i64 16), ptr getelementptr inbounds nuw (i8, ptr @g_265, i64 16), i64 20, i1 false)
call void @llvm.memcpy.p0.p0.i64(ptr @g, ptr getelementptr inbounds (i8, ptr @g_265, i64 24), i64 1, i1 false)
ret void
}
Found roots: %entry
Clobber starting at access 1 = MemoryDef(liveOnEntry)
for instruction call void @llvm.memcpy.p0.p0.i64(ptr getelementptr inbounds (i8, ptr @g_265, i64 16), ptr getelementptr inbounds nuw (i8, ptr @g_265, i64 16), i64 20, i1 false)
is 0 = MemoryDef(liveOnEntry)
Clobber starting at access 1 = MemoryDef(liveOnEntry)
for instruction call void @llvm.memcpy.p0.p0.i64(ptr getelementptr inbounds (i8, ptr @g_265, i64 16), ptr getelementptr inbounds nuw (i8, ptr @g_265, i64 16), i64 20, i1 false)
is 1 = MemoryDef(liveOnEntry)
Clobber starting at access 1 = MemoryDef(liveOnEntry)
for instruction call void @llvm.memcpy.p0.p0.i64(ptr getelementptr inbounds (i8, ptr @g_265, i64 16), ptr getelementptr inbounds nuw (i8, ptr @g_265, i64 16), i64 20, i1 false)
is 1 = MemoryDef(liveOnEntry)
MemCpyOptPass: Forwarding memcpy->memcpy src:
call void @llvm.memcpy.p0.p0.i64(ptr getelementptr inbounds (i8, ptr @g_265, i64 16), ptr getelementptr inbounds nuw (i8, ptr @g_265, i64 16), i64 20, i1 false)
call void @llvm.memcpy.p0.p0.i64(ptr @g, ptr getelementptr inbounds (i8, ptr @g_265, i64 24), i64 1, i1 false)
Clobber starting at access 1 = MemoryDef(liveOnEntry)
for instruction call void @llvm.memcpy.p0.p0.i64(ptr getelementptr inbounds (i8, ptr @g_265, i64 16), ptr getelementptr inbounds nuw (i8, ptr @g_265, i64 16), i64 20, i1 false)
is 0 = MemoryDef(liveOnEntry)
Clobber starting at access 1 = MemoryDef(liveOnEntry)
for instruction call void @llvm.memcpy.p0.p0.i64(ptr getelementptr inbounds (i8, ptr @g_265, i64 16), ptr getelementptr inbounds nuw (i8, ptr @g_265, i64 16), i64 20, i1 false)
is 1 = MemoryDef(liveOnEntry)
Clobber starting at access 1 = MemoryDef(liveOnEntry)
for instruction call void @llvm.memcpy.p0.p0.i64(ptr getelementptr inbounds (i8, ptr @g_265, i64 16), ptr getelementptr inbounds nuw (i8, ptr @g_265, i64 16), i64 20, i1 false)
is 1 = MemoryDef(liveOnEntry)
MemCpyOptPass: Forwarding memcpy->memcpy src:
call void @llvm.memcpy.p0.p0.i64(ptr getelementptr inbounds (i8, ptr @g_265, i64 16), ptr getelementptr inbounds nuw (i8, ptr @g_265, i64 16), i64 20, i1 false)
call void @llvm.memcpy.p0.p0.i64(ptr @g, ptr getelementptr inbounds (i8, ptr getelementptr inbounds nuw (i8, ptr @g_265, i64 16), i64 8), i64 1, i1 false)
...