[clang] [Clang] Remove some dead code in getNumTeamsExprForTargetDirective (PR #95695)
Shivam Gupta via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 24 08:28:08 PDT 2024
https://github.com/xgupta updated https://github.com/llvm/llvm-project/pull/95695
>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 1/2] [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;
>From 85953f86f10f1451fa347a91a98fecbebc84a4c4 Mon Sep 17 00:00:00 2001
From: Shivam Gupta <shivma98.tkg at gmail.com>
Date: Wed, 24 Jul 2024 17:27:44 +0200
Subject: [PATCH 2/2] address review comment
---
clang/lib/CodeGen/CGOpenMPRuntime.cpp | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 0c99ee3b8c4a9..9dd01799bd412 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -6032,11 +6032,8 @@ const Expr *CGOpenMPRuntime::getNumTeamsExprForTargetDirective(
MinTeamsVal = MaxTeamsVal = 0;
return nullptr;
}
- if (isOpenMPParallelDirective(NestedDir->getDirectiveKind()) ||
- isOpenMPSimdDirective(NestedDir->getDirectiveKind())) {
- 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