mirror of
https://github.com/RPCS3/llvm.git
synced 2025-03-06 09:39:28 +00:00
[DeadStoreElimination] Check function modref behavior before considering memory clobbered
Differential Revision: https://reviews.llvm.org/D29996 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296625 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2747964727
commit
f789f6f9d7
@ -551,7 +551,7 @@ static bool memoryIsNotModifiedBetween(Instruction *FirstI,
|
|||||||
Instruction *I = &*BI;
|
Instruction *I = &*BI;
|
||||||
if (I->mayWriteToMemory() && I != SecondI) {
|
if (I->mayWriteToMemory() && I != SecondI) {
|
||||||
auto Res = AA->getModRefInfo(I, MemLoc);
|
auto Res = AA->getModRefInfo(I, MemLoc);
|
||||||
if (Res != MRI_NoModRef)
|
if (Res & MRI_Mod)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,3 +41,15 @@ define void @test3() {
|
|||||||
store i64 0, i64* %s
|
store i64 0, i64* %s
|
||||||
ret void
|
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
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user