[llvm] fe5f233 - Fix assert that doesn't check anything.
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 23 19:12:00 PST 2020
Author: Weverything
Date: 2020-01-23T19:02:00-08:00
New Revision: fe5f233a938f5bc31c458c39cca54d7dcc2667ef
URL: https://github.com/llvm/llvm-project/commit/fe5f233a938f5bc31c458c39cca54d7dcc2667ef
DIFF: https://github.com/llvm/llvm-project/commit/fe5f233a938f5bc31c458c39cca54d7dcc2667ef.diff
LOG: 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.
Added:
Modified:
llvm/lib/Analysis/SyncDependenceAnalysis.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/SyncDependenceAnalysis.cpp b/llvm/lib/Analysis/SyncDependenceAnalysis.cpp
index 8447dc87069d..c16daa91a775 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;
More information about the llvm-commits
mailing list