diff options
author | Florian Hahn <flo@fhahn.com> | 2019-12-07 17:22:14 +0000 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2019-12-07 17:23:42 +0000 |
commit | c25de56905b104fb2b90559ce5863f4fec93a974 (patch) | |
tree | d9afd2a7dd4255e23f3c7d478cf99c6f1da8ef9a /llvm/lib/Transforms/Utils | |
parent | 5ea611daf9cb51ba3d6492e50a6b568348fb62c0 (diff) | |
download | bcm5719-llvm-c25de56905b104fb2b90559ce5863f4fec93a974.tar.gz bcm5719-llvm-c25de56905b104fb2b90559ce5863f4fec93a974.zip |
[SimplifyCFG] Account for N being null.
Fixes a crash, e.g.
http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/15119/
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 16044210f52..d93ca4f04cd 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -2269,13 +2269,14 @@ static bool FoldCondBranchOnPHI(BranchInst *BI, const DataLayout &DL, if (!BBI->use_empty()) TranslateMap[&*BBI] = N; } - // Insert the new instruction into its new home. - if (N) + if (N) { + // Insert the new instruction into its new home. EdgeBB->getInstList().insert(InsertPt, N); - // Register the new instruction with the assumption cache if necessary. - if (AC && match(N, m_Intrinsic<Intrinsic::assume>())) - AC->registerAssumption(cast<IntrinsicInst>(N)); + // Register the new instruction with the assumption cache if necessary. + if (AC && match(N, m_Intrinsic<Intrinsic::assume>())) + AC->registerAssumption(cast<IntrinsicInst>(N)); + } } // Loop over all of the edges from PredBB to BB, changing them to branch |