summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2015-12-14 16:19:59 +0000
committerTobias Grosser <tobias@grosser.es>2015-12-14 16:19:59 +0000
commit9bd0dad92684536351ef2e7ea5ad88e14630234e (patch)
tree5c745d290125c8f8793bd08228968cdb087c3491
parent6f764bbd9c3541172146305b42a042a3f84ef993 (diff)
downloadbcm5719-llvm-9bd0dad92684536351ef2e7ea5ad88e14630234e.tar.gz
bcm5719-llvm-9bd0dad92684536351ef2e7ea5ad88e14630234e.zip
BlockGenerator: Do not use fast-path for external constants
This change should not change the behavior of Polly today, but it allows external constants to be remapped e.g. when targetting multiple LLVM modules. llvm-svn: 255506
-rw-r--r--polly/lib/CodeGen/BlockGenerators.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp
index 6f26d51dcaa..260ad6ee9c6 100644
--- a/polly/lib/CodeGen/BlockGenerators.cpp
+++ b/polly/lib/CodeGen/BlockGenerators.cpp
@@ -91,9 +91,12 @@ Value *BlockGenerator::trySynthesizeNewValue(ScopStmt &Stmt, Value *Old,
Value *BlockGenerator::getNewValue(ScopStmt &Stmt, Value *Old, ValueMapT &BBMap,
LoopToScevMapT &LTS, Loop *L) const {
- // We assume constants never change.
- // This avoids map lookups for many calls to this function.
- if (isa<Constant>(Old))
+ // Constants that do not reference any named value can always remain
+ // unchanged. Handle them early to avoid expensive map loopups. We do not take
+ // the fast-path for external constants which are referenced through globals
+ // as these may need to be rewritten when distributing code accross different
+ // LLVM modules.
+ if (isa<Constant>(Old) && !isa<GlobalValue>(Old))
return Old;
if (Value *New = GlobalMap.lookup(Old)) {
OpenPOWER on IntegriCloud