Skip to content

Commit c25de56

Browse files
committed
[SimplifyCFG] Account for N being null.
Fixes a crash, e.g. http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/15119/
1 parent 5ea611d commit c25de56

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2269,13 +2269,14 @@ static bool FoldCondBranchOnPHI(BranchInst *BI, const DataLayout &DL,
22692269
if (!BBI->use_empty())
22702270
TranslateMap[&*BBI] = N;
22712271
}
2272-
// Insert the new instruction into its new home.
2273-
if (N)
2272+
if (N) {
2273+
// Insert the new instruction into its new home.
22742274
EdgeBB->getInstList().insert(InsertPt, N);
22752275

2276-
// Register the new instruction with the assumption cache if necessary.
2277-
if (AC && match(N, m_Intrinsic<Intrinsic::assume>()))
2278-
AC->registerAssumption(cast<IntrinsicInst>(N));
2276+
// Register the new instruction with the assumption cache if necessary.
2277+
if (AC && match(N, m_Intrinsic<Intrinsic::assume>()))
2278+
AC->registerAssumption(cast<IntrinsicInst>(N));
2279+
}
22792280
}
22802281

22812282
// Loop over all of the edges from PredBB to BB, changing them to branch

0 commit comments

Comments
 (0)