[clang] d8c4080 - [clang][CGExprConstant] Remove no-op ptr-to-ptr bitcast (NFC)

Youngsuk Kim via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 23 07:18:47 PST 2023


Author: Youngsuk Kim
Date: 2023-11-23T09:17:01-06:00
New Revision: d8c40800edc5995c5ff765c4e2940ea001589fa0

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

LOG: [clang][CGExprConstant] Remove no-op ptr-to-ptr bitcast (NFC)

Remove a call to `getPointerCast` which is effectively does a no-op ptr-to-ptr
bitcast.

Opaque ptr clean-up effort.

Added: 
    

Modified: 
    clang/lib/CodeGen/CGExprConstant.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp
index 69616dcc07efe1f..604e3958161db23 100644
--- a/clang/lib/CodeGen/CGExprConstant.cpp
+++ b/clang/lib/CodeGen/CGExprConstant.cpp
@@ -1861,10 +1861,7 @@ class ConstantLValueEmitter : public ConstStmtVisitor<ConstantLValueEmitter,
     if (!hasNonZeroOffset())
       return C;
 
-    llvm::Type *origPtrTy = C->getType();
-    C = llvm::ConstantExpr::getGetElementPtr(CGM.Int8Ty, C, getOffset());
-    C = llvm::ConstantExpr::getPointerCast(C, origPtrTy);
-    return C;
+    return llvm::ConstantExpr::getGetElementPtr(CGM.Int8Ty, C, getOffset());
   }
 };
 


        


More information about the cfe-commits mailing list