Revert r329684 (and follow-ups 329693, 329714). See discussion on https://reviews.llvm.org/D43578.

llvm-svn: 329739
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 928d873..5c0026c 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -40,7 +40,6 @@
 #include "clang/Sema/TemplateInstCallback.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallSet.h"
-#include "llvm/Support/Timer.h"
 using namespace clang;
 using namespace sema;
 
@@ -843,9 +842,6 @@
 /// translation unit when EOF is reached and all but the top-level scope is
 /// popped.
 void Sema::ActOnEndOfTranslationUnit() {
-  llvm::NamedRegionTimer T(
-      "actoneou1", "Act On End Of Translation Unit: Common case",
-      GroupName, GroupDescription, llvm::TimePassesIsEnabled);
   assert(DelayedDiagnostics.getCurrentPool() == nullptr
          && "reached end of translation unit with a pool attached?");
 
@@ -871,10 +867,6 @@
   // Complete translation units and modules define vtables and perform implicit
   // instantiations. PCH files do not.
   if (TUKind != TU_Prefix) {
-    llvm::NamedRegionTimer T(
-        "actoneou2",
-        "Act On End Of Translation Unit: TUKind != TU_Prefix", GroupName,
-        GroupDescription, llvm::TimePassesIsEnabled);
     DiagnoseUseOfUnimplementedSelectors();
 
     // If DefinedUsedVTables ends up marking any virtual member functions it
@@ -937,10 +929,6 @@
       UnusedFileScopedDecls.end());
 
   if (TUKind == TU_Prefix) {
-    llvm::NamedRegionTimer T(
-        "actoneou3",
-        "Act On End Of Translation Unit: TUKind == TU_Prefix", GroupName,
-        GroupDescription, llvm::TimePassesIsEnabled);
     // Translation unit prefixes don't need any of the checking below.
     if (!PP.isIncrementalProcessingEnabled())
       TUScope = nullptr;
@@ -975,10 +963,6 @@
   }
 
   if (TUKind == TU_Module) {
-    llvm::NamedRegionTimer T(
-        "actoneou4",
-        "Act On End Of Translation Unit: TUKind == TU_Module", GroupName,
-        GroupDescription, llvm::TimePassesIsEnabled);
     // If we are building a module interface unit, we need to have seen the
     // module declaration by now.
     if (getLangOpts().getCompilingModule() ==
@@ -1573,9 +1557,6 @@
 ///  name, this parameter is populated with the decls of the various overloads.
 bool Sema::tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
                          UnresolvedSetImpl &OverloadSet) {
-  llvm::NamedRegionTimer T("tryascall", "Try Expr As Call", GroupName,
-                           GroupDescription, llvm::TimePassesIsEnabled);
-
   ZeroArgCallReturnTy = QualType();
   OverloadSet.clear();
 
@@ -1738,9 +1719,6 @@
 bool Sema::tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD,
                                 bool ForceComplain,
                                 bool (*IsPlausibleResult)(QualType)) {
-  llvm::NamedRegionTimer T("trytorecover", "Try To Recover With Call",
-                           GroupName, GroupDescription,
-                           llvm::TimePassesIsEnabled);
   SourceLocation Loc = E.get()->getExprLoc();
   SourceRange Range = E.get()->getSourceRange();
 
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 74f0de6..fdf7e2b 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -84,7 +84,6 @@
 #include "llvm/Support/Format.h"
 #include "llvm/Support/Locale.h"
 #include "llvm/Support/MathExtras.h"
-#include "llvm/Support/Timer.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
 #include <cassert>
@@ -119,7 +118,7 @@
   // Highlight all the excess arguments.
   SourceRange range(call->getArg(desiredArgCount)->getLocStart(),
                     call->getArg(argCount - 1)->getLocEnd());
-
+    
   return S.Diag(range.getBegin(), diag::err_typecheck_call_too_many_args)
     << 0 /*function call*/ << desiredArgCount << argCount
     << call->getArg(1)->getSourceRange();
@@ -225,7 +224,7 @@
 }
 
 static void SemaBuiltinMemChkCall(Sema &S, FunctionDecl *FDecl,
-                                  CallExpr *TheCall, unsigned SizeIdx,
+		                  CallExpr *TheCall, unsigned SizeIdx,
                                   unsigned DstSizeIdx) {
   if (TheCall->getNumArgs() <= SizeIdx ||
       TheCall->getNumArgs() <= DstSizeIdx)
@@ -492,9 +491,6 @@
 ///                    void (^block)(local void*, ...),
 ///                    uint size0, ...)
 static bool SemaOpenCLBuiltinEnqueueKernel(Sema &S, CallExpr *TheCall) {
-  llvm::NamedRegionTimer T(
-      "semaopenclbuiltin", "Sema OpenCL Builtin Enqueue Kernel",
-      Sema::GroupName, Sema::GroupDescription, llvm::TimePassesIsEnabled);
   unsigned NumArgs = TheCall->getNumArgs();
 
   if (NumArgs < 4) {
@@ -857,10 +853,6 @@
 ExprResult
 Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
                                CallExpr *TheCall) {
-  llvm::NamedRegionTimer T("checkbuiltinfunction",
-                           "Check Builtin Function Call", GroupName,
-                           GroupDescription, llvm::TimePassesIsEnabled);
-
   ExprResult TheCallResult(TheCall);
 
   // Find out if any arguments are required to be integer constant expressions.
@@ -2260,9 +2252,6 @@
 }
 
 bool Sema::CheckX86BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
-  llvm::NamedRegionTimer T("checkx86builtin",
-                           "Check X86 Builtin Function Call", GroupName,
-                           GroupDescription, llvm::TimePassesIsEnabled);
   if (BuiltinID == X86::BI__builtin_cpu_supports)
     return SemaBuiltinCpuSupports(*this, TheCall);
 
@@ -2704,8 +2693,6 @@
                      const Expr *ThisArg, ArrayRef<const Expr *> Args,
                      bool IsMemberFunction, SourceLocation Loc,
                      SourceRange Range, VariadicCallType CallType) {
-  llvm::NamedRegionTimer T("checkcall", "Check Call", GroupName,
-                           GroupDescription, llvm::TimePassesIsEnabled);
   // FIXME: We should check as much as we can in the template definition.
   if (CurContext->isDependentContext())
     return;
@@ -3344,10 +3331,6 @@
 /// builtins,
 ExprResult
 Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) {
-  llvm::NamedRegionTimer T("semabuiltinatomic",
-                           "Sema Builtin Atomic Overloaded", GroupName,
-                           GroupDescription, llvm::TimePassesIsEnabled);
-
   CallExpr *TheCall = (CallExpr *)TheCallResult.get();
   DeclRefExpr *DRE =cast<DeclRefExpr>(TheCall->getCallee()->IgnoreParenCasts());
   FunctionDecl *FDecl = cast<FunctionDecl>(DRE->getDecl());
@@ -9535,10 +9518,6 @@
 static void
 CheckImplicitConversion(Sema &S, Expr *E, QualType T, SourceLocation CC,
                         bool *ICContext = nullptr) {
-  llvm::NamedRegionTimer NRT("checkimplicit",
-                             "Check Implicit Conversion", Sema::GroupName,
-                             Sema::GroupDescription, llvm::TimePassesIsEnabled);
-
   if (E->isTypeDependent() || E->isValueDependent()) return;
 
   const Type *Source = S.Context.getCanonicalType(E->getType()).getTypePtr();
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 6ed2c9e..9228d65 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -44,7 +44,6 @@
 #include "clang/Sema/Template.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/Triple.h"
-#include "llvm/Support/Timer.h"
 #include <algorithm>
 #include <cstring>
 #include <functional>
@@ -850,8 +849,6 @@
                    SourceLocation NameLoc, const Token &NextToken,
                    bool IsAddressOfOperand,
                    std::unique_ptr<CorrectionCandidateCallback> CCC) {
-  llvm::NamedRegionTimer T("classifyname", "Classify Name", GroupName,
-                           GroupDescription, llvm::TimePassesIsEnabled);
   DeclarationNameInfo NameInfo(Name, NameLoc);
   ObjCMethodDecl *CurMethod = getCurMethodDecl();
 
@@ -5324,8 +5321,6 @@
 
 NamedDecl *Sema::HandleDeclarator(Scope *S, Declarator &D,
                                   MultiTemplateParamsArg TemplateParamLists) {
-  llvm::NamedRegionTimer T("handledeclarator", "Handle Declarator", GroupName,
-                           GroupDescription, llvm::TimePassesIsEnabled);
   // TODO: consider using NameInfo for diagnostic.
   DeclarationNameInfo NameInfo = GetNameForDeclarator(D);
   DeclarationName Name = NameInfo.getName();
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 0b86480..b8cadaf 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -44,7 +44,6 @@
 #include "clang/Sema/SemaInternal.h"
 #include "clang/Sema/Template.h"
 #include "llvm/Support/ConvertUTF.h"
-#include "llvm/Support/Timer.h"
 using namespace clang;
 using namespace sema;
 
@@ -1309,10 +1308,6 @@
                                 Expr *ControllingExpr,
                                 ArrayRef<ParsedType> ArgTypes,
                                 ArrayRef<Expr *> ArgExprs) {
-  llvm::NamedRegionTimer T("actongenericselection",
-                           "Act On Generic Selection Expr", GroupName,
-                           GroupDescription, llvm::TimePassesIsEnabled);
-
   unsigned NumAssocs = ArgTypes.size();
   assert(NumAssocs == ArgExprs.size());
 
@@ -1525,9 +1520,6 @@
 ExprResult
 Sema::ActOnStringLiteral(ArrayRef<Token> StringToks, Scope *UDLScope) {
   assert(!StringToks.empty() && "Must have at least one string!");
-  llvm::NamedRegionTimer T("actonstringliteral", "Act On String Literal",
-                           GroupName, GroupDescription,
-                           llvm::TimePassesIsEnabled);
 
   StringLiteralParser Literal(StringToks, PP);
   if (Literal.hadError)
@@ -2035,9 +2027,6 @@
                         bool IsInlineAsmIdentifier, Token *KeywordReplacement) {
   assert(!(IsAddressOfOperand && HasTrailingLParen) &&
          "cannot be direct & operand and have a trailing lparen");
-  llvm::NamedRegionTimer T("actonid", "Act On Id Expression",
-                           GroupName, GroupDescription,
-                           llvm::TimePassesIsEnabled);
   if (SS.isInvalid())
     return ExprError();
 
@@ -3074,10 +3063,6 @@
 }
 
 ExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind) {
-  llvm::NamedRegionTimer T("actonpredefined", "Act On Predefined Expr",
-                           GroupName, GroupDescription,
-                           llvm::TimePassesIsEnabled);
-
   PredefinedExpr::IdentType IT;
 
   switch (Kind) {
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 9df697e..9cc1bd5 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -32,7 +32,6 @@
 #include "llvm/ADT/SmallBitVector.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
-#include "llvm/Support/Timer.h"
 
 #include <iterator>
 using namespace clang;
@@ -304,9 +303,6 @@
                               QualType ObjectType,
                               bool EnteringContext,
                               bool &MemberOfUnknownSpecialization) {
-  llvm::NamedRegionTimer T("lookuptemplate", "Lookup Template Name",
-                           GroupName, GroupDescription,
-                           llvm::TimePassesIsEnabled);
   // Determine where to perform name lookup
   MemberOfUnknownSpecialization = false;
   DeclContext *LookupCtx = nullptr;
@@ -547,9 +543,6 @@
                                  const DeclarationNameInfo &NameInfo,
                                  bool isAddressOfOperand,
                            const TemplateArgumentListInfo *TemplateArgs) {
-  llvm::NamedRegionTimer T("actondependent",
-                           "Act On Dependent Id Expression", GroupName,
-                           GroupDescription, llvm::TimePassesIsEnabled);
   DeclContext *DC = getFunctionLevelDeclContext();
 
   // C++11 [expr.prim.general]p12: