diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-04-02 00:16:53 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-04-02 00:16:53 +0000 |
commit | 5e8edbac4f55d4ef51e60aeff0a83b1d5e47b5c2 (patch) | |
tree | b206acd97a342f3e783df570a6859846c0f4f2e0 /clang/lib/CodeGen/CGDecl.cpp | |
parent | 60ede621ef4651ec08c569fa5099bd9c7090bb16 (diff) | |
download | llvm-5e8edbac4f55d4ef51e60aeff0a83b1d5e47b5c2.zip llvm-5e8edbac4f55d4ef51e60aeff0a83b1d5e47b5c2.tar.gz llvm-5e8edbac4f55d4ef51e60aeff0a83b1d5e47b5c2.tar.bz2 |
Fix type mismatch assertion related to inalloca and PR19287
Augment the test case from r205217 to catch this related bug.
Fixes the Windows self-host which was failing on VariantValue.cpp.
llvm-svn: 205378
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 430b56c..9db3c91a6 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -1655,8 +1655,11 @@ void CodeGenFunction::EmitParmDecl(const VarDecl &D, llvm::Value *Arg, CharUnits Align = getContext().getDeclAlign(&D); // If we already have a pointer to the argument, reuse the input pointer. if (ArgIsPointer) { - assert(isa<llvm::PointerType>(Arg->getType())); - DeclPtr = Arg; + // If we have a prettier pointer type at this point, bitcast to that. + unsigned AS = cast<llvm::PointerType>(Arg->getType())->getAddressSpace(); + llvm::Type *IRTy = ConvertTypeForMem(Ty)->getPointerTo(AS); + DeclPtr = Arg->getType() == IRTy ? Arg : Builder.CreateBitCast(Arg, IRTy, + D.getName()); // Push a destructor cleanup for this parameter if the ABI requires it. if (!IsScalar && getTarget().getCXXABI().areArgsDestroyedLeftToRightInCallee()) { |