summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorAndrew Kaylor <andrew.kaylor@intel.com>2018-03-23 17:36:18 +0000
committerAndrew Kaylor <andrew.kaylor@intel.com>2018-03-23 17:36:18 +0000
commita237866faff488edf9c822b38e16af3de13c0e90 (patch)
treee3957b3bbdb971b9c58cec00d830b917e5e3e1f3 /llvm
parent51dba7d3ab5e8790e04114ece7df70977324d9e2 (diff)
downloadbcm5719-llvm-a237866faff488edf9c822b38e16af3de13c0e90.tar.gz
bcm5719-llvm-a237866faff488edf9c822b38e16af3de13c0e90.zip
Fix a block copying problem in LICM
Differential Revision: https://reviews.llvm.org/D44817 llvm-svn: 328336
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index ee9f9b474ca..414f3b79bf0 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -893,8 +893,14 @@ static void splitPredecessorsOfLoopExit(PHINode *PN, DominatorTree *DT,
// Since we do not allow splitting EH-block with BlockColors in
// canSplitPredecessors(), we can simply assign predecessor's color to
// the new block.
- if (!BlockColors.empty())
- BlockColors[NewPred] = BlockColors[PredBB];
+ if (!BlockColors.empty()) {
+ // Grab a reference to the ColorVector to be inserted before getting the
+ // reference to the vector we are copying because inserting the new
+ // element in BlockColors might cause the map to be reallocated.
+ ColorVector &ColorsForNewBlock = BlockColors[NewPred];
+ ColorVector &ColorsForOldBlock = BlockColors[PredBB];
+ ColorsForNewBlock = ColorsForOldBlock;
+ }
}
PredBBs.remove(PredBB);
}
OpenPOWER on IntegriCloud