Make ScopAnnotator a function-local variable to ensure it is freed at each run
When the ScopAnnotator was a class member variable some of the maps it contains
have not been properly cleared. As a result we had dangling pointers to
llvm::Value(s) which got detected by the AssertingVH we recently added.
No test case as this issue is hard to reproduce reliably as subsequent
optimizations need to delete some of the llvm::Values we still keep in our
lists.
llvm-svn: 249269
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp
index 53aac25..23ee445 100644
--- a/polly/lib/CodeGen/CodeGeneration.cpp
+++ b/polly/lib/CodeGen/CodeGeneration.cpp
@@ -60,9 +60,6 @@
RegionInfo *RI;
///}
- /// @brief The loop annotator to generate llvm.loop metadata.
- ScopAnnotator Annotator;
-
/// @brief Build the runtime condition.
///
/// Build the condition that evaluates at run-time to true iff all
@@ -125,6 +122,7 @@
Region *R = &S.getRegion();
assert(!R->isTopLevelRegion() && "Top level regions are not supported");
+ ScopAnnotator Annotator;
Annotator.buildAliasScopes(S);
simplifyRegion(R, DT, LI, RI);