diff options
| author | Youngsuk Kim <youngsuk.kim@hpe.com> | 2023-06-30 17:33:28 -0400 |
|---|---|---|
| committer | JOE1994 <joseph942010@gmail.com> | 2023-06-30 17:35:36 -0400 |
| commit | 5f32baf17db172478f1081e3d345f08e1053579f (patch) | |
| tree | e5213188be44bf15ea8866319e1eb723104c0a8f /clang/lib/CodeGen/CGExprAgg.cpp | |
| parent | a63d6a00140d25289e0cba294c9228dbb74b06fa (diff) | |
| download | llvm-5f32baf17db172478f1081e3d345f08e1053579f.zip llvm-5f32baf17db172478f1081e3d345f08e1053579f.tar.gz llvm-5f32baf17db172478f1081e3d345f08e1053579f.tar.bz2 | |
[clang] Replace uses of CreateElementBitCast (NFC)
Partial progress towards replacing uses of CreateElementBitCast, as it
no longer does what its name suggests.
Reviewed By: barannikov88
Differential Revision: https://reviews.llvm.org/D154229
Diffstat (limited to 'clang/lib/CodeGen/CGExprAgg.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGExprAgg.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index 0b29190..810b28f 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -134,8 +134,8 @@ public: // destination but can have a different type. Just do a bitcast in this // case to avoid incorrect GEPs. if (Result->getType() != StoreDest.getType()) - StoreDest = - CGF.Builder.CreateElementBitCast(StoreDest, Result->getType()); + StoreDest = StoreDest.withElementType(Result->getType()); + CGF.EmitAggregateStore(Result, StoreDest, E->getType().isVolatileQualified()); return; @@ -751,8 +751,7 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) { // GCC union extension QualType Ty = E->getSubExpr()->getType(); - Address CastPtr = - Builder.CreateElementBitCast(Dest.getAddress(), CGF.ConvertType(Ty)); + Address CastPtr = Dest.getAddress().withElementType(CGF.ConvertType(Ty)); EmitInitializationToLValue(E->getSubExpr(), CGF.MakeAddrLValue(CastPtr, Ty)); break; @@ -767,9 +766,8 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) { LValue SourceLV = CGF.EmitLValue(E->getSubExpr()); Address SourceAddress = - Builder.CreateElementBitCast(SourceLV.getAddress(CGF), CGF.Int8Ty); - Address DestAddress = - Builder.CreateElementBitCast(Dest.getAddress(), CGF.Int8Ty); + SourceLV.getAddress(CGF).withElementType(CGF.Int8Ty); + Address DestAddress = Dest.getAddress().withElementType(CGF.Int8Ty); llvm::Value *SizeVal = llvm::ConstantInt::get( CGF.SizeTy, CGF.getContext().getTypeSizeInChars(E->getType()).getQuantity()); @@ -2024,8 +2022,7 @@ static void CheckAggExprForMemSetUse(AggValueSlot &Slot, const Expr *E, // Okay, it seems like a good idea to use an initial memset, emit the call. llvm::Constant *SizeVal = CGF.Builder.getInt64(Size.getQuantity()); - Address Loc = Slot.getAddress(); - Loc = CGF.Builder.CreateElementBitCast(Loc, CGF.Int8Ty); + Address Loc = Slot.getAddress().withElementType(CGF.Int8Ty); CGF.Builder.CreateMemSet(Loc, CGF.Builder.getInt8(0), SizeVal, false); // Tell the AggExprEmitter that the slot is known zero. @@ -2189,8 +2186,8 @@ void CodeGenFunction::EmitAggregateCopy(LValue Dest, LValue Src, QualType Ty, // we need to use a different call here. We use isVolatile to indicate when // either the source or the destination is volatile. - DestPtr = Builder.CreateElementBitCast(DestPtr, Int8Ty); - SrcPtr = Builder.CreateElementBitCast(SrcPtr, Int8Ty); + DestPtr = DestPtr.withElementType(Int8Ty); + SrcPtr = SrcPtr.withElementType(Int8Ty); // Don't do any of the memmove_collectable tests if GC isn't set. if (CGM.getLangOpts().getGC() == LangOptions::NonGC) { |
