[llvm-commits] [llvm] r161857 - in /llvm/trunk: lib/Transforms/Scalar/DeadStoreElimination.cpp test/Transforms/DeadStoreElimination/simple.ll
Craig Topper
craig.topper at gmail.com
Tue Aug 14 00:32:05 PDT 2012
Author: ctopper
Date: Tue Aug 14 02:32:05 2012
New Revision: 161857
URL: http://llvm.org/viewvc/llvm-project?rev=161857&view=rev
Log:
Change greater than to greater than or equal so that an identical sized store to the same offset is treated as completing overwriting.
Modified:
llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
llvm/trunk/test/Transforms/DeadStoreElimination/simple.ll
Modified: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp?rev=161857&r1=161856&r2=161857&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp Tue Aug 14 02:32:05 2012
@@ -378,7 +378,7 @@
//
// We have to be careful here as *Off is signed while *.Size is unsigned.
if (EarlierOff >= LaterOff &&
- Later.Size > Earlier.Size &&
+ Later.Size >= Earlier.Size &&
uint64_t(EarlierOff - LaterOff) + Earlier.Size <= Later.Size)
return OverwriteComplete;
Modified: llvm/trunk/test/Transforms/DeadStoreElimination/simple.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadStoreElimination/simple.ll?rev=161857&r1=161856&r2=161857&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/DeadStoreElimination/simple.ll (original)
+++ llvm/trunk/test/Transforms/DeadStoreElimination/simple.ll Tue Aug 14 02:32:05 2012
@@ -291,3 +291,22 @@
%call = call i8* @strdup(i8* %arrayidx) nounwind
ret i8* %call
}
+
+; Make sure same sized store to later element is deleted
+; CHECK: @test24
+; CHECK-NOT: store i32 0
+; CHECK-NOT: store i32 0
+; CHECK: store i32 %b
+; CHECK: store i32 %c
+; CHECK: ret void
+define void @test24([2 x i32]* %a, i32 %b, i32 %c) nounwind {
+ %1 = getelementptr inbounds [2 x i32]* %a, i64 0, i64 0
+ store i32 0, i32* %1, align 4
+ %2 = getelementptr inbounds [2 x i32]* %a, i64 0, i64 1
+ store i32 0, i32* %2, align 4
+ %3 = getelementptr inbounds [2 x i32]* %a, i64 0, i64 0
+ store i32 %b, i32* %3, align 4
+ %4 = getelementptr inbounds [2 x i32]* %a, i64 0, i64 1
+ store i32 %c, i32* %4, align 4
+ ret void
+}
More information about the llvm-commits
mailing list