From fe5f233a938f5bc31c458c39cca54d7dcc2667ef Mon Sep 17 00:00:00 2001 From: Weverything Date: Thu, 23 Jan 2020 16:03:31 -0800 Subject: [PATCH] Fix assert that doesn't check anything. Move the assert that checks for the end iterator inside the loop which actually moves over the elements. This allows it to check that the iteration stays within the range. --- llvm/lib/Analysis/SyncDependenceAnalysis.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Analysis/SyncDependenceAnalysis.cpp b/llvm/lib/Analysis/SyncDependenceAnalysis.cpp index 8447dc87069..c16daa91a77 100644 --- a/llvm/lib/Analysis/SyncDependenceAnalysis.cpp +++ b/llvm/lib/Analysis/SyncDependenceAnalysis.cpp @@ -244,12 +244,12 @@ struct DivergencePropagator { ); auto ItBeginRPO = FuncRPOT.begin(); + auto ItEndRPO = FuncRPOT.end(); // skip until term (TODO RPOT won't let us start at @term directly) - for (; *ItBeginRPO != &RootBlock; ++ItBeginRPO) {} - - auto ItEndRPO = FuncRPOT.end(); - assert(ItBeginRPO != ItEndRPO); + for (; *ItBeginRPO != &RootBlock; ++ItBeginRPO) { + assert(ItBeginRPO != ItEndRPO && "Unable to find RootBlock"); + } // propagate definitions at the immediate successors of the node in RPO auto ItBlockRPO = ItBeginRPO; -- 2.11.0