mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-12 05:56:28 +00:00
[DeadStoreElimination] Check function modref behavior before considering memory clobbered
Differential Revision: https://reviews.llvm.org/D29996 llvm-svn: 296625
This commit is contained in:
parent
7835d8c042
commit
d9a0db4f6e
@ -551,7 +551,7 @@ static bool memoryIsNotModifiedBetween(Instruction *FirstI,
|
||||
Instruction *I = &*BI;
|
||||
if (I->mayWriteToMemory() && I != SecondI) {
|
||||
auto Res = AA->getModRefInfo(I, MemLoc);
|
||||
if (Res != MRI_NoModRef)
|
||||
if (Res & MRI_Mod)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user