Skip to content

[clang][CGExprScalar] Remove no-op ptr-to-ptr bitcast (NFC) #72072

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

JOE1994
Copy link
Member

@JOE1994 JOE1994 commented Nov 13, 2023

Remove bitcast added back in dcd7471 .

@JOE1994 JOE1994 requested a review from urnathan November 13, 2023 01:15
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:codegen IR generation bugs: mangling, exceptions, etc. labels Nov 13, 2023
@llvmbot
Copy link
Member

llvmbot commented Nov 13, 2023

@llvm/pr-subscribers-clang-codegen

Author: Youngsuk Kim (JOE1994)

Changes

Remove bitcast added back in dcd7471 .


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

1 Files Affected:

  • (modified) clang/lib/CodeGen/CGExprScalar.cpp (-8)
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index 1a7a3f97bb779a0..2faab20fc069ee7 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -2227,14 +2227,6 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
     llvm::Value *V = CE->changesVolatileQualification()
                          ? EmitLoadOfLValue(CE)
                          : Visit(const_cast<Expr *>(E));
-    if (V) {
-      // CK_NoOp can model a pointer qualification conversion, which can remove
-      // an array bound and change the IR type.
-      // FIXME: Once pointee types are removed from IR, remove this.
-      llvm::Type *T = ConvertType(DestTy);
-      if (T != V->getType())
-        V = Builder.CreateBitCast(V, T);
-    }
     return V;
   }
 

@llvmbot
Copy link
Member

llvmbot commented Nov 13, 2023

@llvm/pr-subscribers-clang

Author: Youngsuk Kim (JOE1994)

Changes

Remove bitcast added back in dcd7471 .


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

1 Files Affected:

  • (modified) clang/lib/CodeGen/CGExprScalar.cpp (-8)
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index 1a7a3f97bb779a0..2faab20fc069ee7 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -2227,14 +2227,6 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
     llvm::Value *V = CE->changesVolatileQualification()
                          ? EmitLoadOfLValue(CE)
                          : Visit(const_cast<Expr *>(E));
-    if (V) {
-      // CK_NoOp can model a pointer qualification conversion, which can remove
-      // an array bound and change the IR type.
-      // FIXME: Once pointee types are removed from IR, remove this.
-      llvm::Type *T = ConvertType(DestTy);
-      if (T != V->getType())
-        V = Builder.CreateBitCast(V, T);
-    }
     return V;
   }
 

@JOE1994 JOE1994 merged commit 2a47f4a into llvm:main Nov 13, 2023
@JOE1994 JOE1994 deleted the remove_noop_ptrtoptr_bitcast branch November 13, 2023 15:06
zahiraam pushed a commit to zahiraam/llvm-project that referenced this pull request Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:codegen IR generation bugs: mangling, exceptions, etc. clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants