From 228748e96a2c1010138bcaa20d7d9fa60da1551d Mon Sep 17 00:00:00 2001 From: SergeyZ Date: Mon, 6 Jan 2025 09:17:01 -0800 Subject: [PATCH] [VPlan][Coverity] Fix coverity CID1579964. Fix for the Coverity hit with CID1579964 in VPlan.cpp. --- llvm/lib/Transforms/Vectorize/VPlan.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp index e804f81c36dba..aa41c41e90c4c 100644 --- a/llvm/lib/Transforms/Vectorize/VPlan.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp @@ -438,10 +438,10 @@ void VPBasicBlock::connectToPredecessors(VPTransformState::CFGState &CFG) { // Set each forward successor here when it is created, excluding // backedges. A backward successor is set when the branch is created. unsigned idx = PredVPSuccessors.front() == this ? 0 : 1; - assert( - (!TermBr->getSuccessor(idx) || - (isa(this) && TermBr->getSuccessor(idx) == NewBB)) && - "Trying to reset an existing successor block."); + assert((TermBr && (!TermBr->getSuccessor(idx) || + (isa(this) && + TermBr->getSuccessor(idx) == NewBB))) && + "Trying to reset an existing successor block."); TermBr->setSuccessor(idx, NewBB); } CFG.DTU.applyUpdates({{DominatorTree::Insert, PredBB, NewBB}});