Author: akhuang Date: Mon Apr 8 15:46:41 2019 New Revision: 357952 URL: http://llvm.org/viewvc/llvm-project?rev=357952&view=rev Log: Revert "[MS] Add metadata for __declspec(allocator)"
This reverts commit e7bd735bb03a7b8141e32f7d6cb98e8914d8799e. Reverting because of buildbot failure. Removed: cfe/trunk/test/CodeGen/debug-info-codeview-heapallocsite.c Modified: cfe/trunk/lib/CodeGen/CGCall.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.h Modified: cfe/trunk/lib/CodeGen/CGCall.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=357952&r1=357951&r2=357952&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGCall.cpp (original) +++ cfe/trunk/lib/CodeGen/CGCall.cpp Mon Apr 8 15:46:41 2019 @@ -3800,8 +3800,6 @@ RValue CodeGenFunction::EmitCall(const C llvm::FunctionType *IRFuncTy = getTypes().GetFunctionType(CallInfo); - const Decl *TargetDecl = Callee.getAbstractInfo().getCalleeDecl().getDecl(); - #ifndef NDEBUG if (!(CallInfo.isVariadic() && CallInfo.getArgStruct())) { // For an inalloca varargs function, we don't expect CallInfo to match the @@ -4290,7 +4288,11 @@ RValue CodeGenFunction::EmitCall(const C // Apply always_inline to all calls within flatten functions. // FIXME: should this really take priority over __try, below? if (CurCodeDecl && CurCodeDecl->hasAttr<FlattenAttr>() && - !(TargetDecl && TargetDecl->hasAttr<NoInlineAttr>())) { + !(Callee.getAbstractInfo().getCalleeDecl().getDecl() && + Callee.getAbstractInfo() + .getCalleeDecl() + .getDecl() + ->hasAttr<NoInlineAttr>())) { Attrs = Attrs.addAttribute(getLLVMContext(), llvm::AttributeList::FunctionIndex, llvm::Attribute::AlwaysInline); @@ -4374,16 +4376,11 @@ RValue CodeGenFunction::EmitCall(const C // Suppress tail calls if requested. if (llvm::CallInst *Call = dyn_cast<llvm::CallInst>(CI)) { + const Decl *TargetDecl = Callee.getAbstractInfo().getCalleeDecl().getDecl(); if (TargetDecl && TargetDecl->hasAttr<NotTailCalledAttr>()) Call->setTailCallKind(llvm::CallInst::TCK_NoTail); } - // Add metadata for calls to MSAllocator functions - // FIXME: Get the type that the return value is cast to. - if (!DisableDebugInfo && TargetDecl && - TargetDecl->hasAttr<MSAllocatorAttr>()) - getDebugInfo()->addHeapAllocSiteMetadata(CI, RetTy, Loc); - // 4. Finish the call. // If the call doesn't return, finish the basic block and clear the @@ -4540,6 +4537,7 @@ RValue CodeGenFunction::EmitCall(const C } (); // Emit the assume_aligned check on the return value. + const Decl *TargetDecl = Callee.getAbstractInfo().getCalleeDecl().getDecl(); if (Ret.isScalar() && TargetDecl) { if (const auto *AA = TargetDecl->getAttr<AssumeAlignedAttr>()) { llvm::Value *OffsetValue = nullptr; Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=357952&r1=357951&r2=357952&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Apr 8 15:46:41 2019 @@ -1959,20 +1959,6 @@ llvm::DIType *CGDebugInfo::getOrCreateSt return T; } -void CGDebugInfo::addHeapAllocSiteMetadata(llvm::Instruction *CI, - QualType D, - SourceLocation Loc) { - llvm::MDNode *node; - if (D.getTypePtr()->isVoidPointerType()) { - node = llvm::MDNode::get(CGM.getLLVMContext(), None); - } else { - QualType PointeeTy = D.getTypePtr()->getPointeeType(); - node = getOrCreateType(PointeeTy, getOrCreateFile(Loc)); - } - - CI->setMetadata("heapallocsite", node); -} - void CGDebugInfo::completeType(const EnumDecl *ED) { if (DebugKind <= codegenoptions::DebugLineTablesOnly) return; Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=357952&r1=357951&r2=357952&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Mon Apr 8 15:46:41 2019 @@ -476,10 +476,6 @@ public: /// Emit standalone debug info for a type. llvm::DIType *getOrCreateStandaloneType(QualType Ty, SourceLocation Loc); - /// Add heapallocsite metadata for MSAllocator calls. - void addHeapAllocSiteMetadata(llvm::Instruction *CallSite, QualType Ty, - SourceLocation Loc); - void completeType(const EnumDecl *ED); void completeType(const RecordDecl *RD); void completeRequiredType(const RecordDecl *RD); Removed: cfe/trunk/test/CodeGen/debug-info-codeview-heapallocsite.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-codeview-heapallocsite.c?rev=357951&view=auto ============================================================================== --- cfe/trunk/test/CodeGen/debug-info-codeview-heapallocsite.c (original) +++ cfe/trunk/test/CodeGen/debug-info-codeview-heapallocsite.c (removed) @@ -1,27 +0,0 @@ -// RUN: %clang_cc1 -triple x86_64-windows-msvc -debug-info-kind=limited -gcodeview -fdeclspec -S -emit-llvm < %s | FileCheck %s - -struct Foo { - int x; -}; - -__declspec(allocator) void *alloc_void(); -__declspec(allocator) struct Foo *alloc_foo(); - -void call_alloc_void() { - struct Foo *p = (struct Foo*)alloc_void(); -} - -void call_alloc_foo() { - struct Foo *p = alloc_foo(); -} - -// CHECK-LABEL: define {{.*}}void @call_alloc_void -// CHECK: call i8* {{.*}}@alloc_void{{.*}} !heapallocsite [[DBG1:!.*]] - -// CHECK-LABEL: define {{.*}}void @call_alloc_foo -// CHECK: call %struct.Foo* {{.*}}@alloc_foo{{.*}} !heapallocsite [[DBG2:!.*]] - -// CHECK: [[DBG1]] = !{} -// CHECK: [[DBG2]] = distinct !DICompositeType(tag: DW_TAG_structure_type, -// CHECK-SAME: name: "Foo" - _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits