r304127 - IRGen: Add optnone attribute on function during O0

2017-05-28 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Mon May 29 00:38:20 2017
New Revision: 304127

URL: http://llvm.org/viewvc/llvm-project?rev=304127&view=rev
Log:
IRGen: Add optnone attribute on function during O0

Amongst other, this will help LTO to correctly handle/honor files
compiled with O0, helping debugging failures.
It also seems in line with how we handle other options, like how
-fnoinline adds the appropriate attribute as well.

Differential Revision: https://reviews.llvm.org/D28404

Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/CodeGen/aarch64-neon-2velem.c
cfe/trunk/test/CodeGen/aarch64-neon-3v.c
cfe/trunk/test/CodeGen/aarch64-neon-across.c
cfe/trunk/test/CodeGen/aarch64-neon-extract.c
cfe/trunk/test/CodeGen/aarch64-neon-fcvt-intrinsics.c
cfe/trunk/test/CodeGen/aarch64-neon-fma.c
cfe/trunk/test/CodeGen/aarch64-neon-intrinsics.c
cfe/trunk/test/CodeGen/aarch64-neon-ldst-one.c
cfe/trunk/test/CodeGen/aarch64-neon-misc.c
cfe/trunk/test/CodeGen/aarch64-neon-perm.c
cfe/trunk/test/CodeGen/aarch64-neon-scalar-copy.c
cfe/trunk/test/CodeGen/aarch64-neon-scalar-x-indexed-elem.c
cfe/trunk/test/CodeGen/aarch64-neon-shifts.c
cfe/trunk/test/CodeGen/aarch64-neon-tbl.c
cfe/trunk/test/CodeGen/aarch64-neon-vcombine.c
cfe/trunk/test/CodeGen/aarch64-neon-vget-hilo.c
cfe/trunk/test/CodeGen/aarch64-neon-vget.c
cfe/trunk/test/CodeGen/aarch64-poly128.c
cfe/trunk/test/CodeGen/aarch64-poly64.c
cfe/trunk/test/CodeGen/address-safety-attr-kasan.cpp
cfe/trunk/test/CodeGen/address-safety-attr.cpp
cfe/trunk/test/CodeGen/arm-crc32.c
cfe/trunk/test/CodeGen/arm-neon-directed-rounding.c
cfe/trunk/test/CodeGen/arm-neon-fma.c
cfe/trunk/test/CodeGen/arm-neon-numeric-maxmin.c
cfe/trunk/test/CodeGen/arm-neon-shifts.c
cfe/trunk/test/CodeGen/arm-neon-vcvtX.c
cfe/trunk/test/CodeGen/arm-neon-vget.c
cfe/trunk/test/CodeGen/arm64-crc32.c
cfe/trunk/test/CodeGen/arm64-lanes.c
cfe/trunk/test/CodeGen/arm64_vcopy.c
cfe/trunk/test/CodeGen/arm64_vdupq_n_f64.c
cfe/trunk/test/CodeGen/attr-coldhot.c
cfe/trunk/test/CodeGen/attr-naked.c
cfe/trunk/test/CodeGen/builtins-arm-exclusive.c
cfe/trunk/test/CodeGen/builtins-arm.c
cfe/trunk/test/CodeGen/builtins-arm64.c
cfe/trunk/test/CodeGen/noduplicate-cxx11-test.cpp
cfe/trunk/test/CodeGen/pragma-weak.c
cfe/trunk/test/CodeGen/unwind-attr.c
cfe/trunk/test/CodeGenCXX/apple-kext-indirect-virtual-dtor-call.cpp
cfe/trunk/test/CodeGenCXX/apple-kext-no-staticinit-section.cpp
cfe/trunk/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp
cfe/trunk/test/CodeGenCXX/optnone-templates.cpp
cfe/trunk/test/CodeGenCXX/static-init-wasm.cpp
cfe/trunk/test/CodeGenCXX/thunks.cpp
cfe/trunk/test/CodeGenObjC/gnu-exceptions.m
cfe/trunk/test/CodeGenOpenCL/amdgpu-attrs.cl
cfe/trunk/test/Driver/darwin-iphone-defaults.m

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=304127&r1=304126&r2=304127&view=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Mon May 29 00:38:20 2017
@@ -172,6 +172,8 @@ def disable_llvm_optzns : Flag<["-"], "d
 def disable_lifetimemarkers : Flag<["-"], "disable-lifetime-markers">,
   HelpText<"Disable lifetime-markers emission even when optimizations are "
"enabled">;
+def disable_O0_optnone : Flag<["-"], "disable-O0-optnone">,
+  HelpText<"Disable adding the optnone attribute to functions at O0">;
 def disable_red_zone : Flag<["-"], "disable-red-zone">,
   HelpText<"Do not emit code that uses the red zone.">;
 def dwarf_column_info : Flag<["-"], "dwarf-column-info">,

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=304127&r1=304126&r2=304127&view=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Mon May 29 00:38:20 2017
@@ -53,6 +53,7 @@ CODEGENOPT(DisableLLVMPasses , 1, 0) ///
  ///< the pristine IR generated by the
  ///< frontend.
 CODEGENOPT(DisableLifetimeMarkers, 1, 0) ///< Don't emit any lifetime markers
+CODEGENOPT(DisableO0ImplyOptNone , 1, 0) ///< Don't annonate function with 
optnone at O0
 CODEGENOPT(ExperimentalNewPassManager, 1, 0) ///< Enables the new, experimental

r311857 - Emit static constexpr member as available_externally definition

2017-08-27 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Sun Aug 27 13:24:09 2017
New Revision: 311857

URL: http://llvm.org/viewvc/llvm-project?rev=311857&view=rev
Log:
Emit static constexpr member as available_externally definition

By exposing the constant initializer, the optimizer can fold many
of these constructs.

Differential Revision: https://reviews.llvm.org/D34992

Added:
cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=311857&r1=311856&r2=311857&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Sun Aug 27 13:24:09 2017
@@ -2437,6 +2437,28 @@ CodeGenModule::GetOrCreateLLVMGlobal(Str
 D->getType().isConstant(Context) &&
 isExternallyVisible(D->getLinkageAndVisibility().getLinkage()))
   GV->setSection(".cp.rodata");
+
+// Check if we a have a const declaration with an initializer, we may be
+// able to emit it as available_externally to expose it's value to the
+// optimizer.
+if (Context.getLangOpts().CPlusPlus && GV->hasExternalLinkage() &&
+D->getType().isConstQualified() && !GV->hasInitializer() &&
+!D->hasDefinition() && D->hasInit() && !D->hasAttr()) {
+  const auto *Record =
+  Context.getBaseElementType(D->getType())->getAsCXXRecordDecl();
+  bool HasMutableFields = Record && Record->hasMutableFields();
+  if (!HasMutableFields) {
+const VarDecl *InitDecl;
+const Expr *InitExpr = D->getAnyInitializer(InitDecl);
+if (InitExpr) {
+  GV->setConstant(true);
+  GV->setLinkage(llvm::GlobalValue::AvailableExternallyLinkage);
+  ConstantEmitter emitter(*this);
+  GV->setInitializer(emitter.tryEmitForInitializer(*InitDecl));
+  emitter.finalize(GV);
+}
+  }
+}
   }
 
   auto ExpectedAS =

Added: cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp?rev=311857&view=auto
==
--- cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp Sun Aug 27 13:24:09 
2017
@@ -0,0 +1,55 @@
+// RUN: %clang_cc1 -std=c++11 %s -emit-llvm -o - -triple x86_64-linux-gnu | 
FileCheck %s --check-prefix=CHECK --check-prefix=CXX11
+// RUN: %clang_cc1 -std=c++1z %s -emit-llvm -o - -triple x86_64-linux-gnu | 
FileCheck %s --check-prefix=CHECK --check-prefix=CXX17
+
+struct A {
+  static const int Foo = 123;
+};
+// CHECK: @_ZN1A3FooE = constant i32 123, align 4
+const int *p = &A::Foo; // emit available_externally
+const int A::Foo;   // convert to full definition
+
+struct Bar {
+  int b;
+};
+
+struct MutableBar {
+  mutable int b;
+};
+
+struct Foo {
+  // CXX11: @_ZN3Foo21ConstexprStaticMemberE = available_externally constant 
i32 42,
+  // CXX17: @_ZN3Foo21ConstexprStaticMemberE = linkonce_odr constant i32 42,
+  static constexpr int ConstexprStaticMember = 42;
+  // CHECK: @_ZN3Foo17ConstStaticMemberE = available_externally constant i32 
43,
+  static const int ConstStaticMember = 43;
+
+  // CXX11: @_ZN3Foo23ConstStaticStructMemberE = available_externally constant 
%struct.Bar { i32 44 },
+  // CXX17: @_ZN3Foo23ConstStaticStructMemberE = linkonce_odr constant 
%struct.Bar { i32 44 },
+  static constexpr Bar ConstStaticStructMember = {44};
+
+  // CXX11: @_ZN3Foo34ConstexprStaticMutableStructMemberE = external global 
%struct.MutableBar,
+  // CXX17: @_ZN3Foo34ConstexprStaticMutableStructMemberE = linkonce_odr 
global %struct.MutableBar { i32 45 },
+  static constexpr MutableBar ConstexprStaticMutableStructMember = {45};
+};
+// CHECK: @_ZL15ConstStaticexpr = internal constant i32 46,
+static constexpr int ConstStaticexpr = 46;
+// CHECK: @_ZL9ConstExpr = internal constant i32 46, align 4
+static const int ConstExpr = 46;
+
+// CHECK: @_ZL21ConstexprStaticStruct = internal constant %struct.Bar { i32 47 
},
+static constexpr Bar ConstexprStaticStruct = {47};
+
+// CHECK: @_ZL28ConstexprStaticMutableStruct = internal global 
%struct.MutableBar { i32 48 },
+static constexpr MutableBar ConstexprStaticMutableStruct = {48};
+
+void use(const int &);
+void foo() {
+  use(Foo::ConstexprStaticMember);
+  use(Foo::ConstStaticMember);
+  use(Foo::ConstStaticStructMember.b);
+  use(Foo::ConstexprStaticMutableStructMember.b);
+  use(ConstStaticexpr);
+  use(ConstExpr);
+  use(ConstexprStaticStruct.b);
+  use(ConstexprStaticMutableStruct.b);
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r311858 - CMake: only try to find the Z3 package when `CLANG_ANALYZER_BUILD_Z3` is ON

2017-08-27 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Sun Aug 27 13:24:23 2017
New Revision: 311858

URL: http://llvm.org/viewvc/llvm-project?rev=311858&view=rev
Log:
CMake: only try to find the Z3 package when `CLANG_ANALYZER_BUILD_Z3` is ON

This avoids the spurious message:

 Could NOT find Z3 (missing:  Z3_LIBRARIES Z3_INCLUDE_DIR) (Required is at 
least version "4.5")

Modified:
cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=311858&r1=311857&r2=311858&view=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Sun Aug 27 13:24:23 2017
@@ -187,8 +187,6 @@ if (LIBXML2_FOUND)
   set(CLANG_HAVE_LIBXML 1)
 endif()
 
-find_package(Z3 4.5)
-
 include(CheckIncludeFile)
 check_include_file(sys/resource.h CLANG_HAVE_RLIMITS)
 
@@ -384,6 +382,7 @@ if(NOT CLANG_ENABLE_STATIC_ANALYZER AND
 endif()
 
 if(CLANG_ANALYZER_BUILD_Z3)
+  find_package(Z3 4.5)
   if(Z3_FOUND)
 set(CLANG_ANALYZER_WITH_Z3 1)
   else()


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r311857 - Emit static constexpr member as available_externally definition

2017-08-28 Thread Mehdi AMINI via cfe-commits
Sorry for the inconvenience!

I will follow-up in the PR.

-- 
Mehdi


2017-08-28 12:42 GMT-07:00 Hans Wennborg :

> I reverted this in r311898 as it caused Chromium builds to fail with
> an assertion; see PR34348.
>
> On Sun, Aug 27, 2017 at 1:24 PM, Mehdi Amini via cfe-commits
>  wrote:
> > Author: mehdi_amini
> > Date: Sun Aug 27 13:24:09 2017
> > New Revision: 311857
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=311857&view=rev
> > Log:
> > Emit static constexpr member as available_externally definition
> >
> > By exposing the constant initializer, the optimizer can fold many
> > of these constructs.
> >
> > Differential Revision: https://reviews.llvm.org/D34992
> >
> > Added:
> > cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp
> > Modified:
> > cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> >
> > Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/
> CodeGenModule.cpp?rev=311857&r1=311856&r2=311857&view=diff
> > 
> ==
> > --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
> > +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Sun Aug 27 13:24:09 2017
> > @@ -2437,6 +2437,28 @@ CodeGenModule::GetOrCreateLLVMGlobal(Str
> >  D->getType().isConstant(Context) &&
> >  isExternallyVisible(D->getLinkageAndVisibility().getLinkage()))
> >GV->setSection(".cp.rodata");
> > +
> > +// Check if we a have a const declaration with an initializer, we
> may be
> > +// able to emit it as available_externally to expose it's value to
> the
> > +// optimizer.
> > +if (Context.getLangOpts().CPlusPlus && GV->hasExternalLinkage() &&
> > +D->getType().isConstQualified() && !GV->hasInitializer() &&
> > +!D->hasDefinition() && D->hasInit() &&
> !D->hasAttr()) {
> > +  const auto *Record =
> > +  Context.getBaseElementType(D->getType())->
> getAsCXXRecordDecl();
> > +  bool HasMutableFields = Record && Record->hasMutableFields();
> > +  if (!HasMutableFields) {
> > +const VarDecl *InitDecl;
> > +const Expr *InitExpr = D->getAnyInitializer(InitDecl);
> > +if (InitExpr) {
> > +  GV->setConstant(true);
> > +  GV->setLinkage(llvm::GlobalValue::
> AvailableExternallyLinkage);
> > +  ConstantEmitter emitter(*this);
> > +  GV->setInitializer(emitter.tryEmitForInitializer(*InitDecl));
> > +  emitter.finalize(GV);
> > +}
> > +  }
> > +}
> >}
> >
> >auto ExpectedAS =
> >
> > Added: cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> CodeGenCXX/cxx11-extern-constexpr.cpp?rev=311857&view=auto
> > 
> ==
> > --- cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp (added)
> > +++ cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp Sun Aug 27
> 13:24:09 2017
> > @@ -0,0 +1,55 @@
> > +// RUN: %clang_cc1 -std=c++11 %s -emit-llvm -o - -triple
> x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK --check-prefix=CXX11
> > +// RUN: %clang_cc1 -std=c++1z %s -emit-llvm -o - -triple
> x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK --check-prefix=CXX17
> > +
> > +struct A {
> > +  static const int Foo = 123;
> > +};
> > +// CHECK: @_ZN1A3FooE = constant i32 123, align 4
> > +const int *p = &A::Foo; // emit available_externally
> > +const int A::Foo;   // convert to full definition
> > +
> > +struct Bar {
> > +  int b;
> > +};
> > +
> > +struct MutableBar {
> > +  mutable int b;
> > +};
> > +
> > +struct Foo {
> > +  // CXX11: @_ZN3Foo21ConstexprStaticMemberE = available_externally
> constant i32 42,
> > +  // CXX17: @_ZN3Foo21ConstexprStaticMemberE = linkonce_odr constant
> i32 42,
> > +  static constexpr int ConstexprStaticMember = 42;
> > +  // CHECK: @_ZN3Foo17ConstStaticMemberE = available_externally
> constant i32 43,
> > +  static const int ConstStaticMember = 43;
> > +
> > +  // CXX11: @_ZN3Foo23ConstStaticStructMemberE = available_externally
> constant %struct.Bar { i32 44 },
> > +  // CXX17: @_ZN3Foo23ConstStaticStructMemberE = linkonce_odr constant
> %st

r312512 - Emit static constexpr member as available_externally definition

2017-09-04 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Mon Sep  4 20:58:35 2017
New Revision: 312512

URL: http://llvm.org/viewvc/llvm-project?rev=312512&view=rev
Log:
Emit static constexpr member as available_externally definition

By exposing the constant initializer, the optimizer can fold many
of these constructs.

This is a recommit of r311857 that was reverted in r311898 because
an assert was hit when building Chromium.
We have to take into account that the GlobalVariable may be first
created with a different type than the initializer. This can
happen for example when the variable is a struct with tail padding
while the initializer does not have padding. In such case, the
variable needs to be destroyed an replaced with a new one with the
type of the initializer.

Differential Revision: https://reviews.llvm.org/D34992

Added:
cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=312512&r1=312511&r2=312512&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Sep  4 20:58:35 2017
@@ -2437,6 +2437,48 @@ CodeGenModule::GetOrCreateLLVMGlobal(Str
 D->getType().isConstant(Context) &&
 isExternallyVisible(D->getLinkageAndVisibility().getLinkage()))
   GV->setSection(".cp.rodata");
+
+// Check if we a have a const declaration with an initializer, we may be
+// able to emit it as available_externally to expose it's value to the
+// optimizer.
+if (Context.getLangOpts().CPlusPlus && GV->hasExternalLinkage() &&
+D->getType().isConstQualified() && !GV->hasInitializer() &&
+!D->hasDefinition() && D->hasInit() && !D->hasAttr()) {
+  const auto *Record =
+  Context.getBaseElementType(D->getType())->getAsCXXRecordDecl();
+  bool HasMutableFields = Record && Record->hasMutableFields();
+  if (!HasMutableFields) {
+const VarDecl *InitDecl;
+const Expr *InitExpr = D->getAnyInitializer(InitDecl);
+if (InitExpr) {
+  ConstantEmitter emitter(*this);
+  llvm::Constant *Init = emitter.tryEmitForInitializer(*InitDecl);
+  if (Init) {
+auto *InitType = Init->getType();
+if (GV->getType()->getElementType() != InitType) {
+  // The type of the initializer does not match the definition.
+  // This happens when an initializer has a different type from
+  // the type of the global (because of padding at the end of a
+  // structure for instance).
+  GV->setName(StringRef());
+  // Make a new global with the correct type, this is now 
guaranteed
+  // to work.
+  auto *NewGV = cast(
+  GetAddrOfGlobalVar(D, InitType, IsForDefinition));
+
+  // Erase the old global, since it is no longer used.
+  cast(GV)->eraseFromParent();
+  GV = NewGV;
+} else {
+  GV->setInitializer(Init);
+  GV->setConstant(true);
+  GV->setLinkage(llvm::GlobalValue::AvailableExternallyLinkage);
+}
+emitter.finalize(GV);
+  }
+}
+  }
+}
   }
 
   auto ExpectedAS =

Added: cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp?rev=312512&view=auto
==
--- cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp Mon Sep  4 20:58:35 
2017
@@ -0,0 +1,68 @@
+// RUN: %clang_cc1 -std=c++11 %s -emit-llvm -o - -triple x86_64-linux-gnu | 
FileCheck %s --check-prefix=CHECK --check-prefix=CXX11
+// RUN: %clang_cc1 -std=c++1z %s -emit-llvm -o - -triple x86_64-linux-gnu | 
FileCheck %s --check-prefix=CHECK --check-prefix=CXX17
+
+struct A {
+  static const int Foo = 123;
+};
+// CHECK: @_ZN1A3FooE = constant i32 123, align 4
+const int *p = &A::Foo; // emit available_externally
+const int A::Foo;   // convert to full definition
+
+struct PODWithInit {
+  int g = 42;
+  char h = 43;
+};
+struct CreatePOD {
+  // Deferred initialization of the structure here requires changing
+  // the type of the global variable: the initializer list does not include
+  // the tail padding.
+  // CXX11: @_ZN9CreatePOD3podE = available_externally constant { i32, i8 } { 
i32 42, i8 43 },
+  static constexpr PODWithInit pod{};
+};
+const int *p_pod = &CreatePOD::pod.g;
+
+struct Bar {
+  int b;
+};
+
+struct MutableBar {
+  mutable int b;
+};
+
+struct Foo {
+  // CXX11: @_ZN3Foo21ConstexprStaticMemberE = available_externally constant 
i32 42,
+  // CXX17: @_ZN3Foo21ConstexprStaticMemberE 

Re: r311857 - Emit static constexpr member as available_externally definition

2017-09-04 Thread Mehdi AMINI via cfe-commits
Hey Hans,

Just a heads up that I fixed the issue and reapplies the commit in r312512.
Let me know if any new issues occur! (and feel free to revert of course).

Thanks,

-- 
Mehdi

2017-08-28 14:18 GMT-07:00 Mehdi AMINI :

> Sorry for the inconvenience!
>
> I will follow-up in the PR.
>
> --
> Mehdi
>
>
> 2017-08-28 12:42 GMT-07:00 Hans Wennborg :
>
>> I reverted this in r311898 as it caused Chromium builds to fail with
>> an assertion; see PR34348.
>>
>> On Sun, Aug 27, 2017 at 1:24 PM, Mehdi Amini via cfe-commits
>>  wrote:
>> > Author: mehdi_amini
>> > Date: Sun Aug 27 13:24:09 2017
>> > New Revision: 311857
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=311857&view=rev
>> > Log:
>> > Emit static constexpr member as available_externally definition
>> >
>> > By exposing the constant initializer, the optimizer can fold many
>> > of these constructs.
>> >
>> > Differential Revision: https://reviews.llvm.org/D34992
>> >
>> > Added:
>> > cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp
>> > Modified:
>> > cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>> >
>> > Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Co
>> deGenModule.cpp?rev=311857&r1=311856&r2=311857&view=diff
>> > 
>> ==
>> > --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
>> > +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Sun Aug 27 13:24:09 2017
>> > @@ -2437,6 +2437,28 @@ CodeGenModule::GetOrCreateLLVMGlobal(Str
>> >  D->getType().isConstant(Context) &&
>> >  isExternallyVisible(D->getLinkageAndVisibility().getLinkage(
>> )))
>> >GV->setSection(".cp.rodata");
>> > +
>> > +// Check if we a have a const declaration with an initializer, we
>> may be
>> > +// able to emit it as available_externally to expose it's value to
>> the
>> > +// optimizer.
>> > +if (Context.getLangOpts().CPlusPlus && GV->hasExternalLinkage() &&
>> > +D->getType().isConstQualified() && !GV->hasInitializer() &&
>> > +!D->hasDefinition() && D->hasInit() &&
>> !D->hasAttr()) {
>> > +  const auto *Record =
>> > +  Context.getBaseElementType(D->getType())->getAsCXXRecordDecl
>> ();
>> > +  bool HasMutableFields = Record && Record->hasMutableFields();
>> > +  if (!HasMutableFields) {
>> > +const VarDecl *InitDecl;
>> > +const Expr *InitExpr = D->getAnyInitializer(InitDecl);
>> > +if (InitExpr) {
>> > +  GV->setConstant(true);
>> > +  GV->setLinkage(llvm::GlobalValue::AvailableExternallyLinkage
>> );
>> > +  ConstantEmitter emitter(*this);
>> > +  GV->setInitializer(emitter.tryEmitForInitializer(*InitDecl))
>> ;
>> > +  emitter.finalize(GV);
>> > +}
>> > +  }
>> > +}
>> >}
>> >
>> >auto ExpectedAS =
>> >
>> > Added: cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp
>> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCX
>> X/cxx11-extern-constexpr.cpp?rev=311857&view=auto
>> > 
>> ==
>> > --- cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp (added)
>> > +++ cfe/trunk/test/CodeGenCXX/cxx11-extern-constexpr.cpp Sun Aug 27
>> 13:24:09 2017
>> > @@ -0,0 +1,55 @@
>> > +// RUN: %clang_cc1 -std=c++11 %s -emit-llvm -o - -triple
>> x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK --check-prefix=CXX11
>> > +// RUN: %clang_cc1 -std=c++1z %s -emit-llvm -o - -triple
>> x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK --check-prefix=CXX17
>> > +
>> > +struct A {
>> > +  static const int Foo = 123;
>> > +};
>> > +// CHECK: @_ZN1A3FooE = constant i32 123, align 4
>> > +const int *p = &A::Foo; // emit available_externally
>> > +const int A::Foo;   // convert to full definition
>> > +
>> > +struct Bar {
>> > +  int b;
>> > +};
>> > +
>> > +struct MutableBar {
>> > +  mutable int b;
>> > +};
>> 

[clang] 57d2d48 - Revert "[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff."

2020-04-09 Thread Mehdi Amini via cfe-commits

Author: Mehdi Amini
Date: 2020-04-10T06:27:59Z
New Revision: 57d2d48399b63c0ef1dda490fdaf28efbb80c2c0

URL: 
https://github.com/llvm/llvm-project/commit/57d2d48399b63c0ef1dda490fdaf28efbb80c2c0
DIFF: 
https://github.com/llvm/llvm-project/commit/57d2d48399b63c0ef1dda490fdaf28efbb80c2c0.diff

LOG: Revert "[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff."

This reverts commit a90374988e4eb8c50d91e11f4e61cdbd5debb235 and 
5da1671bf82306b7fa8dca48f495896c2b29e909.

A new dependency is introduced here from Support to IR which seems like
a layering violation. It also breaks the MLIR build at the moment.

Added: 


Modified: 
clang/include/clang/Analysis/Analyses/Dominators.h
llvm/include/llvm/IR/CFGDiff.h
llvm/include/llvm/IR/Dominators.h
llvm/include/llvm/Support/GenericDomTree.h
llvm/include/llvm/Support/GenericDomTreeConstruction.h
llvm/lib/IR/Dominators.cpp

Removed: 




