From 201d02c75c8ad92a295309833569bf49f4cf8511 Mon Sep 17 00:00:00 2001 From: Alina Sbirlea Date: Wed, 20 Jun 2018 21:06:13 +0000 Subject: [PATCH] [MemorySSA] Verify Phi incoming blocks are block predecessors. Summary: Make the MemorySSA verify also check that all Phi incoming blocks are block predecessors. Reviewers: george.burgess.iv Subscribers: sanjoy, jlebar, Prazek, llvm-commits Differential Revision: https://reviews.llvm.org/D48333 llvm-svn: 335174 --- llvm/lib/Analysis/MemorySSA.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp index dda4227..1a0103d 100644 --- a/llvm/lib/Analysis/MemorySSA.cpp +++ b/llvm/lib/Analysis/MemorySSA.cpp @@ -1746,8 +1746,12 @@ void MemorySSA::verifyDefUses(Function &F) const { assert(Phi->getNumOperands() == static_cast(std::distance( pred_begin(&B), pred_end(&B))) && "Incomplete MemoryPhi Node"); - for (unsigned I = 0, E = Phi->getNumIncomingValues(); I != E; ++I) + for (unsigned I = 0, E = Phi->getNumIncomingValues(); I != E; ++I) { verifyUseInDefs(Phi->getIncomingValue(I), Phi); + assert(find(predecessors(&B), Phi->getIncomingBlock(I)) != + pred_end(&B) && + "Incoming phi block not a block predecessor"); + } } for (Instruction &I : B) { -- 2.7.4