From: Eric Christopher Date: Sat, 14 Nov 2015 01:56:04 +0000 (+0000) Subject: Clarify and elaborate the conditions on which we're checking target X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fb7eadc9ed0ec843961bb2fc5102b03fee6f2c9a;p=clang Clarify and elaborate the conditions on which we're checking target features for calls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253117 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 8b01094168..a3f863fc0a 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -3748,10 +3748,12 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType, llvm::Value *Callee, "Call must have function pointer type!"); if (const FunctionDecl *FD = dyn_cast_or_null(TargetDecl)) - // If this isn't an always_inline function we can't guarantee that any - // function isn't being used correctly so only check if we have the - // attribute and a set of target attributes that might be different from - // our default. + // We can only guarantee that a function is called from the correct + // context/function based on the appropriate target attributes, + // so only check in the case where we have both always_inline and target + // since otherwise we could be making a conditional call after a check for + // the proper cpu features (and it won't cause code generation issues due to + // function based code generation). if (TargetDecl->hasAttr() && TargetDecl->hasAttr()) checkTargetFeatures(E, FD);