diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 0f2b9055b88eb0..64521ce7182eee 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -2486,10 +2486,8 @@ llvm::Value *CodeGenFunction::EmitAnnotationCall(llvm::Function *AnnotationFn, const AnnotateAttr *Attr) { SmallVector Args = { AnnotatedVal, - Builder.CreateBitCast(CGM.EmitAnnotationString(AnnotationStr), - ConstGlobalsPtrTy), - Builder.CreateBitCast(CGM.EmitAnnotationUnit(Location), - ConstGlobalsPtrTy), + CGM.EmitAnnotationString(AnnotationStr), + CGM.EmitAnnotationUnit(Location), CGM.EmitAnnotationLineNo(Location), }; if (Attr) @@ -2499,15 +2497,10 @@ llvm::Value *CodeGenFunction::EmitAnnotationCall(llvm::Function *AnnotationFn, void CodeGenFunction::EmitVarAnnotations(const VarDecl *D, llvm::Value *V) { assert(D->hasAttr() && "no annotate attribute"); - // FIXME We create a new bitcast for every annotation because that's what - // llvm-gcc was doing. - unsigned AS = V->getType()->getPointerAddressSpace(); - llvm::Type *I8PtrTy = Builder.getPtrTy(AS); for (const auto *I : D->specific_attrs()) EmitAnnotationCall(CGM.getIntrinsic(llvm::Intrinsic::var_annotation, - {I8PtrTy, CGM.ConstGlobalsPtrTy}), - Builder.CreateBitCast(V, I8PtrTy, V->getName()), - I->getAnnotation(), D->getLocation(), I); + {V->getType(), CGM.ConstGlobalsPtrTy}), + V, I->getAnnotation(), D->getLocation(), I); } Address CodeGenFunction::EmitFieldAnnotations(const FieldDecl *D,