]> granicus.if.org Git - clang/commitdiff
IRgen: Fix an immediate-exit-from-fn style nit.
authorDaniel Dunbar <daniel@zuster.org>
Thu, 10 Feb 2011 17:32:22 +0000 (17:32 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 10 Feb 2011 17:32:22 +0000 (17:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125289 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenFunction.cpp

index 364f2697e608762bf50400a6b2a28e9c7a4fd77a..5a4f2b70e33698c1845f97b2f7bb7b71b2136d00 100644 (file)
@@ -126,7 +126,8 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) {
   // Emit function epilog (to return).
   EmitReturnBlock();
 
-  EmitFunctionInstrumentation("__cyg_profile_func_exit");
+  if (ShouldInstrumentFunction())
+    EmitFunctionInstrumentation("__cyg_profile_func_exit");
 
   // Emit debug descriptor for function end.
   if (CGDebugInfo *DI = getDebugInfo()) {
@@ -185,9 +186,6 @@ bool CodeGenFunction::ShouldInstrumentFunction() {
 /// instrumentation function with the current function and the call site, if
 /// function instrumentation is enabled.
 void CodeGenFunction::EmitFunctionInstrumentation(const char *Fn) {
-  if (!ShouldInstrumentFunction())
-    return;
-
   const llvm::PointerType *PointerTy;
   const llvm::FunctionType *FunctionTy;
   std::vector<const llvm::Type*> ProfileFuncArgs;
@@ -267,7 +265,8 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
     DI->EmitFunctionStart(GD, FnType, CurFn, Builder);
   }
 
-  EmitFunctionInstrumentation("__cyg_profile_func_enter");
+  if (ShouldInstrumentFunction())
+    EmitFunctionInstrumentation("__cyg_profile_func_enter");
 
   if (CGM.getCodeGenOpts().InstrumentForProfiling)
     EmitMCountInstrumentation();