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

Nikita Popov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 20 00:44:11 PDT 2023


nikic added inline comments.


================
Comment at: clang/lib/CodeGen/CGNonTrivialStruct.cpp:370
     llvm::Value *DstArrayEnd =
         CGF.Builder.CreateInBoundsGEP(CGF.Int8Ty, BC.getPointer(), SizeInBytes);
     DstArrayEnd = CGF.Builder.CreateBitCast(
----------------
Only `BC.getPointer()` is used, so you can omit the withElementType.


================
Comment at: clang/lib/CodeGen/MicrosoftCXXABI.cpp:3121-3123
+  This = This.withElementType(CGM.Int8Ty);
   llvm::Value *VBPtr = Builder.CreateInBoundsGEP(
       This.getElementType(), This.getPointer(), VBPtrOffset, "vbptr");
----------------



================
Comment at: clang/lib/CodeGen/MicrosoftCXXABI.cpp:3126
   VBPtr = Builder.CreateBitCast(VBPtr,
             CGM.Int32Ty->getPointerTo(0)->getPointerTo(This.getAddressSpace()));
 
----------------
Can drop this bitcast while here.


================
Comment at: clang/lib/CodeGen/Targets/AArch64.cpp:523
     Address Addr = Address(Load, CGF.Int8Ty, SlotSize);
-    return CGF.Builder.CreateElementBitCast(Addr, CGF.ConvertTypeForMem(Ty));
+    return Addr.withElementType(CGF.ConvertTypeForMem(Ty));
   }
----------------
Can inline this withElementType call into Address ctor.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153314



More information about the cfe-commits mailing list