[llvm] [VPlan][Coverity] Fix coverity CID1579964. (PR #121805)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 6 09:25:08 PST 2025


https://github.com/offsake created https://github.com/llvm/llvm-project/pull/121805

Fix for the Coverity hit with CID1579964 in VPlan.cpp.


>From 228748e96a2c1010138bcaa20d7d9fa60da1551d Mon Sep 17 00:00:00 2001
From: SergeyZ <sergey.i.zverev at intel.com>
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 e804f81c36dba0..aa41c41e90c4c4 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<VPIRBasicBlock>(this) && TermBr->getSuccessor(idx) == NewBB)) &&
-          "Trying to reset an existing successor block.");
+      assert((TermBr && (!TermBr->getSuccessor(idx) ||
+                         (isa<VPIRBasicBlock>(this) &&
+                          TermBr->getSuccessor(idx) == NewBB))) &&
+             "Trying to reset an existing successor block.");
       TermBr->setSuccessor(idx, NewBB);
     }
     CFG.DTU.applyUpdates({{DominatorTree::Insert, PredBB, NewBB}});



More information about the llvm-commits mailing list