diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-03-11 18:59:49 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-03-12 21:01:16 +0100 |
commit | 42eb658f656c43ee63e25222f32abbbbcb86ad7b (patch) | |
tree | 42f25f9b87040f2e894efccf389ae676f52175c1 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 51151828acad6b1e5b0719285ce7172506877fd1 (diff) | |
download | llvm-42eb658f656c43ee63e25222f32abbbbcb86ad7b.zip llvm-42eb658f656c43ee63e25222f32abbbbcb86ad7b.tar.gz llvm-42eb658f656c43ee63e25222f32abbbbcb86ad7b.tar.bz2 |
[OpaquePtrs] Remove some uses of type-less CreateGEP() (NFC)
This removes some (but not all) uses of type-less CreateGEP()
and CreateInBoundsGEP() APIs, which are incompatible with opaque
pointers.
There are a still a number of tricky uses left, as well as many
more variation APIs for CreateGEP.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 3a7d1ab..a00ae74 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -1816,8 +1816,8 @@ static void emitNonZeroVLAInit(CodeGenFunction &CGF, QualType baseType, Address begin = Builder.CreateElementBitCast(dest, CGF.Int8Ty, "vla.begin"); - llvm::Value *end = - Builder.CreateInBoundsGEP(begin.getPointer(), sizeInChars, "vla.end"); + llvm::Value *end = Builder.CreateInBoundsGEP( + begin.getElementType(), begin.getPointer(), sizeInChars, "vla.end"); llvm::BasicBlock *originBB = CGF.Builder.GetInsertBlock(); llvm::BasicBlock *loopBB = CGF.createBasicBlock("vla-init.loop"); @@ -2024,9 +2024,9 @@ llvm::Value *CodeGenFunction::emitArrayLength(const ArrayType *origArrayType, addr = Builder.CreateElementBitCast(addr, baseType, "array.begin"); } else { // Create the actual GEP. - addr = Address(Builder.CreateInBoundsGEP(addr.getPointer(), - gepIndices, "array.begin"), - addr.getAlignment()); + addr = Address(Builder.CreateInBoundsGEP( + addr.getElementType(), addr.getPointer(), gepIndices, "array.begin"), + addr.getAlignment()); } baseType = eltType; |