diff  --git a/clang/include/clang/Analysis/Analyses/Dominators.h 
b/clang/include/clang/Analysis/Analyses/Dominators.h
index c0cfc186c365..061c98137da2 100644
--- a/clang/include/clang/Analysis/Analyses/Dominators.h
+++ b/clang/include/clang/Analysis/Analyses/Dominators.h
@@ -275,6 +275,76 @@ class ControlDependencyCalculator : public ManagedAnalysis 
{
 
 namespace llvm {
 
+/// Clang's CFG contains nullpointers for unreachable succesors, e.g. when an
+/// if statement's condition is always false, it's 'then' branch is represented
+/// with a nullptr. This however will result in a nullpointer derefernece for
+/// dominator tree calculation.
+///
+/// To circumvent this, let's just crudely specialize the children getters
+/// used in LLVM's dominator tree builder.
+namespace DomTreeBuilder {
+
+using ClangCFGDomChildrenGetter =
+SemiNCAInfo::ChildrenGetter<
+ 
/*Inverse=*/false>;
+
+template <>
+template <>
+inline ClangCFGDomChildrenGetter::ResultTy ClangCFGDomChildrenGetter::Get(
+clang::CFGBlock *N, std::integral_constant) {
+  auto RChildren = reverse(children(N));
+  ResultTy Ret(RChildren.begin(), RChildren.end());
+  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
+  return Ret;
+}
+
+using ClangCFGDomReverseChildrenGetter =
+SemiNCAInfo::ChildrenGetter<
+  
/*Inverse=*/true>;
+
+template <>
+template <>
+inline ClangCFGDomReverseChildrenGetter::ResultTy
+ClangCFGDomReverseChildrenGetter::Get(
+clang::CFGBlock *N, std::integral_constant) {
+  auto IChildren = inverse_children(N);
+  ResultTy Ret(IChildren.begin(), IChildren.end());
+  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
+  return Ret;
+}
+
+using ClangCFGPostDomChildrenGetter =
+SemiNCAInfo::ChildrenGetter<
+ 
/*Inverse=*/false>;
+
+template <>
+template <>
+inline ClangCFGPostDomChildrenGetter::ResultTy
+ClangCFGPostDomChildrenGetter::Get(
+clang::CFGBlock *N, std::integral_constant) {
+  auto RChildren = reverse(children(N));
+  ResultTy Ret(RChildren.begin(), RChildren.end());
+  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
+  return Ret;
+}
+
+using ClangCFGPostDomReverseChildrenGetter =
+SemiNCAInfo::ChildrenGetter<
+  
/*Inverse=*/true>;
+
+template <>
+template <>
+inline ClangCFGPostDomReverseChildrenGetter::ResultTy
+ClangCFGPostDomReverseChildrenGetter::Get(
+clang::CFGBlock *N, std::integral_constant) {
+  auto IChildren = inverse_children(N);
+  ResultTy Ret(IChildren.begin(), IChildren.end());
+  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
+  return Ret;
+}
+
+} // end of namespace DomTreeBuilder
+
 //===-
 /// DominatorTree GraphTraits specialization so the DominatorTree can be
 /// iterable by generic graph iterators.

diff  --git a/llvm/include/llvm/IR/CFGDiff.h b/llvm/include/llvm/IR/CFGDiff.h
index 5f2b5c709324..c50db0de79a3 100644
--- a/llvm/include/llvm/IR/CFGDiff.h
+++ b/llvm/include/llvm/IR/CFGDiff.h
@@ -195,23 +195,6 @@ template  
class GraphDiff {
 #endif
 };
 
-namespace detail {
-template 
-auto reverse_if_helper(Range &&R, std::integral_constant) {
-  return std::forward(R);
-}
-
-template 
-auto reverse_if_helper(Range &&R, std::integral_constant) {
-  return llvm::reverse(std::forward(R));
-}
-
-template  auto reverse_if(Range &&R) {
-  return reverse_if_helper(std::forward(R),
-   std::integral_constant{});
-}
-} // namespace detail
-
 template >
 struct CFGViewChildren {
@@ -228,10 +211,9 @@ struct CFGViewChildren {
 
 // filter iterator init:
 auto R = make_range(GT::child_begin(N.second), GT::child_end(N.second));
-auto RR = detail::reverse_if(R);
 // This lambda is copied into the iterators and persis

[clang] 0445c64 - [DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff.

2020-04-10 Thread Mehdi Amini via cfe-commits

Author: Alina Sbirlea
Date: 2020-04-10T07:38:53Z
New Revision: 0445c64998d14b81f0d3a3182011fc5eae47fa71

URL: 
https://github.com/llvm/llvm-project/commit/0445c64998d14b81f0d3a3182011fc5eae47fa71
DIFF: 
https://github.com/llvm/llvm-project/commit/0445c64998d14b81f0d3a3182011fc5eae47fa71.diff

LOG: [DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff.

This replaces the ChildrenGetter inside the DominatorTree with
GraphTraits over a GraphDiff object, an object which encapsulated the
view of the previous CFG.
This also simplifies the extentions in clang which use DominatorTree, as
GraphDiff also filters nullptrs.

Re-land a90374988e4eb8c50d91e11f4e61cdbd5debb235 after moving CFGDiff.h
to Support.

Differential Revision: https://reviews.llvm.org/D77341

Added: 


Modified: 
clang/include/clang/Analysis/Analyses/Dominators.h
llvm/include/llvm/IR/Dominators.h
llvm/include/llvm/Support/CFGDiff.h
llvm/include/llvm/Support/GenericDomTree.h
llvm/include/llvm/Support/GenericDomTreeConstruction.h
llvm/lib/IR/Dominators.cpp

Removed: 




diff  --git a/clang/include/clang/Analysis/Analyses/Dominators.h 
b/clang/include/clang/Analysis/Analyses/Dominators.h
index 061c98137da2..c0cfc186c365 100644
--- a/clang/include/clang/Analysis/Analyses/Dominators.h
+++ b/clang/include/clang/Analysis/Analyses/Dominators.h
@@ -275,76 +275,6 @@ class ControlDependencyCalculator : public ManagedAnalysis 
{
 
 namespace llvm {
 
-/// Clang's CFG contains nullpointers for unreachable succesors, e.g. when an
-/// if statement's condition is always false, it's 'then' branch is represented
-/// with a nullptr. This however will result in a nullpointer derefernece for
-/// dominator tree calculation.
-///
-/// To circumvent this, let's just crudely specialize the children getters
-/// used in LLVM's dominator tree builder.
-namespace DomTreeBuilder {
-
-using ClangCFGDomChildrenGetter =
-SemiNCAInfo::ChildrenGetter<
- 
/*Inverse=*/false>;
-
-template <>
-template <>
-inline ClangCFGDomChildrenGetter::ResultTy ClangCFGDomChildrenGetter::Get(
-clang::CFGBlock *N, std::integral_constant) {
-  auto RChildren = reverse(children(N));
-  ResultTy Ret(RChildren.begin(), RChildren.end());
-  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
-  return Ret;
-}
-
-using ClangCFGDomReverseChildrenGetter =
-SemiNCAInfo::ChildrenGetter<
-  
/*Inverse=*/true>;
-
-template <>
-template <>
-inline ClangCFGDomReverseChildrenGetter::ResultTy
-ClangCFGDomReverseChildrenGetter::Get(
-clang::CFGBlock *N, std::integral_constant) {
-  auto IChildren = inverse_children(N);
-  ResultTy Ret(IChildren.begin(), IChildren.end());
-  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
-  return Ret;
-}
-
-using ClangCFGPostDomChildrenGetter =
-SemiNCAInfo::ChildrenGetter<
- 
/*Inverse=*/false>;
-
-template <>
-template <>
-inline ClangCFGPostDomChildrenGetter::ResultTy
-ClangCFGPostDomChildrenGetter::Get(
-clang::CFGBlock *N, std::integral_constant) {
-  auto RChildren = reverse(children(N));
-  ResultTy Ret(RChildren.begin(), RChildren.end());
-  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
-  return Ret;
-}
-
-using ClangCFGPostDomReverseChildrenGetter =
-SemiNCAInfo::ChildrenGetter<
-  
/*Inverse=*/true>;
-
-template <>
-template <>
-inline ClangCFGPostDomReverseChildrenGetter::ResultTy
-ClangCFGPostDomReverseChildrenGetter::Get(
-clang::CFGBlock *N, std::integral_constant) {
-  auto IChildren = inverse_children(N);
-  ResultTy Ret(IChildren.begin(), IChildren.end());
-  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
-  return Ret;
-}
-
-} // end of namespace DomTreeBuilder
-
 //===-
 /// DominatorTree GraphTraits specialization so the DominatorTree can be
 /// iterable by generic graph iterators.

diff  --git a/llvm/include/llvm/IR/Dominators.h 
b/llvm/include/llvm/IR/Dominators.h
index 6a14785a6cc3..0c98902c72c8 100644
--- a/llvm/include/llvm/IR/Dominators.h
+++ b/llvm/include/llvm/IR/Dominators.h
@@ -44,6 +44,9 @@ using BBPostDomTree = PostDomTreeBase;
 
 using BBUpdates = ArrayRef>;
 
+using BBDomTreeGraphDiff = GraphDiff;
+using BBPostDomTreeGraphDiff = GraphDiff;
+
 extern template void Calculate(BBDomTree &DT);
 extern template void CalculateWithUpdates(BBDomTree &DT,
  BBUpdates U);
@@ -62,8 +65,10 @@ extern template void DeleteEdge(BBPostDomTree 
&DT,
BasicBlock *From,
BasicBlock *To);
 
-extern template void ApplyUpdates(BBDomTree

[clang] bbeeb35 - Revert "[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff."

2020-04-10 Thread Mehdi Amini via cfe-commits

Author: Mehdi Amini
Date: 2020-04-10T07:44:06Z
New Revision: bbeeb35c1ffaf7aeb3241bdfcb69bf4708370ac1

URL: 
https://github.com/llvm/llvm-project/commit/bbeeb35c1ffaf7aeb3241bdfcb69bf4708370ac1
DIFF: 
https://github.com/llvm/llvm-project/commit/bbeeb35c1ffaf7aeb3241bdfcb69bf4708370ac1.diff

LOG: Revert "[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff."

This reverts commit 0445c64998d14b81f0d3a3182011fc5eae47fa71.

MLIR Build is broken by this change at the moment.

Added: 


Modified: 
clang/include/clang/Analysis/Analyses/Dominators.h
llvm/include/llvm/IR/Dominators.h
llvm/include/llvm/Support/CFGDiff.h
llvm/include/llvm/Support/GenericDomTree.h
llvm/include/llvm/Support/GenericDomTreeConstruction.h
llvm/lib/IR/Dominators.cpp

Removed: 




diff  --git a/clang/include/clang/Analysis/Analyses/Dominators.h 
b/clang/include/clang/Analysis/Analyses/Dominators.h
index c0cfc186c365..061c98137da2 100644
--- a/clang/include/clang/Analysis/Analyses/Dominators.h
+++ b/clang/include/clang/Analysis/Analyses/Dominators.h
@@ -275,6 +275,76 @@ class ControlDependencyCalculator : public ManagedAnalysis 
{
 
 namespace llvm {
 
+/// Clang's CFG contains nullpointers for unreachable succesors, e.g. when an
+/// if statement's condition is always false, it's 'then' branch is represented
+/// with a nullptr. This however will result in a nullpointer derefernece for
+/// dominator tree calculation.
+///
+/// To circumvent this, let's just crudely specialize the children getters
+/// used in LLVM's dominator tree builder.
+namespace DomTreeBuilder {
+
+using ClangCFGDomChildrenGetter =
+SemiNCAInfo::ChildrenGetter<
+ 
/*Inverse=*/false>;
+
+template <>
+template <>
+inline ClangCFGDomChildrenGetter::ResultTy ClangCFGDomChildrenGetter::Get(
+clang::CFGBlock *N, std::integral_constant) {
+  auto RChildren = reverse(children(N));
+  ResultTy Ret(RChildren.begin(), RChildren.end());
+  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
+  return Ret;
+}
+
+using ClangCFGDomReverseChildrenGetter =
+SemiNCAInfo::ChildrenGetter<
+  
/*Inverse=*/true>;
+
+template <>
+template <>
+inline ClangCFGDomReverseChildrenGetter::ResultTy
+ClangCFGDomReverseChildrenGetter::Get(
+clang::CFGBlock *N, std::integral_constant) {
+  auto IChildren = inverse_children(N);
+  ResultTy Ret(IChildren.begin(), IChildren.end());
+  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
+  return Ret;
+}
+
+using ClangCFGPostDomChildrenGetter =
+SemiNCAInfo::ChildrenGetter<
+ 
/*Inverse=*/false>;
+
+template <>
+template <>
+inline ClangCFGPostDomChildrenGetter::ResultTy
+ClangCFGPostDomChildrenGetter::Get(
+clang::CFGBlock *N, std::integral_constant) {
+  auto RChildren = reverse(children(N));
+  ResultTy Ret(RChildren.begin(), RChildren.end());
+  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
+  return Ret;
+}
+
+using ClangCFGPostDomReverseChildrenGetter =
+SemiNCAInfo::ChildrenGetter<
+  
/*Inverse=*/true>;
+
+template <>
+template <>
+inline ClangCFGPostDomReverseChildrenGetter::ResultTy
+ClangCFGPostDomReverseChildrenGetter::Get(
+clang::CFGBlock *N, std::integral_constant) {
+  auto IChildren = inverse_children(N);
+  ResultTy Ret(IChildren.begin(), IChildren.end());
+  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
+  return Ret;
+}
+
+} // end of namespace DomTreeBuilder
+
 //===-
 /// DominatorTree GraphTraits specialization so the DominatorTree can be
 /// iterable by generic graph iterators.

diff  --git a/llvm/include/llvm/IR/Dominators.h 
b/llvm/include/llvm/IR/Dominators.h
index 0c98902c72c8..6a14785a6cc3 100644
--- a/llvm/include/llvm/IR/Dominators.h
+++ b/llvm/include/llvm/IR/Dominators.h
@@ -44,9 +44,6 @@ using BBPostDomTree = PostDomTreeBase;
 
 using BBUpdates = ArrayRef>;
 
-using BBDomTreeGraphDiff = GraphDiff;
-using BBPostDomTreeGraphDiff = GraphDiff;
-
 extern template void Calculate(BBDomTree &DT);
 extern template void CalculateWithUpdates(BBDomTree &DT,
  BBUpdates U);
@@ -65,10 +62,8 @@ extern template void DeleteEdge(BBPostDomTree 
&DT,
BasicBlock *From,
BasicBlock *To);
 
-extern template void ApplyUpdates(BBDomTree &DT,
- BBDomTreeGraphDiff &);
-extern template void ApplyUpdates(BBPostDomTree &DT,
- BBPostDomTreeGraphDiff &);
+extern template void ApplyUpdates(BBDomTree &DT, BBUpdates);
+extern template 

[clang] ed03d94 - Revert "[TLI] Per-function fveclib for math library used for vectorization"

2020-04-10 Thread Mehdi Amini via cfe-commits

Author: Mehdi Amini
Date: 2020-04-11T01:05:01Z
New Revision: ed03d9485eb5b502708f8a21ce34fa6da05a9ca5

URL: 
https://github.com/llvm/llvm-project/commit/ed03d9485eb5b502708f8a21ce34fa6da05a9ca5
DIFF: 
https://github.com/llvm/llvm-project/commit/ed03d9485eb5b502708f8a21ce34fa6da05a9ca5.diff

LOG: Revert "[TLI] Per-function fveclib for math library used for vectorization"

This reverts commit 60c642e74be6af86906d9f3d982728be7bd4329f.

This patch is making the TLI "closed" for a predefined set of VecLib
while at the moment it is extensible for anyone to customize when using
LLVM as a library.
Reverting while we figure out a way to re-land it without losing the
generality of the current API.

Differential Revision: https://reviews.llvm.org/D77925

Added: 


Modified: 
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/CodeGen/CGCall.cpp
llvm/include/llvm/Analysis/TargetLibraryInfo.h
llvm/lib/Analysis/InlineCost.cpp
llvm/lib/Analysis/TargetLibraryInfo.cpp
llvm/test/Transforms/Inline/inline-no-builtin-compatible.ll

Removed: 
clang/test/CodeGen/libcalls-veclib.c
llvm/test/Transforms/Inline/veclib-compat.ll



diff  --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index bd1a4e50e7a5..87d5ebe853d8 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -354,8 +354,24 @@ static void addMemTagOptimizationPasses(const 
PassManagerBuilder &Builder,
   PM.add(createStackSafetyGlobalInfoWrapperPass(/*SetMetadata=*/true));
 }
 
-static TargetLibraryInfoImpl *createTLII(llvm::Triple &TargetTriple) {
-  return new TargetLibraryInfoImpl(TargetTriple);
+static TargetLibraryInfoImpl *createTLII(llvm::Triple &TargetTriple,
+ const CodeGenOptions &CodeGenOpts) {
+  TargetLibraryInfoImpl *TLII = new TargetLibraryInfoImpl(TargetTriple);
+
+  switch (CodeGenOpts.getVecLib()) {
+  case CodeGenOptions::Accelerate:
+
TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::Accelerate);
+break;
+  case CodeGenOptions::MASSV:
+TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::MASSV);
+break;
+  case CodeGenOptions::SVML:
+TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::SVML);
+break;
+  default:
+break;
+  }
+  return TLII;
 }
 
 static void addSymbolRewriterPass(const CodeGenOptions &Opts,
@@ -548,7 +564,8 @@ void EmitAssemblyHelper::CreatePasses(legacy::PassManager 
&MPM,
   // are inserted before PMBuilder ones - they'd get the default-constructed
   // TLI with an unknown target otherwise.
   Triple TargetTriple(TheModule->getTargetTriple());
-  std::unique_ptr TLII(createTLII(TargetTriple));
+  std::unique_ptr TLII(
+  createTLII(TargetTriple, CodeGenOpts));
 
   // If we reached here with a non-empty index file name, then the index file
   // was empty and we are not performing ThinLTO backend compilation (used in
@@ -790,7 +807,8 @@ bool EmitAssemblyHelper::AddEmitPasses(legacy::PassManager 
&CodeGenPasses,
raw_pwrite_stream *DwoOS) {
   // Add LibraryInfo.
   llvm::Triple TargetTriple(TheModule->getTargetTriple());
-  std::unique_ptr TLII(createTLII(TargetTriple));
+  std::unique_ptr TLII(
+  createTLII(TargetTriple, CodeGenOpts));
   CodeGenPasses.add(new TargetLibraryInfoWrapperPass(*TLII));
 
   // Normal mode, emit a .s or .o file by running the code generator. Note,
@@ -1126,7 +1144,8 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager(
   // Register the target library analysis directly and give it a customized
   // preset TLI.
   Triple TargetTriple(TheModule->getTargetTriple());
-  std::unique_ptr TLII(createTLII(TargetTriple));
+  std::unique_ptr TLII(
+  createTLII(TargetTriple, CodeGenOpts));
   FAM.registerPass([&] { return TargetLibraryAnalysis(*TLII); });
 
   // Register all the basic analyses with the managers.

diff  --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 73869fa3c9b0..3c44632dfd60 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -1868,24 +1868,6 @@ static void addNoBuiltinAttributes(llvm::AttrBuilder 
&FuncAttrs,
   llvm::for_each(NBA->builtinNames(), AddNoBuiltinAttr);
 }
 
-static void addVectLibAttributes(llvm::AttrBuilder &FuncAttrs,
- const CodeGenOptions &CodeGenOpts) {
-  StringRef AttributeName = "veclib";
-  switch (CodeGenOpts.getVecLib()) {
-  case CodeGenOptions::Accelerate:
-FuncAttrs.addAttribute(AttributeName, "Accelerate");
-break;
-  case CodeGenOptions::MASSV:
-FuncAttrs.addAttribute(AttributeName, "MASSV");
-break;
-  case CodeGenOptions::SVML:
-FuncAttrs.addAttribute(AttributeName, "SVML");
-break;
-  case CodeGenOptions::NoLibrary:
-break;
-  }
-}
-
 void CodeGenModule::ConstructAttributeList(
 StringRef Name, const CGFunctionInf

[clang] d31c9e5 - Change filecheck default to dump input on failure

2020-06-09 Thread Mehdi Amini via cfe-commits

Author: Mehdi Amini
Date: 2020-06-09T18:57:46Z
New Revision: d31c9e5a46ee692daf2430b52626afcea1db18ab

URL: 
https://github.com/llvm/llvm-project/commit/d31c9e5a46ee692daf2430b52626afcea1db18ab
DIFF: 
https://github.com/llvm/llvm-project/commit/d31c9e5a46ee692daf2430b52626afcea1db18ab.diff

LOG: Change filecheck default to dump input on failure

Having the input dumped on failure seems like a better
default: I debugged FileCheck tests for a while without knowing
about this option, which really helps to understand failures.

Remove `-dump-input-on-failure` and the environment variable
FILECHECK_DUMP_INPUT_ON_FAILURE which are now obsolete.

Differential Revision: https://reviews.llvm.org/D81422

Added: 


Modified: 
clang/test/CodeGenObjC/externally-retained.m
clang/test/Driver/rocm-device-libs.cl
compiler-rt/test/fuzzer/fork.test
debuginfo-tests/llvm-prettyprinters/gdb/llvm-support.gdb
llvm/docs/CommandGuide/FileCheck.rst
llvm/test/CodeGen/AArch64/speculation-hardening-dagisel.ll
llvm/test/CodeGen/AArch64/speculation-hardening-loads.ll
llvm/test/CodeGen/AArch64/speculation-hardening.ll
llvm/test/CodeGen/AArch64/speculation-hardening.mir
llvm/test/FileCheck/comment/after-words.txt
llvm/test/FileCheck/comment/blank-comments.txt
llvm/test/FileCheck/comment/suffixes.txt
llvm/test/FileCheck/comment/suppresses-checks.txt
llvm/test/FileCheck/comment/unused-comment-prefixes.txt
llvm/test/FileCheck/dump-input-enable.txt
llvm/test/FileCheck/envvar-opts.txt
llvm/test/FileCheck/lit.local.cfg
llvm/test/FileCheck/match-full-lines.txt
llvm/test/FileCheck/verbose.txt
llvm/test/Transforms/InstCombine/fortify-folding.ll
llvm/utils/FileCheck/FileCheck.cpp
llvm/utils/lit/lit/TestingConfig.py
llvm/utils/lit/tests/lit.cfg
mlir/test/Analysis/test-callgraph.mlir
mlir/test/Analysis/test-dominance.mlir
mlir/test/Analysis/test-liveness.mlir
mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir
mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl.mlir
mlir/test/Conversion/SCFToGPU/no_blocks_no_threads.mlir
mlir/test/Conversion/SCFToGPU/parallel_loop.mlir
mlir/test/Conversion/ShapeToStandard/shape-to-standard.mlir
mlir/test/Dialect/GPU/outlining.mlir
mlir/test/Dialect/Linalg/fusion-tensor.mlir
mlir/test/Dialect/Linalg/fusion.mlir
mlir/test/Dialect/Linalg/fusion_indexed_generic.mlir
mlir/test/Dialect/Linalg/parallel_loops.mlir
mlir/test/Dialect/Linalg/tensors-to-buffers.mlir
mlir/test/Dialect/Linalg/tile_conv_padding.mlir
mlir/test/Dialect/Linalg/tile_parallel.mlir
mlir/test/Dialect/SCF/ops.mlir
mlir/test/Dialect/SCF/parallel-loop-fusion.mlir
mlir/test/Dialect/SCF/parallel-loop-specialization.mlir
mlir/test/Dialect/SCF/parallel-loop-tiling.mlir
mlir/test/Dialect/Shape/ops.mlir
mlir/test/Dialect/Shape/shape-to-shape.mlir
mlir/test/Dialect/Standard/expand-atomic.mlir
mlir/test/Dialect/Vector/vector-contract-transforms.mlir
mlir/test/Dialect/Vector/vector-flat-transforms.mlir
mlir/test/EDSC/builder-api-test.cpp
mlir/test/IR/print-op-local-scope.mlir

mlir/test/Transforms/buffer-placement-preparation-allowed-memref-results.mlir
mlir/test/Transforms/buffer-placement-preparation.mlir
mlir/test/Transforms/buffer-placement.mlir
mlir/test/Transforms/canonicalize.mlir
mlir/test/Transforms/sccp-callgraph.mlir
mlir/test/mlir-tblgen/op-attribute.td
mlir/test/mlir-tblgen/op-decl.td
mlir/test/mlir-tblgen/op-derived-attribute.mlir
mlir/test/mlir-tblgen/op-format-spec.td
mlir/test/mlir-tblgen/op-interface.td
mlir/test/mlir-tblgen/pattern.mlir
mlir/test/mlir-tblgen/predicate.td
mlir/test/mlir-tblgen/return-types.mlir

Removed: 




diff  --git a/clang/test/CodeGenObjC/externally-retained.m 
b/clang/test/CodeGenObjC/externally-retained.m
index f68696879768..b842b8c4c68c 100644
--- a/clang/test/CodeGenObjC/externally-retained.m
+++ b/clang/test/CodeGenObjC/externally-retained.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fobjc-arc -fblocks 
-Wno-objc-root-class -O0 %s -S -emit-llvm -o - | FileCheck %s 
--dump-input-on-failure
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fobjc-arc -fblocks 
-Wno-objc-root-class -O0 -xobjective-c++ -std=c++11 %s -S -emit-llvm -o - | 
FileCheck %s --check-prefix CHECKXX --dump-input-on-failure
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fobjc-arc -fblocks 
-Wno-objc-root-class -O0 %s -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fobjc-arc -fblocks 
-Wno-objc-root-class -O0 -xobjective-c++ -std=c++11 %s -S -emit-llvm -o - | 
FileCheck %s --check-prefix CHECKXX
 
 #define EXT_RET __attribute__((objc_externally_retained))
 

diff  --git a/clang/test/Driver/rocm-device-libs.cl 
b/clang/test/Driver/rocm-device-libs.

[clang] 72d20b9 - [LLVM] Change isa<> to a variadic function template

2020-06-15 Thread Mehdi Amini via cfe-commits

Author: Rahul Joshi
Date: 2020-06-15T18:46:57Z
New Revision: 72d20b9604f65e35eedb3d00098a2c9412953946

URL: 
https://github.com/llvm/llvm-project/commit/72d20b9604f65e35eedb3d00098a2c9412953946
DIFF: 
https://github.com/llvm/llvm-project/commit/72d20b9604f65e35eedb3d00098a2c9412953946.diff

LOG: [LLVM] Change isa<> to a variadic function template

Change isa<> to a variadic function template, so that it can be used to test 
against one of multiple types as follows:
   isa(Val)

Differential Revision: https://reviews.llvm.org/D81045

Added: 


Modified: 
clang/include/clang/AST/DeclBase.h
llvm/include/llvm/Support/Casting.h
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp

Removed: 




diff  --git a/clang/include/clang/AST/DeclBase.h 
b/clang/include/clang/AST/DeclBase.h
index f66c5d0f8cd7..ba84f27617f5 100644
--- a/clang/include/clang/AST/DeclBase.h
+++ b/clang/include/clang/AST/DeclBase.h
@@ -518,7 +518,7 @@ class alignas(8) Decl {
 if (!HasAttrs) return;
 
 AttrVec &Vec = getAttrs();
-Vec.erase(std::remove_if(Vec.begin(), Vec.end(), isa), 
Vec.end());
+llvm::erase_if(Vec, [](Attr *A) { return isa(A); });
 
 if (Vec.empty())
   HasAttrs = false;

diff  --git a/llvm/include/llvm/Support/Casting.h 
b/llvm/include/llvm/Support/Casting.h
index 41f1b6740c6f..d6f7793d5df0 100644
--- a/llvm/include/llvm/Support/Casting.h
+++ b/llvm/include/llvm/Support/Casting.h
@@ -132,24 +132,30 @@ struct isa_impl_wrap {
   }
 };
 
-// isa - Return true if the parameter to the template is an instance of the
-// template type argument.  Used like this:
+// isa - Return true if the parameter to the template is an instance of one
+// of the template type arguments.  Used like this:
 //
 //  if (isa(myVal)) { ... }
+//  if (isa(myVal)) { ... }
 //
 template  LLVM_NODISCARD inline bool isa(const Y &Val) {
   return isa_impl_wrap::SimpleType>::doit(Val);
 }
 
+template 
+LLVM_NODISCARD inline bool isa(const Y &Val) {
+  return isa(Val) || isa(Val);
+}
+
 // isa_and_nonnull - Functionally identical to isa, except that a null value
 // is accepted.
 //
-template 
+template 
 LLVM_NODISCARD inline bool isa_and_nonnull(const Y &Val) {
   if (!Val)
 return false;
-  return isa(Val);
+  return isa(Val);
 }
 
 
//===--===//

diff  --git a/llvm/lib/Analysis/ScalarEvolution.cpp 
b/llvm/lib/Analysis/ScalarEvolution.cpp
index 85f9794aa8d8..3625b5e4203f 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -3860,7 +3860,8 @@ bool ScalarEvolution::containsAddRecurrence(const SCEV 
*S) {
   if (I != HasRecMap.end())
 return I->second;
 
-  bool FoundAddRec = SCEVExprContains(S, isa);
+  bool FoundAddRec =
+  SCEVExprContains(S, [](const SCEV *S) { return isa(S); 
});
   HasRecMap.insert({S, FoundAddRec});
   return FoundAddRec;
 }
@@ -11201,8 +11202,9 @@ static bool findArrayDimensionsRec(ScalarEvolution &SE,
 // Returns true when one of the SCEVs of Terms contains a SCEVUnknown 
parameter.
 static inline bool containsParameters(SmallVectorImpl &Terms) {
   for (const SCEV *T : Terms)
-if (SCEVExprContains(T, isa))
+if (SCEVExprContains(T, [](const SCEV *S) { return isa(S); }))
   return true;
+
   return false;
 }
 

diff  --git a/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp 
b/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp
index 104cf2ba3c00..2259a29f838a 100644
--- a/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp
+++ b/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp
@@ -220,7 +220,7 @@ class PPCBoolRetToInt : public FunctionPass {
 auto Defs = findAllDefs(U);
 
 // If the values are all Constants or Arguments, don't bother
-if (llvm::none_of(Defs, isa))
+if (llvm::none_of(Defs, [](Value *V) { return isa(V); }))
   return false;
 
 // Presently, we only know how to handle PHINode, Constant, Arguments and



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24806: [docs] Add ThinLTO user documentation

2016-09-21 Thread Mehdi AMINI via cfe-commits
mehdi_amini accepted this revision.
mehdi_amini added a comment.
This revision is now accepted and ready to land.

Great! Thanks for writing it :)



Comment at: docs/CommandGuide/clang.rst:339
@@ +338,3 @@
+  The default for :option:`-flto` is :option:`-flto=full`, in which the
+  LLVM bitcode is suitable for regular Link Time Optimization (LTO), where
+  the linker merges all such modules into a single combined module for

What about using "monolithic" instead of "regular"?



Comment at: docs/ThinLTO.rst:14
@@ +13,3 @@
+runtime performance through whole-program analysis and cross-module
+optimization. However, regular LTO implements this by merging all
+input into a single monolithic module, which is not scalable

Same :)


https://reviews.llvm.org/D24806



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r282089 - [docs] Add ThinLTO user documentation

2016-09-21 Thread Mehdi Amini via cfe-commits
It is automatically refreshed frequently I believe.

If it is not there tomorrow, we should start being worried :)

— 
Mehdi
> On Sep 21, 2016, at 10:57 AM, Teresa Johnson  wrote:
> 
> Anyone know how to get these changes on http://clang.llvm.org/docs/ 
> ? Is that site periodically refreshed or do I 
> need to do something explicit?
> 
> Thanks,
> Teresa
> 
> On Wed, Sep 21, 2016 at 9:57 AM, Teresa Johnson via cfe-commits 
> mailto:cfe-commits@lists.llvm.org>> wrote:
> Author: tejohnson
> Date: Wed Sep 21 11:57:03 2016
> New Revision: 282089
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=282089&view=rev 
> 
> Log:
> [docs] Add ThinLTO user documentation
> 
> Summary: Add some user facing documentation on ThinLTO and how to use it.
> 
> Reviewers: mehdi_amini
> 
> Subscribers: mehdi_amini, cfe-commits
> 
> Differential Revision: https://reviews.llvm.org/D24806 
> 
> 
> Added:
> cfe/trunk/docs/ThinLTO.rst
> Modified:
> cfe/trunk/docs/CommandGuide/clang.rst
> cfe/trunk/docs/index.rst
> 
> Modified: cfe/trunk/docs/CommandGuide/clang.rst
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/CommandGuide/clang.rst?rev=282089&r1=282088&r2=282089&view=diff
>  
> 
> ==
> --- cfe/trunk/docs/CommandGuide/clang.rst (original)
> +++ cfe/trunk/docs/CommandGuide/clang.rst Wed Sep 21 11:57:03 2016
> @@ -328,13 +328,19 @@ Code Generation Options
>model can be overridden with the tls_model attribute. The compiler will try
>to choose a more efficient model if possible.
> 
> -.. option:: -flto, -emit-llvm
> +.. option:: -flto[=full,thin], -emit-llvm
> 
>Generate output files in LLVM formats, suitable for link time optimization.
>When used with :option:`-S` this generates LLVM intermediate language
>assembly files, otherwise this generates LLVM bitcode format object files
>(which may be passed to the linker depending on the stage selection 
> options).
> 
> +  The default for :option:`-flto` is :option:`-flto=full`, in which the
> +  LLVM bitcode is suitable for monolithic Link Time Optimization (LTO), where
> +  the linker merges all such modules into a single combined module for
> +  optimization. With :option:`-flto=thin`, :doc:`ThinLTO <../ThinLTO>`
> +  compilation is invoked instead.
> +
>  Driver Options
>  ~~
> 
> 
> Added: cfe/trunk/docs/ThinLTO.rst
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ThinLTO.rst?rev=282089&view=auto
>  
> 
> ==
> --- cfe/trunk/docs/ThinLTO.rst (added)
> +++ cfe/trunk/docs/ThinLTO.rst Wed Sep 21 11:57:03 2016
> @@ -0,0 +1,157 @@
> +===
> +ThinLTO
> +===
> +
> +.. contents::
> +   :local:
> +
> +Introduction
> +
> +
> +*ThinLTO* compilation is a new type of LTO that is both scalable and
> +incremental. *LTO* (Link Time Optimization) achieves better
> +runtime performance through whole-program analysis and cross-module
> +optimization. However, monolithic LTO implements this by merging all
> +input into a single module, which is not scalable
> +in time or memory, and also prevents fast incremental compiles.
> +
> +In ThinLTO mode, as with regular LTO, clang emits LLVM bitcode after the
> +compile phase. The ThinLTO bitcode is augmented with a compact summary
> +of the module. During the link step, only the summaries are read and
> +merged into a combined summary index, which includes an index of function
> +locations for later cross-module function importing. Fast and efficient
> +whole-program analysis is then performed on the combined summary index.
> +
> +However, all transformations, including function importing, occur
> +later when the modules are optimized in fully parallel backends.
> +By default, linkers_ that support ThinLTO are set up to launch
> +the ThinLTO backends in threads. So the usage model is not affected
> +as the distinction between the fast serial thin link step and the backends
> +is transparent to the user.
> +
> +For more information on the ThinLTO design and current performance,
> +see the LLVM blog post `ThinLTO: Scalable and Incremental LTO
> + >`_.
> +While tuning is still in progress, results in the blog post show that
> +ThinLTO already performs well compared to LTO, in many cases matching
> +the performance improvement.
> +
> +Current Status
> +==
> +
> +Clang/LLVM
> +--
> +.. _compiler:
> +
> +The 3.9 release of clang includes ThinLTO support.

Re: [PATCH] D24826: [LTO] Add -flto-jobs=N to control backend parallelism

2016-09-22 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a comment.

The Gold path looks fine. 
On OSX, we would have the clang driver relying on a LLVM cl::opt, for which I 
don't think there is any precedent. CC Duncan for advice.


https://reviews.llvm.org/D24826



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24826: [LTO] Add -flto-jobs=N to control backend parallelism

2016-09-22 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a comment.

Also I don't think the same option should be used for the parallel LTO codegen: 
it actually does not generate the same binary, which should deserve a dedicated 
opt-in (What if I mix ThinLTO and LTO, and I don't want // codegen?)


https://reviews.llvm.org/D24826



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24826: [LTO] Add -flto-jobs=N to control backend parallelism

2016-09-23 Thread Mehdi AMINI via cfe-commits
mehdi_amini added inline comments.


Comment at: include/clang/Driver/Options.td:818
@@ -815,1 +817,3 @@
+  HelpText<"Controls the backend parallelism of -flto=thin (default "
+   "of 0 means use std::thread::hardware_concurrency)">;
 def fthinlto_index_EQ : Joined<["-"], "fthinlto-index=">,

`std::thread::hardware_concurrency` is a bit implementation specific, can we 
find a better formulation?
Something like `(default of 0 means the number of thread will be derived from 
the number of CPUs detected)`?


https://reviews.llvm.org/D24826



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24826: [LTO] Add -flto-jobs=N to control backend parallelism

2016-09-23 Thread Mehdi AMINI via cfe-commits
mehdi_amini accepted this revision.
mehdi_amini added a comment.
This revision is now accepted and ready to land.

LGTM, Thanks!


https://reviews.llvm.org/D24826



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [llvm-dev] Upgrading phabricator

2016-09-29 Thread Mehdi Amini via cfe-commits
One of the new “feature” is that emails are HTML only right now. Not quite nice 
for the archive (or for interacting by email). 
See for instance: 
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160926/172081.html

(Also the funky "[Changed Subscribers] “ in the title)

Another issue is that we can’t delete unposted inline comment anymore.

— 
Mehdi

> On Sep 29, 2016, at 9:35 PM, Zachary Turner via llvm-dev 
>  wrote:
> 
> You mentioned this was for an upgrade. Are there any major new features or 
> bugfixes to be aware of?
> On Thu, Sep 29, 2016 at 9:26 PM Eric Liu via llvm-commits 
> mailto:llvm-comm...@lists.llvm.org>> wrote:
> Hi all,
> 
> Phabricator is (finally) back online! Let me know if you have any feedback or 
> problem :)
> 
> Thanks,
> Eric
> 
> On Thu, Sep 29, 2016 at 10:23 PM Eric Liu  > wrote:
> According to top and iotop, mysqld is still working, and the progress bar did 
> move by a little bit, so I think it's just really slow. Apologies if this is 
> blocking you.
> 
> On Thu, Sep 29, 2016 at 10:17 PM Zachary Turner via llvm-dev 
> mailto:llvm-...@lists.llvm.org>> wrote:
> Still no word on when it will be back up?  It's not hung is it?  :D
> 
> On Thu, Sep 29, 2016 at 9:03 AM mats petersson via llvm-dev 
> mailto:llvm-...@lists.llvm.org>> wrote:
> On 29 September 2016 at 16:11, Mehdi Amini via llvm-dev 
> mailto:llvm-...@lists.llvm.org>> wrote:
> 
>> On Sep 29, 2016, at 7:21 AM, Eric Liu via llvm-dev > > wrote:
>> 
>> Sorry for blocking everyone for so long.
> 
> No pb, thanks very much for taking care of it :)
> 
>> It has been more than a year since the last upgrade, and mysql is adjusting 
>> schema for a table with ~150G data on a single VM instance.
> 
> 150GB? I’m very surprised there is so much data in our phab! That seems 
> huge...
> 
> My guess is that this includes all the diffs for every revision of every 
> review (as well as all the comments, etc), and it probably isn't as clever 
> with diffs as for example git. Which quite soon adds up to huge numbers when 
> you have tens of thousands of reviews.
> 
> Purse speculation of course, I have never looked inside phabricator (or for 
> that matter, any other code-review tool).
> 
> --
> Mats
> 
> — 
> Mehdi
> 
>> Sadly, the progress bar isn't giving useful information (plus I am not a 
>> good system admin),  so I couldn't tell the ETA...
>> 
>> FYI: According to previous maintainer, it takes a couple of hours for the 
>> last upgrade, so this should be done within a few hours (hopefully!).
>> 
>> On Thu, Sep 29, 2016 at 4:04 PM Krzysztof Parzyszek via llvm-dev 
>> mailto:llvm-...@lists.llvm.org>> wrote:
>> Is there any ETA?
>> 
>> -Krzysztof
>> 
>> On 9/29/2016 5:34 AM, Eric Liu via llvm-dev wrote:
>> > That was a bad estimation. Database upgrade is taking time.
>> >
>> > On Thu, Sep 29, 2016 at 11:03 AM Eric Liu > > 
>> > >> wrote:
>> >
>> > Hi all,
>> >
>> > Phabricator(reviews.llvm.org  
>> > >) will be down
>> > for ~30 mins for an upgrade. Sorry for the short notice.
>> >
>> > Regards,
>> > Eric
>> >
>> >
>> >
>> > ___
>> > LLVM Developers mailing list
>> > llvm-...@lists.llvm.org 
>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev 
>> > 
>> >
>> 
>> --
>> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
>> hosted by The Linux Foundation
>> ___
>> LLVM Developers mailing list
>> llvm-...@lists.llvm.org 
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev 
>> 
>> ___
>> LLVM Developers mailing list
>> llvm-...@lists.llvm.org 
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev 
>> 
> 
> 
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org 
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev 
> 
> 
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org 
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev 
> 
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org 
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev 
> 

Re: [llvm-dev] Upgrading phabricator

2016-09-30 Thread Mehdi Amini via cfe-commits

> On Sep 29, 2016, at 11:04 PM, Eric Liu  wrote:
> 
> I've switched the default email format to be plain text only now. This option 
> should be per-user configurable, but somehow it is not shown in the 
> "Settings"; I'll try if I can make the option personalized.
> 
> Regarding new features and bug fixes in this upgrade, I don't really have a 
> list since the Phabricator we are running is the open-source repo + some 
> local modification. The last merge was more than one year ago, so I guess 
> there should be a long list of new features and bug fixes.
> 
> Some new features that I am aware of:
> - Syntax highlighting.
> - Patch size in email headers
> - HTML email (disabled)
> - More compatible with modern arc (the reason for this upgrade)
> - and more to be discovered! :)
> 
> @Mehdi Deleting unposted inline comments works for me. At which patch did 
> this issue occur?

I picked randomly in the “All revisions” list.
(For example: https://reviews.llvm.org/D25094 )

It seems I can delete comment unless I edited it first. Strange…

— 
Mehdi


> 
> - Eric
> 
> On Fri, Sep 30, 2016 at 7:39 AM Mehdi Amini  > wrote:
> One of the new “feature” is that emails are HTML only right now. Not quite 
> nice for the archive (or for interacting by email). 
> See for instance: 
> http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160926/172081.html 
> 
> 
> (Also the funky "[Changed Subscribers] “ in the title)
> 
> Another issue is that we can’t delete unposted inline comment anymore.
> 
> — 
> Mehdi
> 
>> On Sep 29, 2016, at 9:35 PM, Zachary Turner via llvm-dev 
>> mailto:llvm-...@lists.llvm.org>> wrote:
>> 
>> You mentioned this was for an upgrade. Are there any major new features or 
>> bugfixes to be aware of?
>> On Thu, Sep 29, 2016 at 9:26 PM Eric Liu via llvm-commits 
>> mailto:llvm-comm...@lists.llvm.org>> wrote:
>> Hi all,
>> 
>> Phabricator is (finally) back online! Let me know if you have any feedback 
>> or problem :)
>> 
>> Thanks,
>> Eric
>> 
>> On Thu, Sep 29, 2016 at 10:23 PM Eric Liu > > wrote:
>> According to top and iotop, mysqld is still working, and the progress bar 
>> did move by a little bit, so I think it's just really slow. Apologies if 
>> this is blocking you.
>> 
>> On Thu, Sep 29, 2016 at 10:17 PM Zachary Turner via llvm-dev 
>> mailto:llvm-...@lists.llvm.org>> wrote:
>> Still no word on when it will be back up?  It's not hung is it?  :D
>> 
>> On Thu, Sep 29, 2016 at 9:03 AM mats petersson via llvm-dev 
>> mailto:llvm-...@lists.llvm.org>> wrote:
>> On 29 September 2016 at 16:11, Mehdi Amini via llvm-dev 
>> mailto:llvm-...@lists.llvm.org>> wrote:
>> 
>>> On Sep 29, 2016, at 7:21 AM, Eric Liu via llvm-dev >> > wrote:
>>> 
>>> Sorry for blocking everyone for so long.
>> 
>> No pb, thanks very much for taking care of it :)
>> 
>>> It has been more than a year since the last upgrade, and mysql is adjusting 
>>> schema for a table with ~150G data on a single VM instance.
>> 
>> 150GB? I’m very surprised there is so much data in our phab! That seems 
>> huge...
>> 
>> My guess is that this includes all the diffs for every revision of every 
>> review (as well as all the comments, etc), and it probably isn't as clever 
>> with diffs as for example git. Which quite soon adds up to huge numbers when 
>> you have tens of thousands of reviews.
>> 
>> Purse speculation of course, I have never looked inside phabricator (or for 
>> that matter, any other code-review tool).
>> 
>> --
>> Mats
>> 
>> — 
>> Mehdi
>> 
>>> Sadly, the progress bar isn't giving useful information (plus I am not a 
>>> good system admin),  so I couldn't tell the ETA...
>>> 
>>> FYI: According to previous maintainer, it takes a couple of hours for the 
>>> last upgrade, so this should be done within a few hours (hopefully!).
>>> 
>>> On Thu, Sep 29, 2016 at 4:04 PM Krzysztof Parzyszek via llvm-dev 
>>> mailto:llvm-...@lists.llvm.org>> wrote:
>>> Is there any ETA?
>>> 
>>> -Krzysztof
>>> 
>>> On 9/29/2016 5:34 AM, Eric Liu via llvm-dev wrote:
>>> > That was a bad estimation. Database upgrade is taking time.
>>> >
>>> > On Thu, Sep 29, 2016 at 11:03 AM Eric Liu >> > 
>>> > >> wrote:
>>> >
>>> > Hi all,
>>> >
>>> > Phabricator(reviews.llvm.org  
>>> > >) will be down
>>> > for ~30 mins for an upgrade. Sorry for the short notice.
>>> >
>>> > Regards,
>>> > Eric
>>> >
>>> >
>>> >
>>> > ___
>>> > LLVM Developers mailing list
>>> > llvm-...@lists.llvm.org 
>>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev 
>>> > 
>>> >
>>> 
>>> --
>>> Qualcomm Innov

r282996 - Use StringRef in Triple API (NFC)

2016-09-30 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Sep 30 20:16:22 2016
New Revision: 282996

URL: http://llvm.org/viewvc/llvm-project?rev=282996&view=rev
Log:
Use StringRef in Triple API (NFC)

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=282996&r1=282995&r2=282996&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Fri Sep 30 20:16:22 2016
@@ -2492,14 +2492,15 @@ RValue CodeGenFunction::EmitBuiltinExpr(
   // See if we have a target specific intrinsic.
   const char *Name = getContext().BuiltinInfo.getName(BuiltinID);
   Intrinsic::ID IntrinsicID = Intrinsic::not_intrinsic;
-  if (const char *Prefix =
-  llvm::Triple::getArchTypePrefix(getTarget().getTriple().getArch())) {
-IntrinsicID = Intrinsic::getIntrinsicForGCCBuiltin(Prefix, Name);
+  StringRef Prefix =
+  llvm::Triple::getArchTypePrefix(getTarget().getTriple().getArch());
+  if (!Prefix.empty()) {
+IntrinsicID = Intrinsic::getIntrinsicForGCCBuiltin(Prefix.data(), Name);
 // NOTE we dont need to perform a compatibility flag check here since the
 // intrinsics are declared in Builtins*.def via LANGBUILTIN which filter 
the
 // MS builtins via ALL_MS_LANGUAGES and are filtered earlier.
 if (IntrinsicID == Intrinsic::not_intrinsic)
-  IntrinsicID = Intrinsic::getIntrinsicForMSBuiltin(Prefix, Name);
+  IntrinsicID = Intrinsic::getIntrinsicForMSBuiltin(Prefix.data(), Name);
   }
 
   if (IntrinsicID != Intrinsic::not_intrinsic) {


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283004 - Use StringRef in Pass/PassManager APIs (NFC)

2016-09-30 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Sep 30 21:56:57 2016
New Revision: 283004

URL: http://llvm.org/viewvc/llvm-project?rev=283004&view=rev
Log:
Use StringRef in Pass/PassManager APIs (NFC)

Modified:
cfe/trunk/lib/CodeGen/CodeGenAction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=283004&r1=283003&r2=283004&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Fri Sep 30 21:56:57 2016
@@ -517,7 +517,7 @@ void BackendConsumer::EmitOptimizationMe
 MsgStream << " (hotness: " << *D.getHotness() << ")";
 
   Diags.Report(Loc, DiagID)
-  << AddFlagValue(D.getPassName() ? D.getPassName() : "")
+  << AddFlagValue(D.getPassName())
   << MsgStream.str();
 
   if (BadDebugInfo)


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283039 - Use StringRef in Registry API (NFC)

2016-10-01 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Sat Oct  1 10:44:54 2016
New Revision: 283039

URL: http://llvm.org/viewvc/llvm-project?rev=283039&view=rev
Log:
Use StringRef in Registry API (NFC)

Modified:
cfe/trunk/lib/Tooling/CompilationDatabase.cpp

Modified: cfe/trunk/lib/Tooling/CompilationDatabase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/CompilationDatabase.cpp?rev=283039&r1=283038&r2=283039&view=diff
==
--- cfe/trunk/lib/Tooling/CompilationDatabase.cpp (original)
+++ cfe/trunk/lib/Tooling/CompilationDatabase.cpp Sat Oct  1 10:44:54 2016
@@ -49,7 +49,7 @@ CompilationDatabase::loadFromDirectory(S
 if (std::unique_ptr DB =
 Plugin->loadFromDirectory(BuildDirectory, DatabaseErrorMessage))
   return DB;
-ErrorStream << It->getName() << ": " << DatabaseErrorMessage << "\n";
+ErrorStream << It->getName().data() << ": " << DatabaseErrorMessage << 
"\n";
   }
   ErrorMessage = ErrorStream.str();
   return nullptr;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283043 - Use StringRef for MemoryBuffer identifier API (NFC)

2016-10-01 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Sat Oct  1 11:38:28 2016
New Revision: 283043

URL: http://llvm.org/viewvc/llvm-project?rev=283043&view=rev
Log:
Use StringRef for MemoryBuffer identifier API (NFC)

Modified:
cfe/trunk/include/clang/Basic/SourceManager.h
cfe/trunk/include/clang/Lex/DirectoryLookup.h
cfe/trunk/include/clang/Lex/HeaderMap.h
cfe/trunk/include/clang/Rewrite/Core/HTMLRewrite.h
cfe/trunk/lib/Basic/SourceManager.cpp
cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
cfe/trunk/lib/Frontend/Rewrite/HTMLPrint.cpp
cfe/trunk/lib/Frontend/Rewrite/InclusionRewriter.cpp
cfe/trunk/lib/Lex/HeaderMap.cpp
cfe/trunk/lib/Lex/HeaderSearch.cpp
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp

Modified: cfe/trunk/include/clang/Basic/SourceManager.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=283043&r1=283042&r2=283043&view=diff
==
--- cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/trunk/include/clang/Basic/SourceManager.h Sat Oct  1 11:38:28 2016
@@ -1291,7 +1291,7 @@ public:
   ///
   /// Note that this name does not respect \#line directives.  Use
   /// getPresumedLoc for normal clients.
-  const char *getBufferName(SourceLocation Loc, bool *Invalid = nullptr) const;
+  StringRef getBufferName(SourceLocation Loc, bool *Invalid = nullptr) const;
 
   /// \brief Return the file characteristic of the specified source
   /// location, indicating whether this is a normal file, a system

Modified: cfe/trunk/include/clang/Lex/DirectoryLookup.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/DirectoryLookup.h?rev=283043&r1=283042&r2=283043&view=diff
==
--- cfe/trunk/include/clang/Lex/DirectoryLookup.h (original)
+++ cfe/trunk/include/clang/Lex/DirectoryLookup.h Sat Oct  1 11:38:28 2016
@@ -88,7 +88,7 @@ public:
 
   /// getName - Return the directory or filename corresponding to this lookup
   /// object.
-  const char *getName() const;
+  StringRef getName() const;
 
   /// getDir - Return the directory that this entry refers to.
   ///

Modified: cfe/trunk/include/clang/Lex/HeaderMap.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderMap.h?rev=283043&r1=283042&r2=283043&view=diff
==
--- cfe/trunk/include/clang/Lex/HeaderMap.h (original)
+++ cfe/trunk/include/clang/Lex/HeaderMap.h Sat Oct  1 11:38:28 2016
@@ -45,7 +45,7 @@ public:
SmallVectorImpl &DestPath) const;
 
   /// Return the filename of the headermap.
-  const char *getFileName() const;
+  StringRef getFileName() const;
 
   /// Print the contents of this headermap to stderr.
   void dump() const;

Modified: cfe/trunk/include/clang/Rewrite/Core/HTMLRewrite.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Rewrite/Core/HTMLRewrite.h?rev=283043&r1=283042&r2=283043&view=diff
==
--- cfe/trunk/include/clang/Rewrite/Core/HTMLRewrite.h (original)
+++ cfe/trunk/include/clang/Rewrite/Core/HTMLRewrite.h Sat Oct  1 11:38:28 2016
@@ -62,8 +62,8 @@ namespace html {
 
   void AddLineNumbers(Rewriter& R, FileID FID);
 
-  void AddHeaderFooterInternalBuiltinCSS(Rewriter& R, FileID FID,
- const char *title = nullptr);
+  void AddHeaderFooterInternalBuiltinCSS(Rewriter &R, FileID FID,
+ StringRef title);
 
   /// SyntaxHighlight - Relex the specified FileID and annotate the HTML with
   /// information about keywords, comments, etc.

Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=283043&r1=283042&r2=283043&view=diff
==
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Sat Oct  1 11:38:28 2016
@@ -1437,8 +1437,8 @@ SourceManager::getFileCharacteristic(Sou
 /// Return the filename or buffer identifier of the buffer the location is in.
 /// Note that this name does not respect \#line directives.  Use getPresumedLoc
 /// for normal clients.
-const char *SourceManager::getBufferName(SourceLocation Loc, 
- bool *Invalid) const {
+StringRef SourceManager::getBufferName(SourceLocation Loc,
+   bool *Invalid) const {
   if (isInvalid(Loc, Invalid)) return "";
 
   return getBuffer(getFileID(Loc), Invalid)->getBufferIdentifier();
@@ -1470,7 +1470,7 @@ PresumedLoc SourceManager::getPresumedLo
   // To get the source name, fir

[PATCH] D25190: [ThinLTO doc] Fix typo

2016-10-03 Thread Mehdi AMINI via cfe-commits
mehdi_amini accepted this revision.
mehdi_amini added a comment.
This revision is now accepted and ready to land.

Good catch indeed!


https://reviews.llvm.org/D25190



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24815: [clang] make reciprocal estimate codegen a function attribute

2016-10-03 Thread Mehdi AMINI via cfe-commits
mehdi_amini added inline comments.


> echristo wrote in CGCall.cpp:1735
> Would be nice to get these pulled into a single fast-math string that's set 
> and then used all over for sure. :)

I agree with getting on a path to remove these function attributes that have an 
equivalent on per-instruction flag.

I wonder what is the status of these flags in SelectionDAG though? We still 
have a variant of the flags on the TargetOptions I believe. Are all the uses 
migrated to per-node flags?

https://reviews.llvm.org/D24815



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24815: [clang] make reciprocal estimate codegen a function attribute

2016-10-03 Thread Mehdi AMINI via cfe-commits
mehdi_amini added inline comments.


> spatel wrote in CGCall.cpp:1735
> Good point - I think we have to convert all codegen tests that have these 
> function-level attributes to IR FMF and make sure that the output doesn't 
> change. Definitely not part of this patch, but hopefully something that can 
> be done incrementally, test-by-test.

I wonder if we couldn’t have this part of the bitcode/IR auto-upgrade: when we 
load a function with this attribute, we automatically add the individual flag 
on every instruction.

https://reviews.llvm.org/D24815



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24815: [clang] make reciprocal estimate codegen a function attribute

2016-10-04 Thread Mehdi AMINI via cfe-commits
mehdi_amini added inline comments.


> spatel wrote in CGCall.cpp:1735
> Auto-upgrading is part of the solution. Based on how we've been doing this 
> with vector intrinsics that get converted to IR, it's a ~3-step process:
> 
> 1. Prepare the backend (DAG) to handle the expected new IR patterns and add 
> tests for those.
> 2. Auto-upgrade the IR, remove deprecated handling of the old IR patterns, 
> and change/remove existing tests.
> 3. Update clang to not produce the deprecated patterns.
> 
> The extra step for FMF in the DAG is that we still don't allow FMF on all 
> SDNode subclasses. The DAG plumbing for FMF only applies to binops because 
> that's all that FMF on IR worked on at the time (fmul/fadd/fsub/fdiv/frem). 
> Later, I added FMF to IR calls so we could have that functionality on sqrt, 
> fma and other calls. Assuming that is ok (and I realize that it may be 
> controversial), we can now extend FMF in the DAG to all SDNodes and have a 
> full node-level FMF solution for the DAG layer.

I think I remember folks being against FMF on calls (Chris Lattner?), I'll try 
to find the relevant discussion.
Otherwise your plan seems fine to me!

https://reviews.llvm.org/D24815



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24644: Pass -ffunction-sections/-fdata-sections along to gold-plugin

2016-10-05 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a comment.

What about function attributes? Hey that's the trend :)
You could have a subset of the functions in their own sections but not all. 
With LTO it means that you can disable this for a single input file.


https://reviews.llvm.org/D24644



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283416 - Use llvm::raw_string_ostream instead of std::stringstream (NFC)

2016-10-05 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Wed Oct  5 23:26:16 2016
New Revision: 283416

URL: http://llvm.org/viewvc/llvm-project?rev=283416&view=rev
Log:
Use llvm::raw_string_ostream instead of std::stringstream (NFC)

As a side effect, this avoid having to call .data() on the StringRef.

Modified:
cfe/trunk/lib/Tooling/CompilationDatabase.cpp

Modified: cfe/trunk/lib/Tooling/CompilationDatabase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/CompilationDatabase.cpp?rev=283416&r1=283415&r2=283416&view=diff
==
--- cfe/trunk/lib/Tooling/CompilationDatabase.cpp (original)
+++ cfe/trunk/lib/Tooling/CompilationDatabase.cpp Wed Oct  5 23:26:16 2016
@@ -39,7 +39,7 @@ CompilationDatabase::~CompilationDatabas
 std::unique_ptr
 CompilationDatabase::loadFromDirectory(StringRef BuildDirectory,
std::string &ErrorMessage) {
-  std::stringstream ErrorStream;
+  llvm::raw_string_ostream ErrorStream(ErrorMessage);
   for (CompilationDatabasePluginRegistry::iterator
It = CompilationDatabasePluginRegistry::begin(),
Ie = CompilationDatabasePluginRegistry::end();
@@ -49,9 +49,8 @@ CompilationDatabase::loadFromDirectory(S
 if (std::unique_ptr DB =
 Plugin->loadFromDirectory(BuildDirectory, DatabaseErrorMessage))
   return DB;
-ErrorStream << It->getName().data() << ": " << DatabaseErrorMessage << 
"\n";
+ErrorStream << It->getName() << ": " << DatabaseErrorMessage << "\n";
   }
-  ErrorMessage = ErrorStream.str();
   return nullptr;
 }
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283417 - Taking StringRef in Driver.h APIs instead of raw pointers (NFC)

2016-10-05 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Thu Oct  6 00:11:48 2016
New Revision: 283417

URL: http://llvm.org/viewvc/llvm-project?rev=283417&view=rev
Log:
Taking StringRef in Driver.h APIs instead of raw pointers (NFC)

Modified:
cfe/trunk/include/clang/Driver/Driver.h
cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=283417&r1=283416&r2=283417&view=diff
==
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Thu Oct  6 00:11:48 2016
@@ -223,7 +223,7 @@ private:
   // Before executing jobs, sets up response files for commands that need them.
   void setUpResponseFiles(Compilation &C, Command &Cmd);
 
-  void generatePrefixedToolNames(const char *Tool, const ToolChain &TC,
+  void generatePrefixedToolNames(StringRef Tool, const ToolChain &TC,
  SmallVectorImpl &Names) const;
 
 public:
@@ -369,7 +369,7 @@ public:
   /// directories to search.
   //
   // FIXME: This should be in CompilationInfo.
-  std::string GetFilePath(const char *Name, const ToolChain &TC) const;
+  std::string GetFilePath(StringRef Name, const ToolChain &TC) const;
 
   /// GetProgramPath - Lookup \p Name in the list of program search paths.
   ///
@@ -377,7 +377,7 @@ public:
   /// directories to search.
   //
   // FIXME: This should be in CompilationInfo.
-  std::string GetProgramPath(const char *Name, const ToolChain &TC) const;
+  std::string GetProgramPath(StringRef Name, const ToolChain &TC) const;
 
   /// HandleImmediateArgs - Handle any arguments which should be
   /// treated before building actions or binding tools.
@@ -427,7 +427,7 @@ public:
   /// as part of compilation; the file will have the given prefix and suffix.
   ///
   /// GCC goes to extra lengths here to be a bit more robust.
-  std::string GetTemporaryPath(StringRef Prefix, const char *Suffix) const;
+  std::string GetTemporaryPath(StringRef Prefix, StringRef Suffix) const;
 
   /// Return the pathname of the pch file in clang-cl mode.
   std::string GetClPchPath(Compilation &C, StringRef BaseName) const;
@@ -483,9 +483,8 @@ public:
   /// \return True if the entire string was parsed (9.2), or all
   /// groups were parsed (10.3.5extrastuff). HadExtra is true if all
   /// groups were parsed but extra characters remain at the end.
-  static bool GetReleaseVersion(const char *Str, unsigned &Major,
-unsigned &Minor, unsigned &Micro,
-bool &HadExtra);
+  static bool GetReleaseVersion(StringRef Str, unsigned &Major, unsigned 
&Minor,
+unsigned &Micro, bool &HadExtra);
 
   /// Parse digits from a string \p Str and fulfill \p Digits with
   /// the parsed numbers. This method assumes that the max number of
@@ -493,7 +492,7 @@ public:
   ///
   /// \return True if the entire string was parsed and there are
   /// no extra characters remaining at the end.
-  static bool GetReleaseVersion(const char *Str,
+  static bool GetReleaseVersion(StringRef Str,
 MutableArrayRef Digits);
 };
 

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=283417&r1=283416&r2=283417&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Thu Oct  6 00:11:48 2016
@@ -2908,7 +2908,7 @@ const char *Driver::GetNamedOutputPath(C
   }
 }
 
-std::string Driver::GetFilePath(const char *Name, const ToolChain &TC) const {
+std::string Driver::GetFilePath(StringRef Name, const ToolChain &TC) const {
   // Respect a limited subset of the '-Bprefix' functionality in GCC by
   // attempting to use this prefix when looking for file paths.
   for (const std::string &Dir : PrefixDirs) {
@@ -2938,16 +2938,16 @@ std::string Driver::GetFilePath(const ch
 }
 
 void Driver::generatePrefixedToolNames(
-const char *Tool, const ToolChain &TC,
+StringRef Tool, const ToolChain &TC,
 SmallVectorImpl &Names) const {
   // FIXME: Needs a better variable than DefaultTargetTriple
-  Names.emplace_back(DefaultTargetTriple + "-" + Tool);
+  Names.emplace_back((DefaultTargetTriple + "-" + Tool).str());
   Names.emplace_back(Tool);
 
   // Allow the discovery of tools prefixed with LLVM's default target triple.
   std::string LLVMDefaultTargetTriple = llvm::sys::getDefaultTargetTriple();
   if (LLVMDefaultTargetTriple != DefaultTargetTriple)
-Names.emplace_back(LLVMDefaultTargetTriple + "-" + Tool);
+Names.emplace_back((LLVMDefaultTargetTriple + "-" + Tool).str());
 }
 
 static bool ScanDirForExecutable(SmallString<128> &Dir,
@@ -2961,8 +2961,7 @@ static bool ScanDirForExecutable(SmallSt
   return false;
 }
 
-std::string Driver::GetProg

[clang-tools-extra] r283525 - Revert "Revert "Add a static_assert to enforce that parameters to llvm::format() are not totally unsafe""

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 03:25:42 2016
New Revision: 283525

URL: http://llvm.org/viewvc/llvm-project?rev=283525&view=rev
Log:
Revert "Revert "Add a static_assert to enforce that parameters to 
llvm::format() are not totally unsafe""

This reverts commit r283510 and reapply r283509, with updates to
clang-tools-extra as well.

Modified:
clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp?rev=283525&r1=283524&r2=283525&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp 
Fri Oct  7 03:25:42 2016
@@ -777,7 +777,7 @@ void IdentifierNamingCheck::check(const
 DEBUG(llvm::dbgs()
   << Decl->getLocStart().printToString(*Result.SourceManager)
   << llvm::format(": unable to split words for %s '%s'\n",
-  KindName.c_str(), Name));
+  KindName.c_str(), Name.str().c_str()));
   }
 } else {
   NamingCheckFailure &Failure = NamingCheckFailures[NamingCheckId(
@@ -811,7 +811,7 @@ void IdentifierNamingCheck::checkMacro(S
   DEBUG(
   llvm::dbgs() << MacroNameTok.getLocation().printToString(SourceMgr)
<< llvm::format(": unable to split words for %s '%s'\n",
-   KindName.c_str(), Name));
+   KindName.c_str(), Name.str().c_str()));
 }
   } else {
 NamingCheckId ID(MI->getDefinitionLoc(), Name);


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283527 - Use StringReg in TargetParser APIs (NFC)

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 03:37:29 2016
New Revision: 283527

URL: http://llvm.org/viewvc/llvm-project?rev=283527&view=rev
Log:
Use StringReg in TargetParser APIs (NFC)

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=283527&r1=283526&r2=283527&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Oct  7 03:37:29 2016
@@ -5055,7 +5055,7 @@ public:
  StringRef CPU,
  const std::vector &FeaturesVec) const override {
 
-std::vector TargetFeatures;
+std::vector TargetFeatures;
 unsigned Arch = llvm::ARM::parseArch(getTriple().getArchName());
 
 // get default FPU features
@@ -5066,9 +5066,9 @@ public:
 unsigned Extensions = llvm::ARM::getDefaultExtensions(CPU, Arch);
 llvm::ARM::getExtensionFeatures(Extensions, TargetFeatures);
 
-for (const char *Feature : TargetFeatures)
+for (auto Feature : TargetFeatures)
   if (Feature[0] == '+')
-Features[Feature+1] = true;
+Features[Feature.drop_front(1)] = true;
 
 return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);
   }

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=283527&r1=283526&r2=283527&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Oct  7 03:37:29 2016
@@ -54,7 +54,7 @@ using namespace clang;
 using namespace llvm::opt;
 
 static void handleTargetFeaturesGroup(const ArgList &Args,
-  std::vector &Features,
+  std::vector &Features,
   OptSpecifier Group) {
   for (const Arg *A : Args.filtered(Group)) {
 StringRef Name = A->getOption().getName();
@@ -694,7 +694,7 @@ static void getARMArchCPUFromArgs(const
 // FIXME: Use ARMTargetParser.
 static void getARMHWDivFeatures(const Driver &D, const Arg *A,
 const ArgList &Args, StringRef HWDiv,
-std::vector &Features) {
+std::vector &Features) {
   unsigned HWDivID = llvm::ARM::parseHWDiv(HWDiv);
   if (!llvm::ARM::getHWDivFeatures(HWDivID, Features))
 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
@@ -703,7 +703,7 @@ static void getARMHWDivFeatures(const Dr
 // Handle -mfpu=.
 static void getARMFPUFeatures(const Driver &D, const Arg *A,
   const ArgList &Args, StringRef FPU,
-  std::vector &Features) {
+  std::vector &Features) {
   unsigned FPUID = llvm::ARM::parseFPU(FPU);
   if (!llvm::ARM::getFPUFeatures(FPUID, Features))
 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
@@ -711,13 +711,13 @@ static void getARMFPUFeatures(const Driv
 
 // Decode ARM features from string like +[no]featureA+[no]featureB+...
 static bool DecodeARMFeatures(const Driver &D, StringRef text,
-  std::vector &Features) {
+  std::vector &Features) {
   SmallVector Split;
   text.split(Split, StringRef("+"), -1, false);
 
   for (StringRef Feature : Split) {
-const char *FeatureName = llvm::ARM::getArchExtFeature(Feature);
-if (FeatureName)
+StringRef FeatureName = llvm::ARM::getArchExtFeature(Feature);
+if (!FeatureName.empty())
   Features.push_back(FeatureName);
 else
   return false;
@@ -730,7 +730,7 @@ static bool DecodeARMFeatures(const Driv
 // to handle -march=native correctly.
 static void checkARMArchName(const Driver &D, const Arg *A, const ArgList 
&Args,
  llvm::StringRef ArchName,
- std::vector &Features,
+ std::vector &Features,
  const llvm::Triple &Triple) {
   std::pair Split = ArchName.split("+");
 
@@ -743,7 +743,7 @@ static void checkARMArchName(const Drive
 // Check -mcpu=. Needs ArchName to handle -mcpu=generic.
 static void checkARMCPUName(const Driver &D, const Arg *A, const ArgList &Args,
 llvm::StringRef CPUName, llvm::StringRef ArchName,
-std::vector &Features,
+std::vector &Features,
 const llvm::Triple &Triple) {
   std::pair Split = CPUName.split("+");
 
@@ -867,7 +867,7 @@ arm::FloatABI arm::getARMFloatABI(const
 static void getARMTargetFeatures(const ToolChain &TC,
  const llvm::Triple &Triple,
  const ArgList &Args,
-  

r283605 - Turn ArchName/BoundArch in Driver from raw pointer to StringRef (NFC)

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 16:27:26 2016
New Revision: 283605

URL: http://llvm.org/viewvc/llvm-project?rev=283605&view=rev
Log:
Turn ArchName/BoundArch in Driver from raw pointer to StringRef (NFC)

Modified:
cfe/trunk/include/clang/Driver/Action.h
cfe/trunk/include/clang/Driver/Compilation.h
cfe/trunk/include/clang/Driver/Driver.h
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/Action.cpp
cfe/trunk/lib/Driver/Compilation.cpp
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/MSVCToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h

Modified: cfe/trunk/include/clang/Driver/Action.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Action.h?rev=283605&r1=283604&r2=283605&view=diff
==
--- cfe/trunk/include/clang/Driver/Action.h (original)
+++ cfe/trunk/include/clang/Driver/Action.h Fri Oct  7 16:27:26 2016
@@ -190,12 +190,12 @@ class BindArchAction : public Action {
   virtual void anchor();
   /// The architecture to bind, or 0 if the default architecture
   /// should be bound.
-  const char *ArchName;
+  StringRef ArchName;
 
 public:
-  BindArchAction(Action *Input, const char *ArchName);
+  BindArchAction(Action *Input, StringRef ArchName);
 
-  const char *getArchName() const { return ArchName; }
+  StringRef getArchName() const { return ArchName; }
 
   static bool classof(const Action *A) {
 return A->getKind() == BindArchClass;

Modified: cfe/trunk/include/clang/Driver/Compilation.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Compilation.h?rev=283605&r1=283604&r2=283605&view=diff
==
--- cfe/trunk/include/clang/Driver/Compilation.h (original)
+++ cfe/trunk/include/clang/Driver/Compilation.h Fri Oct  7 16:27:26 2016
@@ -69,8 +69,9 @@ class Compilation {
 
   /// Cache of translated arguments for a particular tool chain and bound
   /// architecture.
-  llvm::DenseMap,
- llvm::opt::DerivedArgList *> TCArgs;
+  llvm::DenseMap,
+ llvm::opt::DerivedArgList *>
+  TCArgs;
 
   /// Temporary files which should be removed on exit.
   llvm::opt::ArgStringList TempFiles;
@@ -184,7 +185,7 @@ public:
   ///
   /// \param BoundArch - The bound architecture name, or 0.
   const llvm::opt::DerivedArgList &getArgsForToolChain(const ToolChain *TC,
-   const char *BoundArch);
+   StringRef BoundArch);
 
   /// addTempFile - Add a file to remove on exit, and returns its
   /// argument.

Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=283605&r1=283604&r2=283605&view=diff
==
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Fri Oct  7 16:27:26 2016
@@ -397,7 +397,7 @@ public:
   /// jobs for a given (Action, ToolChain, BoundArch) tuple once.
   InputInfo
   BuildJobsForAction(Compilation &C, const Action *A, const ToolChain *TC,
- const char *BoundArch, bool AtTopLevel, bool 
MultipleArchs,
+ StringRef BoundArch, bool AtTopLevel, bool MultipleArchs,
  const char *LinkingOutput,
  std::map, 
InputInfo>
  &CachedResults,
@@ -419,7 +419,7 @@ public:
   /// \param MultipleArchs - Whether multiple -arch options were supplied.
   /// \param NormalizedTriple - The normalized triple of the relevant target.
   const char *GetNamedOutputPath(Compilation &C, const JobAction &JA,
- const char *BaseInput, const char *BoundArch,
+ const char *BaseInput, StringRef BoundArch,
  bool AtTopLevel, bool MultipleArchs,
  StringRef NormalizedTriple) const;
 
@@ -468,9 +468,8 @@ private:
   /// jobs specifically for the given action, but will use the cache when
   /// building jobs for the Action's inputs.
   InputInfo BuildJobsForActionNoCache(
-  Compilation &C, const Action *A, const ToolChain *TC,
-  const char *BoundArch, bool AtTopLevel, bool MultipleArchs,
-  const char *LinkingOutput,
+  Compilation &C, const Action *A, const ToolChain *TC, StringRef 
BoundArch,
+  bool AtTopLevel, bool MultipleArchs, const char *LinkingOutput,
   std::map, InputInfo>
   &CachedResults,
   bool BuildForOffloadDevice) const;

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=283605&r1=283604&r2=283605&view=diff
=

r283611 - Driver: use StringRef instead of raw pointer in lookupTypeForExtension() (NFC)

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 16:41:00 2016
New Revision: 283611

URL: http://llvm.org/viewvc/llvm-project?rev=283611&view=rev
Log:
Driver: use StringRef instead of raw pointer in lookupTypeForExtension() (NFC)

Modified:
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/include/clang/Driver/Types.h
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Types.cpp

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Fri Oct  7 16:41:00 2016
@@ -233,7 +233,7 @@ public:
 
   /// LookupTypeForExtension - Return the default language type to use for the
   /// given extension.
-  virtual types::ID LookupTypeForExtension(const char *Ext) const;
+  virtual types::ID LookupTypeForExtension(StringRef Ext) const;
 
   /// IsBlocksDefault - Does this tool chain enable -fblocks by default.
   virtual bool IsBlocksDefault() const { return false; }

Modified: cfe/trunk/include/clang/Driver/Types.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.h?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/include/clang/Driver/Types.h (original)
+++ cfe/trunk/include/clang/Driver/Types.h Fri Oct  7 16:41:00 2016
@@ -13,6 +13,9 @@
 #include "clang/Driver/Phases.h"
 #include "llvm/ADT/SmallVector.h"
 
+namespace llvm {
+class StringRef;
+}
 namespace clang {
 namespace driver {
 namespace types {
@@ -79,7 +82,7 @@ namespace types {
 
   /// lookupTypeForExtension - Lookup the type to use for the file
   /// extension \p Ext.
-  ID lookupTypeForExtension(const char *Ext);
+  ID lookupTypeForExtension(llvm::StringRef Ext);
 
   /// lookupTypeForTypSpecifier - Lookup the type to use for a user
   /// specified type name.

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Oct  7 16:41:00 2016
@@ -370,7 +370,7 @@ std::string ToolChain::GetLinkerPath() c
   return GetProgramPath(DefaultLinker);
 }
 
-types::ID ToolChain::LookupTypeForExtension(const char *Ext) const {
+types::ID ToolChain::LookupTypeForExtension(StringRef Ext) const {
   return types::lookupTypeForExtension(Ext);
 }
 

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Oct  7 16:41:00 2016
@@ -54,7 +54,7 @@ MachO::MachO(const Driver &D, const llvm
 Darwin::Darwin(const Driver &D, const llvm::Triple &Triple, const ArgList 
&Args)
 : MachO(D, Triple, Args), TargetInitialized(false) {}
 
-types::ID MachO::LookupTypeForExtension(const char *Ext) const {
+types::ID MachO::LookupTypeForExtension(StringRef Ext) const {
   types::ID Ty = types::lookupTypeForExtension(Ext);
 
   // Darwin always preprocesses assembly files (unless -x is used explicitly).

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Fri Oct  7 16:41:00 2016
@@ -312,7 +312,7 @@ public:
   /// @name ToolChain Implementation
   /// {
 
-  types::ID LookupTypeForExtension(const char *Ext) const override;
+  types::ID LookupTypeForExtension(StringRef Ext) const override;
 
   bool HasNativeLLVMSupport() const override;
 

Modified: cfe/trunk/lib/Driver/Types.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Types.cpp?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/lib/Driver/Types.cpp (original)
+++ cfe/trunk/lib/Driver/Types.cpp Fri Oct  7 16:41:00 2016
@@ -170,7 +170,7 @@ bool types::isCuda(ID Id) {
   }
 }
 
-types::ID types::lookupTypeForExtension(const char *Ext) {
+types::ID types::lookupTypeForExtension(llvm::StringRef Ext) {
   return llvm::StringSwitch(Ext)
.Case("c", TY_C)
.Case("C", TY_CXX)


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/m

r283616 - Rename variable to not use C++ reserved name (leading underscore + capital) (NFC)

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 17:03:03 2016
New Revision: 283616

URL: http://llvm.org/viewvc/llvm-project?rev=283616&view=rev
Log:
Rename variable to not use C++ reserved name (leading underscore + capital) 
(NFC)

Modified:
cfe/trunk/lib/Driver/Action.cpp

Modified: cfe/trunk/lib/Driver/Action.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Action.cpp?rev=283616&r1=283615&r2=283616&view=diff
==
--- cfe/trunk/lib/Driver/Action.cpp (original)
+++ cfe/trunk/lib/Driver/Action.cpp Fri Oct  7 17:03:03 2016
@@ -125,8 +125,8 @@ InputAction::InputAction(const Arg &_Inp
 
 void BindArchAction::anchor() {}
 
-BindArchAction::BindArchAction(Action *Input, llvm::StringRef _ArchName)
-: Action(BindArchClass, Input), ArchName(_ArchName) {}
+BindArchAction::BindArchAction(Action *Input, llvm::StringRef ArchName)
+: Action(BindArchClass, Input), ArchName(ArchName) {}
 
 void OffloadAction::anchor() {}
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283615 - Fix MSVC build: requires namespace in front of StringRef (NFC)

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 17:02:59 2016
New Revision: 283615

URL: http://llvm.org/viewvc/llvm-project?rev=283615&view=rev
Log:
Fix MSVC build: requires namespace in front of StringRef (NFC)

Modified:
cfe/trunk/lib/Driver/Action.cpp

Modified: cfe/trunk/lib/Driver/Action.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Action.cpp?rev=283615&r1=283614&r2=283615&view=diff
==
--- cfe/trunk/lib/Driver/Action.cpp (original)
+++ cfe/trunk/lib/Driver/Action.cpp Fri Oct  7 17:02:59 2016
@@ -125,7 +125,7 @@ InputAction::InputAction(const Arg &_Inp
 
 void BindArchAction::anchor() {}
 
-BindArchAction::BindArchAction(Action *Input, StringRef _ArchName)
+BindArchAction::BindArchAction(Action *Input, llvm::StringRef _ArchName)
 : Action(BindArchClass, Input), ArchName(_ArchName) {}
 
 void OffloadAction::anchor() {}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283645 - Use StringRef in Command::printArg() instead of raw pointer (NFC)

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 20:38:43 2016
New Revision: 283645

URL: http://llvm.org/viewvc/llvm-project?rev=283645&view=rev
Log:
Use StringRef in Command::printArg() instead of raw pointer (NFC)

Modified:
cfe/trunk/include/clang/Driver/Job.h
cfe/trunk/lib/Driver/Job.cpp

Modified: cfe/trunk/include/clang/Driver/Job.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Job.h?rev=283645&r1=283644&r2=283645&view=diff
==
--- cfe/trunk/include/clang/Driver/Job.h (original)
+++ cfe/trunk/include/clang/Driver/Job.h Fri Oct  7 20:38:43 2016
@@ -116,7 +116,7 @@ public:
   const llvm::opt::ArgStringList &getArguments() const { return Arguments; }
 
   /// Print a command argument, and optionally quote it.
-  static void printArg(llvm::raw_ostream &OS, const char *Arg, bool Quote);
+  static void printArg(llvm::raw_ostream &OS, StringRef Arg, bool Quote);
 };
 
 /// Like Command, but with a fallback which is executed in case

Modified: cfe/trunk/lib/Driver/Job.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Job.cpp?rev=283645&r1=283644&r2=283645&view=diff
==
--- cfe/trunk/lib/Driver/Job.cpp (original)
+++ cfe/trunk/lib/Driver/Job.cpp Fri Oct  7 20:38:43 2016
@@ -80,8 +80,8 @@ static int skipArgs(const char *Flag, bo
   return 0;
 }
 
-void Command::printArg(raw_ostream &OS, const char *Arg, bool Quote) {
-  const bool Escape = std::strpbrk(Arg, "\"\\$");
+void Command::printArg(raw_ostream &OS, StringRef Arg, bool Quote) {
+  const bool Escape = Arg.find_first_of("\"\\$") != StringRef::npos;
 
   if (!Quote && !Escape) {
 OS << Arg;
@@ -90,7 +90,7 @@ void Command::printArg(raw_ostream &OS,
 
   // Quote and escape. This isn't really complete, but good enough.
   OS << '"';
-  while (const char c = *Arg++) {
+  for (const char c : Arg) {
 if (c == '"' || c == '\\' || c == '$')
   OS << '\\';
 OS << c;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283671 - Turn cl::values() (for enum) from a vararg function to using C++ variadic template

2016-10-08 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Sat Oct  8 14:41:06 2016
New Revision: 283671

URL: http://llvm.org/viewvc/llvm-project?rev=283671&view=rev
Log:
Turn cl::values() (for enum) from a vararg function to using C++ variadic 
template

The core of the change is supposed to be NFC, however it also fixes
what I believe was an undefined behavior when calling:

 va_start(ValueArgs, Desc);

with Desc being a StringRef.

Differential Revision: https://reviews.llvm.org/D25342

Modified:
cfe/trunk/tools/c-index-test/core_main.cpp
cfe/trunk/utils/TableGen/TableGen.cpp

Modified: cfe/trunk/tools/c-index-test/core_main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/core_main.cpp?rev=283671&r1=283670&r2=283671&view=diff
==
--- cfe/trunk/tools/c-index-test/core_main.cpp (original)
+++ cfe/trunk/tools/c-index-test/core_main.cpp Sat Oct  8 14:41:06 2016
@@ -41,8 +41,7 @@ static cl::opt
 Action(cl::desc("Action:"), cl::init(ActionType::None),
cl::values(
   clEnumValN(ActionType::PrintSourceSymbols,
- "print-source-symbols", "Print symbols from source"),
-  clEnumValEnd),
+ "print-source-symbols", "Print symbols from source")),
cl::cat(IndexTestCoreCategory));
 
 static cl::extrahelp MoreHelp(

Modified: cfe/trunk/utils/TableGen/TableGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/TableGen.cpp?rev=283671&r1=283670&r2=283671&view=diff
==
--- cfe/trunk/utils/TableGen/TableGen.cpp (original)
+++ cfe/trunk/utils/TableGen/TableGen.cpp Sat Oct  8 14:41:06 2016
@@ -135,8 +135,7 @@ cl::opt Action(
 clEnumValN(GenAttrDocs, "gen-attr-docs",
"Generate attribute documentation"),
 clEnumValN(GenDiagDocs, "gen-diag-docs",
-   "Generate attribute documentation"),
-clEnumValEnd));
+   "Generate attribute documentation")));
 
 cl::opt
 ClangComponent("clang-component",


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r283671 - Turn cl::values() (for enum) from a vararg function to using C++ variadic template

2016-10-08 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Sat Oct  8 14:41:06 2016
New Revision: 283671

URL: http://llvm.org/viewvc/llvm-project?rev=283671&view=rev
Log:
Turn cl::values() (for enum) from a vararg function to using C++ variadic 
template

The core of the change is supposed to be NFC, however it also fixes
what I believe was an undefined behavior when calling:

 va_start(ValueArgs, Desc);

with Desc being a StringRef.

Differential Revision: https://reviews.llvm.org/D25342

Modified:
clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp

Modified: clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp?rev=283671&r1=283670&r2=283671&view=diff
==
--- clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp (original)
+++ clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp Sat Oct  8 
14:41:06 2016
@@ -90,8 +90,7 @@ enum DatabaseFormatTy {
 cl::opt DatabaseFormat(
 "db", cl::desc("Specify input format"),
 cl::values(clEnumVal(fixed, "Hard-coded mapping"),
-   clEnumVal(yaml, "Yaml database created by find-all-symbols"),
-   clEnumValEnd),
+   clEnumVal(yaml, "Yaml database created by find-all-symbols")),
 cl::init(yaml), cl::cat(IncludeFixerCategory));
 
 cl::opt Input("input",


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283776 - Use StringRef in LangOptions::isNoBuiltinFunc API (NFC)

2016-10-10 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Mon Oct 10 11:34:07 2016
New Revision: 283776

URL: http://llvm.org/viewvc/llvm-project?rev=283776&view=rev
Log:
Use StringRef in LangOptions::isNoBuiltinFunc API (NFC)

Modified:
cfe/trunk/include/clang/Basic/LangOptions.h
cfe/trunk/lib/Basic/LangOptions.cpp

Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=283776&r1=283775&r2=283776&view=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Mon Oct 10 11:34:07 2016
@@ -165,7 +165,7 @@ public:
 
   /// \brief Is this a libc/libm function that is no longer recognized as a
   /// builtin because a -fno-builtin-* option has been specified?
-  bool isNoBuiltinFunc(const char *Name) const;
+  bool isNoBuiltinFunc(StringRef Name) const;
 };
 
 /// \brief Floating point control options

Modified: cfe/trunk/lib/Basic/LangOptions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/LangOptions.cpp?rev=283776&r1=283775&r2=283776&view=diff
==
--- cfe/trunk/lib/Basic/LangOptions.cpp (original)
+++ cfe/trunk/lib/Basic/LangOptions.cpp Mon Oct 10 11:34:07 2016
@@ -36,8 +36,7 @@ void LangOptions::resetNonModularOptions
   CurrentModule.clear();
 }
 
-bool LangOptions::isNoBuiltinFunc(const char *Name) const {
-  StringRef FuncName(Name);
+bool LangOptions::isNoBuiltinFunc(StringRef FuncName) const {
   for (unsigned i = 0, e = NoBuiltinFuncs.size(); i != e; ++i)
 if (FuncName.equals(NoBuiltinFuncs[i]))
   return true;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283802 - Change Builtins name to be stored as StringRef instead of raw pointers (NFC)

2016-10-10 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Mon Oct 10 16:34:29 2016
New Revision: 283802

URL: http://llvm.org/viewvc/llvm-project?rev=283802&view=rev
Log:
Change Builtins name to be stored as StringRef instead of raw pointers (NFC)

Modified:
cfe/trunk/include/clang/Basic/Builtins.h
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp

Modified: cfe/trunk/include/clang/Basic/Builtins.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=283802&r1=283801&r2=283802&view=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.h (original)
+++ cfe/trunk/include/clang/Basic/Builtins.h Mon Oct 10 16:34:29 2016
@@ -51,7 +51,8 @@ enum ID {
 };
 
 struct Info {
-  const char *Name, *Type, *Attributes, *HeaderName;
+  llvm::StringRef Name;
+  const char *Type, *Attributes, *HeaderName;
   LanguageID Langs;
   const char *Features;
 };
@@ -80,7 +81,7 @@ public:
 
   /// \brief Return the identifier name for the specified builtin,
   /// e.g. "__builtin_abs".
-  const char *getName(unsigned ID) const {
+  llvm::StringRef getName(unsigned ID) const {
 return getRecord(ID).Name;
   }
 

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=283802&r1=283801&r2=283802&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Oct 10 16:34:29 2016
@@ -50,7 +50,7 @@ llvm::Value *CodeGenModule::getBuiltinLi
   if (FD->hasAttr())
 Name = getMangledName(D);
   else
-Name = Context.BuiltinInfo.getName(BuiltinID) + 10;
+Name = Context.BuiltinInfo.getName(BuiltinID).drop_front(10);
 
   llvm::FunctionType *Ty =
 cast(getTypes().ConvertType(FD->getType()));
@@ -2523,11 +2523,11 @@ RValue CodeGenFunction::EmitBuiltinExpr(
   checkTargetFeatures(E, FD);
 
   // See if we have a target specific intrinsic.
-  const char *Name = getContext().BuiltinInfo.getName(BuiltinID);
   Intrinsic::ID IntrinsicID = Intrinsic::not_intrinsic;
   StringRef Prefix =
   llvm::Triple::getArchTypePrefix(getTarget().getTriple().getArch());
   if (!Prefix.empty()) {
+StringRef Name = getContext().BuiltinInfo.getName(BuiltinID);
 IntrinsicID = Intrinsic::getIntrinsicForGCCBuiltin(Prefix.data(), Name);
 // NOTE we dont need to perform a compatibility flag check here since the
 // intrinsics are declared in Builtins*.def via LANGBUILTIN which filter 
the

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=283802&r1=283801&r2=283802&view=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Mon Oct 10 16:34:29 2016
@@ -3199,12 +3199,12 @@ Sema::SemaBuiltinAtomicOverloaded(ExprRe
   // Get the decl for the concrete builtin from this, we can tell what the
   // concrete integer type we should convert to is.
   unsigned NewBuiltinID = BuiltinIndices[BuiltinIndex][SizeIndex];
-  const char *NewBuiltinName = Context.BuiltinInfo.getName(NewBuiltinID);
   FunctionDecl *NewBuiltinDecl;
   if (NewBuiltinID == BuiltinID)
 NewBuiltinDecl = FDecl;
   else {
 // Perform builtin lookup to avoid redeclaring it.
+StringRef NewBuiltinName = Context.BuiltinInfo.getName(NewBuiltinID);
 DeclarationName DN(&Context.Idents.get(NewBuiltinName));
 LookupResult Res(*this, DN, DRE->getLocStart(), LookupOrdinaryName);
 LookupName(Res, TUScope, /*AllowBuiltinCreation=*/true);
@@ -6263,7 +6263,7 @@ static void emitReplacement(Sema &S, Sou
 unsigned AbsKind, QualType ArgType) {
   bool EmitHeaderHint = true;
   const char *HeaderName = nullptr;
-  const char *FunctionName = nullptr;
+  StringRef FunctionName;
   if (S.getLangOpts().CPlusPlus && !ArgType->isAnyComplexType()) {
 FunctionName = "std::abs";
 if (ArgType->isIntegralOrEnumerationType()) {
@@ -6381,7 +6381,7 @@ void Sema::CheckAbsoluteValueFunction(co
   // Unsigned types cannot be negative.  Suggest removing the absolute value
   // function call.
   if (ArgType->isUnsignedIntegerType()) {
-const char *FunctionName =
+StringRef FunctionName =
 IsStdAbs ? "std::abs" : Context.BuiltinInfo.getName(AbsKind);
 Diag(Call->getExprLoc(), diag::warn_unsigned_abs) << ArgType << ParamType;
 Diag(Call->getExprLoc(), diag::note_remove_abs)


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283815 - Store FileEntry::Filename as a StringRef instead of raw pointer (NFC)

2016-10-10 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Mon Oct 10 17:52:47 2016
New Revision: 283815

URL: http://llvm.org/viewvc/llvm-project?rev=283815&view=rev
Log:
Store FileEntry::Filename as a StringRef instead of raw pointer (NFC)

Modified:
cfe/trunk/include/clang/Basic/FileManager.h
cfe/trunk/lib/Basic/FileManager.cpp
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
cfe/trunk/lib/Lex/HeaderSearch.cpp
cfe/trunk/lib/Lex/PTHLexer.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTReaderInternals.h
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/tools/libclang/CXSourceLocation.cpp
cfe/trunk/unittests/Basic/FileManagerTest.cpp

Modified: cfe/trunk/include/clang/Basic/FileManager.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/FileManager.h?rev=283815&r1=283814&r2=283815&view=diff
==
--- cfe/trunk/include/clang/Basic/FileManager.h (original)
+++ cfe/trunk/include/clang/Basic/FileManager.h Mon Oct 10 17:52:47 2016
@@ -51,7 +51,7 @@ public:
 /// If the 'File' member is valid, then this FileEntry has an open file
 /// descriptor for the file.
 class FileEntry {
-  const char *Name;   // Name of the file.
+  StringRef Name; // Name of the file.
   std::string RealPathName;   // Real path to the file; could be empty.
   off_t Size; // File size in bytes.
   time_t ModTime; // Modification time of file.
@@ -82,7 +82,7 @@ public:
 assert(!isValid() && "Cannot copy an initialized FileEntry");
   }
 
-  const char *getName() const { return Name; }
+  StringRef getName() const { return Name; }
   StringRef tryGetRealPathName() const { return RealPathName; }
   bool isValid() const { return IsValid; }
   off_t getSize() const { return Size; }

Modified: cfe/trunk/lib/Basic/FileManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileManager.cpp?rev=283815&r1=283814&r2=283815&view=diff
==
--- cfe/trunk/lib/Basic/FileManager.cpp (original)
+++ cfe/trunk/lib/Basic/FileManager.cpp Mon Oct 10 17:52:47 2016
@@ -423,7 +423,7 @@ FileManager::getBufferForFile(const File
   if (isVolatile)
 FileSize = -1;
 
-  const char *Filename = Entry->getName();
+  StringRef Filename = Entry->getName();
   // If the file is already open, use the open file descriptor.
   if (Entry->File) {
 auto Result =

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=283815&r1=283814&r2=283815&view=diff
==
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Mon Oct 10 17:52:47 2016
@@ -2582,7 +2582,7 @@ llvm::Function *CGObjCGNU::ModuleInitFun
   SourceManager &SM = CGM.getContext().getSourceManager();
   const FileEntry *mainFile = SM.getFileEntryForID(SM.getMainFileID());
   std::string path =
-std::string(mainFile->getDir()->getName()) + '/' + mainFile->getName();
+  (Twine(mainFile->getDir()->getName()) + "/" + mainFile->getName()).str();
   Elements.push_back(MakeConstantString(path, ".objc_source_file_name"));
   Elements.push_back(SymTab);
 

Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=283815&r1=283814&r2=283815&view=diff
==
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Mon Oct 10 17:52:47 2016
@@ -847,17 +847,19 @@ LookupSubframeworkHeader(StringRef Filen
   if (SlashPos == StringRef::npos) return nullptr;
 
   // Look up the base framework name of the ContextFileEnt.
-  const char *ContextName = ContextFileEnt->getName();
+  StringRef ContextName = ContextFileEnt->getName();
 
   // If the context info wasn't a framework, couldn't be a subframework.
   const unsigned DotFrameworkLen = 10;
-  const char *FrameworkPos = strstr(ContextName, ".framework");
-  if (FrameworkPos == nullptr ||
-  (FrameworkPos[DotFrameworkLen] != '/' && 
-   FrameworkPos[DotFrameworkLen] != '\\'))
+  auto FrameworkPos = ContextName.find(".framework");
+  if (FrameworkPos == StringRef::npos ||
+  (ContextName[FrameworkPos + DotFrameworkLen] != '/' &&
+   ContextName[FrameworkPos + DotFrameworkLen] != '\\'))
 return nullptr;
 
-  SmallString<1024> FrameworkName(ContextName, FrameworkPos+DotFrameworkLen+1);
+  SmallString<1024> FrameworkName(ContextName.data(), ContextName.data() +
+  FrameworkPos +
+  DotFrameworkLen + 1);
 
   // Append Frameworks/HIToolbox.framework/
   FrameworkName += "Frameworks/";
@@ -1449,7 +1451,7 @@ std::string HeaderSearch::suggestPath

[clang-tools-extra] r283819 - Fix clang-tools-extra build after r283815 (Store FileEntry::Filename as a StringRef instead of raw pointer)

2016-10-10 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Mon Oct 10 18:24:16 2016
New Revision: 283819

URL: http://llvm.org/viewvc/llvm-project?rev=283819&view=rev
Log:
Fix clang-tools-extra build after r283815 (Store FileEntry::Filename as a 
StringRef instead of raw pointer)

Modified:

clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp

clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp

Modified: 
clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp?rev=283819&r1=283818&r2=283819&view=diff
==
--- 
clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
 (original)
+++ 
clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
 Mon Oct 10 18:24:16 2016
@@ -300,7 +300,7 @@ bool writeFiles(const clang::Rewriter &R
   for (Rewriter::const_buffer_iterator BufferI = Rewrites.buffer_begin(),
BufferE = Rewrites.buffer_end();
BufferI != BufferE; ++BufferI) {
-const char *FileName =
+StringRef FileName =
 Rewrites.getSourceMgr().getFileEntryForID(BufferI->first)->getName();
 
 std::error_code EC;

Modified: 
clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp?rev=283819&r1=283818&r2=283819&view=diff
==
--- 
clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
 (original)
+++ 
clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
 Mon Oct 10 18:24:16 2016
@@ -248,7 +248,7 @@ int main(int argc, char **argv) {
   continue;
 
 std::string NewFileData;
-const char *FileName = FileAndReplacements.first->getName();
+StringRef FileName = FileAndReplacements.first->getName();
 if (!applyReplacements(FileAndReplacements.second, NewFileData,
Diagnostics)) {
   errs() << "Failed to apply replacements to " << FileName << "\n";


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283856 - Turn FileManager DirectoryEntry::Name from raw pointer to StringRef (NFC)

2016-10-11 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Tue Oct 11 02:31:29 2016
New Revision: 283856

URL: http://llvm.org/viewvc/llvm-project?rev=283856&view=rev
Log:
Turn FileManager DirectoryEntry::Name from raw pointer to StringRef (NFC)

Modified:
cfe/trunk/include/clang/Basic/FileManager.h
cfe/trunk/include/clang/Basic/FileSystemStatCache.h
cfe/trunk/lib/Basic/FileManager.cpp
cfe/trunk/lib/Basic/FileSystemStatCache.cpp
cfe/trunk/lib/Frontend/CacheTokens.cpp
cfe/trunk/lib/Lex/HeaderSearch.cpp
cfe/trunk/lib/Lex/PTHLexer.cpp
cfe/trunk/unittests/Basic/FileManagerTest.cpp

Modified: cfe/trunk/include/clang/Basic/FileManager.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/FileManager.h?rev=283856&r1=283855&r2=283856&view=diff
==
--- cfe/trunk/include/clang/Basic/FileManager.h (original)
+++ cfe/trunk/include/clang/Basic/FileManager.h Tue Oct 11 02:31:29 2016
@@ -38,11 +38,10 @@ class FileSystemStatCache;
 /// \brief Cached information about one directory (either on disk or in
 /// the virtual file system).
 class DirectoryEntry {
-  const char *Name;   // Name of the directory.
+  StringRef Name; // Name of the directory.
   friend class FileManager;
 public:
-  DirectoryEntry() : Name(nullptr) {}
-  const char *getName() const { return Name; }
+  StringRef getName() const { return Name; }
 };
 
 /// \brief Cached information about one file (either on disk
@@ -165,7 +164,7 @@ class FileManager : public RefCountedBas
   // Caching.
   std::unique_ptr StatCache;
 
-  bool getStatValue(const char *Path, FileData &Data, bool isFile,
+  bool getStatValue(StringRef Path, FileData &Data, bool isFile,
 std::unique_ptr *F);
 
   /// Add all ancestors of the given path (pointing to either a file

Modified: cfe/trunk/include/clang/Basic/FileSystemStatCache.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/FileSystemStatCache.h?rev=283856&r1=283855&r2=283856&view=diff
==
--- cfe/trunk/include/clang/Basic/FileSystemStatCache.h (original)
+++ cfe/trunk/include/clang/Basic/FileSystemStatCache.h Tue Oct 11 02:31:29 2016
@@ -68,7 +68,7 @@ public:
   /// success for directories (not files).  On a successful file lookup, the
   /// implementation can optionally fill in \p F with a valid \p File object 
and
   /// the client guarantees that it will close it.
-  static bool get(const char *Path, FileData &Data, bool isFile,
+  static bool get(StringRef Path, FileData &Data, bool isFile,
   std::unique_ptr *F, FileSystemStatCache *Cache,
   vfs::FileSystem &FS);
 
@@ -92,11 +92,11 @@ protected:
   // FIXME: The pointer here is a non-owning/optional reference to the
   // unique_ptr. Optional&> might be nicer, but
   // Optional needs some work to support references so this isn't possible yet.
-  virtual LookupResult getStat(const char *Path, FileData &Data, bool isFile,
+  virtual LookupResult getStat(StringRef Path, FileData &Data, bool isFile,
std::unique_ptr *F,
vfs::FileSystem &FS) = 0;
 
-  LookupResult statChained(const char *Path, FileData &Data, bool isFile,
+  LookupResult statChained(StringRef Path, FileData &Data, bool isFile,
std::unique_ptr *F, vfs::FileSystem &FS) 
{
 if (FileSystemStatCache *Next = getNextStatCache())
   return Next->getStat(Path, Data, isFile, F, FS);
@@ -121,7 +121,7 @@ public:
   iterator begin() const { return StatCalls.begin(); }
   iterator end() const { return StatCalls.end(); }
 
-  LookupResult getStat(const char *Path, FileData &Data, bool isFile,
+  LookupResult getStat(StringRef Path, FileData &Data, bool isFile,
std::unique_ptr *F,
vfs::FileSystem &FS) override;
 };

Modified: cfe/trunk/lib/Basic/FileManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileManager.cpp?rev=283856&r1=283855&r2=283856&view=diff
==
--- cfe/trunk/lib/Basic/FileManager.cpp (original)
+++ cfe/trunk/lib/Basic/FileManager.cpp Tue Oct 11 02:31:29 2016
@@ -140,7 +140,7 @@ void FileManager::addAncestorsAsVirtualD
 
   // Add the virtual directory to the cache.
   auto UDE = llvm::make_unique();
-  UDE->Name = NamedDirEnt.first().data();
+  UDE->Name = NamedDirEnt.first();
   NamedDirEnt.second = UDE.get();
   VirtualDirectoryEntries.push_back(std::move(UDE));
 
@@ -185,7 +185,7 @@ const DirectoryEntry *FileManager::getDi
 
   // Get the null-terminated directory name as stored as the key of the
   // SeenDirEntries map.
-  const char *InterndDirName = NamedDirEnt.first().data();
+  StringRef InterndDirName = NamedDirEnt.first();
 
   // Check to see if the directory exists.
   FileData Data;
@@ -203,7 +203,7 @@ const Di

r283888 - Use StringRef instead of raw pointer in SourceManagerInternals LineTableInfo API (NFC)

2016-10-11 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Tue Oct 11 10:15:32 2016
New Revision: 283888

URL: http://llvm.org/viewvc/llvm-project?rev=283888&view=rev
Log:
Use StringRef instead of raw pointer in SourceManagerInternals LineTableInfo 
API (NFC)

Modified:
cfe/trunk/include/clang/Basic/SourceManagerInternals.h

Modified: cfe/trunk/include/clang/Basic/SourceManagerInternals.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManagerInternals.h?rev=283888&r1=283887&r2=283888&view=diff
==
--- cfe/trunk/include/clang/Basic/SourceManagerInternals.h (original)
+++ cfe/trunk/include/clang/Basic/SourceManagerInternals.h Tue Oct 11 10:15:32 
2016
@@ -95,9 +95,9 @@ public:
   }
 
   unsigned getLineTableFilenameID(StringRef Str);
-  const char *getFilename(unsigned ID) const {
+  StringRef getFilename(unsigned ID) const {
 assert(ID < FilenamesByID.size() && "Invalid FilenameID");
-return FilenamesByID[ID]->getKeyData();
+return FilenamesByID[ID]->getKey();
   }
   unsigned getNumFilenames() const { return FilenamesByID.size(); }
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r283802 - Change Builtins name to be stored as StringRef instead of raw pointers (NFC)

2016-10-11 Thread Mehdi Amini via cfe-commits
This is temporary: the last patch of my series of patches adds the constexpr 
ctor and remove all these static initializers.

> On Oct 11, 2016, at 11:26 AM, Benjamin Kramer  wrote:
> 
> I don't think this change is worth it. We create huge static arrays
> with Builtin::Info in Builtins.cpp and Targets.cpp, StringRef(const
> char*) is not constexpr (because of strlen). This means you'll get a
> huge generated initialization function for it. We want to reduce the
> number of global initializers in LLVM, not create new ones.
> 
> On Mon, Oct 10, 2016 at 11:34 PM, Mehdi Amini via cfe-commits
>  wrote:
>> Author: mehdi_amini
>> Date: Mon Oct 10 16:34:29 2016
>> New Revision: 283802
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=283802&view=rev
>> Log:
>> Change Builtins name to be stored as StringRef instead of raw pointers (NFC)
>> 
>> Modified:
>>cfe/trunk/include/clang/Basic/Builtins.h
>>cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>>cfe/trunk/lib/Sema/SemaChecking.cpp
>> 
>> Modified: cfe/trunk/include/clang/Basic/Builtins.h
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=283802&r1=283801&r2=283802&view=diff
>> ==
>> --- cfe/trunk/include/clang/Basic/Builtins.h (original)
>> +++ cfe/trunk/include/clang/Basic/Builtins.h Mon Oct 10 16:34:29 2016
>> @@ -51,7 +51,8 @@ enum ID {
>> };
>> 
>> struct Info {
>> -  const char *Name, *Type, *Attributes, *HeaderName;
>> +  llvm::StringRef Name;
>> +  const char *Type, *Attributes, *HeaderName;
>>   LanguageID Langs;
>>   const char *Features;
>> };
>> @@ -80,7 +81,7 @@ public:
>> 
>>   /// \brief Return the identifier name for the specified builtin,
>>   /// e.g. "__builtin_abs".
>> -  const char *getName(unsigned ID) const {
>> +  llvm::StringRef getName(unsigned ID) const {
>> return getRecord(ID).Name;
>>   }
>> 
>> 
>> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=283802&r1=283801&r2=283802&view=diff
>> ==
>> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Oct 10 16:34:29 2016
>> @@ -50,7 +50,7 @@ llvm::Value *CodeGenModule::getBuiltinLi
>>   if (FD->hasAttr())
>> Name = getMangledName(D);
>>   else
>> -Name = Context.BuiltinInfo.getName(BuiltinID) + 10;
>> +Name = Context.BuiltinInfo.getName(BuiltinID).drop_front(10);
>> 
>>   llvm::FunctionType *Ty =
>> cast(getTypes().ConvertType(FD->getType()));
>> @@ -2523,11 +2523,11 @@ RValue CodeGenFunction::EmitBuiltinExpr(
>>   checkTargetFeatures(E, FD);
>> 
>>   // See if we have a target specific intrinsic.
>> -  const char *Name = getContext().BuiltinInfo.getName(BuiltinID);
>>   Intrinsic::ID IntrinsicID = Intrinsic::not_intrinsic;
>>   StringRef Prefix =
>>   llvm::Triple::getArchTypePrefix(getTarget().getTriple().getArch());
>>   if (!Prefix.empty()) {
>> +StringRef Name = getContext().BuiltinInfo.getName(BuiltinID);
>> IntrinsicID = Intrinsic::getIntrinsicForGCCBuiltin(Prefix.data(), Name);
>> // NOTE we dont need to perform a compatibility flag check here since the
>> // intrinsics are declared in Builtins*.def via LANGBUILTIN which filter 
>> the
>> 
>> Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=283802&r1=283801&r2=283802&view=diff
>> ==
>> --- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaChecking.cpp Mon Oct 10 16:34:29 2016
>> @@ -3199,12 +3199,12 @@ Sema::SemaBuiltinAtomicOverloaded(ExprRe
>>   // Get the decl for the concrete builtin from this, we can tell what the
>>   // concrete integer type we should convert to is.
>>   unsigned NewBuiltinID = BuiltinIndices[BuiltinIndex][SizeIndex];
>> -  const char *NewBuiltinName = Context.BuiltinInfo.getName(NewBuiltinID);
>>   FunctionDecl *NewBuiltinDecl;
>>   if (NewBuiltinID == BuiltinID)
>> NewBuiltinDecl = FDecl;
>>   else {
>> // Perform builtin lookup to avoid redeclaring it.
>> +StringRef NewBuiltinName = Context.BuiltinInfo.getName(NewBuiltinID);
>> Declarati

Re: r283802 - Change Builtins name to be stored as StringRef instead of raw pointers (NFC)

2016-10-11 Thread Mehdi Amini via cfe-commits

> On Oct 11, 2016, at 12:04 PM, Benjamin Kramer  wrote:
> 
> Committing this patch before the constexpr change seems backwards
> then?

Well not really because I need to make StringRef(const char *) explicit, so all 
the others have to go first.

> The static initializers are already breaking stuff because it
> takes GCC with optimization and debug info takes 10+ minutes to
> generate megabytes of static initializer code in Targets.cpp. Can you
> please revert this until the constexpr change is ready?

I already landed > 30 patches like this one, I have no problem temporarily 
reverting this one in particular, but there are others instance of static 
initializers in the other patches.

— 
Mehdi



> 
> On Tue, Oct 11, 2016 at 8:40 PM, Mehdi Amini  wrote:
>> This is temporary: the last patch of my series of patches adds the constexpr 
>> ctor and remove all these static initializers.
>> 
>>> On Oct 11, 2016, at 11:26 AM, Benjamin Kramer  wrote:
>>> 
>>> I don't think this change is worth it. We create huge static arrays
>>> with Builtin::Info in Builtins.cpp and Targets.cpp, StringRef(const
>>> char*) is not constexpr (because of strlen). This means you'll get a
>>> huge generated initialization function for it. We want to reduce the
>>> number of global initializers in LLVM, not create new ones.
>>> 
>>> On Mon, Oct 10, 2016 at 11:34 PM, Mehdi Amini via cfe-commits
>>>  wrote:
>>>> Author: mehdi_amini
>>>> Date: Mon Oct 10 16:34:29 2016
>>>> New Revision: 283802
>>>> 
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=283802&view=rev
>>>> Log:
>>>> Change Builtins name to be stored as StringRef instead of raw pointers 
>>>> (NFC)
>>>> 
>>>> Modified:
>>>>   cfe/trunk/include/clang/Basic/Builtins.h
>>>>   cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>>>>   cfe/trunk/lib/Sema/SemaChecking.cpp
>>>> 
>>>> Modified: cfe/trunk/include/clang/Basic/Builtins.h
>>>> URL: 
>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=283802&r1=283801&r2=283802&view=diff
>>>> ==
>>>> --- cfe/trunk/include/clang/Basic/Builtins.h (original)
>>>> +++ cfe/trunk/include/clang/Basic/Builtins.h Mon Oct 10 16:34:29 2016
>>>> @@ -51,7 +51,8 @@ enum ID {
>>>> };
>>>> 
>>>> struct Info {
>>>> -  const char *Name, *Type, *Attributes, *HeaderName;
>>>> +  llvm::StringRef Name;
>>>> +  const char *Type, *Attributes, *HeaderName;
>>>>  LanguageID Langs;
>>>>  const char *Features;
>>>> };
>>>> @@ -80,7 +81,7 @@ public:
>>>> 
>>>>  /// \brief Return the identifier name for the specified builtin,
>>>>  /// e.g. "__builtin_abs".
>>>> -  const char *getName(unsigned ID) const {
>>>> +  llvm::StringRef getName(unsigned ID) const {
>>>>return getRecord(ID).Name;
>>>>  }
>>>> 
>>>> 
>>>> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>>>> URL: 
>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=283802&r1=283801&r2=283802&view=diff
>>>> ==
>>>> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
>>>> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Oct 10 16:34:29 2016
>>>> @@ -50,7 +50,7 @@ llvm::Value *CodeGenModule::getBuiltinLi
>>>>  if (FD->hasAttr())
>>>>Name = getMangledName(D);
>>>>  else
>>>> -Name = Context.BuiltinInfo.getName(BuiltinID) + 10;
>>>> +Name = Context.BuiltinInfo.getName(BuiltinID).drop_front(10);
>>>> 
>>>>  llvm::FunctionType *Ty =
>>>>cast(getTypes().ConvertType(FD->getType()));
>>>> @@ -2523,11 +2523,11 @@ RValue CodeGenFunction::EmitBuiltinExpr(
>>>>  checkTargetFeatures(E, FD);
>>>> 
>>>>  // See if we have a target specific intrinsic.
>>>> -  const char *Name = getContext().BuiltinInfo.getName(BuiltinID);
>>>>  Intrinsic::ID IntrinsicID = Intrinsic::not_intrinsic;
>>>>  StringRef Prefix =
>>>>  llvm::Triple::getArchTypePrefix(getTarget().getTriple().getArch());
>>>>  if (!Prefix.empty()) {
>>>> +StringRef Name = getContext().Builtin

Re: r283802 - Change Builtins name to be stored as StringRef instead of raw pointers (NFC)

2016-10-11 Thread Mehdi Amini via cfe-commits
Yes, do you have a specific concern for this table size in particular?

> On Oct 11, 2016, at 12:07 PM, Craig Topper  wrote:
> 
> But this also increases the size of the builtin table too right? Since 
> StringRef is twice the size of a pointer.
> 
> ~Craig
> 
> On Tue, Oct 11, 2016 at 11:40 AM, Mehdi Amini via cfe-commits 
> mailto:cfe-commits@lists.llvm.org>> wrote:
> This is temporary: the last patch of my series of patches adds the constexpr 
> ctor and remove all these static initializers.
> 
> > On Oct 11, 2016, at 11:26 AM, Benjamin Kramer  > <mailto:benny@gmail.com>> wrote:
> >
> > I don't think this change is worth it. We create huge static arrays
> > with Builtin::Info in Builtins.cpp and Targets.cpp, StringRef(const
> > char*) is not constexpr (because of strlen). This means you'll get a
> > huge generated initialization function for it. We want to reduce the
> > number of global initializers in LLVM, not create new ones.
> >
> > On Mon, Oct 10, 2016 at 11:34 PM, Mehdi Amini via cfe-commits
> > mailto:cfe-commits@lists.llvm.org>> wrote:
> >> Author: mehdi_amini
> >> Date: Mon Oct 10 16:34:29 2016
> >> New Revision: 283802
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=283802&view=rev 
> >> <http://llvm.org/viewvc/llvm-project?rev=283802&view=rev>
> >> Log:
> >> Change Builtins name to be stored as StringRef instead of raw pointers 
> >> (NFC)
> >>
> >> Modified:
> >>cfe/trunk/include/clang/Basic/Builtins.h
> >>cfe/trunk/lib/CodeGen/CGBuiltin.cpp
> >>cfe/trunk/lib/Sema/SemaChecking.cpp
> >>
> >> Modified: cfe/trunk/include/clang/Basic/Builtins.h
> >> URL: 
> >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=283802&r1=283801&r2=283802&view=diff
> >>  
> >> <http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=283802&r1=283801&r2=283802&view=diff>
> >> ==
> >> --- cfe/trunk/include/clang/Basic/Builtins.h (original)
> >> +++ cfe/trunk/include/clang/Basic/Builtins.h Mon Oct 10 16:34:29 2016
> >> @@ -51,7 +51,8 @@ enum ID {
> >> };
> >>
> >> struct Info {
> >> -  const char *Name, *Type, *Attributes, *HeaderName;
> >> +  llvm::StringRef Name;
> >> +  const char *Type, *Attributes, *HeaderName;
> >>   LanguageID Langs;
> >>   const char *Features;
> >> };
> >> @@ -80,7 +81,7 @@ public:
> >>
> >>   /// \brief Return the identifier name for the specified builtin,
> >>   /// e.g. "__builtin_abs".
> >> -  const char *getName(unsigned ID) const {
> >> +  llvm::StringRef getName(unsigned ID) const {
> >> return getRecord(ID).Name;
> >>   }
> >>
> >>
> >> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
> >> URL: 
> >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=283802&r1=283801&r2=283802&view=diff
> >>  
> >> <http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=283802&r1=283801&r2=283802&view=diff>
> >> ==
> >> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
> >> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Oct 10 16:34:29 2016
> >> @@ -50,7 +50,7 @@ llvm::Value *CodeGenModule::getBuiltinLi
> >>   if (FD->hasAttr())
> >> Name = getMangledName(D);
> >>   else
> >> -Name = Context.BuiltinInfo.getName(BuiltinID) + 10;
> >> +Name = Context.BuiltinInfo.getName(BuiltinID).drop_front(10);
> >>
> >>   llvm::FunctionType *Ty =
> >> cast(getTypes().ConvertType(FD->getType()));
> >> @@ -2523,11 +2523,11 @@ RValue CodeGenFunction::EmitBuiltinExpr(
> >>   checkTargetFeatures(E, FD);
> >>
> >>   // See if we have a target specific intrinsic.
> >> -  const char *Name = getContext().BuiltinInfo.getName(BuiltinID);
> >>   Intrinsic::ID IntrinsicID = Intrinsic::not_intrinsic;
> >>   StringRef Prefix =
> >>   llvm::Triple::getArchTypePrefix(getTarget().getTriple().getArch());
> >>   if (!Prefix.empty()) {
> >> +StringRef Name = getContext().BuiltinInfo.getName(BuiltinID);
> >> IntrinsicID = Intrinsic::getIntrinsicForGCCBuiltin(Prefix.data(), 
> 

r283920 - Revert "Change Builtins name to be stored as StringRef instead of raw pointers (NFC)"

2016-10-11 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Tue Oct 11 14:04:24 2016
New Revision: 283920

URL: http://llvm.org/viewvc/llvm-project?rev=283920&view=rev
Log:
Revert "Change Builtins name to be stored as StringRef instead of raw pointers 
(NFC)"

This reverts commit r283802. It introduces temporarily static
initializers, because StringRef ctor isn't (yet) constexpr for
string literals.
I plan to get there this week, but apparently GCC is so terrible
with these static initializer right now (10 min+ extra codegen
time was reported) that I'll hold on to this patch till the
constexpr one is ready, and land these at the same time.

Modified:
cfe/trunk/include/clang/Basic/Builtins.h
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp

Modified: cfe/trunk/include/clang/Basic/Builtins.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=283920&r1=283919&r2=283920&view=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.h (original)
+++ cfe/trunk/include/clang/Basic/Builtins.h Tue Oct 11 14:04:24 2016
@@ -51,8 +51,7 @@ enum ID {
 };
 
 struct Info {
-  llvm::StringRef Name;
-  const char *Type, *Attributes, *HeaderName;
+  const char *Name, *Type, *Attributes, *HeaderName;
   LanguageID Langs;
   const char *Features;
 };
@@ -81,7 +80,7 @@ public:
 
   /// \brief Return the identifier name for the specified builtin,
   /// e.g. "__builtin_abs".
-  llvm::StringRef getName(unsigned ID) const {
+  const char *getName(unsigned ID) const {
 return getRecord(ID).Name;
   }
 

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=283920&r1=283919&r2=283920&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Tue Oct 11 14:04:24 2016
@@ -50,7 +50,7 @@ llvm::Value *CodeGenModule::getBuiltinLi
   if (FD->hasAttr())
 Name = getMangledName(D);
   else
-Name = Context.BuiltinInfo.getName(BuiltinID).drop_front(10);
+Name = Context.BuiltinInfo.getName(BuiltinID) + 10;
 
   llvm::FunctionType *Ty =
 cast(getTypes().ConvertType(FD->getType()));
@@ -2523,11 +2523,11 @@ RValue CodeGenFunction::EmitBuiltinExpr(
   checkTargetFeatures(E, FD);
 
   // See if we have a target specific intrinsic.
+  const char *Name = getContext().BuiltinInfo.getName(BuiltinID);
   Intrinsic::ID IntrinsicID = Intrinsic::not_intrinsic;
   StringRef Prefix =
   llvm::Triple::getArchTypePrefix(getTarget().getTriple().getArch());
   if (!Prefix.empty()) {
-StringRef Name = getContext().BuiltinInfo.getName(BuiltinID);
 IntrinsicID = Intrinsic::getIntrinsicForGCCBuiltin(Prefix.data(), Name);
 // NOTE we dont need to perform a compatibility flag check here since the
 // intrinsics are declared in Builtins*.def via LANGBUILTIN which filter 
the

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=283920&r1=283919&r2=283920&view=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Tue Oct 11 14:04:24 2016
@@ -3199,12 +3199,12 @@ Sema::SemaBuiltinAtomicOverloaded(ExprRe
   // Get the decl for the concrete builtin from this, we can tell what the
   // concrete integer type we should convert to is.
   unsigned NewBuiltinID = BuiltinIndices[BuiltinIndex][SizeIndex];
+  const char *NewBuiltinName = Context.BuiltinInfo.getName(NewBuiltinID);
   FunctionDecl *NewBuiltinDecl;
   if (NewBuiltinID == BuiltinID)
 NewBuiltinDecl = FDecl;
   else {
 // Perform builtin lookup to avoid redeclaring it.
-StringRef NewBuiltinName = Context.BuiltinInfo.getName(NewBuiltinID);
 DeclarationName DN(&Context.Idents.get(NewBuiltinName));
 LookupResult Res(*this, DN, DRE->getLocStart(), LookupOrdinaryName);
 LookupName(Res, TUScope, /*AllowBuiltinCreation=*/true);
@@ -6263,7 +6263,7 @@ static void emitReplacement(Sema &S, Sou
 unsigned AbsKind, QualType ArgType) {
   bool EmitHeaderHint = true;
   const char *HeaderName = nullptr;
-  StringRef FunctionName;
+  const char *FunctionName = nullptr;
   if (S.getLangOpts().CPlusPlus && !ArgType->isAnyComplexType()) {
 FunctionName = "std::abs";
 if (ArgType->isIntegralOrEnumerationType()) {
@@ -6381,7 +6381,7 @@ void Sema::CheckAbsoluteValueFunction(co
   // Unsigned types cannot be negative.  Suggest removing the absolute value
   // function call.
   if (ArgType->isUnsignedIntegerType()) {
-StringRef FunctionName =
+const char *FunctionName =
 IsStdAbs ? "std::abs" : Context.BuiltinInfo.getName(AbsKind);
 Diag(Call->getExprLoc(), diag::warn_unsigned_abs) << ArgType << ParamType;
 Diag(Call->getExprLoc(), diag

Re: r283802 - Change Builtins name to be stored as StringRef instead of raw pointers (NFC)

2016-10-11 Thread Mehdi Amini via cfe-commits
Reverted in r283920, can you check if it is enough to “fix” the GCC issue?

> On Oct 11, 2016, at 12:04 PM, Benjamin Kramer  wrote:
> 
> Committing this patch before the constexpr change seems backwards
> then? The static initializers are already breaking stuff because it
> takes GCC with optimization and debug info takes 10+ minutes to
> generate megabytes of static initializer code in Targets.cpp. Can you
> please revert this until the constexpr change is ready?
> 
> On Tue, Oct 11, 2016 at 8:40 PM, Mehdi Amini  wrote:
>> This is temporary: the last patch of my series of patches adds the constexpr 
>> ctor and remove all these static initializers.
>> 
>>> On Oct 11, 2016, at 11:26 AM, Benjamin Kramer  wrote:
>>> 
>>> I don't think this change is worth it. We create huge static arrays
>>> with Builtin::Info in Builtins.cpp and Targets.cpp, StringRef(const
>>> char*) is not constexpr (because of strlen). This means you'll get a
>>> huge generated initialization function for it. We want to reduce the
>>> number of global initializers in LLVM, not create new ones.
>>> 
>>> On Mon, Oct 10, 2016 at 11:34 PM, Mehdi Amini via cfe-commits
>>>  wrote:
>>>> Author: mehdi_amini
>>>> Date: Mon Oct 10 16:34:29 2016
>>>> New Revision: 283802
>>>> 
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=283802&view=rev
>>>> Log:
>>>> Change Builtins name to be stored as StringRef instead of raw pointers 
>>>> (NFC)
>>>> 
>>>> Modified:
>>>>   cfe/trunk/include/clang/Basic/Builtins.h
>>>>   cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>>>>   cfe/trunk/lib/Sema/SemaChecking.cpp
>>>> 
>>>> Modified: cfe/trunk/include/clang/Basic/Builtins.h
>>>> URL: 
>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=283802&r1=283801&r2=283802&view=diff
>>>> ==
>>>> --- cfe/trunk/include/clang/Basic/Builtins.h (original)
>>>> +++ cfe/trunk/include/clang/Basic/Builtins.h Mon Oct 10 16:34:29 2016
>>>> @@ -51,7 +51,8 @@ enum ID {
>>>> };
>>>> 
>>>> struct Info {
>>>> -  const char *Name, *Type, *Attributes, *HeaderName;
>>>> +  llvm::StringRef Name;
>>>> +  const char *Type, *Attributes, *HeaderName;
>>>>  LanguageID Langs;
>>>>  const char *Features;
>>>> };
>>>> @@ -80,7 +81,7 @@ public:
>>>> 
>>>>  /// \brief Return the identifier name for the specified builtin,
>>>>  /// e.g. "__builtin_abs".
>>>> -  const char *getName(unsigned ID) const {
>>>> +  llvm::StringRef getName(unsigned ID) const {
>>>>return getRecord(ID).Name;
>>>>  }
>>>> 
>>>> 
>>>> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>>>> URL: 
>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=283802&r1=283801&r2=283802&view=diff
>>>> ==
>>>> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
>>>> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Oct 10 16:34:29 2016
>>>> @@ -50,7 +50,7 @@ llvm::Value *CodeGenModule::getBuiltinLi
>>>>  if (FD->hasAttr())
>>>>Name = getMangledName(D);
>>>>  else
>>>> -Name = Context.BuiltinInfo.getName(BuiltinID) + 10;
>>>> +Name = Context.BuiltinInfo.getName(BuiltinID).drop_front(10);
>>>> 
>>>>  llvm::FunctionType *Ty =
>>>>cast(getTypes().ConvertType(FD->getType()));
>>>> @@ -2523,11 +2523,11 @@ RValue CodeGenFunction::EmitBuiltinExpr(
>>>>  checkTargetFeatures(E, FD);
>>>> 
>>>>  // See if we have a target specific intrinsic.
>>>> -  const char *Name = getContext().BuiltinInfo.getName(BuiltinID);
>>>>  Intrinsic::ID IntrinsicID = Intrinsic::not_intrinsic;
>>>>  StringRef Prefix =
>>>>  llvm::Triple::getArchTypePrefix(getTarget().getTriple().getArch());
>>>>  if (!Prefix.empty()) {
>>>> +StringRef Name = getContext().BuiltinInfo.getName(BuiltinID);
>>>>IntrinsicID = Intrinsic::getIntrinsicForGCCBuiltin(Prefix.data(), Name);
>>>>// NOTE we dont need to perform a compatibility flag check here since 
>>>> the
>>>&

[PATCH] D24644: Pass -ffunction-sections/-fdata-sections along to gold-plugin

2016-10-12 Thread Mehdi AMINI via cfe-commits
mehdi_amini accepted this revision.
mehdi_amini added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D24644



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25537: [ThinLTO] Update doc to include lld

2016-10-12 Thread Mehdi AMINI via cfe-commits
mehdi_amini requested changes to this revision.
mehdi_amini added a comment.
This revision now requires changes to proceed.

You have to add which platforms are supported.


https://reviews.llvm.org/D25537



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D25537: [ThinLTO] Update doc to include lld

2016-10-12 Thread Mehdi Amini via cfe-commits
Perfect!
LGTM, thanks!

— 
Mehdi

> On Oct 12, 2016, at 5:04 PM, Davide Italiano  wrote:
> 
> davide updated this revision to Diff 74459.
> davide added a comment.
> 
> I mentioned that's ELF only. Are you OK with that or you want me to put more 
> detailed info?
> 
> 
> https://reviews.llvm.org/D25537
> 
> Files:
> docs/ThinLTO.rst
> 
> 
> Index: docs/ThinLTO.rst
> ===
> --- docs/ThinLTO.rst
> +++ docs/ThinLTO.rst
> @@ -62,8 +62,8 @@
>  `_.
> - **ld64**:
>  Starting with `Xcode 8 `_.
> -
> -Additionally, support is being added to the *lld* linker.
> +- **lld**:
> +  Starting with r284050 (ELF only).
> 
> Usage
> =
> @@ -109,6 +109,8 @@
>  ``-Wl,-plugin-opt,jobs=N``
> - ld64:
>  ``-Wl,-mllvm,-threads=N``
> +- lld:
> +  ``-Wl,--thinlto-jobs=N``
> 
> Incremental
> ---
> 
> 
> 

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libcxx] r282345 - Use __attribute__((internal_linkage)) when available.

2016-10-12 Thread Mehdi Amini via cfe-commits
Hi Eric,

This is not clear to me that this patch is correct as-is. 

See the last message in the thread: 
http://lists.llvm.org/pipermail/cfe-dev/2016-July/049985.html 


I think we should reach a consensus on the right course of actions about this 
first.

— 
Mehdi




> On Sep 24, 2016, at 8:14 PM, Eric Fiselier via cfe-commits 
>  wrote:
> 
> Author: ericwf
> Date: Sat Sep 24 22:14:13 2016
> New Revision: 282345
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=282345&view=rev
> Log:
> Use __attribute__((internal_linkage)) when available.
> 
> Summary:
> This patch has been a long time coming (Thanks @eugenis). It changes 
> `_LIBCPP_INLINE_VISIBILITY` to use `__attribute__((internal_linkage))` 
> instead of `__attribute__((visibility("hidden"), always_inline))`.
> 
> The point of `_LIBCPP_INLINE_VISIBILITY` is to prevent inline functions from 
> being exported from both the libc++ library and from user libraries. This 
> helps libc++ better manage it's ABI.
> Previously this was done by forcing inlining and modifying the symbols 
> visibility. However inlining isn't guaranteed and symbol visibility only 
> affects shared libraries making this an imperfect solution.  
> `internal_linkage` improves this situation by making all symbols local to the 
> TU they are emitted in, regardless of inlining or visibility. IIRC the effect 
> of applying `__attribute__((internal_linkage))` to an inline function is the 
> same as applying `static`.
> 
> For more information about the attribute see: 
> http://lists.llvm.org/pipermail/cfe-dev/2015-October/045580.html
> 
> Most of the work for this patch was done by @eugenis.
> 
> 
> Reviewers: mclow.lists, eugenis
> 
> Subscribers: eugenis, cfe-commits
> 
> Differential Revision: https://reviews.llvm.org/D24642
> 
> Modified:
>libcxx/trunk/include/__config
>libcxx/trunk/src/string.cpp
> 
> Modified: libcxx/trunk/include/__config
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=282345&r1=282344&r2=282345&view=diff
> ==
> --- libcxx/trunk/include/__config (original)
> +++ libcxx/trunk/include/__config Sat Sep 24 22:14:13 2016
> @@ -34,6 +34,7 @@
> #endif
> 
> #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
> +#define _LIBCPP_ABI_EXTERN_TEMPLATE_SYMBOLS_VERSION 2
> // Change short string representation so that string data starts at offset 0,
> // improving its alignment in some cases.
> #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
> @@ -49,6 +50,7 @@
> #define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
> #define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
> #elif _LIBCPP_ABI_VERSION == 1
> +#define _LIBCPP_ABI_EXTERN_TEMPLATE_SYMBOLS_VERSION 1
> // Feature macros for disabling pre ABI v1 features. All of these options
> // are deprecated.
> #if defined(__FreeBSD__)
> @@ -629,11 +631,19 @@ namespace std {
> #endif
> 
> #ifndef _LIBCPP_INLINE_VISIBILITY
> -#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), 
> __always_inline__))
> +# if __has_attribute(__internal_linkage__)
> +#   define _LIBCPP_INLINE_VISIBILITY __attribute__((__internal_linkage__, 
> __always_inline__))
> +# else
> +#   define _LIBCPP_INLINE_VISIBILITY __attribute__ 
> ((__visibility__("hidden"), __always_inline__))
> +# endif
> #endif
> 
> #ifndef _LIBCPP_ALWAYS_INLINE
> -#define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), 
> __always_inline__))
> +# if __has_attribute(__internal_linkage__)
> +#   define _LIBCPP_ALWAYS_INLINE __attribute__((__internal_linkage__, 
> __always_inline__))
> +# else
> +#   define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), 
> __always_inline__))
> +# endif
> #endif
> 
> #ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
> 
> Modified: libcxx/trunk/src/string.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/string.cpp?rev=282345&r1=282344&r2=282345&view=diff
> ==
> --- libcxx/trunk/src/string.cpp (original)
> +++ libcxx/trunk/src/string.cpp Sat Sep 24 22:14:13 2016
> @@ -29,6 +29,29 @@ template
> string
> operator+, allocator >(char const*, string 
> const&);
> 
> +// These external instantiations are required to maintain dylib compatibility
> +// for ABI v1 when using __attribute__((internal_linkage)) as opposed to
> +// __attribute__((visibility("hidden"), always_inline)).
> +#if _LIBCPP_ABI_EXTERN_TEMPLATE_SYMBOLS_VERSION == 1
> +template basic_string::iterator
> +basic_string::insert(basic_string::const_iterator,
> +   char const *, char const *);
> +
> +template basic_string::iterator
> +basic_string::insert(basic_string::const_iterator,
> +  wchar_t const *, wchar_t const *);
> +
> +template basic_string &
> +basic_string::replace(basic_string::const_iterator,
> + 

Re: [libcxx] r282345 - Use __attribute__((internal_linkage)) when available.

2016-10-12 Thread Mehdi Amini via cfe-commits
Thanks Eric!

> On Oct 12, 2016, at 9:18 PM, Eric Fiselier  wrote:
> 
> Sure, I've reverted the change in r284101.
> 
> I'll try and respond in detail tomorrow.
> 
> /Eric
> 
> On Wed, Oct 12, 2016 at 9:57 PM, Mehdi Amini  > wrote:
> Hi Eric,
> 
> This is not clear to me that this patch is correct as-is. 
> 
> See the last message in the thread: 
> http://lists.llvm.org/pipermail/cfe-dev/2016-July/049985.html 
> 
> 
> I think we should reach a consensus on the right course of actions about this 
> first.
> 
> — 
> Mehdi
> 
> 
> 
> 
>> On Sep 24, 2016, at 8:14 PM, Eric Fiselier via cfe-commits 
>> mailto:cfe-commits@lists.llvm.org>> wrote:
>> 
>> Author: ericwf
>> Date: Sat Sep 24 22:14:13 2016
>> New Revision: 282345
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=282345&view=rev 
>> 
>> Log:
>> Use __attribute__((internal_linkage)) when available.
>> 
>> Summary:
>> This patch has been a long time coming (Thanks @eugenis). It changes 
>> `_LIBCPP_INLINE_VISIBILITY` to use `__attribute__((internal_linkage))` 
>> instead of `__attribute__((visibility("hidden"), always_inline))`.
>> 
>> The point of `_LIBCPP_INLINE_VISIBILITY` is to prevent inline functions from 
>> being exported from both the libc++ library and from user libraries. This 
>> helps libc++ better manage it's ABI.
>> Previously this was done by forcing inlining and modifying the symbols 
>> visibility. However inlining isn't guaranteed and symbol visibility only 
>> affects shared libraries making this an imperfect solution.  
>> `internal_linkage` improves this situation by making all symbols local to 
>> the TU they are emitted in, regardless of inlining or visibility. IIRC the 
>> effect of applying `__attribute__((internal_linkage))` to an inline function 
>> is the same as applying `static`.
>> 
>> For more information about the attribute see: 
>> http://lists.llvm.org/pipermail/cfe-dev/2015-October/045580.html 
>> 
>> 
>> Most of the work for this patch was done by @eugenis.
>> 
>> 
>> Reviewers: mclow.lists, eugenis
>> 
>> Subscribers: eugenis, cfe-commits
>> 
>> Differential Revision: https://reviews.llvm.org/D24642 
>> 
>> 
>> Modified:
>>libcxx/trunk/include/__config
>>libcxx/trunk/src/string.cpp
>> 
>> Modified: libcxx/trunk/include/__config
>> URL: 
>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=282345&r1=282344&r2=282345&view=diff
>>  
>> 
>> ==
>> --- libcxx/trunk/include/__config (original)
>> +++ libcxx/trunk/include/__config Sat Sep 24 22:14:13 2016
>> @@ -34,6 +34,7 @@
>> #endif
>> 
>> #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
>> +#define _LIBCPP_ABI_EXTERN_TEMPLATE_SYMBOLS_VERSION 2
>> // Change short string representation so that string data starts at offset 0,
>> // improving its alignment in some cases.
>> #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
>> @@ -49,6 +50,7 @@
>> #define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
>> #define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
>> #elif _LIBCPP_ABI_VERSION == 1
>> +#define _LIBCPP_ABI_EXTERN_TEMPLATE_SYMBOLS_VERSION 1
>> // Feature macros for disabling pre ABI v1 features. All of these options
>> // are deprecated.
>> #if defined(__FreeBSD__)
>> @@ -629,11 +631,19 @@ namespace std {
>> #endif
>> 
>> #ifndef _LIBCPP_INLINE_VISIBILITY
>> -#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), 
>> __always_inline__))
>> +# if __has_attribute(__internal_linkage__)
>> +#   define _LIBCPP_INLINE_VISIBILITY __attribute__((__internal_linkage__, 
>> __always_inline__))
>> +# else
>> +#   define _LIBCPP_INLINE_VISIBILITY __attribute__ 
>> ((__visibility__("hidden"), __always_inline__))
>> +# endif
>> #endif
>> 
>> #ifndef _LIBCPP_ALWAYS_INLINE
>> -#define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), 
>> __always_inline__))
>> +# if __has_attribute(__internal_linkage__)
>> +#   define _LIBCPP_ALWAYS_INLINE __attribute__((__internal_linkage__, 
>> __always_inline__))
>> +# else
>> +#   define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), 
>> __always_inline__))
>> +# endif
>> #endif
>> 
>> #ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
>> 
>> Modified: libcxx/trunk/src/string.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/string.cpp?rev=282345&r1=282344&r2=282345&view=diff
>>  
>> 
>> ==
>> --- libcxx/trunk/src/string.cpp (original)
>> +++ libcxx/tru

[libcxx] [flang] [libc] [clang-tools-extra] [llvm] [clang] [compiler-rt] [mlir] Make SmallVectorImpl destructor protected (PR #71439)

2023-11-06 Thread Mehdi Amini via cfe-commits


@@ -95,7 +95,7 @@ class SerializeToHsacoPass
   std::unique_ptr>
   serializeISA(const std::string &isa) override;
 
-  std::unique_ptr> assembleIsa(const std::string &isa);
+  std::unique_ptr> assembleIsa(const std::string &isa);

joker-eph wrote:

@krzysz00 can you change this ahead of the current PR?

https://github.com/llvm/llvm-project/pull/71439
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [clang][NFC] Refactor `CXXNewExpr::InitializationStyle` (PR #71322)

2023-11-07 Thread Mehdi Amini via cfe-commits

joker-eph wrote:

> I've seen those exact test failures locally, but since precommit CI was fine, 
> I landed this PR and kept a close eye on the bots.

If you see failures locally, it's best to understand where they coming from: 
even if it passes on bots it just means we have a hole in our test coverage.  
For the pre-commit CI, one thing to look for is a "positive signal" instead of 
the absence of "negative signal": that is checking in the log for a "success" 
for a given tests (depending on the config, tests can be marked "unsupported" 
or not executed for various reasons).
Thanks @zmodem for reporting the issue: we need to fix the premerge config!


https://github.com/llvm/llvm-project/pull/71322
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [clang][NFC] Refactor `CXXNewExpr::InitializationStyle` (PR #71322)

2023-11-07 Thread Mehdi Amini via cfe-commits

joker-eph wrote:

>  tests will fail locally but pass everywhere else (for example, people 
> working on slightly out-of-norm configurations will sometimes have persistent 
> local failures that are unrelated to changes in the patch).

It never happened to me, in a way that can't be root caused and fixed (that is 
for example cases like that would be the name of my directory interfere with a 
CHECK somehow), what do you have in mind?

>  When precommit CI comes back green or with only false positives

The point of my message was that the CI wasn't a false positive: the CI didn't 
run. A false positive would be seeing a "Passed" for the test that you see 
failing locally.

> speculative commits to see whether an issue "is real" or not do happen on 
> occasion and are appropriate 

The cases I have seen for "speculative commits" are the opposite of what you're 
describing: iterating on issues that only happens on a bot and not reproducible 
locally. That is you **have** to push a commit because this is the only way to 
iterate on debugging an issue.
Pushing a commit when you have a local failure seems backward to me, I don't 
quite follow actually.


https://github.com/llvm/llvm-project/pull/71322
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[flang] [clang] [clang-tools-extra] [mlir] [compiler-rt] [llvm] [mlir] Verify non-negative `offset` and `size` (PR #72059)

2023-11-13 Thread Mehdi Amini via cfe-commits

joker-eph wrote:

> > This looks like a good fix for the verifier, but we should also fix the 
> > canonicalization to **not** create invalid IR!
> 
> Then I think that I'll implement the suggestions from Matthias in this PR and 
> leave the canonicalization for a future PR. For that future PR, could you 
> tell me what the preferred result would be? What would be the valid IR here 
> that the canonicalization should return?

It is related to this PR in the sense that we can’t create invalid IR: so if 
you make it illegal in the verifier then the canonicalizer can’t fold to this 
form and must check before doing so.
If we want to leave the canonicalizer folding, then the verifier should accept 
it instead.

Both options are correct, but they should be consistent. Not folding negative 
dimension seems like a straightforward thing I think?

https://github.com/llvm/llvm-project/pull/72059
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[compiler-rt] [clang] [llvm] [mlir] [clang-tools-extra] [mlir][tensor] Document `dest` operand (PR #71726)

2023-11-13 Thread Mehdi Amini via cfe-commits


@@ -18,31 +18,34 @@ def Tensor_Dialect : Dialect {
   let description = [{
 The `tensor` dialect is intended to hold core tensor creation and
 manipulation ops, which are not strongly associated with any particular
-other dialect or domain abstraction. The primary smoke test of this is ops
-that make sense for any tensor element type.
-
-We leave it to other dialects to hold the vast swath of possible
-computations one might want to do on a tensor.
-
-The `tensor` type is (for better or for worse) used to represent all kinds
-of things, and supports an open-ended set of element types. Examples:
+other dialect or domain abstraction. The aim for ops in this dialect is
+that they make sense for any tensor element type. When this is not the
+case, the op is left to live in other dialects. Examples of element types
+that could be supported by the `tensor` dialect include:
 
 - representing large, dense aggregations of primitive types, suitable for
   high-performance numerical computing.
-- representing shapes in the `shape` dialect, which consist of small
-  1D tensors of `index` data type.
+- representing shapes in the `shape` dialect, which consist of small 1D
+  tensors of `index` data type.
 - representing aggregations of strings or “variant” types.
-- representing large, sparse aggregations of primitive types, suitable
-  for high-performance numerical computing.
-
-Thus, for the `tensor` dialect, we prefer for now to constrain the
-scope as much as possible. The expectation is that at some point
-in the future, the `tensor` dialect’s scope may be broadened through a
-careful discussion of the tradeoffs.
-
-The `tensor` type is actually a builtin type (it lives in the builtin
-dialect), and does not live in this dialect.
+- representing large, sparse aggregations of primitive types, suitable for
+  high-performance numerical computing.
 
+Because of this broad element type support and because of the existence of
+more dedicated dialects, such as the `sparse_tensor` and `linalg` dialects,
+we prefer for now to keep the `tensor` dialect as small as possible. The
+expectation is that at some point in the future, the `tensor` dialect’s
+scope may be broadened through a careful discussion of the tradeoffs.
+
+On the `tensor` type itself, note that it is actually a builtin type (it
+lives in the builtin dialect), and does not live in this dialect.
+Furthermore, a `tensor` is an immutable object. For example, this means
+that a copy will always be made of the `tensor` object when it is passed to
+the `dest` operand used by some ops in this dialect. The storage to which
+the `tensor` object refers may be mutated, see the [Destination-Passing
+Style](

joker-eph wrote:

```suggestion
the `dest` operand used by some ops in this dialect. As an optimization,
an implementation can eliminate these copies during lowering when they
are redundant and perform in-place mutation, see the [Destination-Passing
Style](
```


https://github.com/llvm/llvm-project/pull/71726
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[compiler-rt] [clang] [llvm] [mlir] [clang-tools-extra] [mlir][tensor] Document `dest` operand (PR #71726)

2023-11-13 Thread Mehdi Amini via cfe-commits

https://github.com/joker-eph approved this pull request.

LG (with one edit)

https://github.com/llvm/llvm-project/pull/71726
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [mlir] [compiler-rt] [llvm] [libcxx] [clang-tools-extra] [flang] [mlir] Fix a zero stride canonicalizer crash (PR #74200)

2023-12-04 Thread Mehdi Amini via cfe-commits


@@ -0,0 +1,14 @@
+// RUN: mlir-opt %s -inline -split-input-file | FileCheck %s
+
+// CHECK-LABEL: func @inline_negative_stride
+func.func @inline_negative_stride(%arg0 : memref<10xf32>) -> memref<1xf32, 
strided<[?], offset: 1>> {
+  cf.br ^bb1(%arg0 : memref<10xf32>)
+^bb1(%m: memref<10xf32>):
+  %c0 = arith.constant 0 : index
+  %c1 = arith.constant 1 : index
+  %1 = memref.subview %m[1] [1] [%c0] : memref<10xf32> to memref<1xf32, 
strided<[?], offset: 1>>
+  return %1 : memref<1xf32, strided<[?], offset: 1>>
+}
+// CHECK-NEXT: arith.constant 0 : index
+// CHECK-NEXT: %[[SUBVIEW:.*]] = memref.subview
+// CHECK-NEXT: return %[[SUBVIEW]] : memref<1xf32, strided<[?], offset: 1>>

joker-eph wrote:

This is a canonicalized crash, we don't need to run the inliner.

https://github.com/llvm/llvm-project/pull/74200
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[llvm] [clang-tools-extra] [libcxx] [compiler-rt] [mlir] [clang] [flang] [mlir] Fix a zero stride canonicalizer crash (PR #74200)

2023-12-04 Thread Mehdi Amini via cfe-commits

joker-eph wrote:

> Is it possible to add the test case (or minimal similar example) with 
> `--inline` option so that we can confirm the original issue is resolved.
> 
> #73383

It is common that the person filing the issue does not reduce the IR or the 
pipeline that causes the bug. 
In particular this particular reporter (are you associated with them @Lewuathe 
?) seems like automated fuzzer. Here the only thing that the inliner does is 
running the canonicalizer.
I updated the issue instead.

https://github.com/llvm/llvm-project/pull/74200
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[llvm] [libc] [mlir] [clang-tools-extra] [clang] [libcxx] [compiler-rt] [flang] [mlir][llvm] Fix verifier for const int and dense (PR #74340)

2023-12-05 Thread Mehdi Amini via cfe-commits

https://github.com/joker-eph approved this pull request.


https://github.com/llvm/llvm-project/pull/74340
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[compiler-rt] [libcxx] [mlir] [clang] [llvm] [flang] [clang-tools-extra] [mlir] Fix a zero stride canonicalizer crash (PR #74200)

2023-12-05 Thread Mehdi Amini via cfe-commits

https://github.com/joker-eph approved this pull request.

Thanks!

https://github.com/llvm/llvm-project/pull/74200
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[compiler-rt] [lld] [openmp] [libcxx] [mlir] [clang] [lldb] [llvm] [flang] [libc] [clang-tools-extra] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)

2023-12-05 Thread Mehdi Amini via cfe-commits


@@ -0,0 +1,31 @@
+//===- SPIRVToLLVMIRTranslation.cpp - Translate SPIRV to LLVM IR 
--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file implements a translation between the MLIR SPIRV dialect and
+// LLVM IR.
+//
+//===--===//
+
+#include "mlir/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.h"
+#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
+#include "mlir/IR/BuiltinAttributes.h"
+#include "mlir/IR/Operation.h"
+#include "mlir/Target/LLVMIR/ModuleTranslation.h"
+
+using namespace mlir;
+using namespace mlir::LLVM;
+
+void mlir::registerSPIRVDialectTranslation(DialectRegistry ®istry) {
+  registry.insert();

joker-eph wrote:

It does not make sense to me to have an API called 
"registerSPIRVDialectTranslation" that itself registers a dialect and no 
translation actually.

https://github.com/llvm/llvm-project/pull/71430
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[compiler-rt] [lld] [openmp] [libcxx] [mlir] [clang] [lldb] [llvm] [flang] [libc] [clang-tools-extra] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)

2023-12-05 Thread Mehdi Amini via cfe-commits


@@ -61,6 +63,7 @@ registerAllGPUToLLVMIRTranslations(DialectRegistry ®istry) 
{
   registerLLVMDialectTranslation(registry);
   registerNVVMDialectTranslation(registry);
   registerROCDLDialectTranslation(registry);
+  registerSPIRVDialectTranslation(registry);

joker-eph wrote:

> The PR has been open for a while and blocking other work that depends on it. 
> Would be great if you can approve soon.

Well, we were waiting on the test that you just added today!

https://github.com/llvm/llvm-project/pull/71430
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[compiler-rt] [lld] [openmp] [libcxx] [mlir] [clang] [lldb] [llvm] [flang] [libc] [clang-tools-extra] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)

2023-12-05 Thread Mehdi Amini via cfe-commits

https://github.com/joker-eph edited 
https://github.com/llvm/llvm-project/pull/71430
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[flang] [mlir] [llvm] [compiler-rt] [libcxx] [clang-tools-extra] [clang] [libc] [mlir][gpu] Support dynamic_shared_memory Op with vector dialect (PR #74475)

2023-12-05 Thread Mehdi Amini via cfe-commits

https://github.com/joker-eph approved this pull request.


https://github.com/llvm/llvm-project/pull/74475
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[mlir] [llvm] [clang] [llvm] Improve implementation of StringRef::find_last_of and cie (PR #71865)

2023-11-14 Thread Mehdi Amini via cfe-commits


@@ -274,6 +278,23 @@ StringRef::size_type 
StringRef::find_first_not_of(StringRef Chars,
 /// Note: O(size() + Chars.size())
 StringRef::size_type StringRef::find_last_of(StringRef Chars,
  size_t From) const {
+#ifdef __SSE2__
+  if (Chars.size() == 2) {
+__m128i Needle0 = _mm_set1_epi8(Chars[0]);
+__m128i Needle1 = _mm_set1_epi8(Chars[1]);
+size_type Sz = std::min(From, Length);
+do {
+  Sz = Sz < 16 ? 0 : Sz - 16;
+  __m128i Buffer = _mm_loadu_si128((const __m128i *)(Data + Sz));
+  unsigned Mask = _mm_movemask_epi8(_mm_or_si128(
+  _mm_cmpeq_epi8(Buffer, Needle0), _mm_cmpeq_epi8(Buffer, Needle1)));
+  if (Mask != 0) {
+return Sz + sizeof(Mask) * CHAR_BIT - llvm::countl_zero(Mask);
+  }
+} while (Sz);
+return npos;
+  }
+#endif

joker-eph wrote:

Can this be abstracted or made out-of-line?
I'm wondering about the scalability of HW-specific intrinsics in-line 
(anticipating for the incoming `#elif defined(ARM64)`...)

https://github.com/llvm/llvm-project/pull/71865
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [compiler-rt] [llvm] [clang] [flang] [mlir] [mlir] Verify non-negative `offset` and `size` (PR #72059)

2023-11-15 Thread Mehdi Amini via cfe-commits

https://github.com/joker-eph approved this pull request.

Nice, thanks!

https://github.com/llvm/llvm-project/pull/72059
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libc] [clang-tools-extra] [flang] [clang] [llvm] [compiler-rt] [libcxx] [lld] [mlir] [lldb] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)

2023-11-16 Thread Mehdi Amini via cfe-commits


@@ -61,6 +63,7 @@ registerAllGPUToLLVMIRTranslations(DialectRegistry ®istry) 
{
   registerLLVMDialectTranslation(registry);
   registerNVVMDialectTranslation(registry);
   registerROCDLDialectTranslation(registry);
+  registerSPIRVDialectTranslation(registry);

joker-eph wrote:

Trying to understand...
What is the unit test that requires this?

https://github.com/llvm/llvm-project/pull/71430
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libc] [clang-tools-extra] [flang] [clang] [llvm] [compiler-rt] [libcxx] [lld] [mlir] [lldb] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)

2023-11-16 Thread Mehdi Amini via cfe-commits


@@ -0,0 +1,31 @@
+//===- SPIRVToLLVMIRTranslation.cpp - Translate SPIRV to LLVM IR 
--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file implements a translation between the MLIR SPIRV dialect and
+// LLVM IR.
+//
+//===--===//
+
+#include "mlir/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.h"
+#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
+#include "mlir/IR/BuiltinAttributes.h"
+#include "mlir/IR/Operation.h"
+#include "mlir/Target/LLVMIR/ModuleTranslation.h"
+
+using namespace mlir;
+using namespace mlir::LLVM;
+
+void mlir::registerSPIRVDialectTranslation(DialectRegistry ®istry) {
+  registry.insert();

joker-eph wrote:

I'm confused here: there is no translation interface.

https://github.com/llvm/llvm-project/pull/71430
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libc] [clang-tools-extra] [mlir] [compiler-rt] [lld] [libcxx] [clang] [flang] [lldb] [llvm] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)

2023-11-17 Thread Mehdi Amini via cfe-commits


@@ -61,6 +63,7 @@ registerAllGPUToLLVMIRTranslations(DialectRegistry ®istry) 
{
   registerLLVMDialectTranslation(registry);
   registerNVVMDialectTranslation(registry);
   registerROCDLDialectTranslation(registry);
+  registerSPIRVDialectTranslation(registry);

joker-eph wrote:

Which muir-translate test requires that? I don't find it by skimming the patch.

https://github.com/llvm/llvm-project/pull/71430
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libc] [clang-tools-extra] [mlir] [compiler-rt] [lld] [libcxx] [clang] [flang] [lldb] [llvm] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)

2023-11-17 Thread Mehdi Amini via cfe-commits

https://github.com/joker-eph edited 
https://github.com/llvm/llvm-project/pull/71430
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[lldb] [compiler-rt] [llvm] [clang] [lld] [mlir] [flang] [libcxx] [mlir][async] Avoid crash when not using `func.func` (PR #72801)

2023-11-20 Thread Mehdi Amini via cfe-commits

https://github.com/joker-eph approved this pull request.


https://github.com/llvm/llvm-project/pull/72801
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[flang] [clang] [libcxx] [lld] [lldb] [compiler-rt] [mlir] [llvm] [mlir][async] Avoid crash when not using `func.func` (PR #72801)

2023-11-20 Thread Mehdi Amini via cfe-commits

joker-eph wrote:

FYI the build is failing (maybe re-running would be enough though)

https://github.com/llvm/llvm-project/pull/72801
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [mlir] Add config for PDL (PR #69927)

2023-10-27 Thread Mehdi Amini via cfe-commits

joker-eph wrote:

Need to iterate a bit more on framing the problem:

> MLIR is a general infrastructure and as far as possible no dialect is 
> intended to be special or privileged

Yes, and you can use MLIR without PDL, it's not a mandatory component. I 
believe that the minimal examples `mlir-cat` and `mlir-minimal-opt` don't have 
PDL linked in (so you can already have your *-opt tool without it!

> Users should be able to use MLIR and the parts they need to customize for 
> their solution (e.g., one doesn't have to include any dialect except the ones 
> one uses). 

I don't see PDL as "just a dialect": I see it more as an infrastructure 
component. 
That is no one will have PDL used within their IR! 
It isn't comparable to any other dialect and completely unique from this point 
of view (do we have other dialects that aren't targeting user-written 
compilers? The transform dialect might be in-between)

> Many parts are elided when not referenced (LTO DCE'd etc), but this is not 
> possible with PDL given how its integrated with the common rewrite drivers. 
> This results in it always being included even when not used.

Now that seems more accurate to me: the dependency on PDL is only from the 
rewrite drivers, which is a "bring your own" thing by the way.
So the underlying question for motivating this here would be better framed IMO 
as "should we have an option to build the GreedyPatternRewriter without PDL?" 
I see it less as a strong need here (because again, bring your own driver if 
you don't like it).

Without a stronger case, this seems like something I would be supportive if we 
can make it minimally intrusive: that is localize the changes to a maximum and 
not spread through the codebase.
There are far too many #ifdef  to me right now, this may need some more 
refactoring first to avoid this and make PDL a more proper "separate component" 
inside libMLIRRewrite so that is can be enabled/disabled more naturally.

https://github.com/llvm/llvm-project/pull/69927
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 3289ecf - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-03 Thread Mehdi Amini via cfe-commits

Author: Mehdi Amini
Date: 2023-11-03T03:23:43-07:00
New Revision: 3289ecff8e8f5022cb6a40777392c98f1bcf5780

URL: 
https://github.com/llvm/llvm-project/commit/3289ecff8e8f5022cb6a40777392c98f1bcf5780
DIFF: 
https://github.com/llvm/llvm-project/commit/3289ecff8e8f5022cb6a40777392c98f1bcf5780.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
clang/test/OpenMP/cancel_codegen.cpp
clang/test/OpenMP/parallel_codegen.cpp
llvm/lib/IR/ConstantFold.cpp
mlir/include/mlir/Conversion/Passes.td
mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp
mlir/test/Conversion/VectorToLLVM/vector-mask-to-llvm.mlir
mlir/test/Conversion/VectorToLLVM/vector-reduction-to-llvm.mlir
mlir/test/Conversion/VectorToLLVM/vector-scalable-memcpy.mlir
mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir

Removed: 
mlir/test/Conversion/VectorToLLVM/typed-pointers.mlir



diff  --git a/clang/test/OpenMP/cancel_codegen.cpp 
b/clang/test/OpenMP/cancel_codegen.cpp
index 53580e0c2b0293f..03024cf331b2717 100644
--- a/clang/test/OpenMP/cancel_codegen.cpp
+++ b/clang/test/OpenMP/cancel_codegen.cpp
@@ -1026,25 +1026,25 @@ for (int i = 0; i < argc; ++i) {
 // CHECK3-NEXT:call void @llvm.experimental.noalias.scope.decl(metadata 
[[META8:![0-9]+]])
 // CHECK3-NEXT:call void @llvm.experimental.noalias.scope.decl(metadata 
[[META10:![0-9]+]])
 // CHECK3-NEXT:call void @llvm.experimental.noalias.scope.decl(metadata 
[[META12:![0-9]+]])
-// CHECK3-NEXT:store i32 [[TMP2]], ptr [[DOTGLOBAL_TID__ADDR_I]], align 4, 
!noalias !14
-// CHECK3-NEXT:store ptr [[TMP5]], ptr [[DOTPART_ID__ADDR_I]], align 8, 
!noalias !14
-// CHECK3-NEXT:store ptr null, ptr [[DOTPRIVATES__ADDR_I]], align 8, 
!noalias !14
-// CHECK3-NEXT:store ptr null, ptr [[DOTCOPY_FN__ADDR_I]], align 8, 
!noalias !14
-// CHECK3-NEXT:store ptr [[TMP3]], ptr [[DOTTASK_T__ADDR_I]], align 8, 
!noalias !14
-// CHECK3-NEXT:store ptr [[TMP7]], ptr [[__CONTEXT_ADDR_I]], align 8, 
!noalias !14
-// CHECK3-NEXT:[[TMP8:%.*]] = load ptr, ptr [[__CONTEXT_ADDR_I]], align 8, 
!noalias !14
+// CHECK3-NEXT:store i32 [[TMP2]], ptr [[DOTGLOBAL_TID__ADDR_I]], align 4, 
!noalias ![[NOALIAS0:[0-9]+]]
+// CHECK3-NEXT:store ptr [[TMP5]], ptr [[DOTPART_ID__ADDR_I]], align 8, 
!noalias ![[NOALIAS0]]
+// CHECK3-NEXT:store ptr null, ptr [[DOTPRIVATES__ADDR_I]], align 8, 
!noalias ![[NOALIAS0]]
+// CHECK3-NEXT:store ptr null, ptr [[DOTCOPY_FN__ADDR_I]], align 8, 
!noalias ![[NOALIAS0]]
+// CHECK3-NEXT:store ptr [[TMP3]], ptr [[DOTTASK_T__ADDR_I]], align 8, 
!noalias ![[NOALIAS0]]
+// CHECK3-NEXT:store ptr [[TMP7]], ptr [[__CONTEXT_ADDR_I]], align 8, 
!noalias ![[NOALIAS0]]
+// CHECK3-NEXT:[[TMP8:%.*]] = load ptr, ptr [[__CONTEXT_ADDR_I]], align 8, 
!noalias ![[NOALIAS0]]
 // CHECK3-NEXT:[[OMP_GLOBAL_THREAD_NUM_I:%.*]] = call i32 
@__kmpc_global_thread_num(ptr @[[GLOB12:[0-9]+]])
 // CHECK3-NEXT:[[TMP9:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 
[[OMP_GLOBAL_THREAD_NUM_I]], i32 4)
 // CHECK3-NEXT:[[TMP10:%.*]] = icmp ne i32 [[TMP9]], 0
 // CHECK3-NEXT:br i1 [[TMP10]], label [[DOTCANCEL_EXIT_I:%.*]], label 
[[DOTCANCEL_CONTINUE_I:%.*]]
 // CHECK3:   .cancel.exit.i:
-// CHECK3-NEXT:store i32 1, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias 
!14
+// CHECK3-NEXT:store i32 1, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias 
![[NOALIAS1:[0-9]+]]
 // CHECK3-NEXT:br label [[DOTOMP_OUTLINED__EXIT:%.*]]
 // CHECK3:   .cancel.continue.i:
-// CHECK3-NEXT:store i32 0, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias 
!14
+// CHECK3-NEXT:store i32 0, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias 
![[NOALIAS1]]
 // CHECK3-NEXT:br label [[DOTOMP_OUTLINED__EXIT]]
 // CHECK3:   .omp_outlined..exit:
-// CHECK3-NEXT:[[CLEANUP_DEST_I:%.*]] = load i32, ptr 
[[CLEANUP_DEST_SLOT_I]], align 4, !noalias !14
+// CHECK3-NEXT:[[CLEANUP_DEST_I:%.*]] = load i32, ptr 
[[CLEANUP_DEST_SLOT_I]], align 4, !noalias ![[NOALIAS1]]
 // CHECK3-NEXT:ret i32 0
 //
 //

diff  --git a/clang/test/OpenMP/parallel_codegen.cpp 
b/clang/test/OpenMP/parallel_codegen.cpp
index 5c98761be0808ef..d545b4a9d9fa887 100644
--- a/clang/test/OpenMP/parallel_codegen.cpp
+++ b/clang/test/OpenMP/parallel_codegen.cpp
@@ -812,7 +812,7 @@ int main (int argc, char **argv) {
 //
 //
 // CHECK3-LABEL: define {{[^@]+}}@_Z5tmainIPPcEiT_..omp_par
-// CHECK3-SAME: (ptr noalias [[TID_ADDR:%.*]], ptr noalias [[ZERO_ADDR:%.*]], 
ptr [[TMP0:%.*]]) #[[ATTR1]] {
+// CHECK3-SAME: (ptr noalias [[TID_ADDR:%.*]], ptr noalias [[ZERO_ADDR:%.*]], 
ptr [[TMP0:%.*]]) #[[ATTR2:[0-9]+]]
 // CHECK3-NEXT:  omp.par.entry:
 // CHECK3-NEXT:[[GEP__RELOADED:%.*]] = getelementptr { ptr, ptr }, ptr 
[[TMP0]], i32 0, i32 0
 // CHECK3-NEXT:

[libcxxabi] [flang] [libcxx] [llvm] [clang] [mlir] [clang-tools-extra] [lldb] [lld] [compiler-rt] Refactor ModuleToObject to offer more flexibility to subclass (NFC) (PR #71165)

2023-11-03 Thread Mehdi Amini via cfe-commits

https://github.com/joker-eph edited 
https://github.com/llvm/llvm-project/pull/71165
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxxabi] [flang] [libcxx] [llvm] [clang] [mlir] [clang-tools-extra] [lldb] [lld] [compiler-rt] Refactor ModuleToObject to offer more flexibility to subclass (NFC) (PR #71165)

2023-11-03 Thread Mehdi Amini via cfe-commits

https://github.com/joker-eph closed 
https://github.com/llvm/llvm-project/pull/71165
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [mlir] [llvm] [compiler-rt] [flang] [mlir][vector] Fix invalid `LoadOp` indices being created (PR #76292)

2024-01-02 Thread Mehdi Amini via cfe-commits


@@ -866,16 +866,41 @@ struct TransferOpConversion : public 
VectorToSCFPattern {
 this->setHasBoundedRewriteRecursion();
   }
 
+  static void getMaskBufferLoadIndices(OpTy xferOp, Value castedMaskBuffer,
+   SmallVector &loadIndices,

joker-eph wrote:

```suggestion
   SmallVectorImpl &loadIndices,
```

https://github.com/llvm/llvm-project/pull/76292
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[mlir] [flang] [clang-tools-extra] [llvm] [compiler-rt] [clang] [mlir][vector] Fix invalid `LoadOp` indices being created (PR #76292)

2024-01-02 Thread Mehdi Amini via cfe-commits


@@ -897,7 +921,8 @@ struct TransferOpConversion : public 
VectorToSCFPattern {
   } else {
 // It's safe to assume the mask buffer can be unpacked if the data
 // buffer was unpacked.
-auto castedMaskType = *unpackOneDim(maskBufferType);
+auto maskBufferType = dyn_cast(maskBuffer.getType());

joker-eph wrote:

Why are you introducing a `dyn_cast` here?

https://github.com/llvm/llvm-project/pull/76292
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[flang] [clang-tools-extra] [clang] [mlir] [llvm] [compiler-rt] [mlir][vector] Fix invalid `LoadOp` indices being created (PR #76292)

2024-01-02 Thread Mehdi Amini via cfe-commits


@@ -866,16 +866,41 @@ struct TransferOpConversion : public 
VectorToSCFPattern {
 this->setHasBoundedRewriteRecursion();
   }
 
+  static void getMaskBufferLoadIndices(OpTy xferOp, Value castedMaskBuffer,
+   SmallVector &loadIndices,
+   Value iv) {
+assert(xferOp.getMask() && "Expected transfer op to have mask");
+
+// Add load indices from the previous iteration.
+// The mask buffer depends on the permutation map, which makes determining
+// the indices quite complex, so this is why we need to "look back" to the
+// previous iteration to find the right indices.
+Value maskBuffer = getMaskBuffer(xferOp);
+for (OpOperand &use : maskBuffer.getUses()) {
+  // If there is no previous load op, then the indices are empty.
+  if (auto loadOp = dyn_cast(use.getOwner())) {

joker-eph wrote:

```suggestion
for (Operation *user : maskBuffer.getUsers()) {
  // If there is no previous load op, then the indices are empty.
  if (auto loadOp = dyn_cast(user)) {
```

https://github.com/llvm/llvm-project/pull/76292
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[llvm] [libcxxabi] [lldb] [libcxx] [polly] [openmp] [compiler-rt] [flang] [libc] [mlir] [clang-tools-extra] [clang] [mlir][vector] Fix invalid `LoadOp` indices being created (PR #76292)

2024-01-02 Thread Mehdi Amini via cfe-commits


@@ -897,7 +921,8 @@ struct TransferOpConversion : public 
VectorToSCFPattern {
   } else {
 // It's safe to assume the mask buffer can be unpacked if the data
 // buffer was unpacked.
-auto castedMaskType = *unpackOneDim(maskBufferType);
+auto maskBufferType = dyn_cast(maskBuffer.getType());

joker-eph wrote:

OK, but we're not checking the result: if this can't fail here by construction 
it should be a cast instead.

https://github.com/llvm/llvm-project/pull/76292
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[lldb] [polly] [libcxx] [openmp] [libcxxabi] [mlir] [compiler-rt] [clang] [llvm] [clang-tools-extra] [libc] [flang] [mlir][vector] Fix invalid `LoadOp` indices being created (PR #76292)

2024-01-03 Thread Mehdi Amini via cfe-commits

https://github.com/joker-eph approved this pull request.


https://github.com/llvm/llvm-project/pull/76292
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 42f588f - Use ManagedStatic and lazy initialization of cl::opt in libSupport to make it free of global initializer

2021-07-15 Thread Mehdi Amini via cfe-commits

Author: Mehdi Amini
Date: 2021-07-16T03:33:20Z
New Revision: 42f588f39c5ce6f521e3709b8871d1fdd076292f

URL: 
https://github.com/llvm/llvm-project/commit/42f588f39c5ce6f521e3709b8871d1fdd076292f
DIFF: 
https://github.com/llvm/llvm-project/commit/42f588f39c5ce6f521e3709b8871d1fdd076292f.diff

LOG: Use ManagedStatic and lazy initialization of cl::opt in libSupport to make 
it free of global initializer

We can build it with -Werror=global-constructors now. This helps
in situation where libSupport is embedded as a shared library,
potential with dlopen/dlclose scenario, and when command-line
parsing or other facilities may not be involved. Avoiding the
implicit construction of these cl::opt can avoid double-registration
issues and other kind of behavior.

Reviewed By: lattner, jpienaar

Differential Revision: https://reviews.llvm.org/D105959

Added: 
llvm/lib/Support/DebugOptions.h

Modified: 
clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
clang-tools-extra/clangd/indexer/IndexerMain.cpp
clang/tools/clang-refactor/ClangRefactor.cpp
llvm/docs/CommandLine.rst
llvm/include/llvm/Support/ARMAttributeParser.h
llvm/include/llvm/Support/ARMBuildAttributes.h
llvm/include/llvm/Support/CommandLine.h
llvm/include/llvm/Support/RISCVAttributeParser.h
llvm/include/llvm/Support/RISCVAttributes.h
llvm/include/llvm/Support/ScopedPrinter.h
llvm/include/llvm/Support/WithColor.h
llvm/lib/Support/ARMBuildAttrs.cpp
llvm/lib/Support/CommandLine.cpp
llvm/lib/Support/Debug.cpp
llvm/lib/Support/DebugCounter.cpp
llvm/lib/Support/ELFAttributeParser.cpp
llvm/lib/Support/GraphWriter.cpp
llvm/lib/Support/RISCVAttributes.cpp
llvm/lib/Support/RandomNumberGenerator.cpp
llvm/lib/Support/Signals.cpp
llvm/lib/Support/Statistic.cpp
llvm/lib/Support/TimeProfiler.cpp
llvm/lib/Support/Timer.cpp
llvm/lib/Support/TypeSize.cpp
llvm/lib/Support/Windows/Signals.inc
llvm/lib/Support/WithColor.cpp
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
llvm/unittests/Support/ARMAttributeParser.cpp
llvm/unittests/Support/CommandLineTest.cpp
llvm/unittests/Support/RISCVAttributeParserTest.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp 
b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
index 49f16e72be92a..581dae7557295 100644
--- a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
+++ b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
@@ -91,7 +91,7 @@ class Command {
   // By resetting the parser options, we lost the standard -help flag.
   llvm::cl::opt> Help{
   "help", llvm::cl::desc("Display available options"),
-  llvm::cl::ValueDisallowed, llvm::cl::cat(llvm::cl::GeneralCategory)};
+  llvm::cl::ValueDisallowed, 
llvm::cl::cat(llvm::cl::getGeneralCategory())};
   // FIXME: Allow commands to signal failure.
   virtual void run() = 0;
 

diff  --git a/clang-tools-extra/clangd/indexer/IndexerMain.cpp 
b/clang-tools-extra/clangd/indexer/IndexerMain.cpp
index fd8404be677a2..54fcc1f28 100644
--- a/clang-tools-extra/clangd/indexer/IndexerMain.cpp
+++ b/clang-tools-extra/clangd/indexer/IndexerMain.cpp
@@ -124,7 +124,7 @@ int main(int argc, const char **argv) {
   )";
 
   auto Executor = clang::tooling::createExecutorFromCommandLineArgs(
-  argc, argv, llvm::cl::GeneralCategory, Overview);
+  argc, argv, llvm::cl::getGeneralCategory(), Overview);
 
   if (!Executor) {
 llvm::errs() << llvm::toString(Executor.takeError()) << "\n";

diff  --git a/clang/tools/clang-refactor/ClangRefactor.cpp 
b/clang/tools/clang-refactor/ClangRefactor.cpp
index 01edad43164fb..eacd00a601dbe 100644
--- a/clang/tools/clang-refactor/ClangRefactor.cpp
+++ b/clang/tools/clang-refactor/ClangRefactor.cpp
@@ -38,11 +38,11 @@ namespace opts {
 static cl::OptionCategory CommonRefactorOptions("Refactoring options");
 
 static cl::opt Verbose("v", cl::desc("Use verbose output"),
- cl::cat(cl::GeneralCategory),
+ cl::cat(cl::getGeneralCategory()),
  cl::sub(*cl::AllSubCommands));
 
 static cl::opt Inplace("i", cl::desc("Inplace edit s"),
- cl::cat(cl::GeneralCategory),
+ cl::cat(cl::getGeneralCategory()),
  cl::sub(*cl::AllSubCommands));
 
 } // end namespace opts
@@ -613,7 +613,7 @@ int main(int argc, const char **argv) {
   ClangRefactorTool RefactorTool;
 
   auto ExpectedParser = CommonOptionsParser::create(
-  argc, argv, cl::GeneralCategory, cl::ZeroOrMore,
+  argc, argv, cl::getGeneralCategory(), cl::ZeroOrMore,
   "Clang-based refactorin

[clang-tools-extra] 16b5e9d - Revert "Use ManagedStatic and lazy initialization of cl::opt in libSupport to make it free of global initializer"

2021-07-15 Thread Mehdi Amini via cfe-commits

Author: Mehdi Amini
Date: 2021-07-16T03:46:53Z
New Revision: 16b5e9d6a269913e8da0fa037e8af32eaf304c8f

URL: 
https://github.com/llvm/llvm-project/commit/16b5e9d6a269913e8da0fa037e8af32eaf304c8f
DIFF: 
https://github.com/llvm/llvm-project/commit/16b5e9d6a269913e8da0fa037e8af32eaf304c8f.diff

LOG: Revert "Use ManagedStatic and lazy initialization of cl::opt in libSupport 
to make it free of global initializer"

This reverts commit 42f588f39c5ce6f521e3709b8871d1fdd076292f.
Broke some buildbots

Added: 


Modified: 
clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
clang-tools-extra/clangd/indexer/IndexerMain.cpp
clang/tools/clang-refactor/ClangRefactor.cpp
llvm/docs/CommandLine.rst
llvm/include/llvm/Support/ARMAttributeParser.h
llvm/include/llvm/Support/ARMBuildAttributes.h
llvm/include/llvm/Support/CommandLine.h
llvm/include/llvm/Support/RISCVAttributeParser.h
llvm/include/llvm/Support/RISCVAttributes.h
llvm/include/llvm/Support/ScopedPrinter.h
llvm/include/llvm/Support/WithColor.h
llvm/lib/Support/ARMBuildAttrs.cpp
llvm/lib/Support/CommandLine.cpp
llvm/lib/Support/Debug.cpp
llvm/lib/Support/DebugCounter.cpp
llvm/lib/Support/ELFAttributeParser.cpp
llvm/lib/Support/GraphWriter.cpp
llvm/lib/Support/RISCVAttributes.cpp
llvm/lib/Support/RandomNumberGenerator.cpp
llvm/lib/Support/Signals.cpp
llvm/lib/Support/Statistic.cpp
llvm/lib/Support/TimeProfiler.cpp
llvm/lib/Support/Timer.cpp
llvm/lib/Support/TypeSize.cpp
llvm/lib/Support/Windows/Signals.inc
llvm/lib/Support/WithColor.cpp
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
llvm/unittests/Support/ARMAttributeParser.cpp
llvm/unittests/Support/CommandLineTest.cpp
llvm/unittests/Support/RISCVAttributeParserTest.cpp

Removed: 
llvm/lib/Support/DebugOptions.h



diff  --git a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp 
b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
index 581dae7557295..49f16e72be92a 100644
--- a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
+++ b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
@@ -91,7 +91,7 @@ class Command {
   // By resetting the parser options, we lost the standard -help flag.
   llvm::cl::opt> Help{
   "help", llvm::cl::desc("Display available options"),
-  llvm::cl::ValueDisallowed, 
llvm::cl::cat(llvm::cl::getGeneralCategory())};
+  llvm::cl::ValueDisallowed, llvm::cl::cat(llvm::cl::GeneralCategory)};
   // FIXME: Allow commands to signal failure.
   virtual void run() = 0;
 

diff  --git a/clang-tools-extra/clangd/indexer/IndexerMain.cpp 
b/clang-tools-extra/clangd/indexer/IndexerMain.cpp
index 54fcc1f28..fd8404be677a2 100644
--- a/clang-tools-extra/clangd/indexer/IndexerMain.cpp
+++ b/clang-tools-extra/clangd/indexer/IndexerMain.cpp
@@ -124,7 +124,7 @@ int main(int argc, const char **argv) {
   )";
 
   auto Executor = clang::tooling::createExecutorFromCommandLineArgs(
-  argc, argv, llvm::cl::getGeneralCategory(), Overview);
+  argc, argv, llvm::cl::GeneralCategory, Overview);
 
   if (!Executor) {
 llvm::errs() << llvm::toString(Executor.takeError()) << "\n";

diff  --git a/clang/tools/clang-refactor/ClangRefactor.cpp 
b/clang/tools/clang-refactor/ClangRefactor.cpp
index eacd00a601dbe..01edad43164fb 100644
--- a/clang/tools/clang-refactor/ClangRefactor.cpp
+++ b/clang/tools/clang-refactor/ClangRefactor.cpp
@@ -38,11 +38,11 @@ namespace opts {
 static cl::OptionCategory CommonRefactorOptions("Refactoring options");
 
 static cl::opt Verbose("v", cl::desc("Use verbose output"),
- cl::cat(cl::getGeneralCategory()),
+ cl::cat(cl::GeneralCategory),
  cl::sub(*cl::AllSubCommands));
 
 static cl::opt Inplace("i", cl::desc("Inplace edit s"),
- cl::cat(cl::getGeneralCategory()),
+ cl::cat(cl::GeneralCategory),
  cl::sub(*cl::AllSubCommands));
 
 } // end namespace opts
@@ -613,7 +613,7 @@ int main(int argc, const char **argv) {
   ClangRefactorTool RefactorTool;
 
   auto ExpectedParser = CommonOptionsParser::create(
-  argc, argv, cl::getGeneralCategory(), cl::ZeroOrMore,
+  argc, argv, cl::GeneralCategory, cl::ZeroOrMore,
   "Clang-based refactoring tool for C, C++ and Objective-C");
   if (!ExpectedParser) {
 llvm::errs() << ExpectedParser.takeError();

diff  --git a/llvm/docs/CommandLine.rst b/llvm/docs/CommandLine.rst
index fef7e39ad86d2..e549d49bd90f5 100644
--- a/llvm/docs/CommandLine.rst
+++ b/llvm/docs/CommandLine.rst
@@ -661,7 +661,7 @@ declared, the command line option ``-help-list

[clang] 16b5e9d - Revert "Use ManagedStatic and lazy initialization of cl::opt in libSupport to make it free of global initializer"

2021-07-15 Thread Mehdi Amini via cfe-commits

Author: Mehdi Amini
Date: 2021-07-16T03:46:53Z
New Revision: 16b5e9d6a269913e8da0fa037e8af32eaf304c8f

URL: 
https://github.com/llvm/llvm-project/commit/16b5e9d6a269913e8da0fa037e8af32eaf304c8f
DIFF: 
https://github.com/llvm/llvm-project/commit/16b5e9d6a269913e8da0fa037e8af32eaf304c8f.diff

LOG: Revert "Use ManagedStatic and lazy initialization of cl::opt in libSupport 
to make it free of global initializer"

This reverts commit 42f588f39c5ce6f521e3709b8871d1fdd076292f.
Broke some buildbots

Added: 


Modified: 
clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
clang-tools-extra/clangd/indexer/IndexerMain.cpp
clang/tools/clang-refactor/ClangRefactor.cpp
llvm/docs/CommandLine.rst
llvm/include/llvm/Support/ARMAttributeParser.h
llvm/include/llvm/Support/ARMBuildAttributes.h
llvm/include/llvm/Support/CommandLine.h
llvm/include/llvm/Support/RISCVAttributeParser.h
llvm/include/llvm/Support/RISCVAttributes.h
llvm/include/llvm/Support/ScopedPrinter.h
llvm/include/llvm/Support/WithColor.h
llvm/lib/Support/ARMBuildAttrs.cpp
llvm/lib/Support/CommandLine.cpp
llvm/lib/Support/Debug.cpp
llvm/lib/Support/DebugCounter.cpp
llvm/lib/Support/ELFAttributeParser.cpp
llvm/lib/Support/GraphWriter.cpp
llvm/lib/Support/RISCVAttributes.cpp
llvm/lib/Support/RandomNumberGenerator.cpp
llvm/lib/Support/Signals.cpp
llvm/lib/Support/Statistic.cpp
llvm/lib/Support/TimeProfiler.cpp
llvm/lib/Support/Timer.cpp
llvm/lib/Support/TypeSize.cpp
llvm/lib/Support/Windows/Signals.inc
llvm/lib/Support/WithColor.cpp
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
llvm/unittests/Support/ARMAttributeParser.cpp
llvm/unittests/Support/CommandLineTest.cpp
llvm/unittests/Support/RISCVAttributeParserTest.cpp

Removed: 
llvm/lib/Support/DebugOptions.h



diff  --git a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp 
b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
index 581dae7557295..49f16e72be92a 100644
--- a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
+++ b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
@@ -91,7 +91,7 @@ class Command {
   // By resetting the parser options, we lost the standard -help flag.
   llvm::cl::opt> Help{
   "help", llvm::cl::desc("Display available options"),
-  llvm::cl::ValueDisallowed, 
llvm::cl::cat(llvm::cl::getGeneralCategory())};
+  llvm::cl::ValueDisallowed, llvm::cl::cat(llvm::cl::GeneralCategory)};
   // FIXME: Allow commands to signal failure.
   virtual void run() = 0;
 

diff  --git a/clang-tools-extra/clangd/indexer/IndexerMain.cpp 
b/clang-tools-extra/clangd/indexer/IndexerMain.cpp
index 54fcc1f28..fd8404be677a2 100644
--- a/clang-tools-extra/clangd/indexer/IndexerMain.cpp
+++ b/clang-tools-extra/clangd/indexer/IndexerMain.cpp
@@ -124,7 +124,7 @@ int main(int argc, const char **argv) {
   )";
 
   auto Executor = clang::tooling::createExecutorFromCommandLineArgs(
-  argc, argv, llvm::cl::getGeneralCategory(), Overview);
+  argc, argv, llvm::cl::GeneralCategory, Overview);
 
   if (!Executor) {
 llvm::errs() << llvm::toString(Executor.takeError()) << "\n";

diff  --git a/clang/tools/clang-refactor/ClangRefactor.cpp 
b/clang/tools/clang-refactor/ClangRefactor.cpp
index eacd00a601dbe..01edad43164fb 100644
--- a/clang/tools/clang-refactor/ClangRefactor.cpp
+++ b/clang/tools/clang-refactor/ClangRefactor.cpp
@@ -38,11 +38,11 @@ namespace opts {
 static cl::OptionCategory CommonRefactorOptions("Refactoring options");
 
 static cl::opt Verbose("v", cl::desc("Use verbose output"),
- cl::cat(cl::getGeneralCategory()),
+ cl::cat(cl::GeneralCategory),
  cl::sub(*cl::AllSubCommands));
 
 static cl::opt Inplace("i", cl::desc("Inplace edit s"),
- cl::cat(cl::getGeneralCategory()),
+ cl::cat(cl::GeneralCategory),
  cl::sub(*cl::AllSubCommands));
 
 } // end namespace opts
@@ -613,7 +613,7 @@ int main(int argc, const char **argv) {
   ClangRefactorTool RefactorTool;
 
   auto ExpectedParser = CommonOptionsParser::create(
-  argc, argv, cl::getGeneralCategory(), cl::ZeroOrMore,
+  argc, argv, cl::GeneralCategory, cl::ZeroOrMore,
   "Clang-based refactoring tool for C, C++ and Objective-C");
   if (!ExpectedParser) {
 llvm::errs() << ExpectedParser.takeError();

diff  --git a/llvm/docs/CommandLine.rst b/llvm/docs/CommandLine.rst
index fef7e39ad86d2..e549d49bd90f5 100644
--- a/llvm/docs/CommandLine.rst
+++ b/llvm/docs/CommandLine.rst
@@ -661,7 +661,7 @@ declared, the command line option ``-help-list

[clang-tools-extra] af93217 - Use ManagedStatic and lazy initialization of cl::opt in libSupport to make it free of global initializer

2021-07-15 Thread Mehdi Amini via cfe-commits

Author: Mehdi Amini
Date: 2021-07-16T06:54:26Z
New Revision: af9321739b20becf170e6bb5060b8d780e1dc8dd

URL: 
https://github.com/llvm/llvm-project/commit/af9321739b20becf170e6bb5060b8d780e1dc8dd
DIFF: 
https://github.com/llvm/llvm-project/commit/af9321739b20becf170e6bb5060b8d780e1dc8dd.diff

LOG: Use ManagedStatic and lazy initialization of cl::opt in libSupport to make 
it free of global initializer

We can build it with -Werror=global-constructors now. This helps
in situation where libSupport is embedded as a shared library,
potential with dlopen/dlclose scenario, and when command-line
parsing or other facilities may not be involved. Avoiding the
implicit construction of these cl::opt can avoid double-registration
issues and other kind of behavior.

Reviewed By: lattner, jpienaar

Differential Revision: https://reviews.llvm.org/D105959

Added: 
llvm/lib/Support/DebugOptions.h

Modified: 
clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
clang-tools-extra/clangd/indexer/IndexerMain.cpp
clang/tools/clang-refactor/ClangRefactor.cpp
llvm/docs/CommandLine.rst
llvm/include/llvm/Support/ARMAttributeParser.h
llvm/include/llvm/Support/ARMBuildAttributes.h
llvm/include/llvm/Support/CommandLine.h
llvm/include/llvm/Support/RISCVAttributeParser.h
llvm/include/llvm/Support/RISCVAttributes.h
llvm/include/llvm/Support/ScopedPrinter.h
llvm/include/llvm/Support/WithColor.h
llvm/lib/Support/ARMBuildAttrs.cpp
llvm/lib/Support/CommandLine.cpp
llvm/lib/Support/Debug.cpp
llvm/lib/Support/DebugCounter.cpp
llvm/lib/Support/ELFAttributeParser.cpp
llvm/lib/Support/GraphWriter.cpp
llvm/lib/Support/RISCVAttributes.cpp
llvm/lib/Support/RandomNumberGenerator.cpp
llvm/lib/Support/Signals.cpp
llvm/lib/Support/Statistic.cpp
llvm/lib/Support/TimeProfiler.cpp
llvm/lib/Support/Timer.cpp
llvm/lib/Support/TypeSize.cpp
llvm/lib/Support/Windows/Signals.inc
llvm/lib/Support/WithColor.cpp
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
llvm/unittests/Support/ARMAttributeParser.cpp
llvm/unittests/Support/CommandLineTest.cpp
llvm/unittests/Support/RISCVAttributeParserTest.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp 
b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
index 49f16e72be92a..581dae7557295 100644
--- a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
+++ b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
@@ -91,7 +91,7 @@ class Command {
   // By resetting the parser options, we lost the standard -help flag.
   llvm::cl::opt> Help{
   "help", llvm::cl::desc("Display available options"),
-  llvm::cl::ValueDisallowed, llvm::cl::cat(llvm::cl::GeneralCategory)};
+  llvm::cl::ValueDisallowed, 
llvm::cl::cat(llvm::cl::getGeneralCategory())};
   // FIXME: Allow commands to signal failure.
   virtual void run() = 0;
 

diff  --git a/clang-tools-extra/clangd/indexer/IndexerMain.cpp 
b/clang-tools-extra/clangd/indexer/IndexerMain.cpp
index fd8404be677a2..54fcc1f28 100644
--- a/clang-tools-extra/clangd/indexer/IndexerMain.cpp
+++ b/clang-tools-extra/clangd/indexer/IndexerMain.cpp
@@ -124,7 +124,7 @@ int main(int argc, const char **argv) {
   )";
 
   auto Executor = clang::tooling::createExecutorFromCommandLineArgs(
-  argc, argv, llvm::cl::GeneralCategory, Overview);
+  argc, argv, llvm::cl::getGeneralCategory(), Overview);
 
   if (!Executor) {
 llvm::errs() << llvm::toString(Executor.takeError()) << "\n";

diff  --git a/clang/tools/clang-refactor/ClangRefactor.cpp 
b/clang/tools/clang-refactor/ClangRefactor.cpp
index 01edad43164fb..eacd00a601dbe 100644
--- a/clang/tools/clang-refactor/ClangRefactor.cpp
+++ b/clang/tools/clang-refactor/ClangRefactor.cpp
@@ -38,11 +38,11 @@ namespace opts {
 static cl::OptionCategory CommonRefactorOptions("Refactoring options");
 
 static cl::opt Verbose("v", cl::desc("Use verbose output"),
- cl::cat(cl::GeneralCategory),
+ cl::cat(cl::getGeneralCategory()),
  cl::sub(*cl::AllSubCommands));
 
 static cl::opt Inplace("i", cl::desc("Inplace edit s"),
- cl::cat(cl::GeneralCategory),
+ cl::cat(cl::getGeneralCategory()),
  cl::sub(*cl::AllSubCommands));
 
 } // end namespace opts
@@ -613,7 +613,7 @@ int main(int argc, const char **argv) {
   ClangRefactorTool RefactorTool;
 
   auto ExpectedParser = CommonOptionsParser::create(
-  argc, argv, cl::GeneralCategory, cl::ZeroOrMore,
+  argc, argv, cl::getGeneralCategor

[clang-tools-extra] 8d051d8 - Revert "Use ManagedStatic and lazy initialization of cl::opt in libSupport to make it free of global initializer"

2021-07-16 Thread Mehdi Amini via cfe-commits

Author: Mehdi Amini
Date: 2021-07-16T07:35:13Z
New Revision: 8d051d854619956de633047409149cdab1e3319a

URL: 
https://github.com/llvm/llvm-project/commit/8d051d854619956de633047409149cdab1e3319a
DIFF: 
https://github.com/llvm/llvm-project/commit/8d051d854619956de633047409149cdab1e3319a.diff

LOG: Revert "Use ManagedStatic and lazy initialization of cl::opt in libSupport 
to make it free of global initializer"

This reverts commit af9321739b20becf170e6bb5060b8d780e1dc8dd.
Still some specific config broken in some way that requires more
investigation.

Added: 


Modified: 
clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
clang-tools-extra/clangd/indexer/IndexerMain.cpp
clang/tools/clang-refactor/ClangRefactor.cpp
llvm/docs/CommandLine.rst
llvm/include/llvm/Support/ARMAttributeParser.h
llvm/include/llvm/Support/ARMBuildAttributes.h
llvm/include/llvm/Support/CommandLine.h
llvm/include/llvm/Support/RISCVAttributeParser.h
llvm/include/llvm/Support/RISCVAttributes.h
llvm/include/llvm/Support/ScopedPrinter.h
llvm/include/llvm/Support/WithColor.h
llvm/lib/Support/ARMBuildAttrs.cpp
llvm/lib/Support/CommandLine.cpp
llvm/lib/Support/Debug.cpp
llvm/lib/Support/DebugCounter.cpp
llvm/lib/Support/ELFAttributeParser.cpp
llvm/lib/Support/GraphWriter.cpp
llvm/lib/Support/RISCVAttributes.cpp
llvm/lib/Support/RandomNumberGenerator.cpp
llvm/lib/Support/Signals.cpp
llvm/lib/Support/Statistic.cpp
llvm/lib/Support/TimeProfiler.cpp
llvm/lib/Support/Timer.cpp
llvm/lib/Support/TypeSize.cpp
llvm/lib/Support/Windows/Signals.inc
llvm/lib/Support/WithColor.cpp
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
llvm/unittests/Support/ARMAttributeParser.cpp
llvm/unittests/Support/CommandLineTest.cpp
llvm/unittests/Support/RISCVAttributeParserTest.cpp

Removed: 
llvm/lib/Support/DebugOptions.h



diff  --git a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp 
b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
index 581dae7557295..49f16e72be92a 100644
--- a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
+++ b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
@@ -91,7 +91,7 @@ class Command {
   // By resetting the parser options, we lost the standard -help flag.
   llvm::cl::opt> Help{
   "help", llvm::cl::desc("Display available options"),
-  llvm::cl::ValueDisallowed, 
llvm::cl::cat(llvm::cl::getGeneralCategory())};
+  llvm::cl::ValueDisallowed, llvm::cl::cat(llvm::cl::GeneralCategory)};
   // FIXME: Allow commands to signal failure.
   virtual void run() = 0;
 

diff  --git a/clang-tools-extra/clangd/indexer/IndexerMain.cpp 
b/clang-tools-extra/clangd/indexer/IndexerMain.cpp
index 54fcc1f28..fd8404be677a2 100644
--- a/clang-tools-extra/clangd/indexer/IndexerMain.cpp
+++ b/clang-tools-extra/clangd/indexer/IndexerMain.cpp
@@ -124,7 +124,7 @@ int main(int argc, const char **argv) {
   )";
 
   auto Executor = clang::tooling::createExecutorFromCommandLineArgs(
-  argc, argv, llvm::cl::getGeneralCategory(), Overview);
+  argc, argv, llvm::cl::GeneralCategory, Overview);
 
   if (!Executor) {
 llvm::errs() << llvm::toString(Executor.takeError()) << "\n";

diff  --git a/clang/tools/clang-refactor/ClangRefactor.cpp 
b/clang/tools/clang-refactor/ClangRefactor.cpp
index eacd00a601dbe..01edad43164fb 100644
--- a/clang/tools/clang-refactor/ClangRefactor.cpp
+++ b/clang/tools/clang-refactor/ClangRefactor.cpp
@@ -38,11 +38,11 @@ namespace opts {
 static cl::OptionCategory CommonRefactorOptions("Refactoring options");
 
 static cl::opt Verbose("v", cl::desc("Use verbose output"),
- cl::cat(cl::getGeneralCategory()),
+ cl::cat(cl::GeneralCategory),
  cl::sub(*cl::AllSubCommands));
 
 static cl::opt Inplace("i", cl::desc("Inplace edit s"),
- cl::cat(cl::getGeneralCategory()),
+ cl::cat(cl::GeneralCategory),
  cl::sub(*cl::AllSubCommands));
 
 } // end namespace opts
@@ -613,7 +613,7 @@ int main(int argc, const char **argv) {
   ClangRefactorTool RefactorTool;
 
   auto ExpectedParser = CommonOptionsParser::create(
-  argc, argv, cl::getGeneralCategory(), cl::ZeroOrMore,
+  argc, argv, cl::GeneralCategory, cl::ZeroOrMore,
   "Clang-based refactoring tool for C, C++ and Objective-C");
   if (!ExpectedParser) {
 llvm::errs() << ExpectedParser.takeError();

diff  --git a/llvm/docs/CommandLine.rst b/llvm/docs/CommandLine.rst
index fef7e39ad86d2..e549d49bd90f5 100644
--- a/llvm/docs/Comm

[clang-tools-extra] 7637457 - Use ManagedStatic and lazy initialization of cl::opt in libSupport to make it free of global initializer

2021-07-16 Thread Mehdi Amini via cfe-commits

Author: Mehdi Amini
Date: 2021-07-16T07:38:16Z
New Revision: 76374573ce829b083b95b74937a11e9b91f8f45f

URL: 
https://github.com/llvm/llvm-project/commit/76374573ce829b083b95b74937a11e9b91f8f45f
DIFF: 
https://github.com/llvm/llvm-project/commit/76374573ce829b083b95b74937a11e9b91f8f45f.diff

LOG: Use ManagedStatic and lazy initialization of cl::opt in libSupport to make 
it free of global initializer

We can build it with -Werror=global-constructors now. This helps
in situation where libSupport is embedded as a shared library,
potential with dlopen/dlclose scenario, and when command-line
parsing or other facilities may not be involved. Avoiding the
implicit construction of these cl::opt can avoid double-registration
issues and other kind of behavior.

Reviewed By: lattner, jpienaar

Differential Revision: https://reviews.llvm.org/D105959

Added: 
llvm/lib/Support/DebugOptions.h

Modified: 
clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
clang-tools-extra/clangd/indexer/IndexerMain.cpp
clang/tools/clang-refactor/ClangRefactor.cpp
llvm/docs/CommandLine.rst
llvm/include/llvm/Support/ARMAttributeParser.h
llvm/include/llvm/Support/ARMBuildAttributes.h
llvm/include/llvm/Support/CommandLine.h
llvm/include/llvm/Support/RISCVAttributeParser.h
llvm/include/llvm/Support/RISCVAttributes.h
llvm/include/llvm/Support/ScopedPrinter.h
llvm/include/llvm/Support/WithColor.h
llvm/lib/Support/ARMBuildAttrs.cpp
llvm/lib/Support/CommandLine.cpp
llvm/lib/Support/Debug.cpp
llvm/lib/Support/DebugCounter.cpp
llvm/lib/Support/ELFAttributeParser.cpp
llvm/lib/Support/GraphWriter.cpp
llvm/lib/Support/RISCVAttributes.cpp
llvm/lib/Support/RandomNumberGenerator.cpp
llvm/lib/Support/Signals.cpp
llvm/lib/Support/Statistic.cpp
llvm/lib/Support/TimeProfiler.cpp
llvm/lib/Support/Timer.cpp
llvm/lib/Support/TypeSize.cpp
llvm/lib/Support/Windows/Signals.inc
llvm/lib/Support/WithColor.cpp
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
llvm/unittests/Support/ARMAttributeParser.cpp
llvm/unittests/Support/CommandLineTest.cpp
llvm/unittests/Support/RISCVAttributeParserTest.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp 
b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
index 49f16e72be92a..581dae7557295 100644
--- a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
+++ b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
@@ -91,7 +91,7 @@ class Command {
   // By resetting the parser options, we lost the standard -help flag.
   llvm::cl::opt> Help{
   "help", llvm::cl::desc("Display available options"),
-  llvm::cl::ValueDisallowed, llvm::cl::cat(llvm::cl::GeneralCategory)};
+  llvm::cl::ValueDisallowed, 
llvm::cl::cat(llvm::cl::getGeneralCategory())};
   // FIXME: Allow commands to signal failure.
   virtual void run() = 0;
 

diff  --git a/clang-tools-extra/clangd/indexer/IndexerMain.cpp 
b/clang-tools-extra/clangd/indexer/IndexerMain.cpp
index fd8404be677a2..54fcc1f28 100644
--- a/clang-tools-extra/clangd/indexer/IndexerMain.cpp
+++ b/clang-tools-extra/clangd/indexer/IndexerMain.cpp
@@ -124,7 +124,7 @@ int main(int argc, const char **argv) {
   )";
 
   auto Executor = clang::tooling::createExecutorFromCommandLineArgs(
-  argc, argv, llvm::cl::GeneralCategory, Overview);
+  argc, argv, llvm::cl::getGeneralCategory(), Overview);
 
   if (!Executor) {
 llvm::errs() << llvm::toString(Executor.takeError()) << "\n";

diff  --git a/clang/tools/clang-refactor/ClangRefactor.cpp 
b/clang/tools/clang-refactor/ClangRefactor.cpp
index 01edad43164fb..eacd00a601dbe 100644
--- a/clang/tools/clang-refactor/ClangRefactor.cpp
+++ b/clang/tools/clang-refactor/ClangRefactor.cpp
@@ -38,11 +38,11 @@ namespace opts {
 static cl::OptionCategory CommonRefactorOptions("Refactoring options");
 
 static cl::opt Verbose("v", cl::desc("Use verbose output"),
- cl::cat(cl::GeneralCategory),
+ cl::cat(cl::getGeneralCategory()),
  cl::sub(*cl::AllSubCommands));
 
 static cl::opt Inplace("i", cl::desc("Inplace edit s"),
- cl::cat(cl::GeneralCategory),
+ cl::cat(cl::getGeneralCategory()),
  cl::sub(*cl::AllSubCommands));
 
 } // end namespace opts
@@ -613,7 +613,7 @@ int main(int argc, const char **argv) {
   ClangRefactorTool RefactorTool;
 
   auto ExpectedParser = CommonOptionsParser::create(
-  argc, argv, cl::GeneralCategory, cl::ZeroOrMore,
+  argc, argv, cl::getGeneralCategor

[clang] 26eec9e - Revert "[clang] Implement Change scope of lambda trailing-return-type"

2022-04-13 Thread Mehdi Amini via cfe-commits

Author: Mehdi Amini
Date: 2022-04-13T19:35:13Z
New Revision: 26eec9e9dbc20186f6b810fe01d3a01aac8ae6f4

URL: 
https://github.com/llvm/llvm-project/commit/26eec9e9dbc20186f6b810fe01d3a01aac8ae6f4
DIFF: 
https://github.com/llvm/llvm-project/commit/26eec9e9dbc20186f6b810fe01d3a01aac8ae6f4.diff

LOG: Revert "[clang] Implement Change scope of lambda trailing-return-type"

This reverts commit adff142dc253d65b6560e420bba6b858d88d4a98.
This broke clang bootstrap: it made existing C++ code in LLVM invalid:

llvm/include/llvm/CodeGen/LiveInterval.h:630:53: error: captured variable 'Idx' 
cannot appear here
  [=](std::remove_reference_t V,
^

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/AST/DeclCXX.h
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Scope.h
clang/include/clang/Sema/ScopeInfo.h
clang/include/clang/Sema/Sema.h
clang/lib/Parse/ParseExprCXX.cpp
clang/lib/Sema/Scope.cpp
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaCXXScopeSpec.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaLambda.cpp
clang/lib/Sema/TreeTransform.h
clang/test/CXX/expr/expr.prim/expr.prim.lambda/p11-1y.cpp
clang/test/SemaCXX/warn-shadow-in-lambdas.cpp
clang/www/cxx_status.html

Removed: 
clang/test/SemaCXX/lambda-capture-type-deduction.cpp



diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 016aafee016c2..91fc57dfac595 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -247,9 +247,6 @@ C++2b Feature Support
 - Implemented `P2128R6: Multidimensional subscript operator 
`_.
 - Implemented `P0849R8: auto(x): decay-copy in the language 
`_.
 - Implemented `P2242R3: Non-literal variables (and labels and gotos) in 
constexpr functions`_.
-- Implemented `P2036R3: Change scope of lambda trailing-return-type 
`_.
-  This proposal modifies how variables captured in lambdas can appear in 
trailing return type
-  expressions and how their types are deduced therein, in all C++ language 
versions.
 
 CUDA Language Changes in Clang
 --

diff  --git a/clang/include/clang/AST/DeclCXX.h 
b/clang/include/clang/AST/DeclCXX.h
index c640f7f7ba63f..04a9daa14e05e 100644
--- a/clang/include/clang/AST/DeclCXX.h
+++ b/clang/include/clang/AST/DeclCXX.h
@@ -1799,20 +1799,6 @@ class CXXRecordDecl : public RecordDecl {
 return getLambdaData().MethodTyInfo;
   }
 
-  void setLambdaTypeInfo(TypeSourceInfo *TS) {
-auto *DD = DefinitionData;
-assert(DD && DD->IsLambda && "setting lambda property of non-lambda 
class");
-auto &DL = static_cast(*DD);
-DL.MethodTyInfo = TS;
-  }
-
-  void setLambdaIsGeneric(bool IsGeneric) {
-auto *DD = DefinitionData;
-assert(DD && DD->IsLambda && "setting lambda property of non-lambda 
class");
-auto &DL = static_cast(*DD);
-DL.IsGenericLambda = IsGeneric;
-  }
-
   // Determine whether this type is an Interface Like type for
   // __interface inheritance purposes.
   bool isInterfaceLike() const;

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index e154925538f3a..3213163ee7876 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -7704,8 +7704,6 @@ let CategoryName = "Lambda Issue" in {
   def err_lambda_impcap : Error<
 "variable %0 cannot be implicitly captured in a lambda with no "
 "capture-default specified">;
-  def err_lambda_used_before_capture: Error<
-"captured variable %0 cannot appear here">;
   def note_lambda_variable_capture_fixit : Note<
 "capture %0 by %select{value|reference}1">;
   def note_lambda_default_capture_fixit : Note<

diff  --git a/clang/include/clang/Sema/Scope.h 
b/clang/include/clang/Sema/Scope.h
index 5a2d51b63d909..872951a0829b4 100644
--- a/clang/include/clang/Sema/Scope.h
+++ b/clang/include/clang/Sema/Scope.h
@@ -44,11 +44,11 @@ class Scope {
   enum ScopeFlags {
 /// This indicates that the scope corresponds to a function, which
 /// means that labels are set here.
-FnScope = 0x01,
+FnScope   = 0x01,
 
 /// This is a while, do, switch, for, etc that can have break
 /// statements embedded into it.
-BreakScope = 0x02,
+BreakScope= 0x02,
 
 /// This is a while, do, for, which can have continue statements
 /// embedded into it.
@@ -140,12 +140,6 @@ class Scope {
 /// parsed. If such a scope is a ContinueScope, it's invalid to jump to the
 /// continue block from here.
 ConditionVarScope = 0x200,
-
-/// This is the scope for a lambda, after the lambda introducer.
-//

[clang] [llvm] Add missing clang to the monolithic pre-merge build (PR #85354)

2024-03-14 Thread Mehdi Amini via cfe-commits

https://github.com/joker-eph created 
https://github.com/llvm/llvm-project/pull/85354

Clang has a custom separate pipeline integrated with libc++ that only runs in 
release mode. It means that changes which touches only clang won't run the 
clang tests in the configuration used by LLVM premerge and will break it 
unknowingly.

>From d4286b64b9e4eb7743edccbe3f1a3c117a8d0fc0 Mon Sep 17 00:00:00 2001
From: Mehdi Amini 
Date: Thu, 14 Mar 2024 19:49:29 -0700
Subject: [PATCH] Add missing clang to the monolithic pre-merge build

Clang has a custom separate pipeline integrated with libc++
that only runs in release mode. It means that changes which touches
only clang won't run the clang tests in the configuration used by
LLVM premerge and will break it unknowingly.
---
 .ci/generate-buildkite-pipeline-premerge | 2 +-
 clang/empty_trigger  | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 create mode 100644 clang/empty_trigger

diff --git a/.ci/generate-buildkite-pipeline-premerge 
b/.ci/generate-buildkite-pipeline-premerge
index 4ebf304e23d587..b0a995dc8d7df4 100755
--- a/.ci/generate-buildkite-pipeline-premerge
+++ b/.ci/generate-buildkite-pipeline-premerge
@@ -224,7 +224,7 @@ fi
 # needs while letting them run on the infrastructure provided by LLVM.
 
 # Figure out which projects need to be built on each platform
-all_projects="bolt clang-tools-extra compiler-rt cross-project-tests flang 
libc libclc lld lldb llvm mlir openmp polly pstl"
+all_projects="bolt clang clang-tools-extra compiler-rt cross-project-tests 
flang libc libclc lld lldb llvm mlir openmp polly pstl"
 modified_projects="$(keep-modified-projects ${all_projects})"
 
 linux_projects_to_test=$(exclude-linux $(compute-projects-to-test 
${modified_projects}))
diff --git a/clang/empty_trigger b/clang/empty_trigger
new file mode 100644
index 00..e69de29bb2d1d6

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [compiler-rt] [flang] [lld] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-03-22 Thread Mehdi Amini via cfe-commits

joker-eph wrote:

LGTM overall, but the CI failure looks real.

https://github.com/llvm/llvm-project/pull/86318
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [lld] [lldb] [llvm] [mlir] Rename llvm::ThreadPool -> llvm::DefaultThreadPool (NFC) (PR #83702)

2024-03-05 Thread Mehdi Amini via cfe-commits

joker-eph wrote:

Actually no: the first patch landed already, so `ThreadPoolInterface` is now 
the base class in the codebase. I have some mixup here in that when renaming 
ThreadPool -> DefaultThreadPool, I used the base class ThreadPoolInterface when 
updating some of the uses.

I will push these ahead as a NFC change and rebase, that'll reduce the diff 
here.

https://github.com/llvm/llvm-project/pull/83702
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [lld] [lldb] [llvm] [mlir] Rename llvm::ThreadPool -> llvm::DefaultThreadPool (NFC) (PR #83702)

2024-03-05 Thread Mehdi Amini via cfe-commits

https://github.com/joker-eph edited 
https://github.com/llvm/llvm-project/pull/83702
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [lld] [lldb] [llvm] [mlir] Rename llvm::ThreadPool -> llvm::DefaultThreadPool (NFC) (PR #83702)

2024-03-05 Thread Mehdi Amini via cfe-commits

https://github.com/joker-eph updated 
https://github.com/llvm/llvm-project/pull/83702

>From 1b407d9d5abc9a1cf58afaf7f32ed40446d55f52 Mon Sep 17 00:00:00 2001
From: Mehdi Amini 
Date: Tue, 5 Mar 2024 10:38:41 -0800
Subject: [PATCH] Rename llvm::ThreadPool -> llvm::DefaultThreadPool (NFC)

The base class llvm::ThreadPoolInterface will be renamed llvm::ThreadPool
in a subsequent commit.
---
 bolt/lib/Core/ParallelUtilities.cpp   |  4 ++--
 bolt/tools/merge-fdata/merge-fdata.cpp|  2 +-
 .../clang-doc/tool/ClangDocMain.cpp   |  2 +-
 .../tool/FindAllSymbolsMain.cpp   |  2 +-
 clang/lib/Tooling/AllTUsExecution.cpp |  2 +-
 clang/tools/clang-scan-deps/ClangScanDeps.cpp |  2 +-
 lld/MachO/Writer.cpp  |  2 +-
 lldb/source/Core/Debugger.cpp |  4 ++--
 llvm/docs/ORCv2.rst   |  2 +-
 .../SpeculativeJIT/SpeculativeJIT.cpp |  2 +-
 llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h |  2 +-
 llvm/include/llvm/Support/ThreadPool.h|  7 +++---
 llvm/lib/CodeGen/ParallelCG.cpp   |  2 +-
 llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp  |  2 +-
 .../DWARFLinker/Parallel/DWARFLinkerImpl.cpp  |  2 +-
 llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp  |  2 +-
 llvm/lib/ExecutionEngine/Orc/LLJIT.cpp|  4 ++--
 llvm/lib/LTO/LTO.cpp  |  2 +-
 llvm/lib/LTO/LTOBackend.cpp   |  2 +-
 llvm/lib/LTO/ThinLTOCodeGenerator.cpp |  4 ++--
 llvm/lib/Support/BalancedPartitioning.cpp |  2 +-
 llvm/tools/dsymutil/dsymutil.cpp  |  2 +-
 llvm/tools/llvm-cov/CodeCoverage.cpp  |  2 +-
 llvm/tools/llvm-cov/CoverageExporterJson.cpp  |  2 +-
 llvm/tools/llvm-cov/CoverageReport.cpp|  4 ++--
 .../tools/llvm-debuginfod/llvm-debuginfod.cpp |  2 +-
 llvm/tools/llvm-profdata/llvm-profdata.cpp|  2 +-
 llvm/tools/llvm-reduce/deltas/Delta.cpp   |  2 +-
 llvm/unittests/ADT/LazyAtomicPointerTest.cpp  |  4 ++--
 llvm/unittests/Debuginfod/HTTPServerTests.cpp | 16 +++---
 llvm/unittests/Support/ParallelTest.cpp   |  2 +-
 llvm/unittests/Support/ThreadPool.cpp | 22 +--
 .../Support/ThreadSafeAllocatorTest.cpp   |  6 ++---
 mlir/include/mlir/IR/MLIRContext.h|  2 +-
 mlir/lib/CAPI/IR/Support.cpp  |  2 +-
 mlir/lib/ExecutionEngine/AsyncRuntime.cpp |  2 +-
 mlir/lib/IR/MLIRContext.cpp   |  4 ++--
 37 files changed, 65 insertions(+), 66 deletions(-)

diff --git a/bolt/lib/Core/ParallelUtilities.cpp 
b/bolt/lib/Core/ParallelUtilities.cpp
index 88d9444a6a2ba7..5f5e96e0e7881c 100644
--- a/bolt/lib/Core/ParallelUtilities.cpp
+++ b/bolt/lib/Core/ParallelUtilities.cpp
@@ -49,7 +49,7 @@ namespace ParallelUtilities {
 
 namespace {
 /// A single thread pool that is used to run parallel tasks
-std::unique_ptr ThreadPoolPtr;
+std::unique_ptr ThreadPoolPtr;
 
 unsigned computeCostFor(const BinaryFunction &BF,
 const PredicateTy &SkipPredicate,
@@ -106,7 +106,7 @@ ThreadPoolInterface &getThreadPool() {
   if (ThreadPoolPtr.get())
 return *ThreadPoolPtr;
 
-  ThreadPoolPtr = std::make_unique(
+  ThreadPoolPtr = std::make_unique(
   llvm::hardware_concurrency(opts::ThreadCount));
   return *ThreadPoolPtr;
 }
diff --git a/bolt/tools/merge-fdata/merge-fdata.cpp 
b/bolt/tools/merge-fdata/merge-fdata.cpp
index c6dfd3cfdc56de..f2ac5ad4492ee5 100644
--- a/bolt/tools/merge-fdata/merge-fdata.cpp
+++ b/bolt/tools/merge-fdata/merge-fdata.cpp
@@ -316,7 +316,7 @@ void mergeLegacyProfiles(const SmallVectorImpl 
&Filenames) {
   // least 4 tasks.
   ThreadPoolStrategy S = optimal_concurrency(
   std::max(Filenames.size() / 4, static_cast(1)));
-  ThreadPool Pool(S);
+  DefaultThreadPool Pool(S);
   DenseMap ParsedProfiles(
   Pool.getMaxConcurrency());
   for (const auto &Filename : Filenames)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp 
b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index 22bdb5de22d871..21b581fa6df2e1 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -238,7 +238,7 @@ Example usage for a project using a compile commands 
database:
   Error = false;
   llvm::sys::Mutex IndexMutex;
   // ExecutorConcurrency is a flag exposed by AllTUsExecution.h
-  llvm::ThreadPool Pool(llvm::hardware_concurrency(ExecutorConcurrency));
+  llvm::DefaultThreadPool 
Pool(llvm::hardware_concurrency(ExecutorConcurrency));
   for (auto &Group : USRToBitcode) {
 Pool.async([&]() {
   std::vector> Infos;
diff --git 
a/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
 
b/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
index b2d0efecc20692..298b02e77cb0aa 100644
--- 
a/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
+++ 
b/clang-tools-extra/clang-include-fixer/find

[clang] [clang-tools-extra] [lld] [lldb] [llvm] [mlir] Rename llvm::ThreadPool -> llvm::DefaultThreadPool (NFC) (PR #83702)

2024-03-05 Thread Mehdi Amini via cfe-commits

https://github.com/joker-eph updated 
https://github.com/llvm/llvm-project/pull/83702

>From ea79b6037497230b23caf36024a9e6883d3cac04 Mon Sep 17 00:00:00 2001
From: Mehdi Amini 
Date: Tue, 5 Mar 2024 10:38:41 -0800
Subject: [PATCH] Rename llvm::ThreadPool -> llvm::DefaultThreadPool (NFC)

The base class llvm::ThreadPoolInterface will be renamed llvm::ThreadPool
in a subsequent commit.
---
 bolt/lib/Core/ParallelUtilities.cpp   |  4 ++--
 bolt/tools/merge-fdata/merge-fdata.cpp|  2 +-
 .../clang-doc/tool/ClangDocMain.cpp   |  2 +-
 .../tool/FindAllSymbolsMain.cpp   |  2 +-
 clang/lib/Tooling/AllTUsExecution.cpp |  2 +-
 clang/tools/clang-scan-deps/ClangScanDeps.cpp |  2 +-
 lld/MachO/Writer.cpp  |  2 +-
 lldb/source/Core/Debugger.cpp |  4 ++--
 llvm/docs/ORCv2.rst   |  2 +-
 .../SpeculativeJIT/SpeculativeJIT.cpp |  2 +-
 llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h |  2 +-
 llvm/include/llvm/Support/ThreadPool.h|  7 +++---
 llvm/lib/CodeGen/ParallelCG.cpp   |  2 +-
 llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp  |  2 +-
 .../DWARFLinker/Parallel/DWARFLinkerImpl.cpp  |  2 +-
 llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp  |  2 +-
 llvm/lib/ExecutionEngine/Orc/LLJIT.cpp|  4 ++--
 llvm/lib/LTO/LTO.cpp  |  2 +-
 llvm/lib/LTO/LTOBackend.cpp   |  2 +-
 llvm/lib/LTO/ThinLTOCodeGenerator.cpp |  4 ++--
 llvm/lib/Support/BalancedPartitioning.cpp |  2 +-
 llvm/tools/dsymutil/dsymutil.cpp  |  2 +-
 llvm/tools/llvm-cov/CodeCoverage.cpp  |  2 +-
 llvm/tools/llvm-cov/CoverageExporterJson.cpp  |  2 +-
 llvm/tools/llvm-cov/CoverageReport.cpp|  4 ++--
 .../tools/llvm-debuginfod/llvm-debuginfod.cpp |  2 +-
 llvm/tools/llvm-profdata/llvm-profdata.cpp|  2 +-
 llvm/tools/llvm-reduce/deltas/Delta.cpp   |  2 +-
 llvm/unittests/ADT/LazyAtomicPointerTest.cpp  |  4 ++--
 llvm/unittests/Debuginfod/HTTPServerTests.cpp | 16 +++---
 llvm/unittests/Support/ParallelTest.cpp   |  2 +-
 llvm/unittests/Support/ThreadPool.cpp | 22 +--
 .../Support/ThreadSafeAllocatorTest.cpp   |  6 ++---
 mlir/include/mlir/IR/MLIRContext.h|  2 +-
 mlir/lib/CAPI/IR/Support.cpp  |  2 +-
 mlir/lib/ExecutionEngine/AsyncRuntime.cpp |  2 +-
 mlir/lib/IR/MLIRContext.cpp   |  4 ++--
 37 files changed, 65 insertions(+), 66 deletions(-)

diff --git a/bolt/lib/Core/ParallelUtilities.cpp 
b/bolt/lib/Core/ParallelUtilities.cpp
index 88d9444a6a2ba7..5f5e96e0e7881c 100644
--- a/bolt/lib/Core/ParallelUtilities.cpp
+++ b/bolt/lib/Core/ParallelUtilities.cpp
@@ -49,7 +49,7 @@ namespace ParallelUtilities {
 
 namespace {
 /// A single thread pool that is used to run parallel tasks
-std::unique_ptr ThreadPoolPtr;
+std::unique_ptr ThreadPoolPtr;
 
 unsigned computeCostFor(const BinaryFunction &BF,
 const PredicateTy &SkipPredicate,
@@ -106,7 +106,7 @@ ThreadPoolInterface &getThreadPool() {
   if (ThreadPoolPtr.get())
 return *ThreadPoolPtr;
 
-  ThreadPoolPtr = std::make_unique(
+  ThreadPoolPtr = std::make_unique(
   llvm::hardware_concurrency(opts::ThreadCount));
   return *ThreadPoolPtr;
 }
diff --git a/bolt/tools/merge-fdata/merge-fdata.cpp 
b/bolt/tools/merge-fdata/merge-fdata.cpp
index c6dfd3cfdc56de..f2ac5ad4492ee5 100644
--- a/bolt/tools/merge-fdata/merge-fdata.cpp
+++ b/bolt/tools/merge-fdata/merge-fdata.cpp
@@ -316,7 +316,7 @@ void mergeLegacyProfiles(const SmallVectorImpl 
&Filenames) {
   // least 4 tasks.
   ThreadPoolStrategy S = optimal_concurrency(
   std::max(Filenames.size() / 4, static_cast(1)));
-  ThreadPool Pool(S);
+  DefaultThreadPool Pool(S);
   DenseMap ParsedProfiles(
   Pool.getMaxConcurrency());
   for (const auto &Filename : Filenames)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp 
b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index 22bdb5de22d871..21b581fa6df2e1 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -238,7 +238,7 @@ Example usage for a project using a compile commands 
database:
   Error = false;
   llvm::sys::Mutex IndexMutex;
   // ExecutorConcurrency is a flag exposed by AllTUsExecution.h
-  llvm::ThreadPool Pool(llvm::hardware_concurrency(ExecutorConcurrency));
+  llvm::DefaultThreadPool 
Pool(llvm::hardware_concurrency(ExecutorConcurrency));
   for (auto &Group : USRToBitcode) {
 Pool.async([&]() {
   std::vector> Infos;
diff --git 
a/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
 
b/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
index b2d0efecc20692..298b02e77cb0aa 100644
--- 
a/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
+++ 
b/clang-tools-extra/clang-include-fixer/find

  1   2   3   4   5   >