From 459fcccb97b7a157c263d8966b4ea6791117ecca Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Wed, 11 Jan 2017 21:49:00 +0000 Subject: [PATCH] [NewGVN] Strengthen a couple of assertions. StoreCount >= 0 on `unsigned` is always true, otherwise. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291709 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/NewGVN.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Transforms/Scalar/NewGVN.cpp b/lib/Transforms/Scalar/NewGVN.cpp index 1c1e04a6992..04fd5d0b0bd 100644 --- a/lib/Transforms/Scalar/NewGVN.cpp +++ b/lib/Transforms/Scalar/NewGVN.cpp @@ -1063,10 +1063,10 @@ void NewGVN::moveValueToNewCongruenceClass(Value *V, CongruenceClass *OldClass, OldClass->Members.erase(V); NewClass->Members.insert(V); if (isa(V)) { + assert(OldClass->StoreCount > 0 && "Store count underflow detected"); --OldClass->StoreCount; - assert(OldClass->StoreCount >= 0); + assert(NewClass->StoreCount < UINT_MAX && "Store count overflow detected"); ++NewClass->StoreCount; - assert(NewClass->StoreCount >= 0); } ValueToClass[V] = NewClass; -- 2.40.0