aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorYoungsuk Kim <youngsuk.kim@hpe.com>2023-06-18 04:12:08 +0300
committerSergei Barannikov <barannikov88@gmail.com>2023-06-18 04:13:15 +0300
commit44e63ffe2bf7e5c026b828054d67088239939e81 (patch)
tree2e1ae9b830c8f5ae504b56919c3428613d8c374c /clang/lib/CodeGen/CodeGenFunction.cpp
parent5ad9adb9b0ac1c788dee2e1d56850dc4a4d58f4e (diff)
downloadllvm-44e63ffe2bf7e5c026b828054d67088239939e81.zip
llvm-44e63ffe2bf7e5c026b828054d67088239939e81.tar.gz
llvm-44e63ffe2bf7e5c026b828054d67088239939e81.tar.bz2
[clang] Replace uses of CGBuilderTy::CreateElementBitCast (NFC)
* Add `Address::withElementType()` as a replacement for `CGBuilderTy::CreateElementBitCast`. * Partial progress towards replacing `CreateElementBitCast`, as it no longer does what its name suggests. Either replace its uses with `Address::withElementType()`, or remove them if no longer needed. * Remove unused parameter 'Name' of `CreateElementBitCast` Reviewed By: barannikov88, nikic Differential Revision: https://reviews.llvm.org/D153196
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index f660163..b8d3937 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -1935,8 +1935,7 @@ static void emitNonZeroVLAInit(CodeGenFunction &CGF, QualType baseType,
llvm::Value *baseSizeInChars
= llvm::ConstantInt::get(CGF.IntPtrTy, baseSize.getQuantity());
- Address begin =
- Builder.CreateElementBitCast(dest, CGF.Int8Ty, "vla.begin");
+ Address begin = dest.withElementType(CGF.Int8Ty);
llvm::Value *end = Builder.CreateInBoundsGEP(
begin.getElementType(), begin.getPointer(), sizeInChars, "vla.end");
@@ -1980,9 +1979,8 @@ CodeGenFunction::EmitNullInitialization(Address DestPtr, QualType Ty) {
}
}
- // Cast the dest ptr to the appropriate i8 pointer type.
if (DestPtr.getElementType() != Int8Ty)
- DestPtr = Builder.CreateElementBitCast(DestPtr, Int8Ty);
+ DestPtr = DestPtr.withElementType(Int8Ty);
// Get size and alignment info for this aggregate.
CharUnits size = getContext().getTypeSizeInChars(Ty);
@@ -2142,7 +2140,7 @@ llvm::Value *CodeGenFunction::emitArrayLength(const ArrayType *origArrayType,
}
llvm::Type *baseType = ConvertType(eltType);
- addr = Builder.CreateElementBitCast(addr, baseType, "array.begin");
+ addr = addr.withElementType(baseType);
} else {
// Create the actual GEP.
addr = Address(Builder.CreateInBoundsGEP(