summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/StackColoring.cpp
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2018-05-18 12:25:30 +0000
committerThan McIntosh <thanm@google.com>2018-05-18 12:25:30 +0000
commit4c21a363af2249c7c981ff6d3edb00821e860e7b (patch)
tree7ec21ce8f28cef9c42b7b695c5ddd8d33a791139 /llvm/lib/CodeGen/StackColoring.cpp
parentb51ccaf4d41d241a1f592ed1a7a10bd8c5091f44 (diff)
downloadbcm5719-llvm-4c21a363af2249c7c981ff6d3edb00821e860e7b.tar.gz
bcm5719-llvm-4c21a363af2249c7c981ff6d3edb00821e860e7b.zip
StackColoring: better handling of statically unreachable code
Summary: Avoid assert/crash during liveness calculation in situations where the incoming machine function has statically unreachable BBs. Fixes PR37130. Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D46265 llvm-svn: 332707
Diffstat (limited to 'llvm/lib/CodeGen/StackColoring.cpp')
-rw-r--r--llvm/lib/CodeGen/StackColoring.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/StackColoring.cpp b/llvm/lib/CodeGen/StackColoring.cpp
index 4f3d1f704aa..0bd941e64aa 100644
--- a/llvm/lib/CodeGen/StackColoring.cpp
+++ b/llvm/lib/CodeGen/StackColoring.cpp
@@ -782,8 +782,11 @@ void StackColoring::calculateLocalLiveness() {
for (MachineBasicBlock::const_pred_iterator PI = BB->pred_begin(),
PE = BB->pred_end(); PI != PE; ++PI) {
LivenessMap::const_iterator I = BlockLiveness.find(*PI);
- assert(I != BlockLiveness.end() && "Predecessor not found");
- LocalLiveIn |= I->second.LiveOut;
+ // PR37130: transformations prior to stack coloring can
+ // sometimes leave behind statically unreachable blocks; these
+ // can be safely skipped here.
+ if (I != BlockLiveness.end())
+ LocalLiveIn |= I->second.LiveOut;
}
// Compute LiveOut by subtracting out lifetimes that end in this
OpenPOWER on IntegriCloud