mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
[NewGVN] Fix verification of MemoryPhis in verifyMemoryCongruency().
verifyMemoryCongruency() filters out trivially dead MemoryDef(s), as we find them immediately dead, before moving from TOP to a new congruence class. This fixes the same problem for PHI(s) skipping MemoryPhis if all the operands are dead. Differential Revision: https://reviews.llvm.org/D33044 llvm-svn: 303100
This commit is contained in:
parent
db69675c48
commit
a3335b259b
@ -2549,6 +2549,19 @@ void NewGVN::verifyMemoryCongruency() const {
|
||||
return false;
|
||||
if (auto *MemDef = dyn_cast<MemoryDef>(Pair.first))
|
||||
return !isInstructionTriviallyDead(MemDef->getMemoryInst());
|
||||
|
||||
// We could have phi nodes which operands are all trivially dead,
|
||||
// so we don't process them.
|
||||
if (auto *MemPHI = dyn_cast<MemoryPhi>(Pair.first)) {
|
||||
for (auto &U : MemPHI->incoming_values()) {
|
||||
if (Instruction *I = dyn_cast<Instruction>(U.get())) {
|
||||
if (!isInstructionTriviallyDead(I))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
29
test/Transforms/NewGVN/verify-memoryphi.ll
Normal file
29
test/Transforms/NewGVN/verify-memoryphi.ll
Normal file
@ -0,0 +1,29 @@
|
||||
; Skip dead MemoryPhis when performing memory congruency verification
|
||||
; in NewGVN.
|
||||
; RUN: opt -S -newgvn %s | FileCheck %s
|
||||
; REQUIRES: asserts
|
||||
|
||||
; CHECK: define void @tinkywinky() {
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: br i1 false, label %body, label %end
|
||||
; CHECK: body:
|
||||
; CHECK-NEXT: store i8 undef, i8* null
|
||||
; CHECK-NEXT: br label %end
|
||||
; CHECK: end:
|
||||
; CHECK-NEXT: ret void
|
||||
; CHECK-NEXT: }
|
||||
|
||||
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
|
||||
|
||||
define void @tinkywinky() {
|
||||
entry:
|
||||
call void @llvm.lifetime.start.p0i8(i64 4, i8* undef)
|
||||
br i1 false, label %body, label %end
|
||||
|
||||
body:
|
||||
call void @llvm.lifetime.start.p0i8(i64 4, i8* undef)
|
||||
br label %end
|
||||
|
||||
end:
|
||||
ret void
|
||||
}
|
Loading…
Reference in New Issue
Block a user