[llvm] c25de56 - [SimplifyCFG] Account for N being null.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 7 09:26:51 PST 2019
Author: Florian Hahn
Date: 2019-12-07T17:23:42Z
New Revision: c25de56905b104fb2b90559ce5863f4fec93a974
URL: https://github.com/llvm/llvm-project/commit/c25de56905b104fb2b90559ce5863f4fec93a974
DIFF: https://github.com/llvm/llvm-project/commit/c25de56905b104fb2b90559ce5863f4fec93a974.diff
LOG: [SimplifyCFG] Account for N being null.
Fixes a crash, e.g.
http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/15119/
Added:
Modified:
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 16044210f521..d93ca4f04cdb 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
More information about the llvm-commits
mailing list