[clang] [Clang] Remove some dead code in getNumTeamsExprForTargetDirective (PR #95695)

Shivam Gupta via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 16 02:33:02 PDT 2024


https://github.com/xgupta created https://github.com/llvm/llvm-project/pull/95695

This was reported in https://pvs-studio.com/en/blog/posts/cpp/1126/, fragment N9.

V523 The 'then' statement is equivalent to the subsequent code fragment. CGOpenMPRuntime.cpp:6040, 6036

>From 16fde316ba9bd8a54545d71b46df968ae1bb86d3 Mon Sep 17 00:00:00 2001
From: Shivam Gupta <shivam98.tkg at gmail.com>
Date: Sun, 16 Jun 2024 15:01:13 +0530
Subject: [PATCH] [Clang] Remove some dead code in
 getNumTeamsExprForTargetDirective

This was reported in https://pvs-studio.com/en/blog/posts/cpp/1126/, fragment N9.

V523 The 'then' statement is equivalent to the subsequent code fragment. CGOpenMPRuntime.cpp:6040, 6036
---
 clang/lib/CodeGen/CGOpenMPRuntime.cpp | 2 --
 1 file changed, 2 deletions(-)

diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index f6d12d46cfc07..0c99ee3b8c4a9 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -6037,8 +6037,6 @@ const Expr *CGOpenMPRuntime::getNumTeamsExprForTargetDirective(
         MinTeamsVal = MaxTeamsVal = 1;
         return nullptr;
       }
-      MinTeamsVal = MaxTeamsVal = 1;
-      return nullptr;
     }
     // A value of -1 is used to check if we need to emit no teams region
     MinTeamsVal = MaxTeamsVal = -1;



More information about the cfe-commits mailing list