[llvm] r277873 - [MSSA] Match assert vs llvm_unreachable style in verification functions.
Daniel Berlin via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 5 14:47:20 PDT 2016
Author: dannyb
Date: Fri Aug 5 16:47:20 2016
New Revision: 277873
URL: http://llvm.org/viewvc/llvm-project?rev=277873&view=rev
Log:
[MSSA] Match assert vs llvm_unreachable style in verification functions.
Modified:
llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp
Modified: llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp?rev=277873&r1=277872&r2=277873&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp Fri Aug 5 16:47:20 2016
@@ -1865,11 +1865,13 @@ void MemorySSA::verifyOrdering(Function
/// \brief Verify the domination properties of MemorySSA by checking that each
/// definition dominates all of its uses.
void MemorySSA::verifyDomination(Function &F) const {
+#ifndef NDEBUG
for (BasicBlock &B : F) {
// Phi nodes are attached to basic blocks
if (MemoryPhi *MP = getMemoryAccess(&B))
for (const Use &U : MP->uses())
assert(dominates(MP, U) && "Memory PHI does not dominate it's uses");
+
for (Instruction &I : B) {
MemoryAccess *MD = dyn_cast_or_null<MemoryDef>(getMemoryAccess(&I));
if (!MD)
@@ -1879,23 +1881,22 @@ void MemorySSA::verifyDomination(Functio
assert(dominates(MD, U) && "Memory Def does not dominate it's uses");
}
}
+#endif
}
/// \brief Verify the def-use lists in MemorySSA, by verifying that \p Use
/// appears in the use list of \p Def.
-///
-/// llvm_unreachable is used instead of asserts because this may be called in
-/// a build without asserts. In that case, we don't want this to turn into a
-/// nop.
+
void MemorySSA::verifyUseInDefs(MemoryAccess *Def, MemoryAccess *Use) const {
+#ifndef NDEBUG
// The live on entry use may cause us to get a NULL def here
- if (!Def) {
- if (!isLiveOnEntryDef(Use))
- llvm_unreachable("Null def but use not point to live on entry def");
- } else if (std::find(Def->user_begin(), Def->user_end(), Use) ==
- Def->user_end()) {
- llvm_unreachable("Did not find use in def's use list");
- }
+ if (!Def)
+ assert(isLiveOnEntryDef(Use) &&
+ "Null def but use not point to live on entry def");
+ else
+ assert(find(Def->users(), Use) != Def->user_end() &&
+ "Did not find use in def's use list");
+#endif
}
/// \brief Verify the immediate use information, by walking all the memory
More information about the llvm-commits
mailing list