summaryrefslogtreecommitdiffstats
path: root/polly/include
diff options
context:
space:
mode:
authorPhilip Pfaffe <philip.pfaffe@gmail.com>2018-05-15 14:53:25 +0000
committerPhilip Pfaffe <philip.pfaffe@gmail.com>2018-05-15 14:53:25 +0000
commitd477bb9a50b7ccc1b3620de2447bcd18bc78bb79 (patch)
tree3ee2e17fd0ff7f06ec4db24fa204978acb1f86e2 /polly/include
parent8652c53d291f26691e359c115d58574ddf742a0b (diff)
downloadbcm5719-llvm-d477bb9a50b7ccc1b3620de2447bcd18bc78bb79.tar.gz
bcm5719-llvm-d477bb9a50b7ccc1b3620de2447bcd18bc78bb79.zip
[SI] Create Scop Name lazily
Summary: Creating the Scop name is expensive, because creating the Region name it's derived from is expensive. So create the name lazily, because getName() is actually called rarely. This is a reiteration of r328666, which introduced a use-after-free and got reverted in r331363. Differential Revision: https://reviews.llvm.org/D46868 llvm-svn: 332359
Diffstat (limited to 'polly/include')
-rw-r--r--polly/include/polly/ScopInfo.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h
index 324cc2748e4..18ec5c8e247 100644
--- a/polly/include/polly/ScopInfo.h
+++ b/polly/include/polly/ScopInfo.h
@@ -25,6 +25,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/MapVector.h"
+#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
@@ -1717,7 +1718,7 @@ private:
Region &R;
/// The name of the SCoP (identical to the regions name)
- std::string name;
+ Optional<std::string> name;
/// The ID to be assigned to the next Scop in a function
static int NextScopID;
@@ -2455,7 +2456,11 @@ public:
/// could be executed.
bool isEmpty() const { return Stmts.empty(); }
- const StringRef getName() const { return name; }
+ StringRef getName() {
+ if (!name)
+ name = R.getNameStr();
+ return *name;
+ }
using array_iterator = ArrayInfoSetTy::iterator;
using const_array_iterator = ArrayInfoSetTy::const_iterator;
OpenPOWER on IntegriCloud