diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-10-31 08:41:37 -0700 |
---|---|---|
committer | Matt Arsenault <arsenm2@gmail.com> | 2019-10-31 20:07:23 -0700 |
commit | c6da9ec0e90ea8798ecae583bb8d26bdf6b9b79f (patch) | |
tree | fb3ab989ad3137684e77d514ccaaf20055983277 /clang/lib/CodeGen/CGExprScalar.cpp | |
parent | 3479fd25b9d55a3928184aa16626715469827fb0 (diff) | |
download | bcm5719-llvm-c6da9ec0e90ea8798ecae583bb8d26bdf6b9b79f.tar.gz bcm5719-llvm-c6da9ec0e90ea8798ecae583bb8d26bdf6b9b79f.zip |
clang: Fix assert on void pointer arithmetic with address_space
This attempted to always use the default address space void pointer
type instead of preserving the source address space.
Diffstat (limited to 'clang/lib/CodeGen/CGExprScalar.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 55a413a2a71..c1391d46f60 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -3258,7 +3258,7 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF, // GNU void* casts amount to no-ops since our void* type is i8*, but this is // future proof. if (elementType->isVoidType() || elementType->isFunctionType()) { - Value *result = CGF.Builder.CreateBitCast(pointer, CGF.VoidPtrTy); + Value *result = CGF.EmitCastToVoidPtr(pointer); result = CGF.Builder.CreateGEP(result, index, "add.ptr"); return CGF.Builder.CreateBitCast(result, pointer->getType()); } |