diff options
author | Than McIntosh <thanm@google.com> | 2018-05-29 13:52:24 +0000 |
---|---|---|
committer | Than McIntosh <thanm@google.com> | 2018-05-29 13:52:24 +0000 |
commit | 48bf43df8a92057feaad1142d0e251f7a160ab12 (patch) | |
tree | 9a0f5e0af3d9bab53efafc0af7ee6155e18efed0 /llvm/lib/CodeGen/StackColoring.cpp | |
parent | 716103f1cdbe673b00f52d6682baa16e7a9e875e (diff) | |
download | bcm5719-llvm-48bf43df8a92057feaad1142d0e251f7a160ab12.tar.gz bcm5719-llvm-48bf43df8a92057feaad1142d0e251f7a160ab12.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.
Second attempt at submitting; this version of the change includes
a revised testcase.
Fixes PR37130.
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D47372
llvm-svn: 333416
Diffstat (limited to 'llvm/lib/CodeGen/StackColoring.cpp')
-rw-r--r-- | llvm/lib/CodeGen/StackColoring.cpp | 7 |
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 |