[LLVMbugs] [Bug 11420] New: Dead store elimination eliminates live stores
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Nov 21 16:54:20 PST 2011
http://llvm.org/bugs/show_bug.cgi?id=11420
Bug #: 11420
Summary: Dead store elimination eliminates live stores
Product: new-bugs
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: dschuff at google.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 7637
--> http://llvm.org/bugs/attachment.cgi?id=7637
LL file containing example code
This code is generated from the byval-alignment unittest.
struct s0 {
long double x, y;
};
struct s0 g0;
void f0(int i, struct s0 y) {
g0 = y;
g0.x += i;
g0.y += i;
}
Here is the IR before DSE:
dschuff at dschuff:/ulg/llvm-upstream/install$ cat ../llvm/dstest2.ll
target datalayout =
"e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32"
%struct.s0 = type { double, double }
@g0 = common global %struct.s0 zeroinitializer, align 8
define internal fastcc void @f0(double %y.0, double %y.1) nounwind noinline {
entry:
%y = alloca %struct.s0
%.0 = getelementptr %struct.s0* %y, i32 0, i32 0
store double %y.0, double* %.0 <------ initialize the temp struct
%.1 = getelementptr %struct.s0* %y, i32 0, i32 1
store double %y.1, double* %.1 <------ and the rest of it
%0 = bitcast %struct.s0* %y to i8*
tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* bitcast (%struct.s0* @g0 to
i8*), i8* %0, i32 16, i32 8, i1 false) <----- now copy it to the global struct
%1 = load double* getelementptr inbounds (%struct.s0* @g0, i32 0, i32 0),
align 8
%add = fadd double %1, 1.000000e+00
store double %add, double* getelementptr inbounds (%struct.s0* @g0, i32 0,
i32 0), align 8
%2 = load double* getelementptr inbounds (%struct.s0* @g0, i32 0, i32 1),
align 8
%add2 = fadd double %2, 1.000000e+00
store double %add2, double* getelementptr inbounds (%struct.s0* @g0, i32 0,
i32 1), align 8
ret void
}
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32,
i1) nounwind
now run DSE:
bin/opt -basicaa -dse -S -o - ../llvm/dstest2.ll
; ModuleID = '../llvm/dstest2.ll'
target datalayout =
"e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32"
%struct.s0 = type { double, double }
@g0 = common global %struct.s0 zeroinitializer, align 8
define internal fastcc void @f0(double %y.0, double %y.1) nounwind noinline {
entry:
%y = alloca %struct.s0
%0 = bitcast %struct.s0* %y to i8*
tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* bitcast (%struct.s0* @g0 to
i8*), i8* %0, i32 16, i32 8, i1 false) <------ memcpy the UNINITIALIZED local
struct
%1 = load double* getelementptr inbounds (%struct.s0* @g0, i32 0, i32 0),
align 8
%add = fadd double %1, 1.000000e+00
store double %add, double* getelementptr inbounds (%struct.s0* @g0, i32 0,
i32 0), align 8
%2 = load double* getelementptr inbounds (%struct.s0* @g0, i32 0, i32 1),
align 8
%add2 = fadd double %2, 1.000000e+00
store double %add2, double* getelementptr inbounds (%struct.s0* @g0, i32 0,
i32 1), align 8
ret void
}
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32,
i1) nounwind
--
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