|
@@ -3791,6 +3791,8 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
|
|
|
|
|
|
llvm::FunctionType *IRFuncTy = getTypes().GetFunctionType(CallInfo);
|
|
llvm::FunctionType *IRFuncTy = getTypes().GetFunctionType(CallInfo);
|
|
|
|
|
|
|
|
+ const Decl *TargetDecl = Callee.getAbstractInfo().getCalleeDecl().getDecl();
|
|
|
|
+
|
|
#ifndef NDEBUG
|
|
#ifndef NDEBUG
|
|
if (!(CallInfo.isVariadic() && CallInfo.getArgStruct())) {
|
|
if (!(CallInfo.isVariadic() && CallInfo.getArgStruct())) {
|
|
// For an inalloca varargs function, we don't expect CallInfo to match the
|
|
// For an inalloca varargs function, we don't expect CallInfo to match the
|
|
@@ -4279,11 +4281,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
|
|
// Apply always_inline to all calls within flatten functions.
|
|
// Apply always_inline to all calls within flatten functions.
|
|
// FIXME: should this really take priority over __try, below?
|
|
// FIXME: should this really take priority over __try, below?
|
|
if (CurCodeDecl && CurCodeDecl->hasAttr<FlattenAttr>() &&
|
|
if (CurCodeDecl && CurCodeDecl->hasAttr<FlattenAttr>() &&
|
|
- !(Callee.getAbstractInfo().getCalleeDecl().getDecl() &&
|
|
|
|
- Callee.getAbstractInfo()
|
|
|
|
- .getCalleeDecl()
|
|
|
|
- .getDecl()
|
|
|
|
- ->hasAttr<NoInlineAttr>())) {
|
|
|
|
|
|
+ !(TargetDecl && TargetDecl->hasAttr<NoInlineAttr>())) {
|
|
Attrs =
|
|
Attrs =
|
|
Attrs.addAttribute(getLLVMContext(), llvm::AttributeList::FunctionIndex,
|
|
Attrs.addAttribute(getLLVMContext(), llvm::AttributeList::FunctionIndex,
|
|
llvm::Attribute::AlwaysInline);
|
|
llvm::Attribute::AlwaysInline);
|
|
@@ -4367,11 +4365,16 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
|
|
|
|
|
|
// Suppress tail calls if requested.
|
|
// Suppress tail calls if requested.
|
|
if (llvm::CallInst *Call = dyn_cast<llvm::CallInst>(CI)) {
|
|
if (llvm::CallInst *Call = dyn_cast<llvm::CallInst>(CI)) {
|
|
- const Decl *TargetDecl = Callee.getAbstractInfo().getCalleeDecl().getDecl();
|
|
|
|
if (TargetDecl && TargetDecl->hasAttr<NotTailCalledAttr>())
|
|
if (TargetDecl && TargetDecl->hasAttr<NotTailCalledAttr>())
|
|
Call->setTailCallKind(llvm::CallInst::TCK_NoTail);
|
|
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 (getDebugInfo() && TargetDecl &&
|
|
|
|
+ TargetDecl->hasAttr<MSAllocatorAttr>())
|
|
|
|
+ getDebugInfo()->addHeapAllocSiteMetadata(CI, RetTy, Loc);
|
|
|
|
+
|
|
// 4. Finish the call.
|
|
// 4. Finish the call.
|
|
|
|
|
|
// If the call doesn't return, finish the basic block and clear the
|
|
// If the call doesn't return, finish the basic block and clear the
|
|
@@ -4528,7 +4531,6 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
|
|
} ();
|
|
} ();
|
|
|
|
|
|
// Emit the assume_aligned check on the return value.
|
|
// Emit the assume_aligned check on the return value.
|
|
- const Decl *TargetDecl = Callee.getAbstractInfo().getCalleeDecl().getDecl();
|
|
|
|
if (Ret.isScalar() && TargetDecl) {
|
|
if (Ret.isScalar() && TargetDecl) {
|
|
if (const auto *AA = TargetDecl->getAttr<AssumeAlignedAttr>()) {
|
|
if (const auto *AA = TargetDecl->getAttr<AssumeAlignedAttr>()) {
|
|
llvm::Value *OffsetValue = nullptr;
|
|
llvm::Value *OffsetValue = nullptr;
|