From d714aa0dfdb16270fc279e8e91d4a83ace531529 Mon Sep 17 00:00:00 2001 From: Rodrigo Caetano Rocha Date: Sat, 7 Dec 2019 16:47:00 +0000 Subject: [SimplifyCFG] Handle AssumptionCache being null. AssumptionCache can be null in SimplifyCFGOptions. However, FoldCondBranchOnPHI() was not properly handling that when passing a null AssumptionCache to simplifyCFG. Patch by Rodrigo Caetano Rocha Reviewers: fhahn, lebedev.ri, spatel Reviewed By: spatel Differential Revision: https://reviews.llvm.org/D69963 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp') diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 79d4857c2c8..16044210f52 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -2274,9 +2274,8 @@ static bool FoldCondBranchOnPHI(BranchInst *BI, const DataLayout &DL, EdgeBB->getInstList().insert(InsertPt, N); // Register the new instruction with the assumption cache if necessary. - if (auto *II = dyn_cast_or_null(N)) - if (II->getIntrinsicID() == Intrinsic::assume) - AC->registerAssumption(II); + if (AC && match(N, m_Intrinsic())) + AC->registerAssumption(cast(N)); } // Loop over all of the edges from PredBB to BB, changing them to branch -- cgit v1.2.3