[PATCH] D153196: [clang] Replace uses of CGBuilderTy::CreateElementBitCast (NFC)

Nikita Popov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 17 06:55:03 PDT 2023


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: clang/lib/CodeGen/CGObjC.cpp:2207
   llvm::Type *origType = addr.getElementType();
-  addr = CGF.Builder.CreateElementBitCast(addr, CGF.Int8PtrTy);
+  addr = addr.withElementType(CGF.Int8PtrTy);
 
----------------
Can drop this call, we only use addr.getPointer() below.


================
Comment at: clang/lib/CodeGen/CGObjC.cpp:2214
   if (origType != CGF.Int8PtrTy)
     result = CGF.Builder.CreateBitCast(result, origType);
 
----------------
While here, might as well drop this as well.


================
Comment at: clang/lib/CodeGen/CGObjC.cpp:2662
   // Cast the argument to 'id*'.
-  addr = Builder.CreateElementBitCast(addr, Int8PtrTy);
+  addr = addr.withElementType(Int8PtrTy);
 
----------------
Can drop this, as we only use `addr.getPointer()` below.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153196/new/

https://reviews.llvm.org/D153196



More information about the cfe-commits mailing list