summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopSink.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopSink.cpp b/llvm/lib/Transforms/Scalar/LoopSink.cpp
index db502e1c5db..ce6ecea2dc2 100644
--- a/llvm/lib/Transforms/Scalar/LoopSink.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopSink.cpp
@@ -202,6 +202,13 @@ static bool sinkInstruction(Loop &L, Instruction &I,
if (BBsToSinkInto.empty())
return false;
+ // Return if any of the candidate blocks to sink into is non-cold.
+ if (BBsToSinkInto.size() > 1) {
+ for (auto *BB : BBsToSinkInto)
+ if (!LoopBlockNumber.count(BB))
+ return false;
+ }
+
// Copy the final BBs into a vector and sort them using the total ordering
// of the loop block numbers as iterating the set doesn't give a useful
// order. No need to stable sort as the block numbers are a total ordering.
OpenPOWER on IntegriCloud