[polly] r331363 - Revert "[polly] [ScopInfo] Don't pre-compute the name of the Scop's region."
Philip Pfaffe via llvm-commits
llvm-commits at lists.llvm.org
Wed May 2 07:55:39 PDT 2018
Author: pfaffe
Date: Wed May 2 07:55:39 2018
New Revision: 331363
URL: http://llvm.org/viewvc/llvm-project?rev=331363&view=rev
Log:
Revert "[polly] [ScopInfo] Don't pre-compute the name of the Scop's region."
This reverts commit 0f9dc03765dc301fff7a52e2a0e1dd3e5f3130c5, r328666.
The change introduced a use-after-free, caused by the temporary name string
being destroyed after converting it to a StringRef.
Modified:
polly/trunk/include/polly/ScopInfo.h
polly/trunk/lib/Analysis/ScopInfo.cpp
Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=331363&r1=331362&r2=331363&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Wed May 2 07:55:39 2018
@@ -1716,6 +1716,9 @@ private:
/// The underlying Region.
Region &R;
+ /// The name of the SCoP (identical to the regions name)
+ std::string name;
+
/// The ID to be assigned to the next Scop in a function
static int NextScopID;
@@ -2452,7 +2455,7 @@ public:
/// could be executed.
bool isEmpty() const { return Stmts.empty(); }
- const StringRef getName() const { return R.getNameStr(); }
+ const StringRef getName() const { return name; }
using array_iterator = ArrayInfoSetTy::iterator;
using const_array_iterator = ArrayInfoSetTy::const_iterator;
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=331363&r1=331362&r2=331363&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Wed May 2 07:55:39 2018
@@ -3329,8 +3329,8 @@ Scop::Scop(Region &R, ScalarEvolution &S
DominatorTree &DT, ScopDetection::DetectionContext &DC,
OptimizationRemarkEmitter &ORE)
: IslCtx(isl_ctx_alloc(), isl_ctx_free), SE(&ScalarEvolution), DT(&DT),
- R(R), HasSingleExitEdge(R.getExitingBlock()), DC(DC), ORE(ORE),
- Affinator(this, LI),
+ R(R), name(R.getNameStr()), HasSingleExitEdge(R.getExitingBlock()),
+ DC(DC), ORE(ORE), Affinator(this, LI),
ID(getNextID((*R.getEntry()->getParent()).getName().str())) {
if (IslOnErrorAbort)
isl_options_set_on_error(getIslCtx().get(), ISL_ON_ERROR_ABORT);
More information about the llvm-commits
mailing list