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.

llvm-svn: 331363
This commit is contained in:
Philip Pfaffe 2018-05-02 14:55:39 +00:00
parent d2ff5fb536
commit e9ca17e9b6
2 changed files with 6 additions and 3 deletions

View File

@ -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;

View File

@ -3329,8 +3329,8 @@ Scop::Scop(Region &R, ScalarEvolution &ScalarEvolution, LoopInfo &LI,
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);