[llvm] r328336 - Fix a block copying problem in LICM
Andrew Kaylor via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 23 10:36:18 PDT 2018
Author: akaylor
Date: Fri Mar 23 10:36:18 2018
New Revision: 328336
URL: http://llvm.org/viewvc/llvm-project?rev=328336&view=rev
Log:
Fix a block copying problem in LICM
Differential Revision: https://reviews.llvm.org/D44817
Modified:
llvm/trunk/lib/Transforms/Scalar/LICM.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=328336&r1=328335&r2=328336&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Fri Mar 23 10:36:18 2018
@@ -893,8 +893,14 @@ static void splitPredecessorsOfLoopExit(
// 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);
}
More information about the llvm-commits
mailing list