[clang] [CodeGen] Migrate away from PointerUnion::dyn_cast (NFC) (PR #124076)

2025-01-23 Thread Kazu Hirata via cfe-commits

https://github.com/kazutakahirata closed 
https://github.com/llvm/llvm-project/pull/124076
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [CodeGen] Migrate away from PointerUnion::dyn_cast (NFC) (PR #124076)

2025-01-23 Thread Nikita Popov via cfe-commits

https://github.com/nikic approved this pull request.


https://github.com/llvm/llvm-project/pull/124076
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [CodeGen] Migrate away from PointerUnion::dyn_cast (NFC) (PR #124076)

2025-01-22 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)


Changes

Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:

  // FIXME: Replace the uses of is(), get() and dyn_cast() with
  //isa, cast and the llvm::dyn_cast

Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast
because we expect Pos to be nonnull.


---
Full diff: https://github.com/llvm/llvm-project/pull/124076.diff


1 Files Affected:

- (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+2-2) 


``diff
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index ddcb04d53661d0..5ae3fe694d0e6e 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -4079,7 +4079,7 @@ static void emitDependData(CodeGenFunction &CGF, QualType 
&KmpDependInfoTy,
   Size = llvm::ConstantInt::get(CGF.SizeTy, 0);
 }
 LValue Base;
-if (unsigned *P = Pos.dyn_cast()) {
+if (unsigned *P = dyn_cast(Pos)) {
   Base = CGF.MakeAddrLValue(
   CGF.Builder.CreateConstGEP(DependenciesArray, *P), KmpDependInfoTy);
 } else {
@@ -4109,7 +4109,7 @@ static void emitDependData(CodeGenFunction &CGF, QualType 
&KmpDependInfoTy,
 CGF.EmitStoreOfScalar(
 llvm::ConstantInt::get(LLVMFlagsTy, static_cast(DepKind)),
 FlagsLVal);
-if (unsigned *P = Pos.dyn_cast()) {
+if (unsigned *P = dyn_cast(Pos)) {
   ++(*P);
 } else {
   LValue &PosLVal = *cast(Pos);

``




https://github.com/llvm/llvm-project/pull/124076
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [CodeGen] Migrate away from PointerUnion::dyn_cast (NFC) (PR #124076)

2025-01-22 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-codegen

Author: Kazu Hirata (kazutakahirata)


Changes

Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:

  // FIXME: Replace the uses of is(), get() and dyn_cast() with
  //isa, cast and the llvm::dyn_cast

Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast
because we expect Pos to be nonnull.


---
Full diff: https://github.com/llvm/llvm-project/pull/124076.diff


1 Files Affected:

- (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+2-2) 


``diff
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index ddcb04d53661d0..5ae3fe694d0e6e 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -4079,7 +4079,7 @@ static void emitDependData(CodeGenFunction &CGF, QualType 
&KmpDependInfoTy,
   Size = llvm::ConstantInt::get(CGF.SizeTy, 0);
 }
 LValue Base;
-if (unsigned *P = Pos.dyn_cast()) {
+if (unsigned *P = dyn_cast(Pos)) {
   Base = CGF.MakeAddrLValue(
   CGF.Builder.CreateConstGEP(DependenciesArray, *P), KmpDependInfoTy);
 } else {
@@ -4109,7 +4109,7 @@ static void emitDependData(CodeGenFunction &CGF, QualType 
&KmpDependInfoTy,
 CGF.EmitStoreOfScalar(
 llvm::ConstantInt::get(LLVMFlagsTy, static_cast(DepKind)),
 FlagsLVal);
-if (unsigned *P = Pos.dyn_cast()) {
+if (unsigned *P = dyn_cast(Pos)) {
   ++(*P);
 } else {
   LValue &PosLVal = *cast(Pos);

``




https://github.com/llvm/llvm-project/pull/124076
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [CodeGen] Migrate away from PointerUnion::dyn_cast (NFC) (PR #124076)

2025-01-22 Thread Kazu Hirata via cfe-commits

https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/124076

Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:

  // FIXME: Replace the uses of is(), get() and dyn_cast() with
  //isa, cast and the llvm::dyn_cast

Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast
because we expect Pos to be nonnull.


>From 3bcbf9b8fa8b3bec46ee877c90beb7848e4bf860 Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Wed, 22 Jan 2025 00:32:44 -0800
Subject: [PATCH] [CodeGen] Migrate away from PointerUnion::dyn_cast (NFC)

Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:

  // FIXME: Replace the uses of is(), get() and dyn_cast() with
  //isa, cast and the llvm::dyn_cast

Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast
because we expect Pos to be nonnull.
---
 clang/lib/CodeGen/CGOpenMPRuntime.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index ddcb04d53661d0..5ae3fe694d0e6e 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -4079,7 +4079,7 @@ static void emitDependData(CodeGenFunction &CGF, QualType 
&KmpDependInfoTy,
   Size = llvm::ConstantInt::get(CGF.SizeTy, 0);
 }
 LValue Base;
-if (unsigned *P = Pos.dyn_cast()) {
+if (unsigned *P = dyn_cast(Pos)) {
   Base = CGF.MakeAddrLValue(
   CGF.Builder.CreateConstGEP(DependenciesArray, *P), KmpDependInfoTy);
 } else {
@@ -4109,7 +4109,7 @@ static void emitDependData(CodeGenFunction &CGF, QualType 
&KmpDependInfoTy,
 CGF.EmitStoreOfScalar(
 llvm::ConstantInt::get(LLVMFlagsTy, static_cast(DepKind)),
 FlagsLVal);
-if (unsigned *P = Pos.dyn_cast()) {
+if (unsigned *P = dyn_cast(Pos)) {
   ++(*P);
 } else {
   LValue &PosLVal = *cast(Pos);

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits