[PATCH] D152321: [clang] Replace use of Type::getPointerTo() (NFC)
Nikita Popov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 8 09:06:18 PDT 2023
nikic added a comment.
In D152321#4403719 <https://reviews.llvm.org/D152321#4403719>, @JOE1994 wrote:
> Some tests that run with `-no-opaque-pointers` began failing after I updated the revision to get rid of bitcasts.
> The bitcasts are still needed if running Clang with `-no-opaque-pointers`.
I have finished migrating these tests and removed the flag in https://reviews.llvm.org/D152447, so this should no longer be an issue.
================
Comment at: clang/lib/CodeGen/CGBuilder.h:172
+ auto *PtrTy = llvm::PointerType::get(Ty, Addr.getAddressSpace());
return Address(CreateBitCast(Addr.getPointer(), PtrTy, Name), Ty,
Addr.getAlignment(), Addr.isKnownNonNull());
----------------
Can remove this bit cast.
================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:222
CGF.getContext().getTypeSize(T));
- llvm::Type *IntPtrType = IntType->getPointerTo(AddrSpace);
+ llvm::Type *IntPtrType = llvm::PointerType::get(IntType, AddrSpace);
----------------
We should be using the overload that take as a context rather than a type, to create an opaque pointers. The variable name should also drop the mention of the specific type.
Same for other uses.
================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:328
Value *Args[3];
Args[0] = CGF.Builder.CreateBitCast(DestPtr, IntPtrType);
Args[1] = CGF.EmitScalarExpr(E->getArg(1));
----------------
Remove bitcast
================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:421
+ llvm::Type *Int128PtrTy = llvm::PointerType::getUnqual(Int128Ty);
Destination = CGF.Builder.CreateBitCast(Destination, Int128PtrTy);
Address ComparandResult(CGF.Builder.CreateBitCast(ComparandPtr, Int128PtrTy),
----------------
Remove bitcast
================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:4668
llvm::Value *Destination =
Builder.CreateBitCast(EmitScalarExpr(E->getArg(0)), IntPtrType);
----------------
Remove bitcast (more below...)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152321/new/
https://reviews.llvm.org/D152321
More information about the cfe-commits
mailing list