[llvm] r296625 - [DeadStoreElimination] Check function modref behavior before considering memory clobbered
Igor Laevsky via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 1 06:38:29 PST 2017
Author: igor.laevsky
Date: Wed Mar 1 08:38:29 2017
New Revision: 296625
URL: http://llvm.org/viewvc/llvm-project?rev=296625&view=rev
Log:
[DeadStoreElimination] Check function modref behavior before considering memory clobbered
Differential Revision: https://reviews.llvm.org/D29996
Modified:
llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
llvm/trunk/test/Transforms/DeadStoreElimination/operand-bundles.ll
Modified: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp?rev=296625&r1=296624&r2=296625&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp Wed Mar 1 08:38:29 2017
@@ -551,7 +551,7 @@ static bool memoryIsNotModifiedBetween(I
Instruction *I = &*BI;
if (I->mayWriteToMemory() && I != SecondI) {
auto Res = AA->getModRefInfo(I, MemLoc);
- if (Res != MRI_NoModRef)
+ if (Res & MRI_Mod)
return false;
}
}
Modified: llvm/trunk/test/Transforms/DeadStoreElimination/operand-bundles.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadStoreElimination/operand-bundles.ll?rev=296625&r1=296624&r2=296625&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/DeadStoreElimination/operand-bundles.ll (original)
+++ llvm/trunk/test/Transforms/DeadStoreElimination/operand-bundles.ll Wed Mar 1 08:38:29 2017
@@ -41,3 +41,15 @@ define void @test3() {
store i64 0, i64* %s
ret void
}
+
+declare noalias i8* @calloc(i64, i64)
+
+define void @test4() {
+; CHECK-LABEL: @test4
+ %local_obj = call i8* @calloc(i64 1, i64 4)
+ call void @foo() ["deopt" (i8* %local_obj)]
+ store i8 0, i8* %local_obj, align 4
+ ; CHECK-NOT: store i8 0, i8* %local_obj, align 4
+ call void @bar(i8* nocapture %local_obj)
+ ret void
+}
More information about the llvm-commits
mailing list