[polly] [polly] Fix cppcheck SA comment reported in #91235 (PR #93505)

Karthika Devi C via llvm-commits llvm-commits at lists.llvm.org
Mon May 27 23:27:01 PDT 2024


https://github.com/kartcq created https://github.com/llvm/llvm-project/pull/93505

This patch moves the unreachable assert before return statement.
Fixes #91235.

>From a46b778b7da0faa2e5d0c52454e7ee25ac3c39c9 Mon Sep 17 00:00:00 2001
From: Karthika Devi C <quic_kartc at quicinc.com>
Date: Mon, 27 May 2024 23:25:31 -0700
Subject: [PATCH] [polly] Fix cppcheck SA comment reported in #91235

This patch moves the unreachable assert before return statement.
Fixes #91235.
---
 polly/include/polly/ScheduleTreeTransform.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/polly/include/polly/ScheduleTreeTransform.h b/polly/include/polly/ScheduleTreeTransform.h
index ee504c4e5f524..6bd5a3abf9ea2 100644
--- a/polly/include/polly/ScheduleTreeTransform.h
+++ b/polly/include/polly/ScheduleTreeTransform.h
@@ -47,9 +47,9 @@ struct ScheduleTreeVisitor {
       return getDerived().visitSequence(Node.as<isl::schedule_node_sequence>(),
                                         std::forward<Args>(args)...);
     case isl_schedule_node_set:
+      assert(isl_schedule_node_n_children(Node.get()) >= 2);
       return getDerived().visitSet(Node.as<isl::schedule_node_set>(),
                                    std::forward<Args>(args)...);
-      assert(isl_schedule_node_n_children(Node.get()) >= 2);
     case isl_schedule_node_leaf:
       assert(isl_schedule_node_n_children(Node.get()) == 0);
       return getDerived().visitLeaf(Node.as<isl::schedule_node_leaf>(),



More information about the llvm-commits mailing list