[PATCH] D154285: [clang] Deprecate CGBuilderTy::CreateElementBitCast

Jessica Clarke via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 1 11:29:01 PDT 2023


jrtc27 added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:3954
     Function *F = CGM.getIntrinsic(Intrinsic::eh_sjlj_setjmp);
-    Buf = Builder.CreateElementBitCast(Buf, Int8Ty);
     return RValue::get(Builder.CreateCall(F, Buf.getPointer()));
----------------
Missed `Buf = Buf.withElementType(Int8Ty);`? According to the comment above, Buf is a `void **` not a `void *`/`char *`.


================
Comment at: clang/lib/CodeGen/CGExpr.cpp:3896
     llvm::Type *OrigBaseElemTy = Addr.getElementType();
-    Addr = Builder.CreateElementBitCast(Addr, Int8Ty);
 
----------------
This one isn't a direct substitution, although appears to be refactoring the code to not need withElementType in the first place? Probably best to separate that change out from the very mechanical substitution.


================
Comment at: clang/lib/CodeGen/CGObjCRuntime.cpp:111
+  Address Addr =
+      Address(V, llvm::Type::getIntNTy(CGF.getLLVMContext(), Info->StorageSize),
+              Alignment);
----------------
Ditto


================
Comment at: clang/lib/CodeGen/ItaniumCXXABI.cpp:813
-  // Cast to char*.
-  Base = Builder.CreateElementBitCast(Base, CGF.Int8Ty);
-
----------------
Ditto


================
Comment at: clang/lib/CodeGen/Targets/CSKY.cpp:66
   if (isEmptyRecord(getContext(), Ty, true)) {
-    Address Addr = Address(CGF.Builder.CreateLoad(VAListAddr),
-                           getVAListElementType(CGF), SlotSize);
-    Addr = CGF.Builder.CreateElementBitCast(Addr, CGF.ConvertTypeForMem(Ty));
-    return Addr;
+    return Address(CGF.Builder.CreateLoad(VAListAddr),
+                   CGF.ConvertTypeForMem(Ty), SlotSize);
----------------
Ditto


================
Comment at: clang/lib/CodeGen/Targets/RISCV.cpp:465
   if (isEmptyRecord(getContext(), Ty, true)) {
-    Address Addr = Address(CGF.Builder.CreateLoad(VAListAddr),
-                           getVAListElementType(CGF), SlotSize);
-    Addr = CGF.Builder.CreateElementBitCast(Addr, CGF.ConvertTypeForMem(Ty));
-    return Addr;
+    return Address(CGF.Builder.CreateLoad(VAListAddr),
+                   CGF.ConvertTypeForMem(Ty), SlotSize);
----------------
Ditto


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154285



More information about the cfe-commits mailing list