aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2021-03-11 18:59:49 +0100
committerNikita Popov <nikita.ppv@gmail.com>2021-03-12 21:01:16 +0100
commit42eb658f656c43ee63e25222f32abbbbcb86ad7b (patch)
tree42f25f9b87040f2e894efccf389ae676f52175c1 /clang/lib/CodeGen/CGDecl.cpp
parent51151828acad6b1e5b0719285ce7172506877fd1 (diff)
downloadllvm-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/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 5a691ee..243d93a 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -1767,8 +1767,8 @@ void CodeGenFunction::emitZeroOrPatternForAutoVarInit(QualType type,
llvm::Value *BaseSizeInChars =
llvm::ConstantInt::get(IntPtrTy, EltSize.getQuantity());
Address Begin = Builder.CreateElementBitCast(Loc, Int8Ty, "vla.begin");
- llvm::Value *End =
- Builder.CreateInBoundsGEP(Begin.getPointer(), SizeVal, "vla.end");
+ llvm::Value *End = Builder.CreateInBoundsGEP(
+ Begin.getElementType(), Begin.getPointer(), SizeVal, "vla.end");
llvm::BasicBlock *OriginBB = Builder.GetInsertBlock();
EmitBlock(LoopBB);
llvm::PHINode *Cur = Builder.CreatePHI(Begin.getType(), 2, "vla.cur");
@@ -2196,7 +2196,8 @@ void CodeGenFunction::emitDestroy(Address addr, QualType type,
}
llvm::Value *begin = addr.getPointer();
- llvm::Value *end = Builder.CreateInBoundsGEP(begin, length);
+ llvm::Value *end =
+ Builder.CreateInBoundsGEP(addr.getElementType(), begin, length);
emitArrayDestroy(begin, end, type, elementAlign, destroyer,
checkZeroLength, useEHCleanupForArray);
}