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

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 13 07:06:43 PST 2023


Author: Youngsuk Kim
Date: 2023-11-13T10:06:39-05:00
New Revision: 2a47f4ae457b80475058db356d4c0014d5f7f68c

URL: https://github.com/llvm/llvm-project/commit/2a47f4ae457b80475058db356d4c0014d5f7f68c
DIFF: https://github.com/llvm/llvm-project/commit/2a47f4ae457b80475058db356d4c0014d5f7f68c.diff

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

Remove bitcast added back in dcd74716f9d18 .

Added: 
    

Modified: 
    clang/lib/CodeGen/CGExprScalar.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index 05a3c80fbdd03ab..378437364767f69 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -2224,18 +2224,8 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
     return Visit(const_cast<Expr*>(E));
 
   case CK_NoOp: {
-    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;
+    return CE->changesVolatileQualification() ? EmitLoadOfLValue(CE)
+                                              : Visit(const_cast<Expr *>(E));
   }
 
   case CK_BaseToDerived: {


        


More information about the cfe-commits mailing list