[PATCH] D73307: Unique Names for Functions with Internal Linkage

2020-01-23 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added inline comments.



Comment at: clang/lib/CodeGen/CodeGenModule.cpp:
+  this->getFunctionLinkage(GD) == llvm::GlobalValue::InternalLinkage) {
+std::string UniqueSuffix = getUniqueModuleId((), true);
+if (!UniqueSuffix.empty()) {

`std::string llvm::getUniqueModuleId(Module *M) {`

What is the second parameter?

What is the rationale that InternalLinkage is picked here?



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:966
  OPT_fno_unique_section_names, true);
+  Opts.UniqueInternalFuncNames = Args.hasFlag(
+  OPT_funique_internal_funcnames, OPT_fno_unique_internal_funcnames, 
false);

Just `Args.hasArg(OPT_funique_internal_funcnames)`.

`-fno-*` is handled in clangDriver. CC1 does not need to know `-fno-*` if it 
defaults to false.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73307/new/

https://reviews.llvm.org/D73307



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


[PATCH] D73219: [objc_direct] do not add direct properties to the serialization array

2020-01-23 Thread Pierre Habouzit via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
MadCoder marked an inline comment as done.
Closed by commit rG52311d0483ee: [objc_direct] do not add direct properties to 
the serialization array (authored by MadCoder).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73219/new/

https://reviews.llvm.org/D73219

Files:
  clang/lib/CodeGen/CGObjCMac.cpp
  clang/test/CodeGenObjC/direct-properties.m


Index: clang/test/CodeGenObjC/direct-properties.m
===
--- /dev/null
+++ clang/test/CodeGenObjC/direct-properties.m
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -emit-llvm -fobjc-arc -triple x86_64-apple-darwin10 %s -o - 
| FileCheck %s
+
+__attribute__((objc_root_class))
+@interface A
+@property(direct, readonly) int i;
+@end
+
+__attribute__((objc_root_class))
+@interface B
+@property(direct, readonly) int i;
+@property(readonly) int j;
+@end
+
+// CHECK-NOT: @"__OBJC_$_PROP_LIST_A"
+@implementation A
+@synthesize i = _i;
+@end
+
+// CHECK: @"_OBJC_$_PROP_LIST_B" = internal global { i32, i32, [1 x 
%struct._prop_t] } { i32 16, i32 1
+@implementation B
+@synthesize i = _i;
+@synthesize j = _j;
+@end
Index: clang/lib/CodeGen/CGObjCMac.cpp
===
--- clang/lib/CodeGen/CGObjCMac.cpp
+++ clang/lib/CodeGen/CGObjCMac.cpp
@@ -3291,6 +3291,8 @@
   for (auto *PD : ClassExt->properties()) {
 if (IsClassProperty != PD->isClassProperty())
   continue;
+if (PD->isDirectProperty())
+  continue;
 PropertySet.insert(PD->getIdentifier());
 Properties.push_back(PD);
   }
@@ -3302,6 +3304,8 @@
 // class extension.
 if (!PropertySet.insert(PD->getIdentifier()).second)
   continue;
+if (PD->isDirectProperty())
+  continue;
 Properties.push_back(PD);
   }
 
@@ -3327,8 +3331,6 @@
   values.addInt(ObjCTypes.IntTy, Properties.size());
   auto propertiesArray = values.beginArray(ObjCTypes.PropertyTy);
   for (auto PD : Properties) {
-if (PD->isDirectProperty())
-  continue;
 auto property = propertiesArray.beginStruct(ObjCTypes.PropertyTy);
 property.add(GetPropertyName(PD->getIdentifier()));
 property.add(GetPropertyTypeString(PD, Container));


Index: clang/test/CodeGenObjC/direct-properties.m
===
--- /dev/null
+++ clang/test/CodeGenObjC/direct-properties.m
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -emit-llvm -fobjc-arc -triple x86_64-apple-darwin10 %s -o - | FileCheck %s
+
+__attribute__((objc_root_class))
+@interface A
+@property(direct, readonly) int i;
+@end
+
+__attribute__((objc_root_class))
+@interface B
+@property(direct, readonly) int i;
+@property(readonly) int j;
+@end
+
+// CHECK-NOT: @"__OBJC_$_PROP_LIST_A"
+@implementation A
+@synthesize i = _i;
+@end
+
+// CHECK: @"_OBJC_$_PROP_LIST_B" = internal global { i32, i32, [1 x %struct._prop_t] } { i32 16, i32 1
+@implementation B
+@synthesize i = _i;
+@synthesize j = _j;
+@end
Index: clang/lib/CodeGen/CGObjCMac.cpp
===
--- clang/lib/CodeGen/CGObjCMac.cpp
+++ clang/lib/CodeGen/CGObjCMac.cpp
@@ -3291,6 +3291,8 @@
   for (auto *PD : ClassExt->properties()) {
 if (IsClassProperty != PD->isClassProperty())
   continue;
+if (PD->isDirectProperty())
+  continue;
 PropertySet.insert(PD->getIdentifier());
 Properties.push_back(PD);
   }
@@ -3302,6 +3304,8 @@
 // class extension.
 if (!PropertySet.insert(PD->getIdentifier()).second)
   continue;
+if (PD->isDirectProperty())
+  continue;
 Properties.push_back(PD);
   }
 
@@ -3327,8 +3331,6 @@
   values.addInt(ObjCTypes.IntTy, Properties.size());
   auto propertiesArray = values.beginArray(ObjCTypes.PropertyTy);
   for (auto PD : Properties) {
-if (PD->isDirectProperty())
-  continue;
 auto property = propertiesArray.beginStruct(ObjCTypes.PropertyTy);
 property.add(GetPropertyName(PD->getIdentifier()));
 property.add(GetPropertyTypeString(PD, Container));
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D72747: [objc_direct] Allow for direct messages be sent to `self` when it is a Class

2020-01-23 Thread Pierre Habouzit via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7596d3c50c4b: [objc_direct] Allow for direct messages be 
sent to `self` when it is a Class (authored by MadCoder).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72747/new/

https://reviews.llvm.org/D72747

Files:
  clang/lib/Sema/SemaExprObjC.cpp
  clang/test/SemaObjC/method-direct-arc.m
  clang/test/SemaObjC/method-direct.m


Index: clang/test/SemaObjC/method-direct.m
===
--- clang/test/SemaObjC/method-direct.m
+++ clang/test/SemaObjC/method-direct.m
@@ -89,7 +89,10 @@
 }
 - (void)otherRootDirect {
 }
++ (void)someRootDirectMethod { // expected-note {{direct method 
'someRootDirectMethod' declared here}}
+}
 + (void)otherClassRootDirect {
+  [self someRootDirectMethod]; // expected-error {{messaging a Class with a 
method that is possibly direct}}
 }
 - (void)rootExtensionDirect {
 }
Index: clang/test/SemaObjC/method-direct-arc.m
===
--- /dev/null
+++ clang/test/SemaObjC/method-direct-arc.m
@@ -0,0 +1,48 @@
+// RUN: %clang_cc1 -fobjc-arc -fsyntax-only -verify -Wselector-type-mismatch %s
+
+extern Class object_getClass(id);
+
+__attribute__((objc_root_class))
+@interface Root
+- (Class)class;
++ (void)directMethod __attribute__((objc_direct)); // expected-note {{direct 
method 'directMethod' declared here}}
++ (void)anotherDirectMethod __attribute__((objc_direct));
+@end
+
+@implementation Root
+- (Class)class
+{
+  return object_getClass(self);
+}
++ (void)directMethod {
+}
++ (void)anotherDirectMethod {
+  [self directMethod]; // this should not warn
+}
++ (void)regularMethod {
+  [self directMethod];// this should not warn
+  [self anotherDirectMethod]; // this should not warn
+}
+- (void)regularInstanceMethod {
+  [[self class] directMethod]; // expected-error {{messaging a Class with a 
method that is possibly direct}}
+}
+@end
+
+@interface Sub : Root
+@end
+
+@implementation Sub
++ (void)foo {
+  [self directMethod]; // this should not warn
+}
+@end
+
+__attribute__((objc_root_class))
+@interface Other
+@end
+
+@implementation Other
++ (void)bar {
+  [self directMethod]; // expected-error {{no known class method for selector 
'directMethod'}}
+}
+@end
Index: clang/lib/Sema/SemaExprObjC.cpp
===
--- clang/lib/Sema/SemaExprObjC.cpp
+++ clang/lib/Sema/SemaExprObjC.cpp
@@ -3012,7 +3012,11 @@
   << Method->getDeclName();
 }
 
-if (ReceiverType->isObjCClassType() && !isImplicit) {
+// Under ARC, self can't be assigned, and doing a direct call to `self`
+// when it's a Class is hence safe.  For other cases, we can't trust `self`
+// is what we think it is, so we reject it.
+if (ReceiverType->isObjCClassType() && !isImplicit &&
+!(Receiver->isObjCSelfExpr() && getLangOpts().ObjCAutoRefCount)) {
   Diag(Receiver->getExprLoc(),
diag::err_messaging_class_with_direct_method);
   Diag(Method->getLocation(), diag::note_direct_method_declared_at)


Index: clang/test/SemaObjC/method-direct.m
===
--- clang/test/SemaObjC/method-direct.m
+++ clang/test/SemaObjC/method-direct.m
@@ -89,7 +89,10 @@
 }
 - (void)otherRootDirect {
 }
++ (void)someRootDirectMethod { // expected-note {{direct method 'someRootDirectMethod' declared here}}
+}
 + (void)otherClassRootDirect {
+  [self someRootDirectMethod]; // expected-error {{messaging a Class with a method that is possibly direct}}
 }
 - (void)rootExtensionDirect {
 }
Index: clang/test/SemaObjC/method-direct-arc.m
===
--- /dev/null
+++ clang/test/SemaObjC/method-direct-arc.m
@@ -0,0 +1,48 @@
+// RUN: %clang_cc1 -fobjc-arc -fsyntax-only -verify -Wselector-type-mismatch %s
+
+extern Class object_getClass(id);
+
+__attribute__((objc_root_class))
+@interface Root
+- (Class)class;
++ (void)directMethod __attribute__((objc_direct)); // expected-note {{direct method 'directMethod' declared here}}
++ (void)anotherDirectMethod __attribute__((objc_direct));
+@end
+
+@implementation Root
+- (Class)class
+{
+  return object_getClass(self);
+}
++ (void)directMethod {
+}
++ (void)anotherDirectMethod {
+  [self directMethod]; // this should not warn
+}
++ (void)regularMethod {
+  [self directMethod];// this should not warn
+  [self anotherDirectMethod]; // this should not warn
+}
+- (void)regularInstanceMethod {
+  [[self class] directMethod]; // expected-error {{messaging a Class with a method that is possibly direct}}
+}
+@end
+
+@interface Sub : Root
+@end
+
+@implementation Sub
++ (void)foo {
+  [self directMethod]; // this should not warn
+}
+@end
+
+__attribute__((objc_root_class))
+@interface Other
+@end
+
+@implementation Other
++ (void)bar {
+  [self 

[clang] 52311d0 - [objc_direct] do not add direct properties to the serialization array

2020-01-23 Thread Pierre Habouzit via cfe-commits

Author: Pierre Habouzit
Date: 2020-01-23T22:39:47-08:00
New Revision: 52311d0483eecd60bdcc39dd3fb134f2412370f6

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

LOG: [objc_direct] do not add direct properties to the serialization array

If we do, then the property_list_t length is wrong
and class_getProperty gets very sad.

Signed-off-by: Pierre Habouzit 
Radar-Id: rdar://problem/58804805
Differential Revision: https://reviews.llvm.org/D73219

Added: 
clang/test/CodeGenObjC/direct-properties.m

Modified: 
clang/lib/CodeGen/CGObjCMac.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index f36c28a85a68..b36d97357906 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -3291,6 +3291,8 @@ llvm::Constant *CGObjCCommonMac::EmitPropertyList(Twine 
Name,
   for (auto *PD : ClassExt->properties()) {
 if (IsClassProperty != PD->isClassProperty())
   continue;
+if (PD->isDirectProperty())
+  continue;
 PropertySet.insert(PD->getIdentifier());
 Properties.push_back(PD);
   }
@@ -3302,6 +3304,8 @@ llvm::Constant *CGObjCCommonMac::EmitPropertyList(Twine 
Name,
 // class extension.
 if (!PropertySet.insert(PD->getIdentifier()).second)
   continue;
+if (PD->isDirectProperty())
+  continue;
 Properties.push_back(PD);
   }
 
@@ -3327,8 +3331,6 @@ llvm::Constant *CGObjCCommonMac::EmitPropertyList(Twine 
Name,
   values.addInt(ObjCTypes.IntTy, Properties.size());
   auto propertiesArray = values.beginArray(ObjCTypes.PropertyTy);
   for (auto PD : Properties) {
-if (PD->isDirectProperty())
-  continue;
 auto property = propertiesArray.beginStruct(ObjCTypes.PropertyTy);
 property.add(GetPropertyName(PD->getIdentifier()));
 property.add(GetPropertyTypeString(PD, Container));

diff  --git a/clang/test/CodeGenObjC/direct-properties.m 
b/clang/test/CodeGenObjC/direct-properties.m
new file mode 100644
index ..113ac12f18bf
--- /dev/null
+++ b/clang/test/CodeGenObjC/direct-properties.m
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -emit-llvm -fobjc-arc -triple x86_64-apple-darwin10 %s -o - 
| FileCheck %s
+
+__attribute__((objc_root_class))
+@interface A
+@property(direct, readonly) int i;
+@end
+
+__attribute__((objc_root_class))
+@interface B
+@property(direct, readonly) int i;
+@property(readonly) int j;
+@end
+
+// CHECK-NOT: @"__OBJC_$_PROP_LIST_A"
+@implementation A
+@synthesize i = _i;
+@end
+
+// CHECK: @"_OBJC_$_PROP_LIST_B" = internal global { i32, i32, [1 x 
%struct._prop_t] } { i32 16, i32 1
+@implementation B
+@synthesize i = _i;
+@synthesize j = _j;
+@end



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


[clang] 7596d3c - [objc_direct] Allow for direct messages be sent to `self` when it is a Class

2020-01-23 Thread Pierre Habouzit via cfe-commits

Author: Pierre Habouzit
Date: 2020-01-23T22:39:28-08:00
New Revision: 7596d3c50c4b265612d326369e2a015cf8c60801

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

LOG: [objc_direct] Allow for direct messages be sent to `self` when it is a 
Class

Sending a message to `self` when it is const and within a class method
is safe because we know that `self` is the Class itself.

We can only relax this warning in ARC.

Signed-off-by: Pierre Habouzit 
Radar-Id: rdar://problem/58581965
Differential Revision: https://reviews.llvm.org/D72747

Added: 
clang/test/SemaObjC/method-direct-arc.m

Modified: 
clang/lib/Sema/SemaExprObjC.cpp
clang/test/SemaObjC/method-direct.m

Removed: 




diff  --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index c61b13cf5980..7914dc57f9e1 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -3012,7 +3012,11 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
   << Method->getDeclName();
 }
 
-if (ReceiverType->isObjCClassType() && !isImplicit) {
+// Under ARC, self can't be assigned, and doing a direct call to `self`
+// when it's a Class is hence safe.  For other cases, we can't trust `self`
+// is what we think it is, so we reject it.
+if (ReceiverType->isObjCClassType() && !isImplicit &&
+!(Receiver->isObjCSelfExpr() && getLangOpts().ObjCAutoRefCount)) {
   Diag(Receiver->getExprLoc(),
diag::err_messaging_class_with_direct_method);
   Diag(Method->getLocation(), diag::note_direct_method_declared_at)

diff  --git a/clang/test/SemaObjC/method-direct-arc.m 
b/clang/test/SemaObjC/method-direct-arc.m
new file mode 100644
index ..6877cddb073b
--- /dev/null
+++ b/clang/test/SemaObjC/method-direct-arc.m
@@ -0,0 +1,48 @@
+// RUN: %clang_cc1 -fobjc-arc -fsyntax-only -verify -Wselector-type-mismatch %s
+
+extern Class object_getClass(id);
+
+__attribute__((objc_root_class))
+@interface Root
+- (Class)class;
++ (void)directMethod __attribute__((objc_direct)); // expected-note {{direct 
method 'directMethod' declared here}}
++ (void)anotherDirectMethod __attribute__((objc_direct));
+@end
+
+@implementation Root
+- (Class)class
+{
+  return object_getClass(self);
+}
++ (void)directMethod {
+}
++ (void)anotherDirectMethod {
+  [self directMethod]; // this should not warn
+}
++ (void)regularMethod {
+  [self directMethod];// this should not warn
+  [self anotherDirectMethod]; // this should not warn
+}
+- (void)regularInstanceMethod {
+  [[self class] directMethod]; // expected-error {{messaging a Class with a 
method that is possibly direct}}
+}
+@end
+
+@interface Sub : Root
+@end
+
+@implementation Sub
++ (void)foo {
+  [self directMethod]; // this should not warn
+}
+@end
+
+__attribute__((objc_root_class))
+@interface Other
+@end
+
+@implementation Other
++ (void)bar {
+  [self directMethod]; // expected-error {{no known class method for selector 
'directMethod'}}
+}
+@end

diff  --git a/clang/test/SemaObjC/method-direct.m 
b/clang/test/SemaObjC/method-direct.m
index 4829a67cd8a9..c2cbdbebdaf4 100644
--- a/clang/test/SemaObjC/method-direct.m
+++ b/clang/test/SemaObjC/method-direct.m
@@ -89,7 +89,10 @@ + (void)classRootDirect {
 }
 - (void)otherRootDirect {
 }
++ (void)someRootDirectMethod { // expected-note {{direct method 
'someRootDirectMethod' declared here}}
+}
 + (void)otherClassRootDirect {
+  [self someRootDirectMethod]; // expected-error {{messaging a Class with a 
method that is possibly direct}}
 }
 - (void)rootExtensionDirect {
 }



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


[PATCH] D72703: Add a warning, flags and pragmas to limit the number of pre-processor tokens in a translation unit

2020-01-23 Thread Kim Gräsman via Phabricator via cfe-commits
kimgr added a comment.

In D72703#1834177 , @hans wrote:

> I assume the same correlation could also be found with lines of code, but I 
> think tokens is a better dimension to measure since it's less likely to be 
> gamed, and it also is also kind of the basic work unit that the compiler 
> deals with.


Yeah, and code with lots of documentatinon comments isn't penalized.

>> Could you expose a flag for printing token count so users can run their own 
>> analysis? Or does that already exist in baseline clang? It's easier to set a 
>> maximum for a codebase if the distribution is known.
> 
> I used this patch with -fmax-tokens 1 and scraped the output for my 
> measurements. I would like to avoid adding a separate flag if we can avoid it.

Ah, it didn't occur to me that `-fmax-tokens` itself could be used like this. 
Thanks!

FWIW, I'm not ecstatic about `max_tokens_here`, I thought `max_tokens_lexed` 
had a nicer ring to it. /peanut.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72703/new/

https://reviews.llvm.org/D72703



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


[PATCH] D73290: [PowerPC] Add clang -msvr4-struct-return for 32-bit ELF

2020-01-23 Thread Mark Millard via Phabricator via cfe-commits
markmi added a comment.
Herald added a subscriber: wuzish.

Summary: My preliminary testing looks good.

FreeBSD does not have clang/test/ and clang/doc/ in its contrib/llvm-project/ 
so I applied just the other patches to my context and rebuilt my FreeBSD head 
-r356426 based context's clang/clang++ and such.
Using the updated compilers I did buildworld and buildkernel for 32-bit 
powerpc, installed them, and booted an old PowerMac 2-socket G4 with the 
result. After that I built the ports related to devel/freebsd-gcc9 at powerpc 
and lang/gcc9 and installed the packages the build produced. I then used such 
toolchains to build and run the original program that I found the ABI mismatch 
with, building without using -maix-struct-return but using FreeBSD's libc++ and 
such (like before).

The program ran fine.

The overall sequence I used involved buildworld buildkernel for powerpc64 and 
installing and booting such as well. That was in turn used to build some ports 
for 32-bit powerpc via devel/poudriere (so via chroot activity). All that 
worked fine.

It will be some time before all my usual ports have been built for 32-bit 
powerpc. But my preliminary testing is good news.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73290/new/

https://reviews.llvm.org/D73290



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


[PATCH] D73208: [objc_direct] fix codegen for mismatched Decl/Impl return types

2020-01-23 Thread Pierre Habouzit via Phabricator via cfe-commits
MadCoder added a comment.

In D73208#1836789 , @dexonsmith wrote:

> In D73208#1836722 , @MadCoder wrote:
>
> > In D73208#1836704 , @dexonsmith 
> > wrote:
> >
> > > In D73208#1835264 , @MadCoder 
> > > wrote:
> > >
> > > > In D73208#1835051 , 
> > > > @dexonsmith wrote:
> > > >
> > > > > Why isn't a similar dance needed for non-direct methods?
> > > >
> > > >
> > > > because non direct methods do not need an `llvm::Function` to be 
> > > > synthesized at the call-site. direct methods do, and they form one with 
> > > > the type of the declaration they see. Then that same `llvm::Function` 
> > > > is used when you CodeGen the Implementation, so if there's a mismatch, 
> > > > sadness ensues because the LLVM IR verifier will notice the discrepancy 
> > > > between the declared return type of the function and the actual types 
> > > > coming out of the `ret` codepaths.
> > > >
> > > > Regular obj-C methods use the _implementation_ types for the codegen 
> > > > (the declaration(s) aren't even consulted) and I want to stick at what 
> > > > obj-c does as much as I can.
> > > >
> > > > (as a data point: If you use obj-C types with C functions, the type of 
> > > > the first declaration seen is used instead).
> > >
> > >
> > > Okay, that makes sense to me.
> > >
> > > Another solution would be to change IRGen for the implementation: if the 
> > > declaration already exists (`getFunction`), do a bitcast + RAUW dance to 
> > > fix it up (and update the `DirectMethodDefinitions` table).  WDYT?
> >
> >
> > I didn't want to do that because that would mean that the type used for the 
> > implementation would depart from dynamic Objective-C methods, and it feels 
> > that it shouldn't. hence I took this option.
>
>
> I think we're talking across each other.  The idea is check the type when 
> generating the implementation; if it's not correct, you fix it (need to 
> update existing uses to bitcast).  So the type used for the implementation 
> would match dynamic methods.


ah I see, I don't know how to do that, I couldn't figure out how to fix the 
function declaration, if you want to give it a stab I'd love it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73208/new/

https://reviews.llvm.org/D73208



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


[PATCH] D72820: [FPEnv] Add pragma FP_CONTRACT support under strict FP.

2020-01-23 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: clang/lib/CodeGen/CGExprScalar.cpp:3381
+   "constrained mode");
+FMulAdd = Builder.CreateCall(
+CGF.CGM.getIntrinsic(llvm::Intrinsic::experimental_constrained_fmuladd,

Doesn't this need to be CreateConstrainedFPCall so that the strictfp attribute 
is added? That will take care of adding the metadata operands too.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72820/new/

https://reviews.llvm.org/D72820



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


[PATCH] D72906: [X86] Improve X86 cmpps/cmppd/cmpss/cmpsd intrinsics with strictfp

2020-01-23 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment.

In D72906#1826849 , @uweigand wrote:

> In D72906#1826122 , @craig.topper 
> wrote:
>
> > In D72906#1826061 , @uweigand 
> > wrote:
> >
> > > > The constrained fcmp intrinsics don't allow the TRUE/FALSE predicates.
> > >
> > > Hmm, maybe they should then?   The only reason I didn't add them 
> > > initially was that I wasn't sure they were useful for anything; if they 
> > > are, it should be straightforward to add them back.
> >
> >
> > What would we lower it to on a target that doesn’t support it natively?
>
>
> Any supported compare (quiet or signaling as appropriate, just so we get the 
> correct exceptions), and then ignore the result (and use true/false constant 
> result instead)?


Sure. Is that something we want to force all targets to have to implement just 
to handle this case for X86? Unless we can come up with a generic DAG combine 
to pick a valid condition alternate so that the lowering code for each target 
doesn't have to deal with it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72906/new/

https://reviews.llvm.org/D72906



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


[clang] d600ab3 - [Frontend] Delete some unneeded CC1 options

2020-01-23 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2020-01-23T22:01:04-08:00
New Revision: d600ab3bb51268b660e1ed62478d4bfa41294f54

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

LOG: [Frontend] Delete some unneeded CC1 options

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/lib/Driver/XRayArgs.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/asan-globals-gc.cpp
clang/test/CodeGen/function-sections.c
clang/test/CodeGen/xray-attributes-noxray-supported.cpp

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 58cdbb95d05f..80d774e64ee0 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1252,8 +1252,7 @@ def fcf_protection : Flag<["-"], "fcf-protection">, 
Group, Flags<[CoreO
 def fxray_instrument : Flag<["-"], "fxray-instrument">, Group,
   Flags<[CC1Option]>,
   HelpText<"Generate XRay instrumentation sleds on function entry and exit">;
-def fnoxray_instrument : Flag<["-"], "fno-xray-instrument">, Group,
-  Flags<[CC1Option]>;
+def fno_xray_instrument : Flag<["-"], "fno-xray-instrument">, Group;
 
 def fxray_instruction_threshold_EQ :
   JoinedOrSeparate<["-"], "fxray-instruction-threshold=">,
@@ -1283,14 +1282,12 @@ def fxray_modes :
 def fxray_always_emit_customevents : Flag<["-"], 
"fxray-always-emit-customevents">, Group,
   Flags<[CC1Option]>,
   HelpText<"Determine whether to always emit __xray_customevent(...) calls 
even if the function it appears in is not always instrumented.">;
-def fnoxray_always_emit_customevents : Flag<["-"], 
"fno-xray-always-emit-customevents">, Group,
-  Flags<[CC1Option]>;
+def fno_xray_always_emit_customevents : Flag<["-"], 
"fno-xray-always-emit-customevents">, Group;
 
 def fxray_always_emit_typedevents : Flag<["-"], 
"fxray-always-emit-typedevents">, Group,
   Flags<[CC1Option]>,
   HelpText<"Determine whether to always emit __xray_typedevent(...) calls even 
if the function it appears in is not always instrumented.">;
-def fnoxray_always_emit_typedevents : Flag<["-"], 
"fno-xray-always-emit-typedevents">, Group,
-  Flags<[CC1Option]>;
+def fno_xray_always_emit_typedevents : Flag<["-"], 
"fno-xray-always-emit-typedevents">, Group;
 
 def fxray_ignore_loops : Flag<["-"], "fxray-ignore-loops">, Group,
   Flags<[CC1Option]>,
@@ -1558,8 +1555,6 @@ def fno_rtti : Flag<["-"], "fno-rtti">, Group, 
Flags<[CC1Option]>,
 def fno_rtti_data : Flag<["-"], "fno-rtti-data">, Group, 
Flags<[CC1Option]>,
   HelpText<"Control emission of RTTI data">;
 def fno_short_enums : Flag<["-"], "fno-short-enums">, Group;
-def fno_show_column : Flag<["-"], "fno-show-column">, Group, 
Flags<[CC1Option]>,
-  HelpText<"Do not include column number on diagnostics">;
 def fno_show_source_location : Flag<["-"], "fno-show-source-location">, 
Group,
   Flags<[CC1Option]>, HelpText<"Do not include source location information 
with diagnostics">;
 def fdiagnostics_absolute_paths : Flag<["-"], "fdiagnostics-absolute-paths">, 
Group,
@@ -1585,8 +1580,6 @@ def fno_use_cxa_atexit : Flag<["-"], 
"fno-use-cxa-atexit">, Group, Flag
   HelpText<"Don't use __cxa_atexit for calling destructors">;
 def fno_register_global_dtors_with_atexit : Flag<["-"], 
"fno-register-global-dtors-with-atexit">, Group,
   HelpText<"Don't use atexit or __cxa_atexit to register global destructors">;
-def fno_use_init_array : Flag<["-"], "fno-use-init-array">, Group, 
Flags<[CC1Option]>,
-  HelpText<"Don't use .init_array instead of .ctors">;
 def fno_unit_at_a_time : Flag<["-"], "fno-unit-at-a-time">, Group;
 def fno_unwind_tables : Flag<["-"], "fno-unwind-tables">, Group;
 def fno_verbose_asm : Flag<["-"], "fno-verbose-asm">, Group;
@@ -1759,7 +1752,9 @@ def fno_short_wchar : Flag<["-"], "fno-short-wchar">, 
Group,
 def fshow_overloads_EQ : Joined<["-"], "fshow-overloads=">, Group, 
Flags<[CC1Option]>,
   HelpText<"Which overload candidates to show when overload resolution fails: "
"best|all; defaults to all">, Values<"best,all">;
-def fshow_column : Flag<["-"], "fshow-column">, Group, 
Flags<[CC1Option]>;
+def fshow_column : Flag<["-"], "fshow-column">, Group;
+def fno_show_column : Flag<["-"], "fno-show-column">, Group, 
Flags<[CC1Option]>,
+  HelpText<"Do not include column number on diagnostics">;
 def fshow_source_location : Flag<["-"], "fshow-source-location">, 
Group;
 def fspell_checking : Flag<["-"], "fspell-checking">, Group;
 def fspell_checking_limit_EQ : Joined<["-"], "fspell-checking-limit=">, 
Group;
@@ -1897,8 +1892,10 @@ def funwind_tables : Flag<["-"], "funwind-tables">, 
Group;
 def fuse_cxa_atexit : Flag<["-"], "fuse-cxa-atexit">, Group;
 def fregister_global_dtors_with_atexit : Flag<["-"], 
"fregister-global-dtors-with-atexit">, 

[PATCH] D72824: [X86] Add combination for fma and fneg on X86 under strict FP.

2020-01-23 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment.

Are we missing tests for the vector instructions?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72824/new/

https://reviews.llvm.org/D72824



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


[clang] a2137d6 - [X86] Add -flax-vector-conversions=none to all of the x86 vector intrinsic header tests.

2020-01-23 Thread Craig Topper via cfe-commits

Author: Craig Topper
Date: 2020-01-23T20:43:50-08:00
New Revision: a2137d6e097c9122c3bb08c4ef70636761aa10b9

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

LOG: [X86] Add -flax-vector-conversions=none to all of the x86 vector intrinsic 
header tests.

Added: 


Modified: 
clang/test/CodeGen/avx2-builtins.c
clang/test/CodeGen/avx512bf16-builtins.c
clang/test/CodeGen/avx512bitalg-builtins.c
clang/test/CodeGen/avx512bw-builtins.c
clang/test/CodeGen/avx512dq-builtins.c
clang/test/CodeGen/avx512er-builtins.c
clang/test/CodeGen/avx512ifma-builtins.c
clang/test/CodeGen/avx512ifmavl-builtins.c
clang/test/CodeGen/avx512pf-builtins.c
clang/test/CodeGen/avx512vbmi-builtins.c
clang/test/CodeGen/avx512vbmi2-builtins.c
clang/test/CodeGen/avx512vl-builtins.c
clang/test/CodeGen/avx512vlbf16-builtins.c
clang/test/CodeGen/avx512vlbitalg-builtins.c
clang/test/CodeGen/avx512vlbw-builtins.c
clang/test/CodeGen/avx512vlcd-builtins.c
clang/test/CodeGen/avx512vldq-builtins.c
clang/test/CodeGen/avx512vlvbmi2-builtins.c
clang/test/CodeGen/avx512vlvnni-builtins.c
clang/test/CodeGen/avx512vnni-builtins.c
clang/test/CodeGen/fma-builtins.c
clang/test/CodeGen/fma4-builtins.c
clang/test/CodeGen/mmx-builtins.c
clang/test/CodeGen/sse-builtins.c
clang/test/CodeGen/sse2-builtins.c
clang/test/CodeGen/sse3-builtins.c
clang/test/CodeGen/sse41-builtins.c
clang/test/CodeGen/sse42-builtins.c
clang/test/CodeGen/sse4a-builtins.c
clang/test/CodeGen/ssse3-builtins.c
clang/test/CodeGen/xop-builtins-cmp.c
clang/test/CodeGen/xop-builtins.c

Removed: 




diff  --git a/clang/test/CodeGen/avx2-builtins.c 
b/clang/test/CodeGen/avx2-builtins.c
index 4ef11478853a..f4c1c3cf4f35 100644
--- a/clang/test/CodeGen/avx2-builtins.c
+++ b/clang/test/CodeGen/avx2-builtins.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin 
-target-feature +avx2 -emit-llvm -o - -Wall -Werror | FileCheck %s
-// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin 
-target-feature +avx2 -fno-signed-char -emit-llvm -o - -Wall -Werror | 
FileCheck %s
+// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s 
-triple=x86_64-apple-darwin -target-feature +avx2 -emit-llvm -o - -Wall -Werror 
| FileCheck %s
+// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s 
-triple=x86_64-apple-darwin -target-feature +avx2 -fno-signed-char -emit-llvm 
-o - -Wall -Werror | FileCheck %s
 
 
 #include 

diff  --git a/clang/test/CodeGen/avx512bf16-builtins.c 
b/clang/test/CodeGen/avx512bf16-builtins.c
index eac4dbcb5141..9b9e499d0c4d 100644
--- a/clang/test/CodeGen/avx512bf16-builtins.c
+++ b/clang/test/CodeGen/avx512bf16-builtins.c
@@ -1,4 +1,4 @@
-//  RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin \
+//  RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s 
-triple=x86_64-apple-darwin \
 //  RUN:-target-feature +avx512bf16 -emit-llvm -o - -Wall -Werror \
 //  RUN:| FileCheck %s
 

diff  --git a/clang/test/CodeGen/avx512bitalg-builtins.c 
b/clang/test/CodeGen/avx512bitalg-builtins.c
index b289c237cfc0..e5df0a089b9c 100644
--- a/clang/test/CodeGen/avx512bitalg-builtins.c
+++ b/clang/test/CodeGen/avx512bitalg-builtins.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin 
-target-feature +avx512bitalg -emit-llvm -o - -Wall -Werror | FileCheck %s
+// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s 
-triple=x86_64-apple-darwin -target-feature +avx512bitalg -emit-llvm -o - -Wall 
-Werror | FileCheck %s
 
 #include 
 

diff  --git a/clang/test/CodeGen/avx512bw-builtins.c 
b/clang/test/CodeGen/avx512bw-builtins.c
index 562bc312889e..a67ca3f77164 100644
--- a/clang/test/CodeGen/avx512bw-builtins.c
+++ b/clang/test/CodeGen/avx512bw-builtins.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin 
-target-feature +avx512bw -emit-llvm -o - -Wall -Werror | FileCheck %s
-// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin 
-target-feature +avx512bw -fno-signed-char -emit-llvm -o - -Wall -Werror | 
FileCheck %s
+// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s 
-triple=x86_64-apple-darwin -target-feature +avx512bw -emit-llvm -o - -Wall 
-Werror | FileCheck %s
+// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s 
-triple=x86_64-apple-darwin -target-feature +avx512bw -fno-signed-char 
-emit-llvm -o - -Wall -Werror | FileCheck %s
 
 
 #include 

diff  --git a/clang/test/CodeGen/avx512dq-builtins.c 
b/clang/test/CodeGen/avx512dq-builtins.c
index 4f79b2dd85e3..6ed0eef73797 100644
--- a/clang/test/CodeGen/avx512dq-builtins.c
+++ 

[PATCH] D71913: [LTO/WPD] Enable aggressive WPD under LTO option

2020-01-23 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson added a comment.

FYI I reverted this in rG90e630a95ecc 
 due to a 
cfi test failure in a windows sanitizer bot. Not sure what is happening, I'll 
need to try to debug it somehow tomorrow.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71913/new/

https://reviews.llvm.org/D71913



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


[PATCH] D73322: [WebAssembly] Update bleeding-edge CPU features

2020-01-23 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon times-circle color=red} Unit tests: fail. 62150 tests passed, 5 failed 
and 811 were skipped.

  failed: libc++.std/language_support/cmp/cmp_partialord/partialord.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_strongeq/cmp.strongeq.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_strongord/strongord.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_weakeq/cmp.weakeq.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_weakord/weakord.pass.cpp

{icon check-circle color=green} clang-tidy: pass.

{icon check-circle color=green} clang-format: pass.

Build artifacts 
: 
diff.json 
,
 clang-tidy.txt 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 


//Pre-merge checks is in beta. Report issue 
.
 Please join beta  or enable 
it for your project 
.//


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73322/new/

https://reviews.llvm.org/D73322



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


[PATCH] D73320: [WebAssembly] Add reference types target feature

2020-01-23 Thread Sam Clegg via Phabricator via cfe-commits
sbc100 accepted this revision.
sbc100 added inline comments.
This revision is now accepted and ready to land.



Comment at: llvm/test/CodeGen/WebAssembly/reference-types.ll:4
+; This currently only tests if the command line argument for reference types
+; feature is accepted by llc.
+

Couldn't we also check the that attribute is attached to the dummy function?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73320/new/

https://reviews.llvm.org/D73320



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


[PATCH] D73320: [WebAssembly] Add reference types target feature

2020-01-23 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon times-circle color=red} Unit tests: fail. 62151 tests passed, 5 failed 
and 811 were skipped.

  failed: libc++.std/language_support/cmp/cmp_partialord/partialord.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_strongeq/cmp.strongeq.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_strongord/strongord.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_weakeq/cmp.weakeq.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_weakord/weakord.pass.cpp

{icon check-circle color=green} clang-tidy: pass.

{icon check-circle color=green} clang-format: pass.

Build artifacts 
: 
diff.json 
,
 clang-tidy.txt 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 


//Pre-merge checks is in beta. Report issue 
.
 Please join beta  or enable 
it for your project 
.//


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73320/new/

https://reviews.llvm.org/D73320



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


[PATCH] D73322: [WebAssembly] Update bleeding-edge CPU features

2020-01-23 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin created this revision.
aheejin added a reviewer: tlively.
Herald added subscribers: cfe-commits, sunfish, jgravelle-google, sbc100, 
dschuff.
Herald added a project: clang.
aheejin added a comment.

I think their implemention is mostly complete, but please let me know if not.


This adds bulk memory and tail call to "bleeding-edge" CPU, since their
implementation in LLVM/clang seems mostly complete.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73322

Files:
  clang/lib/Basic/Targets/WebAssembly.cpp
  clang/test/Preprocessor/wasm-target-features.c


Index: clang/test/Preprocessor/wasm-target-features.c
===
--- clang/test/Preprocessor/wasm-target-features.c
+++ clang/test/Preprocessor/wasm-target-features.c
@@ -124,12 +124,14 @@
 //
 // BLEEDING-EDGE-DAG:#define __wasm_nontrapping_fptoint__ 1{{$}}
 // BLEEDING-EDGE-DAG:#define __wasm_sign_ext__ 1{{$}}
+// BLEEDING-EDGE-DAG:#define __wasm_bulk_memory__ 1{{$}}
 // BLEEDING-EDGE-DAG:#define __wasm_simd128__ 1{{$}}
 // BLEEDING-EDGE-DAG:#define __wasm_atomics__ 1{{$}}
 // BLEEDING-EDGE-DAG:#define __wasm_mutable_globals__ 1{{$}}
+// BLEEDING-EDGE-DAG:#define __wasm_tail_call__ 1{{$}}
 // BLEEDING-EDGE-NOT:#define __wasm_unimplemented_simd128__ 1{{$}}
+// BLEEDING-EDGE-NOT:#define __wasm_exception_handling__ 1{{$}}
 // BLEEDING-EDGE-NOT:#define __wasm_multivalue__ 1{{$}}
-// BLEEDING-EDGE-NOT:#define __wasm_tail_call__ 1{{$}}
 
 // RUN: %clang -E -dM %s -o - 2>&1 \
 // RUN: -target wasm32-unknown-unknown -mcpu=bleeding-edge -mno-simd128 \
Index: clang/lib/Basic/Targets/WebAssembly.cpp
===
--- clang/lib/Basic/Targets/WebAssembly.cpp
+++ clang/lib/Basic/Targets/WebAssembly.cpp
@@ -102,8 +102,10 @@
   if (CPU == "bleeding-edge") {
 Features["nontrapping-fptoint"] = true;
 Features["sign-ext"] = true;
+Features["bulk-memory"] = true;
 Features["atomics"] = true;
 Features["mutable-globals"] = true;
+Features["tail-call"] = true;
 setSIMDLevel(Features, SIMD128);
   }
   // Other targets do not consider user-configured features here, but while we


Index: clang/test/Preprocessor/wasm-target-features.c
===
--- clang/test/Preprocessor/wasm-target-features.c
+++ clang/test/Preprocessor/wasm-target-features.c
@@ -124,12 +124,14 @@
 //
 // BLEEDING-EDGE-DAG:#define __wasm_nontrapping_fptoint__ 1{{$}}
 // BLEEDING-EDGE-DAG:#define __wasm_sign_ext__ 1{{$}}
+// BLEEDING-EDGE-DAG:#define __wasm_bulk_memory__ 1{{$}}
 // BLEEDING-EDGE-DAG:#define __wasm_simd128__ 1{{$}}
 // BLEEDING-EDGE-DAG:#define __wasm_atomics__ 1{{$}}
 // BLEEDING-EDGE-DAG:#define __wasm_mutable_globals__ 1{{$}}
+// BLEEDING-EDGE-DAG:#define __wasm_tail_call__ 1{{$}}
 // BLEEDING-EDGE-NOT:#define __wasm_unimplemented_simd128__ 1{{$}}
+// BLEEDING-EDGE-NOT:#define __wasm_exception_handling__ 1{{$}}
 // BLEEDING-EDGE-NOT:#define __wasm_multivalue__ 1{{$}}
-// BLEEDING-EDGE-NOT:#define __wasm_tail_call__ 1{{$}}
 
 // RUN: %clang -E -dM %s -o - 2>&1 \
 // RUN: -target wasm32-unknown-unknown -mcpu=bleeding-edge -mno-simd128 \
Index: clang/lib/Basic/Targets/WebAssembly.cpp
===
--- clang/lib/Basic/Targets/WebAssembly.cpp
+++ clang/lib/Basic/Targets/WebAssembly.cpp
@@ -102,8 +102,10 @@
   if (CPU == "bleeding-edge") {
 Features["nontrapping-fptoint"] = true;
 Features["sign-ext"] = true;
+Features["bulk-memory"] = true;
 Features["atomics"] = true;
 Features["mutable-globals"] = true;
+Features["tail-call"] = true;
 setSIMDLevel(Features, SIMD128);
   }
   // Other targets do not consider user-configured features here, but while we
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73322: [WebAssembly] Update bleeding-edge CPU features

2020-01-23 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin added a comment.

I think their implemention is mostly complete, but please let me know if not.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73322/new/

https://reviews.llvm.org/D73322



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


[PATCH] D73320: [WebAssembly] Add reference types target feature

2020-01-23 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin created this revision.
aheejin added a reviewer: tlively.
Herald added subscribers: llvm-commits, cfe-commits, sunfish, hiraditya, 
jgravelle-google, sbc100, dschuff.
Herald added projects: clang, LLVM.

This adds the reference types target feature. This does not enable any
more functionality in LLVM/clang for now, but this is necessary to embed
the info in the target features section, which is used by Binaryen and
Emscripten. It turned out that after D69832  
`-fwasm-exceptions` crashed
because we didn't have the reference types target feature.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73320

Files:
  clang/lib/Basic/Targets/WebAssembly.cpp
  clang/lib/Basic/Targets/WebAssembly.h
  clang/test/Preprocessor/wasm-target-features.c
  llvm/lib/Target/WebAssembly/WebAssembly.td
  llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
  llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h
  llvm/test/CodeGen/WebAssembly/reference-types.ll

Index: llvm/test/CodeGen/WebAssembly/reference-types.ll
===
--- /dev/null
+++ llvm/test/CodeGen/WebAssembly/reference-types.ll
@@ -0,0 +1,12 @@
+; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+reference-types | FileCheck %s
+
+; This currently only tests if the command line argument for reference types
+; feature is accepted by llc.
+
+target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
+target triple = "wasm32-unknown-unknown"
+
+; CHECK-LABEL: dummy
+define void @dummy() {
+  ret void
+}
Index: llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h
===
--- llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h
+++ llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h
@@ -47,6 +47,7 @@
   bool HasMultivalue = false;
   bool HasMutableGlobals = false;
   bool HasTailCall = false;
+  bool HasReferenceTypes = false;
 
   /// String name of used CPU.
   std::string CPUString;
@@ -104,6 +105,7 @@
   bool hasMultivalue() const { return HasMultivalue; }
   bool hasMutableGlobals() const { return HasMutableGlobals; }
   bool hasTailCall() const { return HasTailCall; }
+  bool hasReferenceTypes() const { return HasReferenceTypes; }
 
   /// Parses features string setting specified subtarget options. Definition of
   /// function is auto generated by tblgen.
Index: llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
===
--- llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
+++ llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
@@ -62,6 +62,10 @@
 Predicate<"Subtarget->hasBulkMemory()">,
 AssemblerPredicate<"FeatureBulkMemory", "bulk-memory">;
 
+def HasReferenceTypes :
+Predicate<"Subtarget->hasReferenceTypes()">,
+AssemblerPredicate<"FeatureReferenceTypes", "reference-types">;
+
 //===--===//
 // WebAssembly-specific DAG Node Types.
 //===--===//
Index: llvm/lib/Target/WebAssembly/WebAssembly.td
===
--- llvm/lib/Target/WebAssembly/WebAssembly.td
+++ llvm/lib/Target/WebAssembly/WebAssembly.td
@@ -66,6 +66,10 @@
   SubtargetFeature<"mutable-globals", "HasMutableGlobals", "true",
"Enable mutable globals">;
 
+def FeatureReferenceTypes :
+  SubtargetFeature<"reference-types", "HasReferenceTypes", "true",
+   "Enable reference types">;
+
 //===--===//
 // Architectures.
 //===--===//
Index: clang/test/Preprocessor/wasm-target-features.c
===
--- clang/test/Preprocessor/wasm-target-features.c
+++ clang/test/Preprocessor/wasm-target-features.c
@@ -96,6 +96,15 @@
 // RUN:   | FileCheck %s -check-prefix=TAIL-CALL
 //
 // TAIL-CALL:#define __wasm_tail_call__ 1{{$}}
+//
+// RUN: %clang -E -dM %s -o - 2>&1 \
+// RUN: -target wasm32-unknown-unknown -mreference-types \
+// RUN:   | FileCheck %s -check-prefix=REFERENCE-TYPES
+// RUN: %clang -E -dM %s -o - 2>&1 \
+// RUN: -target wasm64-unknown-unknown -mreference-types \
+// RUN:   | FileCheck %s -check-prefix=REFERENCE-TYPES
+//
+// REFERENCE-TYPES:#define __wasm_reference_types__ 1{{$}}
 
 // RUN: %clang -E -dM %s -o - 2>&1 \
 // RUN: -target wasm32-unknown-unknown -mcpu=mvp \
@@ -114,6 +123,7 @@
 // MVP-NOT:#define __wasm_mutable_globals__
 // MVP-NOT:#define __wasm_multivalue__
 // MVP-NOT:#define __wasm_tail_call__
+// MVP-NOT:#define __wasm_reference_types__
 
 // RUN: %clang -E -dM %s -o - 2>&1 \
 // RUN: -target 

[PATCH] D72242: Fix crash on value dependent bitfields in if conditions in templates

2020-01-23 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith requested changes to this revision.
rsmith added a comment.
This revision now requires changes to proceed.

This is not an appropriate fix; the code is locally correct. The right way to 
handle this is exactly what Clang currently does: if the expression is not 
type-dependent, then contextually convert to `bool`, and if it's not 
value-dependent, then make sure it's a constant expression.

The bug is that we should treat the name of a bit-field with a value-dependent 
width as being type-dependent -- the `c` expression in the testcase should be a 
type-dependent expression (even though its type is known to be `int`) because 
we don't know how to promote it due to the value-dependent bit-width. (This is 
ultimately a bug in the C++ standard, which fails to provide such a rule, but 
I've reported that to the committee and it should be fixed in the standard at 
some point. But the right fix seems obvious enough that we can just do it.)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72242/new/

https://reviews.llvm.org/D72242



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


[PATCH] D73186: [AST] Add fixed-point multiplication constant evaluation.

2020-01-23 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/lib/Basic/FixedPoint.cpp:242
+  } else
+Overflowed = Result < Min || Result > Max;
+

leonardchan wrote:
> ebevhan wrote:
> > rjmccall wrote:
> > > ebevhan wrote:
> > > > ebevhan wrote:
> > > > > rjmccall wrote:
> > > > > > If the maximum expressible value is *k*, and the fully-precise 
> > > > > > multiplication yields *k+e* for some epsilon *e* that isn't 
> > > > > > representable in the result semantics, is that considered an 
> > > > > > overflow?  If so, I think you need to do the shift after these 
> > > > > > bound checks, since the shift destroys the difference between *k* 
> > > > > > and *k+e*.  That is, unless there's a compelling mathematical 
> > > > > > argument that it's not possible to overflow only in the 
> > > > > > fully-precision multiplication — but while I think that's possibly 
> > > > > > true of `_Fract` (since *k^2 < k*), it seems unlikely to be true of 
> > > > > > `_Accum`, although I haven't looked for a counter-example.  And if 
> > > > > > there is a compelling argument, it should probably be at least 
> > > > > > alluded to in a comment.
> > > > > > 
> > > > > > Would this algorithm be simpler if you took advantage of the fact 
> > > > > > that `APFixedPointSemantics` doesn't have to correspond to a real 
> > > > > > type?  You could probably just convert to a double-width common 
> > > > > > semantics, right?
> > > > > > If the maximum expressible value is *k*, and the fully-precise 
> > > > > > multiplication yields *k+e* for some epsilon *e* that isn't 
> > > > > > representable in the result semantics, is that considered an 
> > > > > > overflow? If so, I think you need to do the shift after these bound 
> > > > > > checks, since the shift destroys the difference between *k* and 
> > > > > > *k+e*.
> > > > > 
> > > > > I don't think I would consider that to be overflow; that's precision 
> > > > > loss. E-C considers these to be different:
> > > > > 
> > > > > > If the source value cannot be represented exactly by the 
> > > > > > fixed-point type, the source value is rounded to either the closest 
> > > > > > fixed-point value greater than the source value (rounded up) or to 
> > > > > > the closest fixed-point value less than the source value (rounded 
> > > > > > down).
> > > > > >
> > > > > > When the source value does not fit within the range of the 
> > > > > > fixed-point type, the conversion overflows. [...]
> > > > > >
> > > > > > [...]
> > > > > >
> > > > > > If the result type of an arithmetic operation is a fixed-point 
> > > > > > type, [...] the calculated result is the mathematically exact 
> > > > > > result with overflow handling and rounding performed to the full 
> > > > > > precision of the result type as explained in 4.1.3. 
> > > > > 
> > > > > There is also no value of `e` that would affect saturation. Any full 
> > > > > precision calculation that gives `k+e` must be `k` after downscaling, 
> > > > > since the bits that represent `e` must come from the extra precision 
> > > > > range. Even though `k+e` is technically larger than `k`, saturation 
> > > > > would still just give us `k` after truncating out `e`, so the end 
> > > > > result is the same.
> > > > > 
> > > > > > Would this algorithm be simpler if you took advantage of the fact 
> > > > > > that APFixedPointSemantics doesn't have to correspond to a real 
> > > > > > type? You could probably just convert to a double-width common 
> > > > > > semantics, right?
> > > > > 
> > > > > It's likely possible to use APFixedPoint in the calculations here, 
> > > > > but I used APInt to make the behavior explicit and not accidentally 
> > > > > be dependent on the behavior of APFixedPoint's conversions or 
> > > > > operations.
> > > > Although.,. I guess I see your point in that an intermediate result of 
> > > > k+e technically "does not fit within the range of the fixed-point 
> > > > type"... but I wonder if treating such cases as overflow is 
> > > > particularly meaningful. I don't find there to be much of a distinction 
> > > > between such a case and the case where the exact result lands inbetween 
> > > > two representable values. We just end up with a less precise result.
> > > Right, I was wondering if there was an accepted answer here.  For 
> > > saturating arithmetic, it's equivalent to truncate this extra precision 
> > > down to *k* or to saturate to the maximum representable value, since by 
> > > assumption that was just *k*; but for non-saturating arithmetic, it 
> > > affects whether the operation has UB.  All else being the same, it's 
> > > better to have fewer corner-case sources of UB.
> > > 
> > > My read is that Embedded C is saying there's a sequence here: compute the 
> > > exact mathematical result; round that to the precision of the result 
> > > type; the operation overflows if the rounded result is not representable 
> > > in the result type.  Is the rounding direction 

[PATCH] D73319: Add extension 'gnu_asm_goto_with_outputs'

2020-01-23 Thread Bill Wendling via Phabricator via cfe-commits
void created this revision.
void added a reviewer: nickdesaulniers.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Clang now supports GNU's asm goto with outputs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73319

Files:
  clang/include/clang/Basic/Features.def
  clang/test/Parser/asm-goto-with-outputs.c


Index: clang/test/Parser/asm-goto-with-outputs.c
===
--- /dev/null
+++ clang/test/Parser/asm-goto-with-outputs.c
@@ -0,0 +1,65 @@
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+#if !__has_extension(gnu_asm)
+#error Extension 'gnu_asm' should be available by default
+#endif
+#if !__has_extension(gnu_asm_goto_with_outputs)
+#error Extension 'gnu_asm_goto_with_outputs' should be available by default
+#endif
+
+int test1(int cond) {
+  asm volatile goto("testl %0, %0; jne %l2;" : "=r"(cond) : "r"(cond) :: 
label_true, loop);
+  asm volatile goto("testl %0, %0; jne %l3;" : "=r"(cond) : "r"(cond) :: 
label_true, loop);
+  return 0;
+loop:
+  return 0;
+label_true:
+  return 1;
+}
+
+int test2(int out1, int out2) {
+  asm volatile goto("testl %0, %0; jne %l3;" : "=r"(out1), "=r"(out2) : 
"r"(out1) :: label_true, loop);
+  asm volatile goto("testl %0, %0; jne %l4;" : "=r"(out1), "=r"(out2) : 
"r"(out1) :: label_true, loop);
+  return 0;
+loop:
+  return 0;
+label_true:
+  return 1;
+}
+
+int test3(int out1, int out2) {
+  if (out1 < out2)
+asm volatile goto("jne %l3" : "+S"(out1), "+D"(out2) : "r"(out1) :: 
label_true, loop);
+  else
+asm volatile goto("jne %l5" : "+S"(out1), "+D"(out2) : "r"(out1), 
"r"(out2) :: label_true, loop);
+  return out1 + out2;
+loop:
+  return -1;
+label_true:
+  return -2;
+}
+
+int test4(int addr, int size, int limit) {
+  asm goto(
+  "add %1,%0 ; "
+  "jc %l[t_err] ; "
+  "cmp %2,%0 ; "
+  "ja %l[t_err] ; "
+  : "+r" (addr)
+  : "g" (size), "g" (limit)
+  : : t_err);
+  return 0;
+t_err:
+  return 1;
+}
+
+int test5(int out1) {
+  int out2 = 42;
+  asm volatile goto("testl %0, %0; testl %1, %1; jne %l2" : "+S"(out2) : 
"r"(out1) :: label_true, landing);
+landing:
+  return out1 + out2;
+label_true:
+  return -2;
+}
Index: clang/include/clang/Basic/Features.def
===
--- clang/include/clang/Basic/Features.def
+++ clang/include/clang/Basic/Features.def
@@ -252,6 +252,7 @@
 EXTENSION(pragma_clang_attribute_namespaces, true)
 EXTENSION(pragma_clang_attribute_external_declaration, true)
 EXTENSION(gnu_asm, LangOpts.GNUAsm)
+EXTENSION(gnu_asm_goto_with_outputs, true)
 
 #undef EXTENSION
 #undef FEATURE


Index: clang/test/Parser/asm-goto-with-outputs.c
===
--- /dev/null
+++ clang/test/Parser/asm-goto-with-outputs.c
@@ -0,0 +1,65 @@
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+#if !__has_extension(gnu_asm)
+#error Extension 'gnu_asm' should be available by default
+#endif
+#if !__has_extension(gnu_asm_goto_with_outputs)
+#error Extension 'gnu_asm_goto_with_outputs' should be available by default
+#endif
+
+int test1(int cond) {
+  asm volatile goto("testl %0, %0; jne %l2;" : "=r"(cond) : "r"(cond) :: label_true, loop);
+  asm volatile goto("testl %0, %0; jne %l3;" : "=r"(cond) : "r"(cond) :: label_true, loop);
+  return 0;
+loop:
+  return 0;
+label_true:
+  return 1;
+}
+
+int test2(int out1, int out2) {
+  asm volatile goto("testl %0, %0; jne %l3;" : "=r"(out1), "=r"(out2) : "r"(out1) :: label_true, loop);
+  asm volatile goto("testl %0, %0; jne %l4;" : "=r"(out1), "=r"(out2) : "r"(out1) :: label_true, loop);
+  return 0;
+loop:
+  return 0;
+label_true:
+  return 1;
+}
+
+int test3(int out1, int out2) {
+  if (out1 < out2)
+asm volatile goto("jne %l3" : "+S"(out1), "+D"(out2) : "r"(out1) :: label_true, loop);
+  else
+asm volatile goto("jne %l5" : "+S"(out1), "+D"(out2) : "r"(out1), "r"(out2) :: label_true, loop);
+  return out1 + out2;
+loop:
+  return -1;
+label_true:
+  return -2;
+}
+
+int test4(int addr, int size, int limit) {
+  asm goto(
+  "add %1,%0 ; "
+  "jc %l[t_err] ; "
+  "cmp %2,%0 ; "
+  "ja %l[t_err] ; "
+  : "+r" (addr)
+  : "g" (size), "g" (limit)
+  : : t_err);
+  return 0;
+t_err:
+  return 1;
+}
+
+int test5(int out1) {
+  int out2 = 42;
+  asm volatile goto("testl %0, %0; testl %1, %1; jne %l2" : "+S"(out2) : "r"(out1) :: label_true, landing);
+landing:
+  return out1 + out2;
+label_true:
+  return -2;
+}
Index: clang/include/clang/Basic/Features.def
===
--- clang/include/clang/Basic/Features.def
+++ clang/include/clang/Basic/Features.def
@@ 

[PATCH] D73299: [HIP] Fix environment variable HIP_DEVICE_LIB_PATH

2020-01-23 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 240074.
yaxunl edited the summary of this revision.
yaxunl added a comment.

Revised by Artem's comments.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73299/new/

https://reviews.llvm.org/D73299

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/lib/Driver/ToolChains/HIP.cpp
  clang/test/Driver/hip-device-libs.hip


Index: clang/test/Driver/hip-device-libs.hip
===
--- clang/test/Driver/hip-device-libs.hip
+++ clang/test/Driver/hip-device-libs.hip
@@ -19,6 +19,13 @@
 // RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
 // RUN: 2>&1 | FileCheck %s --check-prefixes=COM,NOFLUSHD
 
+// Test environment variable HIP_DEVICE_LIB_PATH
+
+// RUN: HIP_DEVICE_LIB_PATH=%S/Inputs/hip_dev_lib \
+// RUN:   %clang -### -target x86_64-linux-gnu \
+// RUN:   -x hip --cuda-gpu-arch=gfx900 \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck %s --check-prefixes=COM
 
 // COM: {{"[^"]*clang[^"]*"}}
 // COM-SAME: "-mlink-builtin-bitcode" "{{.*}}hip.amdgcn.bc"
Index: clang/lib/Driver/ToolChains/HIP.cpp
===
--- clang/lib/Driver/ToolChains/HIP.cpp
+++ clang/lib/Driver/ToolChains/HIP.cpp
@@ -327,7 +327,7 @@
DriverArgs.getAllArgValues(options::OPT_hip_device_lib_path_EQ))
 LibraryPaths.push_back(DriverArgs.MakeArgString(Path));
 
-  addDirectoryList(DriverArgs, LibraryPaths, "-L", "HIP_DEVICE_LIB_PATH");
+  addDirectoryList(DriverArgs, LibraryPaths, "", "HIP_DEVICE_LIB_PATH");
 
   llvm::SmallVector BCLibs;
 
Index: clang/lib/Driver/ToolChains/CommonArgs.h
===
--- clang/lib/Driver/ToolChains/CommonArgs.h
+++ clang/lib/Driver/ToolChains/CommonArgs.h
@@ -94,6 +94,11 @@
 
 bool isUseSeparateSections(const llvm::Triple );
 
+/// \p EnvVar is split by system delimiter for environment variables.
+/// If \p ArgName is "-I", "-L", or an empty string, each entry from \p EnvVar
+/// is prefixed by \p ArgName then added to \p Args. Otherwise, for each
+/// entry of \p EnvVar, \p ArgName is added to \p Args first, then the entry
+/// itself is added.
 void addDirectoryList(const llvm::opt::ArgList ,
   llvm::opt::ArgStringList , const char *ArgName,
   const char *EnvVar);
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -91,7 +91,7 @@
 return; // Nothing to do.
 
   StringRef Name(ArgName);
-  if (Name.equals("-I") || Name.equals("-L"))
+  if (Name.equals("-I") || Name.equals("-L") || Name.empty())
 CombinedArg = true;
 
   StringRef Dirs(DirList);


Index: clang/test/Driver/hip-device-libs.hip
===
--- clang/test/Driver/hip-device-libs.hip
+++ clang/test/Driver/hip-device-libs.hip
@@ -19,6 +19,13 @@
 // RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
 // RUN: 2>&1 | FileCheck %s --check-prefixes=COM,NOFLUSHD
 
+// Test environment variable HIP_DEVICE_LIB_PATH
+
+// RUN: HIP_DEVICE_LIB_PATH=%S/Inputs/hip_dev_lib \
+// RUN:   %clang -### -target x86_64-linux-gnu \
+// RUN:   -x hip --cuda-gpu-arch=gfx900 \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck %s --check-prefixes=COM
 
 // COM: {{"[^"]*clang[^"]*"}}
 // COM-SAME: "-mlink-builtin-bitcode" "{{.*}}hip.amdgcn.bc"
Index: clang/lib/Driver/ToolChains/HIP.cpp
===
--- clang/lib/Driver/ToolChains/HIP.cpp
+++ clang/lib/Driver/ToolChains/HIP.cpp
@@ -327,7 +327,7 @@
DriverArgs.getAllArgValues(options::OPT_hip_device_lib_path_EQ))
 LibraryPaths.push_back(DriverArgs.MakeArgString(Path));
 
-  addDirectoryList(DriverArgs, LibraryPaths, "-L", "HIP_DEVICE_LIB_PATH");
+  addDirectoryList(DriverArgs, LibraryPaths, "", "HIP_DEVICE_LIB_PATH");
 
   llvm::SmallVector BCLibs;
 
Index: clang/lib/Driver/ToolChains/CommonArgs.h
===
--- clang/lib/Driver/ToolChains/CommonArgs.h
+++ clang/lib/Driver/ToolChains/CommonArgs.h
@@ -94,6 +94,11 @@
 
 bool isUseSeparateSections(const llvm::Triple );
 
+/// \p EnvVar is split by system delimiter for environment variables.
+/// If \p ArgName is "-I", "-L", or an empty string, each entry from \p EnvVar
+/// is prefixed by \p ArgName then added to \p Args. Otherwise, for each
+/// entry of \p EnvVar, \p ArgName is added to \p Args first, then the entry
+/// itself is added.
 void addDirectoryList(const llvm::opt::ArgList ,
   llvm::opt::ArgStringList , const char *ArgName,
   const char *EnvVar);
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp

[PATCH] D73186: [AST] Add fixed-point multiplication constant evaluation.

2020-01-23 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments.



Comment at: clang/lib/Basic/FixedPoint.cpp:242
+  } else
+Overflowed = Result < Min || Result > Max;
+

ebevhan wrote:
> rjmccall wrote:
> > ebevhan wrote:
> > > ebevhan wrote:
> > > > rjmccall wrote:
> > > > > If the maximum expressible value is *k*, and the fully-precise 
> > > > > multiplication yields *k+e* for some epsilon *e* that isn't 
> > > > > representable in the result semantics, is that considered an 
> > > > > overflow?  If so, I think you need to do the shift after these bound 
> > > > > checks, since the shift destroys the difference between *k* and 
> > > > > *k+e*.  That is, unless there's a compelling mathematical argument 
> > > > > that it's not possible to overflow only in the fully-precision 
> > > > > multiplication — but while I think that's possibly true of `_Fract` 
> > > > > (since *k^2 < k*), it seems unlikely to be true of `_Accum`, although 
> > > > > I haven't looked for a counter-example.  And if there is a compelling 
> > > > > argument, it should probably be at least alluded to in a comment.
> > > > > 
> > > > > Would this algorithm be simpler if you took advantage of the fact 
> > > > > that `APFixedPointSemantics` doesn't have to correspond to a real 
> > > > > type?  You could probably just convert to a double-width common 
> > > > > semantics, right?
> > > > > If the maximum expressible value is *k*, and the fully-precise 
> > > > > multiplication yields *k+e* for some epsilon *e* that isn't 
> > > > > representable in the result semantics, is that considered an 
> > > > > overflow? If so, I think you need to do the shift after these bound 
> > > > > checks, since the shift destroys the difference between *k* and *k+e*.
> > > > 
> > > > I don't think I would consider that to be overflow; that's precision 
> > > > loss. E-C considers these to be different:
> > > > 
> > > > > If the source value cannot be represented exactly by the fixed-point 
> > > > > type, the source value is rounded to either the closest fixed-point 
> > > > > value greater than the source value (rounded up) or to the closest 
> > > > > fixed-point value less than the source value (rounded down).
> > > > >
> > > > > When the source value does not fit within the range of the 
> > > > > fixed-point type, the conversion overflows. [...]
> > > > >
> > > > > [...]
> > > > >
> > > > > If the result type of an arithmetic operation is a fixed-point type, 
> > > > > [...] the calculated result is the mathematically exact result with 
> > > > > overflow handling and rounding performed to the full precision of the 
> > > > > result type as explained in 4.1.3. 
> > > > 
> > > > There is also no value of `e` that would affect saturation. Any full 
> > > > precision calculation that gives `k+e` must be `k` after downscaling, 
> > > > since the bits that represent `e` must come from the extra precision 
> > > > range. Even though `k+e` is technically larger than `k`, saturation 
> > > > would still just give us `k` after truncating out `e`, so the end 
> > > > result is the same.
> > > > 
> > > > > Would this algorithm be simpler if you took advantage of the fact 
> > > > > that APFixedPointSemantics doesn't have to correspond to a real type? 
> > > > > You could probably just convert to a double-width common semantics, 
> > > > > right?
> > > > 
> > > > It's likely possible to use APFixedPoint in the calculations here, but 
> > > > I used APInt to make the behavior explicit and not accidentally be 
> > > > dependent on the behavior of APFixedPoint's conversions or operations.
> > > Although.,. I guess I see your point in that an intermediate result of 
> > > k+e technically "does not fit within the range of the fixed-point 
> > > type"... but I wonder if treating such cases as overflow is particularly 
> > > meaningful. I don't find there to be much of a distinction between such a 
> > > case and the case where the exact result lands inbetween two 
> > > representable values. We just end up with a less precise result.
> > Right, I was wondering if there was an accepted answer here.  For 
> > saturating arithmetic, it's equivalent to truncate this extra precision 
> > down to *k* or to saturate to the maximum representable value, since by 
> > assumption that was just *k*; but for non-saturating arithmetic, it affects 
> > whether the operation has UB.  All else being the same, it's better to have 
> > fewer corner-case sources of UB.
> > 
> > My read is that Embedded C is saying there's a sequence here: compute the 
> > exact mathematical result; round that to the precision of the result type; 
> > the operation overflows if the rounded result is not representable in the 
> > result type.  Is the rounding direction completely unspecified, down to 
> > being potentially operand-specific?  If so, we could just say that we 
> > always  round to avoid overflow if possible.  The main consideration here 
> > is that we need to give the 

[clang] 90e630a - Revert "[LTO/WPD] Enable aggressive WPD under LTO option"

2020-01-23 Thread Teresa Johnson via cfe-commits

Author: Teresa Johnson
Date: 2020-01-23T17:29:24-08:00
New Revision: 90e630a95ecc2cd615d631f684d61acc872ce37e

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

LOG: Revert "[LTO/WPD] Enable aggressive WPD under LTO option"

This reverts commit 59733525d37cf9ad88b5021b33ecdbaf2e18911c.

There is a windows sanitizer bot failure in one of the cfi tests
that I will need some time to figure out:
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/57155/steps/stage%201%20check/logs/stdio

Added: 


Modified: 
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/CodeGen/CGClass.cpp
clang/lib/CodeGen/CGVTables.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/test/CodeGen/thinlto-distributed-cfi-devirt.ll
clang/test/CodeGenCXX/cfi-mfcall.cpp
clang/test/CodeGenCXX/lto-visibility-inference.cpp
clang/test/CodeGenCXX/type-metadata.cpp
lld/ELF/Config.h
lld/ELF/Driver.cpp
lld/ELF/LTO.cpp
lld/ELF/Options.td
llvm/include/llvm/LTO/Config.h
llvm/include/llvm/Transforms/IPO.h
llvm/include/llvm/Transforms/IPO/LowerTypeTests.h
llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h
llvm/lib/LTO/LTO.cpp
llvm/lib/LTO/LTOCodeGenerator.cpp
llvm/lib/LTO/ThinLTOCodeGenerator.cpp
llvm/lib/Transforms/IPO/LowerTypeTests.cpp
llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
llvm/test/ThinLTO/X86/cache-typeid-resolutions.ll
llvm/test/ThinLTO/X86/cfi-devirt.ll
llvm/test/ThinLTO/X86/devirt-after-icp.ll
llvm/test/ThinLTO/X86/devirt.ll
llvm/test/ThinLTO/X86/devirt2.ll
llvm/test/ThinLTO/X86/devirt_alias.ll
llvm/test/ThinLTO/X86/devirt_available_externally.ll
llvm/test/ThinLTO/X86/devirt_external_comdat_same_guid.ll
llvm/test/ThinLTO/X86/devirt_promote.ll
llvm/test/ThinLTO/X86/devirt_promote_legacy.ll
llvm/test/ThinLTO/X86/devirt_single_hybrid.ll
llvm/test/Transforms/WholeProgramDevirt/bad-read-from-vtable.ll
llvm/test/Transforms/WholeProgramDevirt/branch-funnel-threshold.ll
llvm/test/Transforms/WholeProgramDevirt/branch-funnel.ll
llvm/test/Transforms/WholeProgramDevirt/constant-arg.ll
llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl-check.ll
llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl.ll
llvm/test/Transforms/WholeProgramDevirt/expand-check.ll
llvm/test/Transforms/WholeProgramDevirt/export-nothing.ll
llvm/test/Transforms/WholeProgramDevirt/export-single-impl.ll
llvm/test/Transforms/WholeProgramDevirt/export-uniform-ret-val.ll
llvm/test/Transforms/WholeProgramDevirt/export-unique-ret-val.ll
llvm/test/Transforms/WholeProgramDevirt/export-unsuccessful-checked.ll
llvm/test/Transforms/WholeProgramDevirt/export-vcp.ll
llvm/test/Transforms/WholeProgramDevirt/non-constant-vtable.ll
llvm/test/Transforms/WholeProgramDevirt/pointer-vtable.ll
llvm/test/Transforms/WholeProgramDevirt/soa-vtable.ll
llvm/test/Transforms/WholeProgramDevirt/struct-vtable.ll
llvm/test/Transforms/WholeProgramDevirt/uniform-retval-invoke.ll
llvm/test/Transforms/WholeProgramDevirt/uniform-retval.ll
llvm/test/Transforms/WholeProgramDevirt/unique-retval.ll
llvm/test/Transforms/WholeProgramDevirt/vcp-accesses-memory.ll
llvm/test/Transforms/WholeProgramDevirt/vcp-decl.ll
llvm/test/Transforms/WholeProgramDevirt/vcp-no-this.ll
llvm/test/Transforms/WholeProgramDevirt/vcp-non-constant-arg.ll
llvm/test/Transforms/WholeProgramDevirt/vcp-too-wide-ints.ll
llvm/test/Transforms/WholeProgramDevirt/vcp-type-mismatch.ll
llvm/test/Transforms/WholeProgramDevirt/vcp-uses-this.ll
llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-begin.ll
llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-check.ll
llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-end.ll
llvm/test/Transforms/WholeProgramDevirt/vtable-decl.ll
llvm/tools/gold/gold-plugin.cpp
llvm/tools/opt/opt.cpp

Removed: 
clang/test/CodeGenCXX/thinlto-distributed-type-metadata.cpp
lld/test/ELF/lto/devirt_vcall_vis_public.ll
llvm/test/ThinLTO/X86/devirt_vcall_vis_hidden.ll
llvm/test/ThinLTO/X86/devirt_vcall_vis_public.ll
llvm/test/tools/gold/X86/devirt_vcall_vis_public.ll



diff  --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index 6eff6bd7b7c2..f379c103b694 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -51,7 +51,6 @@
 #include "llvm/Transforms/Coroutines.h"
 #include "llvm/Transforms/IPO.h"
 #include "llvm/Transforms/IPO/AlwaysInliner.h"
-#include "llvm/Transforms/IPO/LowerTypeTests.h"
 #include "llvm/Transforms/IPO/PassManagerBuilder.h"
 #include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h"
 #include 

[PATCH] D72467: Remove "mask" operand from shufflevector.

2020-01-23 Thread Eli Friedman via Phabricator via cfe-commits
efriedma updated this revision to Diff 240071.
efriedma added a comment.

Addressed review comments.  Rebased.

Chris Tetreault mentioned offline that we might want to change the return value 
of `getShuffleMask()` now, to try to save some work later when we add more 
forms of scalable vector shuffle.  (Not actually changing the functionality of 
any code, just pre-emptively changing the types so we don't have to change code 
again if it doesn't actually examine the shuffle mask directly.)  I'll look 
into it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72467/new/

https://reviews.llvm.org/D72467

Files:
  clang/lib/CodeGen/CGExpr.cpp
  llvm/include/llvm/ADT/ArrayRef.h
  llvm/include/llvm/Analysis/ConstantFolding.h
  llvm/include/llvm/Analysis/InstructionSimplify.h
  llvm/include/llvm/Analysis/TargetFolder.h
  llvm/include/llvm/IR/ConstantFolder.h
  llvm/include/llvm/IR/Constants.h
  llvm/include/llvm/IR/IRBuilder.h
  llvm/include/llvm/IR/Instructions.h
  llvm/include/llvm/IR/NoFolder.h
  llvm/include/llvm/IR/PatternMatch.h
  llvm/lib/Analysis/ConstantFolding.cpp
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/lib/Analysis/TargetTransformInfo.cpp
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/lib/Analysis/VectorUtils.cpp
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/lib/IR/ConstantFold.cpp
  llvm/lib/IR/ConstantFold.h
  llvm/lib/IR/Constants.cpp
  llvm/lib/IR/ConstantsContext.h
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/Instruction.cpp
  llvm/lib/IR/Instructions.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp
  llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/MVETailPredication.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
  llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
  llvm/lib/Transforms/Scalar/GVN.cpp
  llvm/lib/Transforms/Scalar/GVNSink.cpp
  llvm/lib/Transforms/Scalar/NewGVN.cpp
  llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/unittests/IR/PatternMatch.cpp

Index: llvm/unittests/IR/PatternMatch.cpp
===
--- llvm/unittests/IR/PatternMatch.cpp
+++ llvm/unittests/IR/PatternMatch.cpp
@@ -991,31 +991,31 @@
   EXPECT_TRUE(match(EX3, m_ExtractElement(m_Constant(), m_ConstantInt(;
 
   // Test matching shufflevector
-  EXPECT_TRUE(match(SI1, m_ShuffleVector(m_Value(), m_Undef(), m_Zero(;
-  EXPECT_TRUE(match(SI2, m_ShuffleVector(m_Value(A), m_Value(B), m_Value(C;
+  ArrayRef Mask;
+  EXPECT_TRUE(match(SI1, m_ShuffleVector(m_Value(), m_Undef(), m_ZeroMask(;
+  EXPECT_TRUE(match(SI2, m_ShuffleVector(m_Value(A), m_Value(B), m_Mask(Mask;
   EXPECT_TRUE(A == VI3);
   EXPECT_TRUE(B == VI4);
-  EXPECT_TRUE(C == IdxVec);
   A = B = C = nullptr; // reset
 
   // Test matching the vector splat pattern
   EXPECT_TRUE(match(
   SI1,
   m_ShuffleVector(m_InsertElement(m_Undef(), m_SpecificInt(1), m_Zero()),
-  m_Undef(), m_Zero(;
+  m_Undef(), m_ZeroMask(;
   EXPECT_FALSE(match(
   SI3, m_ShuffleVector(m_InsertElement(m_Undef(), m_Value(), m_Zero()),
-   m_Undef(), m_Zero(;
+   m_Undef(), m_ZeroMask(;
   EXPECT_FALSE(match(
   SI4, m_ShuffleVector(m_InsertElement(m_Undef(), m_Value(), m_Zero()),
-   m_Undef(), m_Zero(;
+   m_Undef(), m_ZeroMask(;
   EXPECT_TRUE(match(
   SP1,
   m_ShuffleVector(m_InsertElement(m_Undef(), m_SpecificInt(2), m_Zero()),
-  m_Undef(), m_Zero(;
+  m_Undef(), m_ZeroMask(;
   EXPECT_TRUE(match(
   SP2, m_ShuffleVector(m_InsertElement(m_Undef(), m_Value(A), m_Zero()),
-   m_Undef(), m_Zero(;
+   m_Undef(), m_ZeroMask(;
   EXPECT_TRUE(A == Val);
 }
 
Index: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
===
--- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -3400,7 +3400,7 @@
 auto *O1 = 

[PATCH] D73072: [Driver][CodeGen] Support -fpatchable-function-entry=N,M and __attribute__((patchable_function_entry(N,M))) where M>0

2020-01-23 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon question-circle color=gray} Unit tests: unknown.

{icon question-circle color=gray} clang-tidy: unknown.

{icon question-circle color=gray} clang-format: unknown.

Build artifacts 
: 
diff.json 
,
 console-log.txt 


//Pre-merge checks is in beta. Report issue 
.
 Please join beta  or enable 
it for your project 
.//


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73072/new/

https://reviews.llvm.org/D73072



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


[PATCH] D70351: [clang][WIP][clang-scan-deps] Add an experimental C API.

2020-01-23 Thread Michael Spencer via Phabricator via cfe-commits
Bigcheese added a comment.

I was finally able to land the patch this depended on.  Still waiting on review 
for this. In the meantime I've tested this ABI out by building a simple program 
that outputs a ninja file given a command line. It depends on a bunch of 
changes to the Clang side of things, but no changes to this interface.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70351/new/

https://reviews.llvm.org/D70351



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


[PATCH] D73072: [Driver][CodeGen] Support -fpatchable-function-entry=N,M and __attribute__((patchable_function_entry(N,M))) where M>0

2020-01-23 Thread Fangrui Song via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG69bf40c45fd7: [Driver][CodeGen] Support 
-fpatchable-function-entry=N,M and __attribute__… (authored by MaskRay).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73072/new/

https://reviews.llvm.org/D73072

Files:
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Driver/CC1Options.td
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/CodeGen/patchable-function-entry.c
  clang/test/Driver/fpatchable-function-entry.c
  clang/test/Sema/patchable-function-entry-attr.c

Index: clang/test/Sema/patchable-function-entry-attr.c
===
--- clang/test/Sema/patchable-function-entry-attr.c
+++ clang/test/Sema/patchable-function-entry-attr.c
@@ -13,5 +13,5 @@
 // expected-error@+1 {{'patchable_function_entry' attribute requires parameter 0 to be an integer constant}}
 __attribute__((patchable_function_entry(i))) void f();
 
-// expected-error@+1 {{'patchable_function_entry' attribute requires integer constant between 0 and 0 inclusive}}
-__attribute__((patchable_function_entry(1, 1))) void f();
+// expected-error@+1 {{'patchable_function_entry' attribute requires integer constant between 0 and 2 inclusive}}
+__attribute__((patchable_function_entry(2, 3))) void f();
Index: clang/test/Driver/fpatchable-function-entry.c
===
--- clang/test/Driver/fpatchable-function-entry.c
+++ clang/test/Driver/fpatchable-function-entry.c
@@ -4,12 +4,14 @@
 // RUN: %clang -target aarch64 %s -fpatchable-function-entry=1,0 -c -### 2>&1 | FileCheck %s
 // CHECK: "-fpatchable-function-entry=1"
 
+// RUN: %clang -target aarch64 -fsyntax-only %s -fpatchable-function-entry=1,1 -c -### 2>&1 | FileCheck --check-prefix=11 %s
+// 11: "-fpatchable-function-entry=1" "-fpatchable-function-entry-offset=1"
+// RUN: %clang -target aarch64 -fsyntax-only %s -fpatchable-function-entry=2,1 -c -### 2>&1 | FileCheck --check-prefix=21 %s
+// 21: "-fpatchable-function-entry=2" "-fpatchable-function-entry-offset=1"
+
 // RUN: not %clang -target ppc64 -fsyntax-only %s -fpatchable-function-entry=1 2>&1 | FileCheck --check-prefix=TARGET %s
 // TARGET: error: unsupported option '-fpatchable-function-entry=1' for target 'ppc64'
 
-// RUN: not %clang -target i386 -fsyntax-only %s -fpatchable-function-entry=1,1 2>&1 | FileCheck --check-prefix=NONZERO %s
-// NONZERO: error: the second argument of '-fpatchable-function-entry' must be 0 or omitted
-
 // RUN: not %clang -target x86_64 -fsyntax-only %s -fpatchable-function-entry=1,0, 2>&1 | FileCheck --check-prefix=EXCESS %s
 // EXCESS: error: invalid argument '1,0,' to -fpatchable-function-entry=
 
Index: clang/test/CodeGen/patchable-function-entry.c
===
--- clang/test/CodeGen/patchable-function-entry.c
+++ clang/test/CodeGen/patchable-function-entry.c
@@ -17,10 +17,20 @@
 __attribute__((patchable_function_entry(2, 0))) void f20decl();
 void f20decl() {}
 
-// OPT: define void @f() #2
+// CHECK: define void @f44() #2
+__attribute__((patchable_function_entry(4, 4))) void f44() {}
+
+// CHECK: define void @f52() #3
+__attribute__((patchable_function_entry(5, 2))) void f52() {}
+
+// OPT: define void @f() #4
 void f() {}
 
-/// M in patchable_function_entry(N,M) is currently ignored.
-// CHECK: attributes #0 = { {{.*}} "patchable-function-entry"="0"
+/// No need to emit "patchable-function-entry"="0"
+// CHECK: attributes #0 = { {{.*}}
+// CHECK-NOT: "patchable-function-entry"
+
 // CHECK: attributes #1 = { {{.*}} "patchable-function-entry"="2"
-// OPT:   attributes #2 = { {{.*}} "patchable-function-entry"="1"
+// CHECK: attributes #2 = { {{.*}} "patchable-function-entry"="0" "patchable-function-prefix"="4"
+// CHECK: attributes #3 = { {{.*}} "patchable-function-entry"="3" "patchable-function-prefix"="2"
+// OPT:   attributes #4 = { {{.*}} "patchable-function-entry"="1"
Index: clang/lib/Sema/SemaDeclAttr.cpp
===
--- clang/lib/Sema/SemaDeclAttr.cpp
+++ clang/lib/Sema/SemaDeclAttr.cpp
@@ -4925,9 +4925,9 @@
 Expr *Arg = AL.getArgAsExpr(1);
 if (!checkUInt32Argument(S, AL, Arg, Offset, 1, true))
   return;
-if (Offset) {
+if (Count < Offset) {
   S.Diag(getAttrLoc(AL), diag::err_attribute_argument_out_of_range)
-  <<  << 0 << 0 << Arg->getBeginLoc();
+  <<  << 0 << Count << Arg->getBeginLoc();
   return;
 }
   }
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- 

[PATCH] D73072: [Driver][CodeGen] Support -fpatchable-function-entry=N,M and __attribute__((patchable_function_entry(N,M))) where M>0

2020-01-23 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay updated this revision to Diff 240064.
MaskRay retitled this revision from "[Driver][CodeGen] Support 
-fpatchable-function-entry=N,M where M>0" to "[Driver][CodeGen] Support 
-fpatchable-function-entry=N,M and 
__attribute__((patchable_function_entry(N,M))) where M>0".
MaskRay added a comment.

Fix Driver test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73072/new/

https://reviews.llvm.org/D73072

Files:
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Driver/CC1Options.td
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/CodeGen/patchable-function-entry.c
  clang/test/Driver/fpatchable-function-entry.c
  clang/test/Sema/patchable-function-entry-attr.c

Index: clang/test/Sema/patchable-function-entry-attr.c
===
--- clang/test/Sema/patchable-function-entry-attr.c
+++ clang/test/Sema/patchable-function-entry-attr.c
@@ -13,5 +13,5 @@
 // expected-error@+1 {{'patchable_function_entry' attribute requires parameter 0 to be an integer constant}}
 __attribute__((patchable_function_entry(i))) void f();
 
-// expected-error@+1 {{'patchable_function_entry' attribute requires integer constant between 0 and 0 inclusive}}
-__attribute__((patchable_function_entry(1, 1))) void f();
+// expected-error@+1 {{'patchable_function_entry' attribute requires integer constant between 0 and 2 inclusive}}
+__attribute__((patchable_function_entry(2, 3))) void f();
Index: clang/test/Driver/fpatchable-function-entry.c
===
--- clang/test/Driver/fpatchable-function-entry.c
+++ clang/test/Driver/fpatchable-function-entry.c
@@ -4,12 +4,14 @@
 // RUN: %clang -target aarch64 %s -fpatchable-function-entry=1,0 -c -### 2>&1 | FileCheck %s
 // CHECK: "-fpatchable-function-entry=1"
 
+// RUN: %clang -target aarch64 -fsyntax-only %s -fpatchable-function-entry=1,1 -c -### 2>&1 | FileCheck --check-prefix=11 %s
+// 11: "-fpatchable-function-entry=1" "-fpatchable-function-entry-offset=1"
+// RUN: %clang -target aarch64 -fsyntax-only %s -fpatchable-function-entry=2,1 -c -### 2>&1 | FileCheck --check-prefix=21 %s
+// 21: "-fpatchable-function-entry=2" "-fpatchable-function-entry-offset=1"
+
 // RUN: not %clang -target ppc64 -fsyntax-only %s -fpatchable-function-entry=1 2>&1 | FileCheck --check-prefix=TARGET %s
 // TARGET: error: unsupported option '-fpatchable-function-entry=1' for target 'ppc64'
 
-// RUN: not %clang -target i386 -fsyntax-only %s -fpatchable-function-entry=1,1 2>&1 | FileCheck --check-prefix=NONZERO %s
-// NONZERO: error: the second argument of '-fpatchable-function-entry' must be 0 or omitted
-
 // RUN: not %clang -target x86_64 -fsyntax-only %s -fpatchable-function-entry=1,0, 2>&1 | FileCheck --check-prefix=EXCESS %s
 // EXCESS: error: invalid argument '1,0,' to -fpatchable-function-entry=
 
Index: clang/test/CodeGen/patchable-function-entry.c
===
--- clang/test/CodeGen/patchable-function-entry.c
+++ clang/test/CodeGen/patchable-function-entry.c
@@ -17,10 +17,20 @@
 __attribute__((patchable_function_entry(2, 0))) void f20decl();
 void f20decl() {}
 
-// OPT: define void @f() #2
+// CHECK: define void @f44() #2
+__attribute__((patchable_function_entry(4, 4))) void f44() {}
+
+// CHECK: define void @f52() #3
+__attribute__((patchable_function_entry(5, 2))) void f52() {}
+
+// OPT: define void @f() #4
 void f() {}
 
-/// M in patchable_function_entry(N,M) is currently ignored.
-// CHECK: attributes #0 = { {{.*}} "patchable-function-entry"="0"
+/// No need to emit "patchable-function-entry"="0"
+// CHECK: attributes #0 = { {{.*}}
+// CHECK-NOT: "patchable-function-entry"
+
 // CHECK: attributes #1 = { {{.*}} "patchable-function-entry"="2"
-// OPT:   attributes #2 = { {{.*}} "patchable-function-entry"="1"
+// CHECK: attributes #2 = { {{.*}} "patchable-function-entry"="0" "patchable-function-prefix"="4"
+// CHECK: attributes #3 = { {{.*}} "patchable-function-entry"="3" "patchable-function-prefix"="2"
+// OPT:   attributes #4 = { {{.*}} "patchable-function-entry"="1"
Index: clang/lib/Sema/SemaDeclAttr.cpp
===
--- clang/lib/Sema/SemaDeclAttr.cpp
+++ clang/lib/Sema/SemaDeclAttr.cpp
@@ -4925,9 +4925,9 @@
 Expr *Arg = AL.getArgAsExpr(1);
 if (!checkUInt32Argument(S, AL, Arg, Offset, 1, true))
   return;
-if (Offset) {
+if (Count < Offset) {
   S.Diag(getAttrLoc(AL), diag::err_attribute_argument_out_of_range)
-  <<  << 0 << 0 << Arg->getBeginLoc();
+  <<  << 0 << Count << Arg->getBeginLoc();
   return;
 }
   }
Index: 

[clang] f394d22 - [Concepts] Update cxx_status.html with Concepts support status

2020-01-23 Thread Saar Raz via cfe-commits

Author: Saar Raz
Date: 2020-01-24T03:00:38+02:00
New Revision: f394d22fa82df03eaf72bf1876e2d63bbe6cd00f

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

LOG: [Concepts] Update cxx_status.html with Concepts support status

Concepts will be available with Clang 10 - update cxx_status.html to reflect
the papers that have been implemented.

Added: 


Modified: 
clang/www/cxx_status.html

Removed: 




diff  --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html
index 50a9d000699c..606b8c956f16 100755
--- a/clang/www/cxx_status.html
+++ b/clang/www/cxx_status.html
@@ -871,7 +871,7 @@ C++2a implementation status
 
   Concepts
   https://wg21.link/p0734r0;>P0734R0
-  No
+  Clang 10
 

 https://wg21.link/p0857r0;>P0857R0
@@ -884,15 +884,18 @@ C++2a implementation status
   

 https://wg21.link/p0848r3;>P0848R3
+No
   
   
 https://wg21.link/p1616r1;>P1616R1
+Clang 10
   
   
 https://wg21.link/p1452r2;>P1452R2
   

 https://wg21.link/p1972r0;>P1972R0
+No
   
   
 https://wg21.link/p1980r0;>P1980R0



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


[PATCH] D73007: [Sema] Avoid Wrange-loop-analysis false positives

2020-01-23 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment.

I'm in favor of splitting the warning into subgroups, then deciding which ones 
should be in -Wall.  We've done this with other warnings such as the conversion 
warnings and tautological compare warnings, with only a subset of them in -Wall.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73007/new/

https://reviews.llvm.org/D73007



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


[PATCH] D72867: [clangd] Support renaming designated initializers

2020-01-23 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev planned changes to this revision.
kbobyrev marked an inline comment as done.
kbobyrev added a comment.

Going to deal with nested designated inits soon and update the patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72867/new/

https://reviews.llvm.org/D72867



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


[PATCH] D72222: [Driver][CodeGen] Add -fpatchable-function-entry=N[,0]

2020-01-23 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D7#1837358 , @nickdesaulniers 
wrote:

> In D7#1837184 , @MaskRay wrote:
>
> > @peter.smith The build was smooth. Do I need other options to reproduce?
>
>
> I was able to reproduce:
>
>   $ git clone --depth 1 
> git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
>   $ cd linux-next
>   $ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang -j71 
> allyesconfig
>   $ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang -j71 
> mm/kasan/quarantine.o
>
>
> The exact compiler invocation (via tacking on `V=1` to the above `make` 
> command is:
>
>   $ clang -Wp,-MD,mm/kasan/.quarantine.o.d  -nostdinc -isystem 
> /android0/llvm-project/llvm/build/lib/clang/11.0.0/include 
> -I./arch/arm64/include -I./arch/arm64/include/generated  -I./include 
> -I./arch/arm64/include/uapi -I./arch/arm64/include/generated/uapi 
> -I./include/uapi -I./include/generated/uapi -include 
> ./include/linux/kconfig.h -include ./include/linux/compiler_types.h 
> -D__KERNEL__ -mlittle-endian -DCC_USING_PATCHABLE_FUNCTION_ENTRY 
> -DKASAN_SHADOW_SCALE_SHIFT=3 -Qunused-arguments -Wall -Wundef 
> -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common 
> -fshort-wchar -fno-PIE -Werror=implicit-function-declaration 
> -Werror=implicit-int -Wno-format-security -std=gnu89 
> --target=aarch64-linux-gnu --prefix=/usr/bin/ --gcc-toolchain=/usr 
> -no-integrated-as -Werror=unknown-warning-option -mgeneral-regs-only 
> -DCONFIG_CC_HAS_K_CONSTRAINT=1 -fno-asynchronous-unwind-tables 
> -DKASAN_SHADOW_SCALE_SHIFT=3 -fno-delete-null-pointer-checks 
> -Wno-address-of-packed-member -O2 -Wframe-larger-than=2048 
> -fstack-protector-strong -Wno-format-invalid-specifier -Wno-gnu 
> -Wno-tautological-compare -mno-global-merge -Wno-unused-const-variable 
> -fno-omit-frame-pointer -fno-optimize-sibling-calls 
> -ftrivial-auto-var-init=pattern -fpatchable-function-entry=2 
> -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -fno-strict-overflow 
> -fno-merge-all-constants -fno-stack-check -Werror=date-time 
> -Werror=incompatible-pointer-types -fmacro-prefix-map=./= 
> -Wno-initializer-overrides -Wno-format -Wno-sign-compare 
> -Wno-format-zero-length   -fno-builtin  
> -DKBUILD_MODFILE='"mm/kasan/quarantine"' -DKBUILD_BASENAME='"quarantine"' 
> -DKBUILD_MODNAME='"quarantine"' -c -o mm/kasan/quarantine.o 
> mm/kasan/quarantine.c
>
>   creduce spits out:
>
>
> // $ clang -O2 quarantine.i
>  __attribute__((patchable_function_entry(0))) a() {
>
>   b(({
> c:
>   &
>   }));
>
> }
>
>  


Thanks. Looks like the following is sufficient to reproduce. (I incorrectly 
thought an empty entry MachineBasicBlock was impossible.) I take the 
opportunity to add test coverage (testing debug-location: D73301 
)

  define void @foo() #0 {
  entry:
unreachable
  }
  
  attributes #0 = { "patchable-function-entry"="2" }

A -DLLVM_ENABLE_ASSERTIONS=on build is required to trigger the assertion 
failure. My `make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- HOSTGCC=gcc 
CC=~/llvm/ReleaseAssert/bin/clang LD=~/llvm/ReleaseAssert/bin/ld.lld 
O=/tmp/arm64 allmodconfig all -j 30` build succeeded. Now I will be in favor of 
pushing the bugfix to release/10.x .

Not clear about -fpatchable-function-entry=N,M where M>0 (D73070 
, D73071 , 
D73072 ). For completeness, I'd like them to 
be included in release/10.x so we will not have a clang 10 that does not work 
with M>0.

For `BTI c` issue, GCC has several releases that do not work with 
-mbranch-protection=bti. The Linux kernel has to develop some mechanism to 
detect the undesirable placement of `bti c`, if there are 
-mbranch-protection=bti users. So I don't think that inconsistency in clang 
10.0.0 with GCC will be a problem.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D7/new/

https://reviews.llvm.org/D7



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


[PATCH] D71313: [AST] Split parent map traversal logic into ParentMapContext.h

2020-01-23 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

I think I can land this version, but I'll wait until tomorrow so I'll be around 
to debug fallout.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71313/new/

https://reviews.llvm.org/D71313



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


[PATCH] D73307: Unique Names for Functions with Internal Linkage

2020-01-23 Thread Sriraman Tallam via Phabricator via cfe-commits
tmsriram created this revision.
tmsriram added reviewers: MaskRay, mehdi_amini, davidxl, pcc, rnk.
tmsriram added a parent revision: D68049: Propeller:  Clang options for basic 
block sections .

This is a subset of the functionality in Propeller patches.

This patch adds a new clang option, -funique-internal-funcnames, to generate 
unique names for functions with internal linkage.  This uses getUniqueModuleID 
and is a best effort and is highly likely that it will generate a unique name.


https://reviews.llvm.org/D73307

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/unique_internal_funcnames.c

Index: clang/test/CodeGen/unique_internal_funcnames.c
===
--- /dev/null
+++ clang/test/CodeGen/unique_internal_funcnames.c
@@ -0,0 +1,17 @@
+// REQUIRES: x86-registered-target
+
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -o - < %s | FileCheck %s --check-prefix=PLAIN
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -funique-internal-funcnames -fno-unique-internal-funcnames -o - < %s | FileCheck %s --check-prefix=PLAIN
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -funique-internal-funcnames -o - < %s | FileCheck %s --check-prefix=UNIQUE
+
+static int foo() {
+  return 0;
+}
+
+int (*bar())() {
+  return foo;
+}
+
+// PLAIN: foo:
+// UNIQUE-NOT: foo:
+// UNIQUE: foo.${{[0-9a-f]+}}
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -963,6 +963,8 @@
   Args.hasFlag(OPT_fstack_size_section, OPT_fno_stack_size_section, false);
   Opts.UniqueSectionNames = Args.hasFlag(OPT_funique_section_names,
  OPT_fno_unique_section_names, true);
+  Opts.UniqueInternalFuncNames = Args.hasFlag(
+  OPT_funique_internal_funcnames, OPT_fno_unique_internal_funcnames, false);
 
   Opts.MergeFunctions = Args.hasArg(OPT_fmerge_functions);
 
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4153,6 +4153,8 @@
 options::OPT_fno_function_sections,
 options::OPT_fdata_sections,
 options::OPT_fno_data_sections,
+options::OPT_funique_internal_funcnames,
+options::OPT_fno_unique_internal_funcnames,
 options::OPT_funique_section_names,
 options::OPT_fno_unique_section_names,
 options::OPT_mrestrict_it,
@@ -4695,6 +4697,10 @@
 options::OPT_fno_unique_section_names, true))
 CmdArgs.push_back("-fno-unique-section-names");
 
+  if (Args.hasFlag(options::OPT_funique_internal_funcnames,
+   options::OPT_fno_unique_internal_funcnames, false))
+CmdArgs.push_back("-funique-internal-funcnames");
+
   Args.AddLastArg(CmdArgs, options::OPT_finstrument_functions,
   options::OPT_finstrument_functions_after_inlining,
   options::OPT_finstrument_function_entry_bare);
Index: clang/lib/CodeGen/CodeGenModule.cpp
===
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -61,6 +61,7 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MD5.h"
 #include "llvm/Support/TimeProfiler.h"
+#include "llvm/Transforms/Utils/ModuleUtils.h"
 
 using namespace clang;
 using namespace CodeGen;
@@ -1101,6 +1102,18 @@
   const auto *ND = cast(GD.getDecl());
   std::string MangledName = getMangledNameImpl(*this, GD, ND);
 
+  // With option -funique-internal-funcnames, functions with internal linkage
+  // should get unique names.  Use "getUniqueModuleId" to get a unique
+  // identifier and this is a best effort.
+  if (getCodeGenOpts().UniqueInternalFuncNames &&
+  dyn_cast(GD.getDecl()) &&
+  this->getFunctionLinkage(GD) == llvm::GlobalValue::InternalLinkage) {
+std::string UniqueSuffix = getUniqueModuleId((), true);
+if (!UniqueSuffix.empty()) {
+  MangledName = MangledName + '.' + UniqueSuffix;
+}
+  }
+
   // Adjust kernel stub mangling as we may need to be able to differentiate
   // them from the kernel itself (e.g., for HIP).
   if (auto *FD = dyn_cast(GD.getDecl()))
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1952,6 +1952,12 @@
 def fno_unique_section_names : Flag <["-"], "fno-unique-section-names">,
   Group, Flags<[CC1Option]>;
 
+def funique_internal_funcnames : Flag <["-"], "funique-internal-funcnames">,
+  Group, Flags<[CC1Option]>,

[PATCH] D71313: [AST] Split parent map traversal logic into ParentMapContext.h

2020-01-23 Thread Reid Kleckner via Phabricator via cfe-commits
rnk updated this revision to Diff 240050.
rnk added a comment.
This revision is now accepted and ready to land.

- Move things around while retaining API compatibility for getParents


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71313/new/

https://reviews.llvm.org/D71313

Files:
  
clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
  clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
  clang-tools-extra/clang-tidy/utils/ExprSequence.cpp
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/ASTNodeTraverser.h
  clang/include/clang/AST/ParentMapContext.h
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/CMakeLists.txt
  clang/lib/AST/Linkage.h
  clang/lib/AST/ParentMapContext.cpp
  clang/lib/ASTMatchers/ASTMatchFinder.cpp
  clang/lib/ASTMatchers/ASTMatchersInternal.cpp
  clang/lib/CodeGen/CGCall.h
  clang/lib/Tooling/ASTDiff/ASTDiff.cpp
  clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
  lldb/include/lldb/Symbol/TypeSystemClang.h

Index: lldb/include/lldb/Symbol/TypeSystemClang.h
===
--- lldb/include/lldb/Symbol/TypeSystemClang.h
+++ lldb/include/lldb/Symbol/TypeSystemClang.h
@@ -21,6 +21,7 @@
 #include 
 
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/ASTFwd.h"
 #include "clang/AST/TemplateBase.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/SmallVector.h"
Index: clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
===
--- clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
+++ clang/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp
@@ -15,6 +15,7 @@
 
 #include "clang/Tooling/Refactoring/Rename/USRLocFinder.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/ParentMapContext.h"
 #include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
Index: clang/lib/Tooling/ASTDiff/ASTDiff.cpp
===
--- clang/lib/Tooling/ASTDiff/ASTDiff.cpp
+++ clang/lib/Tooling/ASTDiff/ASTDiff.cpp
@@ -12,6 +12,7 @@
 
 #include "clang/Tooling/ASTDiff/ASTDiff.h"
 
+#include "clang/AST/ParentMapContext.h"
 #include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/Lex/Lexer.h"
 #include "llvm/ADT/PriorityQueue.h"
Index: clang/lib/CodeGen/CGCall.h
===
--- clang/lib/CodeGen/CGCall.h
+++ clang/lib/CodeGen/CGCall.h
@@ -16,6 +16,7 @@
 
 #include "CGValue.h"
 #include "EHScopeStack.h"
+#include "clang/AST/ASTFwd.h"
 #include "clang/AST/CanonicalType.h"
 #include "clang/AST/GlobalDecl.h"
 #include "clang/AST/Type.h"
Index: clang/lib/ASTMatchers/ASTMatchersInternal.cpp
===
--- clang/lib/ASTMatchers/ASTMatchersInternal.cpp
+++ clang/lib/ASTMatchers/ASTMatchersInternal.cpp
@@ -15,6 +15,7 @@
 #include "clang/AST/ASTTypeTraits.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclTemplate.h"
+#include "clang/AST/ParentMapContext.h"
 #include "clang/AST/PrettyPrinter.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Basic/LLVM.h"
@@ -237,7 +238,8 @@
   TraversalKindScope RAII(Finder->getASTContext(),
   Implementation->TraversalKind());
 
-  auto N = Finder->getASTContext().traverseIgnored(DynNode);
+  auto N =
+  Finder->getASTContext().getParentMapContext().traverseIgnored(DynNode);
 
   if (RestrictKind.isBaseOf(N.getNodeKind()) &&
   Implementation->dynMatches(N, Finder, Builder)) {
@@ -256,7 +258,8 @@
   TraversalKindScope raii(Finder->getASTContext(),
   Implementation->TraversalKind());
 
-  auto N = Finder->getASTContext().traverseIgnored(DynNode);
+  auto N =
+  Finder->getASTContext().getParentMapContext().traverseIgnored(DynNode);
 
   assert(RestrictKind.isBaseOf(N.getNodeKind()));
   if (Implementation->dynMatches(N, Finder, Builder)) {
Index: clang/lib/ASTMatchers/ASTMatchFinder.cpp
===
--- clang/lib/ASTMatchers/ASTMatchFinder.cpp
+++ clang/lib/ASTMatchers/ASTMatchFinder.cpp
@@ -143,11 +143,14 @@
 Stmt *StmtToTraverse = StmtNode;
 if (auto *ExprNode = dyn_cast_or_null(StmtNode)) {
   auto *LambdaNode = dyn_cast_or_null(StmtNode);
-  if (LambdaNode && Finder->getASTContext().getTraversalKind() ==
-  ast_type_traits::TK_IgnoreUnlessSpelledInSource)
+  if (LambdaNode &&
+  Finder->getASTContext().getParentMapContext().getTraversalKind() ==
+  ast_type_traits::TK_IgnoreUnlessSpelledInSource)
 StmtToTraverse = LambdaNode;
   else
-StmtToTraverse = Finder->getASTContext().traverseIgnored(ExprNode);
+StmtToTraverse =
+

[clang] 19c7698 - Fix bot failure from 59733525d37cf9ad88b5021b33ecdbaf2e18911c

2020-01-23 Thread Teresa Johnson via cfe-commits

Author: Teresa Johnson
Date: 2020-01-23T16:34:34-08:00
New Revision: 19c76989bb505c3117730c47df85fd3800ea2767

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

LOG: Fix bot failure from 59733525d37cf9ad88b5021b33ecdbaf2e18911c

Fix bot failure by loosening up the register matching on new test:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-new-pass-manager-fast/builds/2423

Added: 


Modified: 
clang/test/CodeGenCXX/thinlto-distributed-type-metadata.cpp

Removed: 




diff  --git a/clang/test/CodeGenCXX/thinlto-distributed-type-metadata.cpp 
b/clang/test/CodeGenCXX/thinlto-distributed-type-metadata.cpp
index 7e1cedffde6d..a6c0da2e4c3c 100644
--- a/clang/test/CodeGenCXX/thinlto-distributed-type-metadata.cpp
+++ b/clang/test/CodeGenCXX/thinlto-distributed-type-metadata.cpp
@@ -22,7 +22,7 @@
 // OPT-NOT: call void @llvm.assume
 // We should have only one @llvm.assume call, the one that was expanded
 // from the builtin in the IR below, not the one fed by the type test.
-// OPT: %cmp = icmp ne %struct.A* %0, null
+// OPT: %cmp = icmp ne %struct.A* %{{.*}}, null
 // OPT: void @llvm.assume(i1 %cmp)
 // Check after the builtin assume again that we don't have a type test assume
 // sequence.



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


[PATCH] D73236: [clang-tidy] Add clang-tidy headers to clang distribution

2020-01-23 Thread Dmitry Polukhin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG301a437250b0: [clang-tidy] Add clang-tidy headers to clang 
distribution (authored by DmitryPolukhin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73236/new/

https://reviews.llvm.org/D73236

Files:
  clang-tools-extra/clang-tidy/CMakeLists.txt


Index: clang-tools-extra/clang-tidy/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -94,3 +94,19 @@
 add_subdirectory(plugin)
 add_subdirectory(tool)
 add_subdirectory(utils)
+
+if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+  install(DIRECTORY .
+DESTINATION include/clang-tidy
+COMPONENT clang-tidy-headers
+FILES_MATCHING
+PATTERN "*.h"
+)
+  add_custom_target(clang-tidy-headers)
+  set_target_properties(clang-tidy-headers PROPERTIES FOLDER "Misc")
+  if(NOT LLVM_ENABLE_IDE)
+add_llvm_install_targets(install-clang-tidy-headers
+ DEPENDS clang-tidy-headers
+ COMPONENT clang-tidy-headers)
+  endif()
+endif()


Index: clang-tools-extra/clang-tidy/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -94,3 +94,19 @@
 add_subdirectory(plugin)
 add_subdirectory(tool)
 add_subdirectory(utils)
+
+if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+  install(DIRECTORY .
+DESTINATION include/clang-tidy
+COMPONENT clang-tidy-headers
+FILES_MATCHING
+PATTERN "*.h"
+)
+  add_custom_target(clang-tidy-headers)
+  set_target_properties(clang-tidy-headers PROPERTIES FOLDER "Misc")
+  if(NOT LLVM_ENABLE_IDE)
+add_llvm_install_targets(install-clang-tidy-headers
+ DEPENDS clang-tidy-headers
+ COMPONENT clang-tidy-headers)
+  endif()
+endif()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] 301a437 - [clang-tidy] Add clang-tidy headers to clang distribution

2020-01-23 Thread Dmitry Polukhin via cfe-commits

Author: Dmitry Polukhin
Date: 2020-01-23T16:29:08-08:00
New Revision: 301a437250b03de021e6da12a8e4a927ef48881e

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

LOG: [clang-tidy] Add clang-tidy headers to clang distribution

Summary:
Clang releases include static libraries for clang-tidy but corresponding
headers are missing in the tarball so these libraries are almost useless.
Clang-tidy libraries can be useful for build custom clang-tidy with
custom checks outside of llvm repo.

List of clang-tidy libraries included in clang 9.0.1 release:
lib/libclangTidyMPIModule.a
lib/libclangTidyPlugin.a
lib/libclangTidyBoostModule.a
lib/libclangTidyCERTModule.a
lib/libclangTidyAndroidModule.a
lib/libclangTidyPortabilityModule.a
lib/libclangTidyPerformanceModule.a
lib/libclangTidyOpenMPModule.a
lib/libclangTidyBugproneModule.a
lib/libclangTidyZirconModule.a
lib/libclangTidyCppCoreGuidelinesModule.a
lib/libclangTidyGoogleModule.a
lib/libclangTidyUtils.a
lib/libclangTidyHICPPModule.a
lib/libclangTidyModernizeModule.a
lib/libclangTidyLLVMModule.a
lib/libclangTidyAbseilModule.a
lib/libclangTidyReadabilityModule.a
lib/libclangTidyFuchsiaModule.a
lib/libclangTidyMiscModule.a
lib/libclangTidy.a
lib/libclangTidyObjCModule.a

Reviewers: smeenai, jdoerfert, alexfh, hokein, aaron.ballman

Subscribers: mgehre, mgorny, xazax.hun, cfe-commits

Tags: #clang-tools-extra, #clang

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

Added: 


Modified: 
clang-tools-extra/clang-tidy/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/CMakeLists.txt 
b/clang-tools-extra/clang-tidy/CMakeLists.txt
index 6dadb2717711..20800cf93750 100644
--- a/clang-tools-extra/clang-tidy/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -94,3 +94,19 @@ set(ALL_CLANG_TIDY_CHECKS ${ALL_CLANG_TIDY_CHECKS} 
PARENT_SCOPE)
 add_subdirectory(plugin)
 add_subdirectory(tool)
 add_subdirectory(utils)
+
+if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+  install(DIRECTORY .
+DESTINATION include/clang-tidy
+COMPONENT clang-tidy-headers
+FILES_MATCHING
+PATTERN "*.h"
+)
+  add_custom_target(clang-tidy-headers)
+  set_target_properties(clang-tidy-headers PROPERTIES FOLDER "Misc")
+  if(NOT LLVM_ENABLE_IDE)
+add_llvm_install_targets(install-clang-tidy-headers
+ DEPENDS clang-tidy-headers
+ COMPONENT clang-tidy-headers)
+  endif()
+endif()



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


[clang] 73eaf62 - [Concepts] Make constraint expressions unevaluated until satisfaction checking

2020-01-23 Thread Saar Raz via cfe-commits

Author: Saar Raz
Date: 2020-01-24T02:24:21+02:00
New Revision: 73eaf62463b4a29adf4194685af12d1a5d172987

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

LOG: [Concepts] Make constraint expressions unevaluated until satisfaction 
checking

As per P1980R0, constraint expressions are unevaluated operands, and their 
constituent atomic
constraints only become constant evaluated during satisfaction checking.

Change the evaluation context during parsing and instantiation of constraints 
to unevaluated.

Added: 
clang/test/SemaTemplate/cxx2a-constraint-exprs.cpp

Modified: 
clang/lib/Parse/ParseExpr.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp

Removed: 




diff  --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index ba7525ecf527..e0c53df992e8 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -234,7 +234,7 @@ ExprResult Parser::ParseCaseExpression(SourceLocation 
CaseLoc) {
 /// \endverbatim
 ExprResult Parser::ParseConstraintExpression() {
   EnterExpressionEvaluationContext ConstantEvaluated(
-  Actions, Sema::ExpressionEvaluationContext::ConstantEvaluated);
+  Actions, Sema::ExpressionEvaluationContext::Unevaluated);
   ExprResult LHS(ParseCastExpression(AnyCastExpr));
   ExprResult Res(ParseRHSOfBinaryExpression(LHS, prec::LogicalOr));
   if (Res.isUsable() && !Actions.CheckConstraintExpression(Res.get())) {
@@ -256,7 +256,7 @@ ExprResult Parser::ParseConstraintExpression() {
 ExprResult
 Parser::ParseConstraintLogicalAndExpression(bool IsTrailingRequiresClause) {
   EnterExpressionEvaluationContext ConstantEvaluated(
-  Actions, Sema::ExpressionEvaluationContext::ConstantEvaluated);
+  Actions, Sema::ExpressionEvaluationContext::Unevaluated);
   bool NotPrimaryExpression = false;
   auto ParsePrimary = [&] () {
 ExprResult E = ParseCastExpression(PrimaryExprOnly,

diff  --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp 
b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 92f6e0dc1c90..fbbab8f00703 100755
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1849,7 +1849,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(
   Expr *TrailingRequiresClause = D->getTrailingRequiresClause();
   if (TrailingRequiresClause) {
 EnterExpressionEvaluationContext ConstantEvaluated(
-SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
+SemaRef, Sema::ExpressionEvaluationContext::Unevaluated);
 ExprResult SubstRC = SemaRef.SubstExpr(TrailingRequiresClause,
TemplateArgs);
 if (SubstRC.isInvalid())
@@ -2189,7 +2189,7 @@ Decl *TemplateDeclInstantiator::VisitCXXMethodDecl(
   Expr *TrailingRequiresClause = D->getTrailingRequiresClause();
   if (TrailingRequiresClause) {
 EnterExpressionEvaluationContext ConstantEvaluated(
-SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
+SemaRef, Sema::ExpressionEvaluationContext::Unevaluated);
 ExprResult SubstRC = SemaRef.SubstExpr(TrailingRequiresClause,
TemplateArgs);
 if (SubstRC.isInvalid())
@@ -2529,8 +2529,6 @@ Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl(
 TemplateArgumentListInfo InstArgs;
 
 if (TemplArgInfo) {
-  EnterExpressionEvaluationContext ConstantEvaluated(
-SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
   InstArgs.setLAngleLoc(TemplArgInfo->LAngleLoc);
   InstArgs.setRAngleLoc(TemplArgInfo->RAngleLoc);
   if (SemaRef.Subst(TemplArgInfo->getTemplateArgs(),
@@ -3736,7 +3734,7 @@ 
TemplateDeclInstantiator::SubstTemplateParams(TemplateParameterList *L) {
   Expr *InstRequiresClause = nullptr;
   if (Expr *E = L->getRequiresClause()) {
 EnterExpressionEvaluationContext ConstantEvaluated(
-SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
+SemaRef, Sema::ExpressionEvaluationContext::Unevaluated);
 ExprResult Res = SemaRef.SubstExpr(E, TemplateArgs);
 if (Res.isInvalid() || !Res.isUsable()) {
   return nullptr;

diff  --git 
a/clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp 
b/clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp
index bc093a0fc50e..b45b57f6b924 100644
--- a/clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp
+++ b/clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp
@@ -39,8 +39,9 @@ namespace std_example {
   using dc1 = D_check; // expected-error{{constraints not satisfied for 
class template 'D_check' [with T = short]}}
 
   template
-  concept C2 = requires (T a) { // 

[PATCH] D71913: [LTO/WPD] Enable aggressive WPD under LTO option

2020-01-23 Thread Teresa Johnson via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG59733525d37c: [LTO/WPD] Enable aggressive WPD under LTO 
option (authored by tejohnson).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71913/new/

https://reviews.llvm.org/D71913

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/CodeGen/CGClass.cpp
  clang/lib/CodeGen/CGVTables.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/lib/CodeGen/ItaniumCXXABI.cpp
  clang/test/CodeGen/thinlto-distributed-cfi-devirt.ll
  clang/test/CodeGenCXX/cfi-mfcall.cpp
  clang/test/CodeGenCXX/lto-visibility-inference.cpp
  clang/test/CodeGenCXX/thinlto-distributed-type-metadata.cpp
  clang/test/CodeGenCXX/type-metadata.cpp
  lld/ELF/Config.h
  lld/ELF/Driver.cpp
  lld/ELF/LTO.cpp
  lld/ELF/Options.td
  lld/test/ELF/lto/devirt_vcall_vis_public.ll
  llvm/include/llvm/LTO/Config.h
  llvm/include/llvm/Transforms/IPO.h
  llvm/include/llvm/Transforms/IPO/LowerTypeTests.h
  llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h
  llvm/lib/LTO/LTO.cpp
  llvm/lib/LTO/LTOCodeGenerator.cpp
  llvm/lib/LTO/ThinLTOCodeGenerator.cpp
  llvm/lib/Transforms/IPO/LowerTypeTests.cpp
  llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
  llvm/test/ThinLTO/X86/cache-typeid-resolutions.ll
  llvm/test/ThinLTO/X86/cfi-devirt.ll
  llvm/test/ThinLTO/X86/devirt-after-icp.ll
  llvm/test/ThinLTO/X86/devirt.ll
  llvm/test/ThinLTO/X86/devirt2.ll
  llvm/test/ThinLTO/X86/devirt_alias.ll
  llvm/test/ThinLTO/X86/devirt_available_externally.ll
  llvm/test/ThinLTO/X86/devirt_external_comdat_same_guid.ll
  llvm/test/ThinLTO/X86/devirt_promote.ll
  llvm/test/ThinLTO/X86/devirt_promote_legacy.ll
  llvm/test/ThinLTO/X86/devirt_single_hybrid.ll
  llvm/test/ThinLTO/X86/devirt_vcall_vis_hidden.ll
  llvm/test/ThinLTO/X86/devirt_vcall_vis_public.ll
  llvm/test/Transforms/WholeProgramDevirt/bad-read-from-vtable.ll
  llvm/test/Transforms/WholeProgramDevirt/branch-funnel-threshold.ll
  llvm/test/Transforms/WholeProgramDevirt/branch-funnel.ll
  llvm/test/Transforms/WholeProgramDevirt/constant-arg.ll
  llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl-check.ll
  llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl.ll
  llvm/test/Transforms/WholeProgramDevirt/expand-check.ll
  llvm/test/Transforms/WholeProgramDevirt/export-nothing.ll
  llvm/test/Transforms/WholeProgramDevirt/export-single-impl.ll
  llvm/test/Transforms/WholeProgramDevirt/export-uniform-ret-val.ll
  llvm/test/Transforms/WholeProgramDevirt/export-unique-ret-val.ll
  llvm/test/Transforms/WholeProgramDevirt/export-unsuccessful-checked.ll
  llvm/test/Transforms/WholeProgramDevirt/export-vcp.ll
  llvm/test/Transforms/WholeProgramDevirt/non-constant-vtable.ll
  llvm/test/Transforms/WholeProgramDevirt/pointer-vtable.ll
  llvm/test/Transforms/WholeProgramDevirt/soa-vtable.ll
  llvm/test/Transforms/WholeProgramDevirt/struct-vtable.ll
  llvm/test/Transforms/WholeProgramDevirt/uniform-retval-invoke.ll
  llvm/test/Transforms/WholeProgramDevirt/uniform-retval.ll
  llvm/test/Transforms/WholeProgramDevirt/unique-retval.ll
  llvm/test/Transforms/WholeProgramDevirt/vcp-accesses-memory.ll
  llvm/test/Transforms/WholeProgramDevirt/vcp-decl.ll
  llvm/test/Transforms/WholeProgramDevirt/vcp-no-this.ll
  llvm/test/Transforms/WholeProgramDevirt/vcp-non-constant-arg.ll
  llvm/test/Transforms/WholeProgramDevirt/vcp-too-wide-ints.ll
  llvm/test/Transforms/WholeProgramDevirt/vcp-type-mismatch.ll
  llvm/test/Transforms/WholeProgramDevirt/vcp-uses-this.ll
  llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-begin.ll
  llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-check.ll
  llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-end.ll
  llvm/test/Transforms/WholeProgramDevirt/vtable-decl.ll
  llvm/test/tools/gold/X86/devirt_vcall_vis_public.ll
  llvm/tools/gold/gold-plugin.cpp
  llvm/tools/opt/opt.cpp

Index: llvm/tools/opt/opt.cpp
===
--- llvm/tools/opt/opt.cpp
+++ llvm/tools/opt/opt.cpp
@@ -54,6 +54,7 @@
 #include "llvm/Transforms/Coroutines.h"
 #include "llvm/Transforms/IPO/AlwaysInliner.h"
 #include "llvm/Transforms/IPO/PassManagerBuilder.h"
+#include "llvm/Transforms/IPO/WholeProgramDevirt.h"
 #include "llvm/Transforms/Utils/Cloning.h"
 #include "llvm/Transforms/Utils/Debugify.h"
 #include 
@@ -625,6 +626,13 @@
 return 1;
   }
 
+  // Enable testing of whole program devirtualization on this module by invoking
+  // the facility for updating public visibility to linkage unit visibility when
+  // specified by an internal option. This is normally done during LTO which is
+  // not performed via opt.
+  updateVCallVisibilityInModule(*M,
+/* WholeProgramVisibilityEnabledInLTO */ false);
+
   // Figure out what stream we are supposed to write to...
   std::unique_ptr Out;
   std::unique_ptr ThinLinkOut;
Index: llvm/tools/gold/gold-plugin.cpp

[PATCH] D72114: [MS] Overhaul how clang passes overaligned args on x86_32

2020-01-23 Thread Reid Kleckner via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2af74e27ed7d: [MS] Overhaul how clang passes overaligned 
args on x86_32 (authored by rnk).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72114/new/

https://reviews.llvm.org/D72114

Files:
  clang/include/clang/CodeGen/CGFunctionInfo.h
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/test/CodeGen/x86_32-arguments-win32.c
  clang/test/CodeGenCXX/inalloca-overaligned.cpp
  clang/test/CodeGenCXX/inalloca-vector.cpp

Index: clang/test/CodeGenCXX/inalloca-vector.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/inalloca-vector.cpp
@@ -0,0 +1,79 @@
+// RUN: %clang_cc1 -w -triple i686-pc-win32 -emit-llvm -o - %s | FileCheck %s
+
+// PR44395
+// MSVC passes up to three vectors in registers, and the rest indirectly. Check
+// that both are compatible with an inalloca prototype.
+
+struct NonTrivial {
+  NonTrivial();
+  NonTrivial(const NonTrivial );
+  unsigned handle;
+};
+
+typedef float __m128 __attribute__((__vector_size__(16), __aligned__(16)));
+__m128 gv128;
+
+// nt, w, and q will be in the inalloca pack.
+void receive_vec_128(NonTrivial nt, __m128 x, __m128 y, __m128 z, __m128 w, __m128 q) {
+  gv128 = x + y + z + w + q;
+}
+// CHECK-LABEL: define dso_local void  @"?receive_vec_128@@YAXUNonTrivial@@T__m128@@@Z"
+// CHECK-SAME: (<4 x float> inreg %x,
+// CHECK-SAME: <4 x float> inreg %y,
+// CHECK-SAME: <4 x float> inreg %z,
+// CHECK-SAME: <{ %struct.NonTrivial, <4 x float>*, <4 x float>* }>* inalloca %0)
+
+void pass_vec_128() {
+  __m128 z = {0};
+  receive_vec_128(NonTrivial(), z, z, z, z, z);
+}
+// CHECK-LABEL: define dso_local void @"?pass_vec_128@@YAXXZ"()
+// CHECK: getelementptr inbounds <{ %struct.NonTrivial, <4 x float>*, <4 x float>* }>, <{ %struct.NonTrivial, <4 x float>*, <4 x float>* }>* %{{[^,]*}}, i32 0, i32 0
+// CHECK: call x86_thiscallcc %struct.NonTrivial* @"??0NonTrivial@@QAE@XZ"(%struct.NonTrivial* %{{.*}})
+
+// Store q, store temp alloca.
+// CHECK: store <4 x float> %{{[^,]*}}, <4 x float>* %{{[^,]*}}, align 16
+// CHECK: getelementptr inbounds <{ %struct.NonTrivial, <4 x float>*, <4 x float>* }>, <{ %struct.NonTrivial, <4 x float>*, <4 x float>* }>* %{{[^,]*}}, i32 0, i32 1
+// CHECK: store <4 x float>* %{{[^,]*}}, <4 x float>** %{{[^,]*}}, align 4
+
+// Store w, store temp alloca.
+// CHECK: store <4 x float> %{{[^,]*}}, <4 x float>* %{{[^,]*}}, align 16
+// CHECK: getelementptr inbounds <{ %struct.NonTrivial, <4 x float>*, <4 x float>* }>, <{ %struct.NonTrivial, <4 x float>*, <4 x float>* }>* %{{[^,]*}}, i32 0, i32 2
+// CHECK: store <4 x float>* %{{[^,]*}}, <4 x float>** %{{[^,]*}}, align 4
+
+// CHECK: call void @"?receive_vec_128@@YAXUNonTrivial@@T__m128@@@Z"
+// CHECK-SAME: (<4 x float> inreg %{{[^,]*}},
+// CHECK-SAME: <4 x float> inreg %{{[^,]*}},
+// CHECK-SAME: <4 x float> inreg %{{[^,]*}},
+// CHECK-SAME: <{ %struct.NonTrivial, <4 x float>*, <4 x float>* }>* inalloca %{{[^,]*}})
+
+// w will be passed indirectly by register, and q will be passed indirectly, but
+// the pointer will be in memory.
+void __fastcall fastcall_receive_vec(__m128 x, __m128 y, __m128 z, __m128 w, int edx, __m128 q, NonTrivial nt) {
+  gv128 = x + y + z + w + q;
+}
+// CHECK-LABEL: define dso_local x86_fastcallcc void @"?fastcall_receive_vec@@Y{{[^"]*}}"
+// CHECK-SAME: (<4 x float> inreg %x,
+// CHECK-SAME: <4 x float> inreg %y,
+// CHECK-SAME: <4 x float> inreg %z,
+// CHECK-SAME: <4 x float>* inreg %0,
+// CHECK-SAME: i32 inreg %edx,
+// CHECK-SAME: <{ <4 x float>*, %struct.NonTrivial }>* inalloca %1)
+
+
+void __vectorcall vectorcall_receive_vec(double xmm0, double xmm1, double xmm2,
+ __m128 x, __m128 y, __m128 z,
+ __m128 w, int edx, __m128 q, NonTrivial nt) {
+  gv128 = x + y + z + w + q;
+}
+// FIXME: Enable these checks, clang generates wrong IR.
+// CHECK-LABEL: define dso_local x86_vectorcallcc void @"?vectorcall_receive_vec@@Y{{[^"]*}}"
+// CHECKX-SAME: (double inreg %xmm0,
+// CHECKX-SAME: double inreg %xmm1,
+// CHECKX-SAME: double inreg %xmm2,
+// CHECKX-SAME: <4 x float> inreg %x,
+// CHECKX-SAME: <4 x float> inreg %y,
+// CHECKX-SAME: <4 x float> inreg %z,
+// CHECKX-SAME: <4 x float>* inreg %0,
+// CHECKX-SAME: i32 inreg %edx,
+// CHECKX-SAME: <{ <4 x float>*, %struct.NonTrivial }>* inalloca %1)
Index: clang/test/CodeGenCXX/inalloca-overaligned.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/inalloca-overaligned.cpp
@@ -0,0 +1,52 @@
+// RUN: %clang_cc1 -fms-extensions -w -triple i386-pc-win32 -emit-llvm -o - %s | FileCheck %s
+
+// PR44395
+// MSVC passes overaligned types indirectly since MSVC 2015. Make sure that
+// works with inalloca.
+
+// FIXME: Pass non-trivial *and* overaligned types 

[clang] 2af74e2 - [MS] Overhaul how clang passes overaligned args on x86_32

2020-01-23 Thread Reid Kleckner via cfe-commits

Author: Reid Kleckner
Date: 2020-01-23T16:04:00-08:00
New Revision: 2af74e27ed7d0832cbdde9cb969aaca7a42e99f9

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

LOG: [MS] Overhaul how clang passes overaligned args on x86_32

MSVC 2013 would refuse to pass highly aligned things (typically vectors
and aggregates) by value. Users would receive this error:
  t.cpp(11) : error C2719: 'w': formal parameter with __declspec(align('32')) 
won't be aligned
  t.cpp(11) : error C2719: 'q': formal parameter with __declspec(align('32')) 
won't be aligned

However, in MSVC 2015, this behavior was changed, and highly aligned
things are now passed indirectly. To avoid breaking backwards
incompatibility, objects that do not have a *required* high alignment
(i.e. double) are still passed directly, even though they are not
naturally aligned. This change implements the new behavior of passing
things indirectly.

The new behavior is:
- up to three vector parameters can be passed in [XYZ]MM0-2
- remaining arguments with required alignment greater than 4 bytes are
  passed indirectly

Previously, MSVC never passed things truly indirectly, meaning clang
would always apply the byval attribute to indirect arguments. We had to
go to the trouble of adding inalloca so that non-trivially copyable C++
types could be passed in place without copying the object
representation. When inalloca was added, we asserted that all arguments
passed indirectly must use byval. With this change, that assert no
longer holds, and I had to update inalloca to handle that case. The
implicit sret pointer parameter was already handled this way, and this
change generalizes some of that logic to arguments.

There are two cases that this change leaves unfixed:
1. objects that are non-trivially copyable *and* overaligned
2. vectorcall + inalloca + vectors

For case 1, I need to touch C++ ABI code in MicrosoftCXXABI.cpp, so I
want to do it in a follow-up.

For case 2, my fix is one line, but it will require updating IR tests to
use lots of inreg, so I wanted to separate it out.

Related to D71915 and D72110

Fixes most of PR44395

Reviewed By: rjmccall, craig.topper, erichkeane

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

Added: 
clang/test/CodeGenCXX/inalloca-overaligned.cpp
clang/test/CodeGenCXX/inalloca-vector.cpp

Modified: 
clang/include/clang/CodeGen/CGFunctionInfo.h
clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGen/x86_32-arguments-win32.c

Removed: 




diff  --git a/clang/include/clang/CodeGen/CGFunctionInfo.h 
b/clang/include/clang/CodeGen/CGFunctionInfo.h
index 2a41ab9eece7..588c96afe402 100644
--- a/clang/include/clang/CodeGen/CGFunctionInfo.h
+++ b/clang/include/clang/CodeGen/CGFunctionInfo.h
@@ -88,6 +88,7 @@ class ABIArgInfo {
   Kind TheKind;
   bool PaddingInReg : 1;
   bool InAllocaSRet : 1;// isInAlloca()
+  bool InAllocaIndirect : 1;// isInAlloca()
   bool IndirectByVal : 1;   // isIndirect()
   bool IndirectRealign : 1; // isIndirect()
   bool SRetAfterThis : 1;   // isIndirect()
@@ -110,8 +111,8 @@ class ABIArgInfo {
 
 public:
   ABIArgInfo(Kind K = Direct)
-  : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
-TheKind(K), PaddingInReg(false), InAllocaSRet(false),
+  : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0), TheKind(K),
+PaddingInReg(false), InAllocaSRet(false), InAllocaIndirect(false),
 IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
 InReg(false), CanBeFlattened(false), SignExt(false) {}
 
@@ -185,9 +186,10 @@ class ABIArgInfo {
 AI.setInReg(true);
 return AI;
   }
-  static ABIArgInfo getInAlloca(unsigned FieldIndex) {
+  static ABIArgInfo getInAlloca(unsigned FieldIndex, bool Indirect = false) {
 auto AI = ABIArgInfo(InAlloca);
 AI.setInAllocaFieldIndex(FieldIndex);
+AI.setInAllocaIndirect(Indirect);
 return AI;
   }
   static ABIArgInfo getExpand() {
@@ -380,6 +382,15 @@ class ABIArgInfo {
 AllocaFieldIndex = FieldIndex;
   }
 
+  unsigned getInAllocaIndirect() const {
+assert(isInAlloca() && "Invalid kind!");
+return InAllocaIndirect;
+  }
+  void setInAllocaIndirect(bool Indirect) {
+assert(isInAlloca() && "Invalid kind!");
+InAllocaIndirect = Indirect;
+  }
+
   /// Return true if this field of an inalloca struct should be returned
   /// to implement a struct return calling convention.
   bool getInAllocaSRet() const {

diff  --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 3a50e2b103f6..5b03f37f4498 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -2339,6 +2339,9 @@ void CodeGenFunction::EmitFunctionProlog(const 
CGFunctionInfo ,
   auto FieldIndex = 

[PATCH] D73236: [clang-tidy] Add clang-tidy headers to clang distribution

2020-01-23 Thread Dmitry Polukhin via Phabricator via cfe-commits
DmitryPolukhin updated this revision to Diff 240037.
DmitryPolukhin added a comment.

remove `PATTERN ".svn" EXCLUDE`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73236/new/

https://reviews.llvm.org/D73236

Files:
  clang-tools-extra/clang-tidy/CMakeLists.txt


Index: clang-tools-extra/clang-tidy/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -94,3 +94,19 @@
 add_subdirectory(plugin)
 add_subdirectory(tool)
 add_subdirectory(utils)
+
+if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+  install(DIRECTORY .
+DESTINATION include/clang-tidy
+COMPONENT clang-tidy-headers
+FILES_MATCHING
+PATTERN "*.h"
+)
+  add_custom_target(clang-tidy-headers)
+  set_target_properties(clang-tidy-headers PROPERTIES FOLDER "Misc")
+  if(NOT LLVM_ENABLE_IDE)
+add_llvm_install_targets(install-clang-tidy-headers
+ DEPENDS clang-tidy-headers
+ COMPONENT clang-tidy-headers)
+  endif()
+endif()


Index: clang-tools-extra/clang-tidy/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -94,3 +94,19 @@
 add_subdirectory(plugin)
 add_subdirectory(tool)
 add_subdirectory(utils)
+
+if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+  install(DIRECTORY .
+DESTINATION include/clang-tidy
+COMPONENT clang-tidy-headers
+FILES_MATCHING
+PATTERN "*.h"
+)
+  add_custom_target(clang-tidy-headers)
+  set_target_properties(clang-tidy-headers PROPERTIES FOLDER "Misc")
+  if(NOT LLVM_ENABLE_IDE)
+add_llvm_install_targets(install-clang-tidy-headers
+ DEPENDS clang-tidy-headers
+ COMPONENT clang-tidy-headers)
+  endif()
+endif()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73236: [clang-tidy] Add clang-tidy headers to clang distribution

2020-01-23 Thread Dmitry Polukhin via Phabricator via cfe-commits
DmitryPolukhin marked an inline comment as done.
DmitryPolukhin added inline comments.



Comment at: clang-tools-extra/clang-tidy/CMakeLists.txt:104
+PATTERN "*.h"
+PATTERN ".svn" EXCLUDE
+)

alexfh wrote:
> Is this still relevant?
Perhaps no, but I still see it in number of case. I'll remove it here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73236/new/

https://reviews.llvm.org/D73236



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


[PATCH] D73007: [Sema] Avoid Wrange-loop-analysis false positives

2020-01-23 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert added a comment.

In D73007#1837271 , @aaronpuchert 
wrote:

> one could also argue that this is a bit harder to follow in a range-based for 
> loop.


This seems to be the argumentation of 
https://bugs.llvm.org/show_bug.cgi?id=32823#c0, so I guess it's Ok.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73007/new/

https://reviews.llvm.org/D73007



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


[PATCH] D67537: [clangd] Client-side support for inactive regions

2020-01-23 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon times-circle color=red} Unit tests: fail. 62144 tests passed, 5 failed 
and 811 were skipped.

  failed: libc++.std/language_support/cmp/cmp_partialord/partialord.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_strongeq/cmp.strongeq.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_strongord/strongord.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_weakeq/cmp.weakeq.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_weakord/weakord.pass.cpp

{icon times-circle color=red} clang-tidy: fail. clang-tidy found 2 errors and 0 
warnings 
.
 0 of them are added as review comments below (why? 
).

{icon times-circle color=red} clang-format: fail. Please format your changes 
with clang-format by running `git-clang-format HEAD^` or applying this patch 
.

Build artifacts 
: 
diff.json 
,
 clang-tidy.txt 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 


//Pre-merge checks is in beta. Report issue 
.
 Please join beta  or enable 
it for your project 
.//


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67537/new/

https://reviews.llvm.org/D67537



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


[PATCH] D73236: [clang-tidy] Add clang-tidy headers to clang distribution

2020-01-23 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

LG with an outstanding comment.




Comment at: clang-tools-extra/clang-tidy/CMakeLists.txt:104
+PATTERN "*.h"
+PATTERN ".svn" EXCLUDE
+)

Is this still relevant?


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73236/new/

https://reviews.llvm.org/D73236



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


[PATCH] D72811: [WIP][OPENMP5.0] allow lvalue for motion clause

2020-01-23 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

Thanks for working on this! While you are at it, `*this` is probably one of the 
most important ones to test and support.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72811/new/

https://reviews.llvm.org/D72811



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


[PATCH] D72811: [WIP][OPENMP5.0] allow lvalue for motion clause

2020-01-23 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen updated this revision to Diff 240029.
cchen added a comment.

Add a checker for locator (test is not complete yet).

The logic of finding basic decl in LocatorChecker:

- `int *B; omp target map(*B)`
  - B
- pointer count (* in type): 1
- deref count: 1
- B is basic decl since pointer count equal to deref count
- `int *B, l; omp target map(*(B+l))`
  - B
- pointer count (* in type): 1
- deref count: 1
- B is basic decl since pointer count equal to deref count
  - l
- pointer count (* in type): 0
- deref count: 1
- pointer count = 0, deref count 1 => not equal
- `int **B, **l; omp target map((B+**l)[1][2]`
  - B
- pointer count (* in type): 2
- deref count: 2 (2 array subscript)
- B is basic decl since pointer count equal to deref count
  - l
- pointer count (* in type): 2
- deref count: 4 (2 array subscript, 2 unary op)
- pointer count = 2, deref count 4 => not equal


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72811/new/

https://reviews.llvm.org/D72811

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/target_map_messages.cpp
  clang/test/OpenMP/target_parallel_for_map_messages.cpp
  clang/test/OpenMP/target_parallel_for_simd_map_messages.cpp
  clang/test/OpenMP/target_parallel_map_messages.cpp
  clang/test/OpenMP/target_simd_map_messages.cpp
  clang/test/OpenMP/target_teams_distribute_map_messages.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_map_messages.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_simd_map_messages.cpp
  clang/test/OpenMP/target_teams_distribute_simd_map_messages.cpp
  clang/test/OpenMP/target_teams_map_messages.cpp
  clang/test/OpenMP/target_update_codegen.cpp
  clang/test/OpenMP/target_update_from_messages.cpp
  clang/test/OpenMP/target_update_to_messages.cpp

Index: clang/test/OpenMP/target_update_to_messages.cpp
===
--- clang/test/OpenMP/target_update_to_messages.cpp
+++ clang/test/OpenMP/target_update_to_messages.cpp
@@ -94,7 +94,7 @@
 #pragma omp target update to(S2::S2sc)
 #pragma omp target update to(to)
 #pragma omp target update to(y x) // expected-error {{expected ',' or ')' in 'to' clause}}
-#pragma omp target update to(argc > 0 ? x : y) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}} 
+#pragma omp target update to(argc > 0 ? x : y)
 #pragma omp target update to(S1) // expected-error {{'S1' does not refer to a value}}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
 #pragma omp target update to(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
 #pragma omp target update to(ba)
@@ -106,7 +106,7 @@
 
 #pragma omp target update to(x, a[:2]) // expected-error {{subscripted value is not an array or pointer}}
 #pragma omp target update to(x, c[:]) // expected-error {{subscripted value is not an array or pointer}}
-#pragma omp target update to(x, (m+1)[2]) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}}
+#pragma omp target update to(x, (m+1)[2])
 #pragma omp target update to(s7.i, s7.a[:3])
 #pragma omp target update to(s7.s6[1].aa[0:5])
 #pragma omp target update to(x, s7.s6[:5].aa[6]) // expected-error {{OpenMP array section is not allowed here}}
@@ -147,7 +147,7 @@
 #pragma omp target update to(S2::S2sc)
 #pragma omp target update to(to)
 #pragma omp target update to(y x) // expected-error {{expected ',' or ')' in 'to' clause}}
-#pragma omp target update to(argc > 0 ? x : y) // expected-error {{expected expression containing only member accesses and/or array sections based on named variables}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+#pragma omp target update to(argc > 0 ? x : y)
 #pragma omp target update to(S1) // expected-error {{'S1' does not refer to a value}}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
 #pragma omp target update to(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
 #pragma omp target update to(ba)
@@ -159,7 +159,7 @@
 
 #pragma omp target update to(x, a[:2]) // expected-error {{subscripted value is not an array or pointer}}
 #pragma omp target update to(x, c[:]) // expected-error {{subscripted value is not an array or pointer}}
-#pragma omp target update to(x, (m+1)[2]) // expected-error {{expected expression containing only member accesses and/or array sections based on named variables}}
+#pragma omp target update to(x, (m+1)[2])
 #pragma omp target update to(s7.i, s7.a[:3])
 #pragma omp target update to(s7.s6[1].aa[0:5])
 #pragma omp target update to(x, 

[PATCH] D72222: [Driver][CodeGen] Add -fpatchable-function-entry=N[,0]

2020-01-23 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment.

In D7#1837116 , @MaskRay wrote:

> along with -mfentry, -mhotpatch (SystemZ specific), -mnop-mcount (x86, 
> SystemZ, -fno-pie specific), -mrecord-mcount (used to retire 
> `scripts/recordmcount.{pl,c}`).


This is a useful summary of similar tools, thank you for the survey. Indeed, 
many of these seem to be used to support tracing in the Linux kernel.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D7/new/

https://reviews.llvm.org/D7



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


[PATCH] D69868: Allow "callbr" to return non-void values

2020-01-23 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment.

In D69868#1836777 , @jyknight wrote:

> The idea of moving the copies to a new MachineBasicBlock seems a reasonable 
> solution. That said, it does mean there will be allocatable physical 
> registers which are live-in to the following block, which is generally not 
> allowed. As far as I can tell, I _think_ that should be fine in this 
> particular circumstance, but I'm a little uneasy that I might be missing some 
> reason why it'll be incorrect.


There are some passes (e.g. machine CSE; MachineCSE.cpp:692) that handle 
physical live-in registers before register allocation. Do those passes run 
after a pass which handles the physical live-in registers? (By "handle" I mean 
analyzes and/or modifies the machine IR so that physical live-ins are "okay".)

> I'm more uncomfortable with the scanning/splitting after-the-fact in 
> ScheduleDAGSDNodes.cpp, and then the successor lists subsequently being 
> incorrect. However, I wasn't immediately able to say what I'd suggest doing 
> instead, so I spent some time yesterday poking around with this patch to see 
> if I could find something that seemed better. I now believe it will be 
> cleaner to have the inline-asm tell SelectionDAGISel::FinishBasicBlock to 
> just emit the copies in another block, which we do in some other situations, 
> already. But, I'm still poking at that to see how it'll end up -- I can't say 
> I'm sure that's the right answer at the moment.

I looked at FinishBasicBlock at one point. I put it in EmitSchedule because I 
wanted to allow the basic block to go through any post processing that may 
occur. I can place it in FinishBasicBlock if you think it fits in there better.

As for the successor list, I justify it this way: The default behavior is 
exactly the same as executing the inline asm and continuing directly out as if 
it's straight line code. If INLINEASM_BR wasn't a terminator, we would add the 
COPYs directly after it and before the JMP. The only issue is whether the 
successors being on the copy block instead of the block containing the 
INLINEASM_BR would cause something to go wrong. Like you I was concerned about 
this. But I think that since the behavior is the same as if the two blocks were 
a single block (the assembly code isn't changed, etc.), and the fact that the 
successors being on the INLINEASM_BR block shouldn't affect any machine passes 
(i.e. no analysis or transformation should care, because the IR can't model 
potential branches by the asm), it should be okay. If you wish I could add a 
part to the machine instruction verifier to ensure that assumptions we're 
making are enforced.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69868/new/

https://reviews.llvm.org/D69868



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


[PATCH] D72222: [Driver][CodeGen] Add -fpatchable-function-entry=N[,0]

2020-01-23 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment.

In D7#1837184 , @MaskRay wrote:

> @peter.smith The build was smooth. Do I need other options to reproduce?


I was able to reproduce:

  $ git clone --depth 1 
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
  $ cd linux-next
  $ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang -j71 allyesconfig
  $ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang -j71 
mm/kasan/quarantine.o

The exact compiler invocation (via tacking on `V=1` to the above `make` command 
is:

  $ clang -Wp,-MD,mm/kasan/.quarantine.o.d  -nostdinc -isystem 
/android0/llvm-project/llvm/build/lib/clang/11.0.0/include 
-I./arch/arm64/include -I./arch/arm64/include/generated  -I./include 
-I./arch/arm64/include/uapi -I./arch/arm64/include/generated/uapi 
-I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h 
-include ./include/linux/compiler_types.h -D__KERNEL__ -mlittle-endian 
-DCC_USING_PATCHABLE_FUNCTION_ENTRY -DKASAN_SHADOW_SCALE_SHIFT=3 
-Qunused-arguments -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs 
-fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE 
-Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security 
-std=gnu89 --target=aarch64-linux-gnu --prefix=/usr/bin/ --gcc-toolchain=/usr 
-no-integrated-as -Werror=unknown-warning-option -mgeneral-regs-only 
-DCONFIG_CC_HAS_K_CONSTRAINT=1 -fno-asynchronous-unwind-tables 
-DKASAN_SHADOW_SCALE_SHIFT=3 -fno-delete-null-pointer-checks 
-Wno-address-of-packed-member -O2 -Wframe-larger-than=2048 
-fstack-protector-strong -Wno-format-invalid-specifier -Wno-gnu 
-Wno-tautological-compare -mno-global-merge -Wno-unused-const-variable 
-fno-omit-frame-pointer -fno-optimize-sibling-calls 
-ftrivial-auto-var-init=pattern -fpatchable-function-entry=2 
-Wdeclaration-after-statement -Wvla -Wno-pointer-sign -fno-strict-overflow 
-fno-merge-all-constants -fno-stack-check -Werror=date-time 
-Werror=incompatible-pointer-types -fmacro-prefix-map=./= 
-Wno-initializer-overrides -Wno-format -Wno-sign-compare 
-Wno-format-zero-length   -fno-builtin  
-DKBUILD_MODFILE='"mm/kasan/quarantine"' -DKBUILD_BASENAME='"quarantine"' 
-DKBUILD_MODNAME='"quarantine"' -c -o mm/kasan/quarantine.o 
mm/kasan/quarantine.c

creduce spits out:

  // $ clang -O2 quarantine.i
  __attribute__((patchable_function_entry(0))) a() {
b(({
  c:
&
}));
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D7/new/

https://reviews.llvm.org/D7



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


[PATCH] D73300: [clang-tidy] Add library for clang-tidy main function

2020-01-23 Thread Dmitry Polukhin via Phabricator via cfe-commits
DmitryPolukhin marked 2 inline comments as done.
DmitryPolukhin added a comment.

@Eugene.Zelenko thank you for the catch


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73300/new/

https://reviews.llvm.org/D73300



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


[PATCH] D73300: [clang-tidy] Add library for clang-tidy main function

2020-01-23 Thread Dmitry Polukhin via Phabricator via cfe-commits
DmitryPolukhin updated this revision to Diff 240025.
DmitryPolukhin added a comment.

Fix license text


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73300/new/

https://reviews.llvm.org/D73300

Files:
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
  clang-tools-extra/clang-tidy/tool/ClangTidyMain.h
  clang-tools-extra/clang-tidy/tool/ClangTidyToolMain.cpp

Index: clang-tools-extra/clang-tidy/tool/ClangTidyToolMain.cpp
===
--- /dev/null
+++ clang-tools-extra/clang-tidy/tool/ClangTidyToolMain.cpp
@@ -0,0 +1,21 @@
+//===--- tools/extra/clang-tidy/ClangTidyToolMain.cpp - Clang tidy tool ---===//
+//
+// 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
+//
+//===--===//
+///
+///  \file This file contains clang-tidy tool entry point main function.
+///
+///  This tool uses the Clang Tooling infrastructure, see
+///http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
+///  for details on setting it up with LLVM source tree.
+///
+//===--===//
+
+#include "ClangTidyMain.h"
+
+int main(int argc, const char **argv) {
+  return clang::tidy::clangTidyMain(argc, argv);
+}
Index: clang-tools-extra/clang-tidy/tool/ClangTidyMain.h
===
--- /dev/null
+++ clang-tools-extra/clang-tidy/tool/ClangTidyMain.h
@@ -0,0 +1,23 @@
+//===--- tools/extra/clang-tidy/ClangTidyMain.h - Clang tidy tool ---===//
+//
+// 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
+//
+//===--===//
+///
+///  \file This file declares clang-tidy tool main function.
+///
+///  This tool uses the Clang Tooling infrastructure, see
+///http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
+///  for details on setting it up with LLVM source tree.
+///
+//===--===//
+
+namespace clang {
+namespace tidy {
+
+int clangTidyMain(int argc, const char **argv);
+
+} // namespace tidy
+} // namespace clang
Index: clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
===
--- clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
+++ clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
@@ -327,7 +327,7 @@
   return FS;
 }
 
-static int clangTidyMain(int argc, const char **argv) {
+int clangTidyMain(int argc, const char **argv) {
   llvm::InitLLVM X(argc, argv);
   CommonOptionsParser OptionsParser(argc, argv, ClangTidyCategory,
 cl::ZeroOrMore);
@@ -488,7 +488,3 @@
 
 } // namespace tidy
 } // namespace clang
-
-int main(int argc, const char **argv) {
-  return clang::tidy::clangTidyMain(argc, argv);
-}
Index: clang-tools-extra/clang-tidy/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/tool/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/tool/CMakeLists.txt
@@ -5,8 +5,24 @@
   support
   )
 
-add_clang_tool(clang-tidy
+# Needed by LLVM's CMake checks because this file defines multiple targets.
+set(LLVM_OPTIONAL_SOURCES ClangTidyMain.cpp ClangTidyToolMain.cpp)
+
+add_clang_library(clangTidyMain
   ClangTidyMain.cpp
+
+  LINK_LIBS
+  clangAST
+  clangASTMatchers
+  clangBasic
+  clangTidy
+  ${ALL_CLANG_TIDY_CHECKS}
+  clangTooling
+  clangToolingCore
+  )
+
+add_clang_tool(clang-tidy
+  ClangTidyToolMain.cpp
   )
 add_dependencies(clang-tidy
   clang-resource-headers
@@ -22,6 +38,7 @@
 target_link_libraries(clang-tidy
   PRIVATE
   clangTidy
+  clangTidyMain
   ${ALL_CLANG_TIDY_CHECKS}
   )
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67537: [clangd] Client-side support for inactive regions

2020-01-23 Thread Nathan Ridge via Phabricator via cfe-commits
nridge updated this revision to Diff 240026.
nridge marked an inline comment as done.
nridge added a comment.

Inject the inactive code decoration type into Highligher.decorationTypes


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67537/new/

https://reviews.llvm.org/D67537

Files:
  clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
  
clang-tools-extra/clangd/clients/clangd-vscode/test/semantic-highlighting.test.ts

Index: clang-tools-extra/clangd/clients/clangd-vscode/test/semantic-highlighting.test.ts
===
--- clang-tools-extra/clangd/clients/clangd-vscode/test/semantic-highlighting.test.ts
+++ clang-tools-extra/clangd/clients/clangd-vscode/test/semantic-highlighting.test.ts
@@ -63,7 +63,8 @@
   test('Colorizer groups decorations correctly', async () => {
 const scopeTable = [
   [ 'variable' ], [ 'entity.type.function' ],
-  [ 'entity.type.function.method' ]
+  [ 'entity.type.function.method' ],
+  [ 'meta.disabled' ]
 ];
 // Create the scope source ranges the highlightings should be highlighted
 // at. Assumes the scopes used are the ones in the "scopeTable" variable.
@@ -80,6 +81,12 @@
   new vscode.Position(line.line,
   token.character + token.length)));
 });
+if (line.isInactive) {
+  scopeRanges[scopeRanges.length - 1].push(new vscode.Range(
+new vscode.Position(line.line, 0),
+new vscode.Position(line.line, 0)
+  ));
+}
   });
   return scopeRanges;
 };
@@ -121,7 +128,8 @@
 tokens : [
   {character : 1, length : 2, scopeIndex : 1},
   {character : 10, length : 2, scopeIndex : 2},
-]
+],
+isInactive: false
   },
   {
 line : 2,
@@ -129,7 +137,8 @@
   {character : 3, length : 2, scopeIndex : 1},
   {character : 6, length : 2, scopeIndex : 1},
   {character : 8, length : 2, scopeIndex : 2},
-]
+],
+isInactive: true
   },
 ];
 
@@ -144,7 +153,8 @@
   line : 1,
   tokens : [
 {character : 2, length : 1, scopeIndex : 0},
-  ]
+  ],
+  isInactive: false
 };
 highlighter.highlight(fileUri2, [ highlightingsInLine1 ]);
 assert.deepEqual(
Index: clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
===
--- clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
+++ clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
@@ -23,6 +23,8 @@
   // with its start position, length and the "lookup table" index of of the
   // semantic highlighting Text Mate scopes.
   tokens?: string;
+  // Whether the line is part of an inactive preprocessor branch.
+  isInactive?: boolean;
 }
 
 // A SemanticHighlightingToken decoded from the base64 data sent by clangd.
@@ -40,6 +42,8 @@
   line: number;
   // All SemanticHighlightingTokens on the line.
   tokens: SemanticHighlightingToken[];
+  // Whether the line is part of an inactive preprocessor branch.
+  isInactive: boolean;
 }
 
 // Language server push notification providing the semantic highlighting
@@ -122,7 +126,10 @@
 
   handleNotification(params: SemanticHighlightingParams) {
 const lines: SemanticHighlightingLine[] = params.lines.map(
-(line) => ({line : line.line, tokens : decodeTokens(line.tokens)}));
+  (line) => ({
+line: line.line, tokens: decodeTokens(line.tokens),
+isInactive: line.isInactive || false
+  }));
 this.highlighter.highlight(vscode.Uri.parse(params.textDocument.uri),
lines);
   }
@@ -161,6 +168,7 @@
   // SemanticHighlightingToken with scopeIndex i should have the decoration at
   // index i in this list.
   private decorationTypes: vscode.TextEditorDecorationType[] = [];
+  private inactiveDecorationIndex: number;
   // The clangd TextMate scope lookup table.
   private scopeLookupTable: string[][];
   constructor(scopeLookupTable: string[][]) {
@@ -180,7 +188,22 @@
   // theme is loaded.
   public initialize(themeRuleMatcher: ThemeRuleMatcher) {
 this.decorationTypes.forEach((t) => t.dispose());
-this.decorationTypes = this.scopeLookupTable.map((scopes) => {
+this.decorationTypes = this.scopeLookupTable.map((scopes, index) => {
+  if (scopes[0] == "meta.disabled") {
+this.inactiveDecorationIndex = index;
+return vscode.window.createTextEditorDecorationType({
+  isWholeLine: true,
+  // FIXME: Avoid hardcoding these colors.
+  light: {
+color: "rgb(100, 100, 100)",
+backgroundColor: "rgba(220, 220, 220, 0.3)"
+  },
+  dark: {
+color: "rgb(100, 100, 

[PATCH] D73299: [HIP] Fix environment variable HIP_DEVICE_LIB_PATH

2020-01-23 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

> If user sets HIP_DEVICE_LIB_PATH, this line in HIP.cpp
>  addDirectoryList(DriverArgs, LibraryPaths, "-L", "HIP_DEVICE_LIB_PATH");
>  adds -L to LibraryPaths. -L is
>  needed since otherwise addDirectoryList will insert an extra empty string.
>  However, the -L must be stripped before checking for existence in addBCLib.

The fact that "-I" and "-L" are prepended to the paths is an implementation 
detail.
IMO it would be better to fix addDirectoryList() so it can deal with empty 
prefixes, and document it in the CommonArgs.h.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73299/new/

https://reviews.llvm.org/D73299



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


[PATCH] D72467: Remove "mask" operand from shufflevector.

2020-01-23 Thread Eli Friedman via Phabricator via cfe-commits
efriedma marked 5 inline comments as done.
efriedma added inline comments.



Comment at: llvm/include/llvm/IR/IRBuilder.h:2551
+SmallVector IntMask;
+IntMask.assign(Mask.begin(), Mask.end());
+return CreateShuffleVector(V1, V2, IntMask, Name);

ctetreau wrote:
> [0 .. uint32_MAX] is wider than [0 .. int_MAX]. Assert the values are in 
> range somehow?
Either the resulting shuffle mask is invalid (and we'll assert later), or the 
input contained UINT_MAX, in which case we'll treat it as undef.



Comment at: llvm/include/llvm/IR/Instructions.h:2015
 
-  // allocate space for exactly three operands
+  // allocate space for exactly two operands
   void *operator new(size_t s) {

spatel wrote:
> This comment doesn't add value to me, so I'd just delete it. If we want to 
> keep it, should fix it to be a proper sentence with a capital letter and 
> period.
I think the comment is there to identify the magic number.  Maybe I should 
introduce a named constant ShuffleVectorInst::NumOperands to make that clear.



Comment at: llvm/include/llvm/IR/PatternMatch.h:1306
+
+struct m_ZeroMask {
+  bool match(ArrayRef Mask) {

spatel wrote:
> IIUC, this is meant to replace the current uses of m_Zero() or m_ZeroInt() 
> with shuffle pattern matching, but there's a logic difference because those 
> matchers allow undefs, but this does not? Are we missing unittests to catch 
> that case?
I guess we're missing tests, yes; I didn't see any failures.



Comment at: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1890
   for( unsigned i=0; i I've never looked in here before - what happens currently if the index is -1 
> (undef)?
The interpreter evaluates undef to zero, and therefore it behaves as if every 
undef is replaced with zero.

Using std::max here preserves the existing behavior.



Comment at: llvm/lib/IR/ConstantsContext.h:564
 case Instruction::ShuffleVector:
-  return new ShuffleVectorConstantExpr(Ops[0], Ops[1], Ops[2]);
+  return new ShuffleVectorConstantExpr(Ops[0], Ops[1], Indexes);
 case Instruction::InsertValue:

spatel wrote:
> (not familiar with this part)
> If we're using Indexes here, do we need to update the code/comments for 
> hasIndices()?
> 
>   /// Return true if this is an insertvalue or extractvalue expression,
>   /// and the getIndices() method may be used.
As part of constructing ConstantExprs, there's a map from ConstantExprKeyType 
to ConstantExpr, to ensure each expression is unique.  "Indexes" is just a list 
of integers, so I was reusing it as a shortcut, to try to avoid making an extra 
ArrayRef.  This only impacts the map itself, not the final ConstantExprs.

It looks like I missed that a few places use `hasIndices()` to check whether 
the ConstantExprKeyType key stores data in Indexes.  I should probably just add 
the extra member variable to make the logic clear, even if it wastes a tiny bit 
of stack space.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72467/new/

https://reviews.llvm.org/D72467



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


[PATCH] D73300: [clang-tidy] Add library for clang-tidy main function

2020-01-23 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added inline comments.



Comment at: clang-tools-extra/clang-tidy/tool/ClangTidyMain.h:5
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.

License seems to be old.



Comment at: clang-tools-extra/clang-tidy/tool/ClangTidyToolMain.cpp:5
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.

License seems to be old.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73300/new/

https://reviews.llvm.org/D73300



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


[PATCH] D72703: Add a warning, flags and pragmas to limit the number of pre-processor tokens in a translation unit

2020-01-23 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm :)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72703/new/

https://reviews.llvm.org/D72703



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


[PATCH] D73300: [clang-tidy] Add library for clang-tidy main function

2020-01-23 Thread Dmitry Polukhin via Phabricator via cfe-commits
DmitryPolukhin created this revision.
DmitryPolukhin added reviewers: smeenai, gribozavr, stephanemoore.
DmitryPolukhin added projects: clang-tools-extra, clang.
Herald added subscribers: xazax.hun, mgorny.

This library allows to create clang-tidy tools with custom checks outside of 
llvm repo
using prebuilt clang release tarball.

Test Plan:
Checked that clang-tidy works as before. New library exists in istall dir.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73300

Files:
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
  clang-tools-extra/clang-tidy/tool/ClangTidyMain.h
  clang-tools-extra/clang-tidy/tool/ClangTidyToolMain.cpp

Index: clang-tools-extra/clang-tidy/tool/ClangTidyToolMain.cpp
===
--- /dev/null
+++ clang-tools-extra/clang-tidy/tool/ClangTidyToolMain.cpp
@@ -0,0 +1,22 @@
+//===--- tools/extra/clang-tidy/ClangTidyMain.cpp - Clang tidy tool ---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+///
+///  \file This file contains clang-tidy tool entry point main function.
+///
+///  This tool uses the Clang Tooling infrastructure, see
+///http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
+///  for details on setting it up with LLVM source tree.
+///
+//===--===//
+
+#include "ClangTidyMain.h"
+
+int main(int argc, const char **argv) {
+  return clang::tidy::clangTidyMain(argc, argv);
+}
Index: clang-tools-extra/clang-tidy/tool/ClangTidyMain.h
===
--- /dev/null
+++ clang-tools-extra/clang-tidy/tool/ClangTidyMain.h
@@ -0,0 +1,24 @@
+//===--- tools/extra/clang-tidy/ClangTidyMain.h - Clang tidy tool ---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+///
+///  \file This file declares clang-tidy tool main function.
+///
+///  This tool uses the Clang Tooling infrastructure, see
+///http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
+///  for details on setting it up with LLVM source tree.
+///
+//===--===//
+
+namespace clang {
+namespace tidy {
+
+int clangTidyMain(int argc, const char **argv);
+
+} // namespace tidy
+} // namespace clang
Index: clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
===
--- clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
+++ clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
@@ -327,7 +327,7 @@
   return FS;
 }
 
-static int clangTidyMain(int argc, const char **argv) {
+int clangTidyMain(int argc, const char **argv) {
   llvm::InitLLVM X(argc, argv);
   CommonOptionsParser OptionsParser(argc, argv, ClangTidyCategory,
 cl::ZeroOrMore);
@@ -488,7 +488,3 @@
 
 } // namespace tidy
 } // namespace clang
-
-int main(int argc, const char **argv) {
-  return clang::tidy::clangTidyMain(argc, argv);
-}
Index: clang-tools-extra/clang-tidy/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/tool/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/tool/CMakeLists.txt
@@ -5,8 +5,24 @@
   support
   )
 
-add_clang_tool(clang-tidy
+# Needed by LLVM's CMake checks because this file defines multiple targets.
+set(LLVM_OPTIONAL_SOURCES ClangTidyMain.cpp ClangTidyToolMain.cpp)
+
+add_clang_library(clangTidyMain
   ClangTidyMain.cpp
+
+  LINK_LIBS
+  clangAST
+  clangASTMatchers
+  clangBasic
+  clangTidy
+  ${ALL_CLANG_TIDY_CHECKS}
+  clangTooling
+  clangToolingCore
+  )
+
+add_clang_tool(clang-tidy
+  ClangTidyToolMain.cpp
   )
 add_dependencies(clang-tidy
   clang-resource-headers
@@ -22,6 +38,7 @@
 target_link_libraries(clang-tidy
   PRIVATE
   clangTidy
+  clangTidyMain
   ${ALL_CLANG_TIDY_CHECKS}
   )
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D72222: [Driver][CodeGen] Add -fpatchable-function-entry=N[,0]

2020-01-23 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

> @hans To address the CI problem (https://reviews.llvm.org/D7#1836728) 
> reported by @peter.smith, we just need to delete the driver option in the 
> release/10.x branch. (I need a -E preproccessed file to investigate.)
>  I think we don't need to hurry. We can simply revert this patch (D7 
> ) a few days before 10.0.0.

Waiting until a few days before the release is not a good idea. If we know 
there is a problem, I'd like it to be fixed on the branch as soon as possible.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D7/new/

https://reviews.llvm.org/D7



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


[clang] 67c608a - [Concepts] Deprecate -fconcepts-ts, enable Concepts under -std=c++2a

2020-01-23 Thread Saar Raz via cfe-commits

Author: Saar Raz
Date: 2020-01-24T00:48:59+02:00
New Revision: 67c608a9695496cfc9d3fdf9d0b12b554ac6b4df

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

LOG: [Concepts] Deprecate -fconcepts-ts, enable Concepts under -std=c++2a

Now with concepts support merged and mostly complete, we do not need 
-fconcepts-ts
(which was also misleading as we were not implementing the TS) and can enable
concepts features under C++2a. A warning will be generated if users still 
attempt
to use -fconcepts-ts.

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticFrontendKinds.td
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Basic/TokenKinds.def
clang/include/clang/Driver/CC1Options.td
clang/lib/AST/DeclTemplate.cpp
clang/lib/Basic/IdentifierTable.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Frontend/InitPreprocessor.cpp
clang/lib/Parse/ParseTemplate.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/SemaType.cpp
clang/test/CXX/class.derived/class.virtual/p6.cpp
clang/test/CXX/class/class.compare/class.spaceship/p2.cpp
clang/test/CXX/dcl/dcl.decl/p3.cpp
clang/test/CXX/dcl/dcl.fct/p17.cpp
clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
clang/test/CXX/expr/expr.prim/expr.prim.id/mixed-constraints.cpp
clang/test/CXX/expr/expr.prim/expr.prim.id/p4.cpp

clang/test/CXX/expr/expr.prim/expr.prim.lambda/expr.prim.lambda.closure/p3.cpp
clang/test/CXX/expr/expr.prim/expr.prim.req/compound-requirement.cpp
clang/test/CXX/expr/expr.prim/expr.prim.req/equivalence.cpp
clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp
clang/test/CXX/expr/expr.prim/expr.prim.req/p3.cpp
clang/test/CXX/expr/expr.prim/expr.prim.req/requires-expr.cpp
clang/test/CXX/expr/expr.prim/expr.prim.req/simple-requirement.cpp
clang/test/CXX/expr/expr.prim/expr.prim.req/type-requirement.cpp
clang/test/CXX/over/over.match/over.match.best/p1-2a.cpp
clang/test/CXX/over/over.match/over.match.viable/p3.cpp
clang/test/CXX/over/over.over/p4-2a.cpp
clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp
clang/test/CXX/temp/temp.constr/temp.constr.constr/function-templates.cpp

clang/test/CXX/temp/temp.constr/temp.constr.constr/non-function-templates.cpp

clang/test/CXX/temp/temp.constr/temp.constr.constr/partial-specializations.cpp
clang/test/CXX/temp/temp.constr/temp.constr.decl/class-template-decl.cpp
clang/test/CXX/temp/temp.constr/temp.constr.decl/p3.cpp
clang/test/CXX/temp/temp.constr/temp.constr.normal/p1.cpp

clang/test/CXX/temp/temp.constr/temp.constr.order/class-template-partial-specializations.cpp
clang/test/CXX/temp/temp.constr/temp.constr.order/function-templates.cpp

clang/test/CXX/temp/temp.constr/temp.constr.order/var-template-partial-specializations.cpp
clang/test/CXX/temp/temp.explicit/p8.cpp
clang/test/CXX/temp/temp.param/p10-2a.cpp
clang/test/CodeGenCXX/mangle-concept.cpp
clang/test/Lexer/cxx-features.cpp
clang/test/Lexer/keywords_test.cpp
clang/test/PCH/cxx2a-requires-expr.cpp
clang/test/Parser/cxx-concept-declaration.cpp
clang/test/Parser/cxx-concepts-ambig-constraint-expr.cpp
clang/test/Parser/cxx-concepts-requires-clause.cpp
clang/test/Parser/cxx2a-concept-declaration.cpp
clang/test/Parser/cxx2a-concepts-requires-expr.cpp
clang/test/Parser/cxx2a-constrained-template-param-with-partial-id.cpp
clang/test/Parser/cxx2a-constrained-template-param.cpp
clang/test/Parser/cxx2a-placeholder-type-constraint.cpp
clang/test/SemaTemplate/cxx2a-constraint-caching.cpp
clang/test/SemaTemplate/instantiate-expanded-type-constraint.cpp
clang/test/SemaTemplate/instantiate-requires-clause.cpp
clang/test/SemaTemplate/instantiate-requires-expr.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticFrontendKinds.td 
b/clang/include/clang/Basic/DiagnosticFrontendKinds.td
index a798b498d4e9..ed2092fb4c84 100644
--- a/clang/include/clang/Basic/DiagnosticFrontendKinds.td
+++ b/clang/include/clang/Basic/DiagnosticFrontendKinds.td
@@ -105,6 +105,9 @@ def err_fe_invalid_wchar_type
 : Error<"invalid wchar_t type '%0'; must be one of 'char', 'short', 
'int'">;
 def err_fe_invalid_exception_model
: Error<"invalid exception model '%0' for target '%1'">;
+def warn_fe_concepts_ts_flag : Warning<
+  "-fconcepts-ts is deprecated - use '-std=c++2a' for Concepts support">,
+  InGroup;
 
 def warn_fe_serialized_diag_merge_failure : Warning<
 "unable to merge a subprocess's serialized diagnostics">,

diff  --git a/clang/include/clang/Basic/LangOptions.def 
b/clang/include/clang/Basic/LangOptions.def
index b8112eb26913..3319a3123976 100644
--- 

[PATCH] D73007: [Sema] Avoid Wrange-loop-analysis false positives

2020-01-23 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert added a comment.

I think we can actually view this in more general terms, unrelated to 
range-based for loops.

  // X is non-trivially copyable.
  struct X { X(const X&); };
  struct Y { Y(const X&); };
  
  X retVal();
  const X& retRef();
  
  // In function scope ...
  const X  = retVal(); // (1) Ok, but maybe misleading.
  const X  x2 = retRef(); // (2) Creates a copy that's unnecessary.
  const Y  = retVal(); // (3) Ok, but maybe misleading, and maybe not 
intended.
  const Y  = retRef(); // (4) Ok, but maybe misleading, and maybe not 
intended.

My point is that the standard explicitly allows binding temporaries to `const` 
references and mandates a lifetime extension for the temporary that makes this 
safe.

It definitely makes sense to warn about (2) in `-Wall` under certain 
circumstances, because it might be a performance issue. (We have the similar 
`-Wpessimizing-move`.) But (1) is a stylistic issue, and doesn't belong in 
`-Wall`. I'm somewhat uncertain about (3) and (4): these are implicit 
conversions at work and one could argue that we're not warning about them 
anywhere else, but one could also argue that this is a bit harder to follow in 
a range-based for loop.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73007/new/

https://reviews.llvm.org/D73007



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


[PATCH] D72553: [clang-tidy] Add performance-prefer-preincrement check

2020-01-23 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment.

Gonna throw it out there, those pre merge fails aren't anything to do with this 
patch


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72553/new/

https://reviews.llvm.org/D72553



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


[PATCH] D69825: [Clang][Driver] Re-use the calling process instead of creating a new process for the cc1 invocation

2020-01-23 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

In D69825#1837243 , @hctim wrote:

> For tracking purposes.
>
> The ASan leaks have been worked around in two separate patches in order to 
> make the bots green again:
>
> - c38e42527b21acee8d01a016d5bfa2fb83202e29 
> 
> - e174da447c180b586719cb28f7bd556e30625762 
> 


Thanks! I've cherry-picked these to the 10.x branch in 
2dd6b91f35edb967f329f0437b53ea14395aa770 
 and 
bfaba51f07d1b79ff6e71da106c2b7e153874b1d 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69825/new/

https://reviews.llvm.org/D69825



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


[PATCH] D73299: [HIP] Fix environment variable HIP_DEVICE_LIB_PATH

2020-01-23 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.
yaxunl added a reviewer: tra.

If user sets HIP_DEVICE_LIB_PATH, this line in HIP.cpp
addDirectoryList(DriverArgs, LibraryPaths, "-L", "HIP_DEVICE_LIB_PATH");
adds `-L` to LibraryPaths. `-L` is
needed since otherwise addDirectoryList will insert an extra empty string.
However, the `-L` must be stripped before checking for existence in addBCLib.

Patch by Greg Rodgers.


https://reviews.llvm.org/D73299

Files:
  clang/lib/Driver/ToolChains/HIP.cpp
  clang/test/Driver/hip-device-libs.hip


Index: clang/test/Driver/hip-device-libs.hip
===
--- clang/test/Driver/hip-device-libs.hip
+++ clang/test/Driver/hip-device-libs.hip
@@ -19,6 +19,13 @@
 // RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
 // RUN: 2>&1 | FileCheck %s --check-prefixes=COM,NOFLUSHD
 
+// Test environment variable HIP_DEVICE_LIB_PATH
+
+// RUN: HIP_DEVICE_LIB_PATH=%S/Inputs/hip_dev_lib \
+// RUN:   %clang -### -target x86_64-linux-gnu \
+// RUN:   -x hip --cuda-gpu-arch=gfx900 \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck %s --check-prefixes=COM
 
 // COM: {{"[^"]*clang[^"]*"}}
 // COM-SAME: "-mlink-builtin-bitcode" "{{.*}}hip.amdgcn.bc"
Index: clang/lib/Driver/ToolChains/HIP.cpp
===
--- clang/lib/Driver/ToolChains/HIP.cpp
+++ clang/lib/Driver/ToolChains/HIP.cpp
@@ -39,6 +39,8 @@
 SmallString<128> Path(LibraryPath);
 llvm::sys::path::append(Path, BCName);
 FullName = Path;
+if (FullName.startswith("-L"))
+  FullName = FullName.substr(2);
 if (llvm::sys::fs::exists(FullName)) {
   CmdArgs.push_back("-mlink-builtin-bitcode");
   CmdArgs.push_back(Args.MakeArgString(FullName));


Index: clang/test/Driver/hip-device-libs.hip
===
--- clang/test/Driver/hip-device-libs.hip
+++ clang/test/Driver/hip-device-libs.hip
@@ -19,6 +19,13 @@
 // RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
 // RUN: 2>&1 | FileCheck %s --check-prefixes=COM,NOFLUSHD
 
+// Test environment variable HIP_DEVICE_LIB_PATH
+
+// RUN: HIP_DEVICE_LIB_PATH=%S/Inputs/hip_dev_lib \
+// RUN:   %clang -### -target x86_64-linux-gnu \
+// RUN:   -x hip --cuda-gpu-arch=gfx900 \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck %s --check-prefixes=COM
 
 // COM: {{"[^"]*clang[^"]*"}}
 // COM-SAME: "-mlink-builtin-bitcode" "{{.*}}hip.amdgcn.bc"
Index: clang/lib/Driver/ToolChains/HIP.cpp
===
--- clang/lib/Driver/ToolChains/HIP.cpp
+++ clang/lib/Driver/ToolChains/HIP.cpp
@@ -39,6 +39,8 @@
 SmallString<128> Path(LibraryPath);
 llvm::sys::path::append(Path, BCName);
 FullName = Path;
+if (FullName.startswith("-L"))
+  FullName = FullName.substr(2);
 if (llvm::sys::fs::exists(FullName)) {
   CmdArgs.push_back("-mlink-builtin-bitcode");
   CmdArgs.push_back(Args.MakeArgString(FullName));
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69825: [Clang][Driver] Re-use the calling process instead of creating a new process for the cc1 invocation

2020-01-23 Thread Mitch Phillips via Phabricator via cfe-commits
hctim added a comment.

For tracking purposes.

The ASan leaks have been worked around in two separate patches in order to make 
the bots green again:

- c38e42527b21acee8d01a016d5bfa2fb83202e29 

- e174da447c180b586719cb28f7bd556e30625762 


@plotfi is graciously debugging :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69825/new/

https://reviews.llvm.org/D69825



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


[clang] e174da4 - [Clang][IFS][Test] Work around in-process cc1 ASAN issues #2.

2020-01-23 Thread Mitch Phillips via cfe-commits

Author: Mitch Phillips
Date: 2020-01-23T14:25:53-08:00
New Revision: e174da447c180b586719cb28f7bd556e30625762

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

LOG: [Clang][IFS][Test] Work around in-process cc1 ASAN issues #2.

Using the same strategy as c38e42527b21.

D69825 revealed (introduced?) a problem when building with ASan, and
some memory leaks somewhere. More details are available in the original
patch.

Looks like we missed one failing tests, this patch adds the workaround
to this test as well.

Added: 


Modified: 
clang/test/Driver/cl-showfilenames.c

Removed: 




diff  --git a/clang/test/Driver/cl-showfilenames.c 
b/clang/test/Driver/cl-showfilenames.c
index b2932f1a01ac..73205978c44c 100644
--- a/clang/test/Driver/cl-showfilenames.c
+++ b/clang/test/Driver/cl-showfilenames.c
@@ -2,11 +2,19 @@
 // target Windows.
 // REQUIRES: x86-registered-target
 
-// RUN: %clang_cl --target=i686-pc-win32 /c /Fo%T/ /showFilenames -- %s 2>&1 | 
FileCheck -check-prefix=show %s
-// RUN: %clang_cl --target=i686-pc-win32 /c /Fo%T/ /showFilenames -- %s 
%S/Inputs/wildcard*.c 2>&1 | FileCheck -check-prefix=multiple %s
+// NOTE: -fno-integrated-cc1 has been added to work around an ASAN failure
+//   caused by in-process cc1 invocation. Clang InterfaceStubs is not the
+//   culprit, but Clang Interface Stubs' Driver pipeline setup uncovers an
+//   existing ASAN issue when invoking multiple normal cc1 jobs along with
+//   multiple Clang Interface Stubs cc1 jobs together.
+//   There is currently a discussion of this going on at:
+// https://reviews.llvm.org/D69825
 
-// RUN: %clang_cl --target=i686-pc-win32 /c /Fo%T/ -- %s 2>&1 | FileCheck 
-check-prefix=noshow %s
-// RUN: %clang_cl --target=i686-pc-win32 /c /Fo%T/ /showFilenames 
/showFilenames- -- %s 2>&1 | FileCheck -check-prefix=noshow %s
+// RUN: %clang_cl -fno-integrated-cc1 --target=i686-pc-win32 /c /Fo%T/ 
/showFilenames -- %s 2>&1 | FileCheck -check-prefix=show %s
+// RUN: %clang_cl -fno-integrated-cc1 --target=i686-pc-win32 /c /Fo%T/ 
/showFilenames -- %s %S/Inputs/wildcard*.c 2>&1 | FileCheck 
-check-prefix=multiple %s
+
+// RUN: %clang_cl -fno-integrated-cc1 --target=i686-pc-win32 /c /Fo%T/ -- %s 
2>&1 | FileCheck -check-prefix=noshow %s
+// RUN: %clang_cl -fno-integrated-cc1 --target=i686-pc-win32 /c /Fo%T/ 
/showFilenames /showFilenames- -- %s 2>&1 | FileCheck -check-prefix=noshow %s
 
 
 #pragma message "Hello"



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


[PATCH] D67537: [clangd] Client-side support for inactive regions

2020-01-23 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

In D67537#1833987 , @hokein wrote:

> there is some significant progress about semantic highlighting on VSCode,  
> VSCode now provides an experimental semantic token API 
> , 
> but no LSP binding yet (is not far away I think). When it is ready, we'd like 
> to switch to that and get rid of our own implementation.


Agreed.

(One potential issue is that vscode themes don't support background styling 
. However, that issue has been 
getting a lot of attention, hopefully it too will be fixed soon.)

I do think there's value in landing this patch in the interim.

> Looking at the API there, it seems like we could make the line-style scope 
> name `meta.disable` clangd specific, and define our own style.

Do you mean naming the scope something like `clangd.meta.disable` to make it 
clear it's a clangd extension?

(In that case, we might as well make it something more descriptive, like 
`clangd.preprocessor.inactive`. `meta` doesn't convey much information.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67537/new/

https://reviews.llvm.org/D67537



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


[PATCH] D65625: [clangd] Allow the client to specify multiple compilation databases in the 'initialize' request

2020-01-23 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon times-circle color=red} Unit tests: fail. 62144 tests passed, 5 failed 
and 811 were skipped.

  failed: libc++.std/language_support/cmp/cmp_partialord/partialord.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_strongeq/cmp.strongeq.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_strongord/strongord.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_weakeq/cmp.weakeq.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_weakord/weakord.pass.cpp

{icon times-circle color=red} clang-tidy: fail. clang-tidy found 2 errors and 4 
warnings 
.
 4 of them are added as review comments below (why? 
).

{icon check-circle color=green} clang-format: pass.

Build artifacts 
: 
diff.json 
,
 clang-tidy.txt 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 


//Pre-merge checks is in beta. Report issue 
.
 Please join beta  or enable 
it for your project 
.//


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65625/new/

https://reviews.llvm.org/D65625



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


[PATCH] D72222: [Driver][CodeGen] Add -fpatchable-function-entry=N[,0]

2020-01-23 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D7#1836409 , @peter.smith wrote:

> Although this particular commit will not be at fault, it is the option that 
> enables the feature which is the earliest I can bisect the fault to. There 
> are 3 files in linux that assert fail on the Implement the 
> 'patchable-function attribute'. The files in question are kasan/quarantine.c, 
> mm/slab_common.c and mm/slub.c .
>
> I reproduced with
>
>   make CC=/path/to/clang/install/clang ARCH=arm64 
> CROSS_COMPILE=aarch64-linux-gnu- HOSTGCC=gcc allmodconfig
>
>
> You can get the log files for the build, which is from clang-10
>  
> https://git.linaro.org/toolchain/ci/base-artifacts.git/log/?h=linaro-local/ci/tcwg_kernel/llvm-release-aarch64-mainline-allmodconfig
>  (4: update: llvm-linux: 19676)
>
> If the patchable functions is intended for clang-10 we'll need to make sure 
> any fix is merged to clang-10.


clang+lld built at HEAD + Linux at head

  make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- HOSTGCC=gcc 
CC=~/llvm/Release/bin/clang LD=~/llvm/Release/bin/ld.lld O=/tmp/arm64 -j 30 
distclean allmodconfig
  make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- HOSTGCC=gcc 
CC=~/llvm/Release/bin/clang LD=~/llvm/Release/bin/ld.lld O=/tmp/arm64 -j 30 all
  ...
OBJCOPY arch/arm64/boot/Image
GZIParch/arm64/boot/Image.gz
  make[1]: Leaving directory '/tmp/arm64'

@peter.smith The build was smooth. Do I need other options to reproduce?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D7/new/

https://reviews.llvm.org/D7



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


[PATCH] D72829: Implement -fsemantic-interposition

2020-01-23 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon times-circle color=red} Unit tests: fail. 62147 tests passed, 5 failed 
and 811 were skipped.

  failed: libc++.std/language_support/cmp/cmp_partialord/partialord.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_strongeq/cmp.strongeq.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_strongord/strongord.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_weakeq/cmp.weakeq.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_weakord/weakord.pass.cpp

{icon check-circle color=green} clang-tidy: pass.

{icon check-circle color=green} clang-format: pass.

Build artifacts 
: 
diff.json 
,
 clang-tidy.txt 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 


//Pre-merge checks is in beta. Report issue 
.
 Please join beta  or enable 
it for your project 
.//


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72829/new/

https://reviews.llvm.org/D72829



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


[PATCH] D73155: [Concepts] Implement P1616R1 - Using unconstrained template template parameters with constrained templates

2020-01-23 Thread Saar Raz via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd42d5eb8ea77: [Concepts] Implement P1616R1 - Using 
unconstrained template template parameters… (authored by saar.raz).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73155/new/

https://reviews.llvm.org/D73155

Files:
  clang/lib/Sema/SemaTemplate.cpp
  clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp


Index: clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp
===
--- clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp
+++ clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp
@@ -7,9 +7,9 @@
 // expected-note@-1{{similar constraint expressions not considered equivalent}}
 template class P> struct S1 { }; // expected-note 2{{'P' declared 
here}}
 
-template struct X { }; // expected-note{{'X' declared here}}
+template struct X { };
 
-template struct Y { }; // expected-note 2{{'Y' declared here}}
+template struct Y { }; // expected-note{{'Y' declared here}}
 template struct Z { };
 template struct W { }; // expected-note{{'W' declared here}}
 
@@ -18,10 +18,10 @@
 S1 s13;
 S1 s14; // expected-error{{template template argument 'W' is more 
constrained than template template parameter 'P'}}
 
-template class P> struct S2 { }; // expected-note 2{{'P' 
declared here}}
+template class P> struct S2 { };
 
-S2 s21; // expected-error{{template template argument 'X' is more 
constrained than template template parameter 'P'}}
-S2 s22; // expected-error{{template template argument 'Y' is more 
constrained than template template parameter 'P'}}
+S2 s21;
+S2 s22;
 S2 s23;
 
 template  class C>
Index: clang/lib/Sema/SemaTemplate.cpp
===
--- clang/lib/Sema/SemaTemplate.cpp
+++ clang/lib/Sema/SemaTemplate.cpp
@@ -7164,6 +7164,11 @@
   //   [temp.constr.order].
   SmallVector ParamsAC, TemplateAC;
   Params->getAssociatedConstraints(ParamsAC);
+  // C++2a[temp.arg.template]p3
+  //   [...] In this comparison, if P is unconstrained, the constraints on 
A
+  //   are not considered.
+  if (ParamsAC.empty())
+return false;
   Template->getAssociatedConstraints(TemplateAC);
   bool IsParamAtLeastAsConstrained;
   if (IsAtLeastAsConstrained(Param, ParamsAC, Template, TemplateAC,


Index: clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp
===
--- clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp
+++ clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp
@@ -7,9 +7,9 @@
 // expected-note@-1{{similar constraint expressions not considered equivalent}}
 template class P> struct S1 { }; // expected-note 2{{'P' declared here}}
 
-template struct X { }; // expected-note{{'X' declared here}}
+template struct X { };
 
-template struct Y { }; // expected-note 2{{'Y' declared here}}
+template struct Y { }; // expected-note{{'Y' declared here}}
 template struct Z { };
 template struct W { }; // expected-note{{'W' declared here}}
 
@@ -18,10 +18,10 @@
 S1 s13;
 S1 s14; // expected-error{{template template argument 'W' is more constrained than template template parameter 'P'}}
 
-template class P> struct S2 { }; // expected-note 2{{'P' declared here}}
+template class P> struct S2 { };
 
-S2 s21; // expected-error{{template template argument 'X' is more constrained than template template parameter 'P'}}
-S2 s22; // expected-error{{template template argument 'Y' is more constrained than template template parameter 'P'}}
+S2 s21;
+S2 s22;
 S2 s23;
 
 template  class C>
Index: clang/lib/Sema/SemaTemplate.cpp
===
--- clang/lib/Sema/SemaTemplate.cpp
+++ clang/lib/Sema/SemaTemplate.cpp
@@ -7164,6 +7164,11 @@
   //   [temp.constr.order].
   SmallVector ParamsAC, TemplateAC;
   Params->getAssociatedConstraints(ParamsAC);
+  // C++2a[temp.arg.template]p3
+  //   [...] In this comparison, if P is unconstrained, the constraints on A
+  //   are not considered.
+  if (ParamsAC.empty())
+return false;
   Template->getAssociatedConstraints(TemplateAC);
   bool IsParamAtLeastAsConstrained;
   if (IsAtLeastAsConstrained(Param, ParamsAC, Template, TemplateAC,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65625: [clangd] Allow the client to specify multiple compilation databases in the 'initialize' request

2020-01-23 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

Ilya / others if interested, I would like to revive this patch.

We left off with a discussion in the corresponding issue 
, where I made a suggestion 
 for an 
initial way forward. Could I get some feedback on that please?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65625/new/

https://reviews.llvm.org/D65625



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


[PATCH] D72829: Implement -fsemantic-interposition

2020-01-23 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added inline comments.



Comment at: clang/lib/CodeGen/CodeGenModule.cpp:488
+  if (Context.getLangOpts().SemanticInterposition &&
+  (Context.getLangOpts().PICLevel && !Context.getLangOpts().PIE))
+// Require various optimization to respect semantic interposition.

The parentheses can be deleted.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72829/new/

https://reviews.llvm.org/D72829



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


[PATCH] D65625: [clangd] Allow the client to specify multiple compilation databases in the 'initialize' request

2020-01-23 Thread Nathan Ridge via Phabricator via cfe-commits
nridge updated this revision to Diff 24.
nridge added a comment.
Herald added a subscriber: usaxena95.

Rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65625/new/

https://reviews.llvm.org/D65625

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
  clang-tools-extra/clangd/GlobalCompilationDatabase.h
  clang-tools-extra/clangd/Protocol.cpp
  clang-tools-extra/clangd/Protocol.h
  clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp

Index: clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
===
--- clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
+++ clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
@@ -39,7 +39,7 @@
 using ::testing::UnorderedElementsAre;
 
 TEST(GlobalCompilationDatabaseTest, FallbackCommand) {
-  DirectoryBasedGlobalCompilationDatabase DB(None);
+  DirectoryBasedGlobalCompilationDatabase DB(None, None);
   auto Cmd = DB.getFallbackCommand(testPath("foo/bar.cc"));
   EXPECT_EQ(Cmd.Directory, testPath("foo"));
   EXPECT_THAT(Cmd.CommandLine, ElementsAre("clang", testPath("foo/bar.cc")));
@@ -236,7 +236,7 @@
   // Note that gen2.cc goes missing with our following model, not sure this
   // happens in practice though.
   {
-DirectoryBasedGlobalCompilationDatabase DB(llvm::None);
+DirectoryBasedGlobalCompilationDatabase DB(llvm::None, llvm::None);
 std::vector DiscoveredFiles;
 auto Sub =
 DB.watch([](const std::vector Changes) {
@@ -258,7 +258,7 @@
 
   // With a custom compile commands dir.
   {
-DirectoryBasedGlobalCompilationDatabase DB(FS.Root.str().str());
+DirectoryBasedGlobalCompilationDatabase DB(FS.Root.str().str(), llvm::None);
 std::vector DiscoveredFiles;
 auto Sub =
 DB.watch([](const std::vector Changes) {
Index: clang-tools-extra/clangd/Protocol.h
===
--- clang-tools-extra/clangd/Protocol.h
+++ clang-tools-extra/clangd/Protocol.h
@@ -23,6 +23,7 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_PROTOCOL_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_PROTOCOL_H
 
+#include "Path.h"
 #include "URI.h"
 #include "index/SymbolID.h"
 #include "clang/Index/IndexSymbol.h"
@@ -449,6 +450,14 @@
 };
 bool fromJSON(const llvm::json::Value &, ConfigurationSettings &);
 
+struct CompilationDatabasePath {
+  Path sourceDir;
+  Path dbPath;
+};
+bool fromJSON(const llvm::json::Value &, CompilationDatabasePath &);
+
+using CompilationDatabaseMap = std::vector;
+
 /// Clangd extension: parameters configurable at `initialize` time.
 /// LSP defines this type as `any`.
 struct InitializationOptions {
@@ -456,7 +465,12 @@
   // also set through the initialize request (initializationOptions field).
   ConfigurationSettings ConfigSettings;
 
-  llvm::Optional compilationDatabasePath;
+  llvm::Optional compilationDatabasePath;
+
+  // A map from source directories to directories containing compilation
+  // database files. Paths must be absolute.
+  llvm::Optional compilationDatabaseMap;
+
   // Additional flags to be included in the "fallback command" used when
   // the compilation database doesn't describe an opened file.
   // The command used will be approximately `clang $FILE $fallbackFlags`.
Index: clang-tools-extra/clangd/Protocol.cpp
===
--- clang-tools-extra/clangd/Protocol.cpp
+++ clang-tools-extra/clangd/Protocol.cpp
@@ -940,6 +940,16 @@
   return true;
 }
 
+bool fromJSON(const llvm::json::Value , CompilationDatabasePath ) {
+  llvm::json::ObjectMapper O(Params);
+  if (!O)
+return true; // 'any' type in LSP.
+
+  O.map("sourceDir", P.sourceDir);
+  O.map("dbPath", P.dbPath);
+  return true;
+}
+
 bool fromJSON(const llvm::json::Value , InitializationOptions ) {
   llvm::json::ObjectMapper O(Params);
   if (!O)
@@ -947,6 +957,7 @@
 
   fromJSON(Params, Opts.ConfigSettings);
   O.map("compilationDatabasePath", Opts.compilationDatabasePath);
+  O.map("compilationDatabaseMap", Opts.compilationDatabaseMap);
   O.map("fallbackFlags", Opts.fallbackFlags);
   O.map("clangdFileStatus", Opts.FileStatus);
   return true;
Index: clang-tools-extra/clangd/GlobalCompilationDatabase.h
===
--- clang-tools-extra/clangd/GlobalCompilationDatabase.h
+++ clang-tools-extra/clangd/GlobalCompilationDatabase.h
@@ -12,6 +12,7 @@
 #include "CompileCommands.h"
 #include "Function.h"
 #include "Path.h"
+#include "Protocol.h"
 #include "clang/Tooling/ArgumentsAdjusters.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/ADT/Optional.h"
@@ -67,7 +68,8 @@
 : public GlobalCompilationDatabase {
 public:
   DirectoryBasedGlobalCompilationDatabase(
-  llvm::Optional CompileCommandsDir);
+  llvm::Optional 

[clang] d42d5eb - [Concepts] Implement P1616R1 - Using unconstrained template template parameters with constrained templates

2020-01-23 Thread Saar Raz via cfe-commits

Author: Saar Raz
Date: 2020-01-23T23:32:03+02:00
New Revision: d42d5eb8ea77b3a3a502a60ba3f053fb81a897f3

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

LOG: [Concepts] Implement P1616R1 - Using unconstrained template template 
parameters with constrained templates

Summary: Allow unconstrained template template parameters to accept 
constrainted templates as arguments.

Reviewers: rsmith

Subscribers: cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/lib/Sema/SemaTemplate.cpp
clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 2f44f8f08d08..05dde46fffd3 100755
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -7164,6 +7164,11 @@ bool 
Sema::CheckTemplateTemplateArgument(TemplateTemplateParmDecl *Param,
   //   [temp.constr.order].
   SmallVector ParamsAC, TemplateAC;
   Params->getAssociatedConstraints(ParamsAC);
+  // C++2a[temp.arg.template]p3
+  //   [...] In this comparison, if P is unconstrained, the constraints on 
A
+  //   are not considered.
+  if (ParamsAC.empty())
+return false;
   Template->getAssociatedConstraints(TemplateAC);
   bool IsParamAtLeastAsConstrained;
   if (IsAtLeastAsConstrained(Param, ParamsAC, Template, TemplateAC,

diff  --git a/clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp 
b/clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp
index 593336163fa1..e7feae31889e 100644
--- a/clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp
+++ b/clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp
@@ -7,9 +7,9 @@ template concept F = T::f();
 // expected-note@-1{{similar constraint expressions not considered equivalent}}
 template class P> struct S1 { }; // expected-note 2{{'P' declared 
here}}
 
-template struct X { }; // expected-note{{'X' declared here}}
+template struct X { };
 
-template struct Y { }; // expected-note 2{{'Y' declared here}}
+template struct Y { }; // expected-note{{'Y' declared here}}
 template struct Z { };
 template struct W { }; // expected-note{{'W' declared here}}
 
@@ -18,10 +18,10 @@ S1 s12; // expected-error{{template template argument 
'Y' is more constrained
 S1 s13;
 S1 s14; // expected-error{{template template argument 'W' is more 
constrained than template template parameter 'P'}}
 
-template class P> struct S2 { }; // expected-note 2{{'P' 
declared here}}
+template class P> struct S2 { };
 
-S2 s21; // expected-error{{template template argument 'X' is more 
constrained than template template parameter 'P'}}
-S2 s22; // expected-error{{template template argument 'Y' is more 
constrained than template template parameter 'P'}}
+S2 s21;
+S2 s22;
 S2 s23;
 
 template  class C>



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


[PATCH] D72222: [Driver][CodeGen] Add -fpatchable-function-entry=N[,0]

2020-01-23 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D7#1836942 , @nickdesaulniers 
wrote:

> In D7#1836687 , @MaskRay wrote:
>
> > (I really dislike how the feature was developed on the GCC side. Yet 
> > another Linux-kernel specific GCC option when there are already 4 existing 
> > options for the same feature)
>
>
> Maybe I'm reading too much into it, but please always have respect for the 
> competition, as a representative of the company and LLVM community you 
> represent, as well as my friend.  It should be clear why that's important and 
> why I won't tolerate anything less.  If you still disagree, I'm happy to talk 
> more about it privately.
>
> Can you enumerate the 4 existing options?  If we do already have an existing 
> tool in our toolbox, it would be good to consider their strengths and 
> limitations before building a new tool.


Apologies if my word felt strong. I meant I felt sad that GCC developed another 
option in this area, along with -mfentry, -mhotpatch (SystemZ specific), 
-mnop-mcount (x86, SystemZ, -fno-pie specific), -mrecord-mcount (used to retire 
`scripts/recordmcount.{pl,c}`). The GCC implementation has several issues, as I 
listed in the link I pasted above. (I fixed a GCC bug in this area.) I also 
feel making the dependent Linux features enabled by default when 
-fpatchable-function-entry= is recognized by the compiler was not sufficient. 
It should have more sophisticated check.

The idea of this option is great. The intention was to unify the existing 
options. However, two major flaws (comdat (C++) / --gc-sections) make it 
impractical for non-Linux-kernel applications. I noticed we recently add 
support for -mnop-mcount. I haven't made enough investigation, but I suspect we 
don't have to do that and can use a general option instead.

@hans To address the CI problem (https://reviews.llvm.org/D7#1836728) 
reported by @peter.smith, we just need to delete the driver option in the 
release/10.x branch. (I need a -E preproccessed file to investigate.)
I think we don't need to hurry. We can simply revert this patch (D7 
) a few days before 10.0.0.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D7/new/

https://reviews.llvm.org/D7



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


[PATCH] D73237: [CUDA] Fix order of memcpy arguments in __shfl_*(<64-bit type>).

2020-01-23 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

In D73237#1836978 , @timshen wrote:

> What's the test situation for these headers?


They are not testable in clang/llvm tree as they need CUDA SDK headers. I 
should be able to add some tests in the test-suite.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73237/new/

https://reviews.llvm.org/D73237



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


[clang] 4d33a8d - [Concepts] Add ExpressionEvaluationContexts to instantiation of constraints

2020-01-23 Thread Saar Raz via cfe-commits

Author: Saar Raz
Date: 2020-01-23T23:24:56+02:00
New Revision: 4d33a8dfcf67e970ea4d150d514b27de02e79aee

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

LOG: [Concepts] Add ExpressionEvaluationContexts to instantiation of constraints

Proper ExpressionEvaluationContext were not being entered when instantiating 
constraint
expressions, which caused assertion failures in certain cases, including bug 
#44614.

Added: 


Modified: 
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/test/SemaTemplate/instantiate-requires-clause.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp 
b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 8fd7491c45e3..92f6e0dc1c90 100755
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1848,6 +1848,8 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(
   // FIXME: Concepts: Do not substitute into constraint expressions
   Expr *TrailingRequiresClause = D->getTrailingRequiresClause();
   if (TrailingRequiresClause) {
+EnterExpressionEvaluationContext ConstantEvaluated(
+SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
 ExprResult SubstRC = SemaRef.SubstExpr(TrailingRequiresClause,
TemplateArgs);
 if (SubstRC.isInvalid())
@@ -2186,6 +2188,8 @@ Decl *TemplateDeclInstantiator::VisitCXXMethodDecl(
   // FIXME: Concepts: Do not substitute into constraint expressions
   Expr *TrailingRequiresClause = D->getTrailingRequiresClause();
   if (TrailingRequiresClause) {
+EnterExpressionEvaluationContext ConstantEvaluated(
+SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
 ExprResult SubstRC = SemaRef.SubstExpr(TrailingRequiresClause,
TemplateArgs);
 if (SubstRC.isInvalid())
@@ -2525,6 +2529,8 @@ Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl(
 TemplateArgumentListInfo InstArgs;
 
 if (TemplArgInfo) {
+  EnterExpressionEvaluationContext ConstantEvaluated(
+SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
   InstArgs.setLAngleLoc(TemplArgInfo->LAngleLoc);
   InstArgs.setRAngleLoc(TemplArgInfo->RAngleLoc);
   if (SemaRef.Subst(TemplArgInfo->getTemplateArgs(),
@@ -3729,6 +3735,8 @@ 
TemplateDeclInstantiator::SubstTemplateParams(TemplateParameterList *L) {
   // checking satisfaction.
   Expr *InstRequiresClause = nullptr;
   if (Expr *E = L->getRequiresClause()) {
+EnterExpressionEvaluationContext ConstantEvaluated(
+SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
 ExprResult Res = SemaRef.SubstExpr(E, TemplateArgs);
 if (Res.isInvalid() || !Res.isUsable()) {
   return nullptr;

diff  --git a/clang/test/SemaTemplate/instantiate-requires-clause.cpp 
b/clang/test/SemaTemplate/instantiate-requires-clause.cpp
index 04b595717e6d..3b7dc3ddd740 100644
--- a/clang/test/SemaTemplate/instantiate-requires-clause.cpp
+++ b/clang/test/SemaTemplate/instantiate-requires-clause.cpp
@@ -39,3 +39,15 @@ struct S {
 };
 
 static_assert(S::f(1));
+
+constexpr auto value = 0;
+
+template
+struct S2 {
+  template requires(value, true)
+  static constexpr auto f() requires(value, true) {
+  }
+};
+
+static_assert((S2::f(), true));
+



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


[PATCH] D71911: [ThinLTO] Summarize vcall_visibility metadata

2020-01-23 Thread Teresa Johnson via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9c2eb220edd5: [ThinLTO] Summarize vcall_visibility metadata 
(authored by tejohnson).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71911/new/

https://reviews.llvm.org/D71911

Files:
  clang/test/CodeGenCXX/vcall-visibility-metadata.cpp
  llvm/include/llvm/IR/ModuleSummaryIndex.h
  llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
  llvm/lib/AsmParser/LLLexer.cpp
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/AsmParser/LLToken.h
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/test/Assembler/thinlto-vtable-summary.ll

Index: llvm/test/Assembler/thinlto-vtable-summary.ll
===
--- llvm/test/Assembler/thinlto-vtable-summary.ll
+++ llvm/test/Assembler/thinlto-vtable-summary.ll
@@ -29,9 +29,9 @@
 
 ^0 = module: (path: "", hash: (0, 0, 0, 0, 0))
 ^1 = gv: (name: "_ZN1A1nEi") ; guid = 1621563287929432257
-^2 = gv: (name: "_ZTV1B", summaries: (variable: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), varFlags: (readonly: 0, writeonly: 0, constant: 0), vTableFuncs: ((virtFunc: ^3, offset: 16), (virtFunc: ^1, offset: 24)), refs: (^3, ^1 ; guid = 5283576821522790367
+^2 = gv: (name: "_ZTV1B", summaries: (variable: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), varFlags: (readonly: 0, writeonly: 0, constant: 0, vcall_visibility: 0), vTableFuncs: ((virtFunc: ^3, offset: 16), (virtFunc: ^1, offset: 24)), refs: (^3, ^1 ; guid = 5283576821522790367
 ^3 = gv: (name: "_ZN1B1fEi") ; guid = 7162046368816414394
-^4 = gv: (name: "_ZTV1C", summaries: (variable: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), varFlags: (readonly: 0, writeonly: 0, constant: 0), vTableFuncs: ((virtFunc: ^5, offset: 16), (virtFunc: ^1, offset: 24)), refs: (^1, ^5 ; guid = 1362402378846296
+^4 = gv: (name: "_ZTV1C", summaries: (variable: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), varFlags: (readonly: 0, writeonly: 0, constant: 0, vcall_visibility: 0), vTableFuncs: ((virtFunc: ^5, offset: 16), (virtFunc: ^1, offset: 24)), refs: (^1, ^5 ; guid = 1362402378846296
 ^5 = gv: (name: "_ZN1C1fEi") ; guid = 14876272565662207556
 ^6 = typeidCompatibleVTable: (name: "_ZTS1A", summary: ((offset: 16, ^2), (offset: 16, ^4))) ; guid = 7004155349499253778
 ^7 = typeidCompatibleVTable: (name: "_ZTS1B", summary: ((offset: 16, ^2))) ; guid = 6203814149063363976
Index: llvm/lib/IR/AsmWriter.cpp
===
--- llvm/lib/IR/AsmWriter.cpp
+++ llvm/lib/IR/AsmWriter.cpp
@@ -2900,11 +2900,15 @@
 }
 
 void AssemblyWriter::printGlobalVarSummary(const GlobalVarSummary *GS) {
+  auto VTableFuncs = GS->vTableFuncs();
   Out << ", varFlags: (readonly: " << GS->VarFlags.MaybeReadOnly << ", "
   << "writeonly: " << GS->VarFlags.MaybeWriteOnly << ", "
-  << "constant: " << GS->VarFlags.Constant << ")";
+  << "constant: " << GS->VarFlags.Constant;
+  if (!VTableFuncs.empty())
+Out << ", "
+<< "vcall_visibility: " << GS->VarFlags.VCallVisibility;
+  Out << ")";
 
-  auto VTableFuncs = GS->vTableFuncs();
   if (!VTableFuncs.empty()) {
 Out << ", vTableFuncs: (";
 FieldSeparator FS;
Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
===
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1028,8 +1028,8 @@
 }
 
 static uint64_t getEncodedGVarFlags(GlobalVarSummary::GVarFlags Flags) {
-  uint64_t RawFlags =
-  Flags.MaybeReadOnly | (Flags.MaybeWriteOnly << 1) | (Flags.Constant << 2);
+  uint64_t RawFlags = Flags.MaybeReadOnly | (Flags.MaybeWriteOnly << 1) |
+  (Flags.Constant << 2) | Flags.VCallVisibility << 3;
   return RawFlags;
 }
 
Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
===
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -985,9 +985,10 @@
 
 // Decode the flags for GlobalVariable in the summary
 static GlobalVarSummary::GVarFlags getDecodedGVarFlags(uint64_t RawFlags) {
-  return GlobalVarSummary::GVarFlags((RawFlags & 0x1) ? true : false,
- (RawFlags & 0x2) ? true : false,
- (RawFlags & 0x4) ? true : false);
+  return GlobalVarSummary::GVarFlags(
+  (RawFlags & 0x1) ? true : false, (RawFlags & 0x2) ? true : false,
+  (RawFlags & 0x4) ? true : false,
+  (GlobalObject::VCallVisibility)(RawFlags >> 3));
 }
 
 static GlobalValue::VisibilityTypes 

[PATCH] D72829: Implement -fsemantic-interposition

2020-01-23 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 239996.
serge-sans-paille added a comment.

Take into account pie/pic interaction with semantic-interposition
More test case
Remove premature release note entry


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72829/new/

https://reviews.llvm.org/D72829

Files:
  clang/docs/ClangCommandLineReference.rst
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/semantic-interposition.c
  clang/test/Driver/clang_f_opts.c
  llvm/include/llvm/IR/GlobalValue.h
  llvm/include/llvm/IR/Module.h
  llvm/lib/IR/Globals.cpp
  llvm/lib/IR/Module.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/test/Transforms/Inline/inline-semantic-interposition.ll
  llvm/test/Verifier/module-flags-semantic-interposition.ll

Index: llvm/test/Verifier/module-flags-semantic-interposition.ll
===
--- /dev/null
+++ llvm/test/Verifier/module-flags-semantic-interposition.ll
@@ -0,0 +1,12 @@
+; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
+
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+@foo = dso_local global i32 1, align 4
+
+!llvm.module.flags = !{!0}
+
+!0 = !{i32 1, !"SemanticInterposition", float 1.}
+
+; CHECK: SemanticInterposition metadata requires constant integer argument
Index: llvm/test/Transforms/Inline/inline-semantic-interposition.ll
===
--- /dev/null
+++ llvm/test/Transforms/Inline/inline-semantic-interposition.ll
@@ -0,0 +1,24 @@
+; RUN: opt < %s -inline  -S | FileCheck %s
+
+define internal i32 @callee1(i32 %A) {
+  ret i32 %A
+}
+define i32 @callee2(i32 %A) {
+  ret i32 %A
+}
+
+; CHECK-LABEL: @caller
+define i32 @caller(i32 %A) {
+; CHECK-NOT: call i32 @callee1(i32 %A)
+  %A1 = call i32 @callee1(i32 %A)
+; CHECK: %A2 = call i32 @callee2(i32 %A)
+  %A2 = call i32 @callee2(i32 %A)
+; CHECK: add i32 %A, %A2
+  %R = add i32 %A1, %A2
+  ret i32 %R
+}
+
+
+!llvm.module.flags = !{!0}
+
+!0 = !{i32 1, !"SemanticInterposition", i32 1}
Index: llvm/lib/IR/Verifier.cpp
===
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -1476,6 +1476,13 @@
"'Linker Options' named metadata no longer supported");
   }
 
+  if (ID->getString() == "SemanticInterposition") {
+ConstantInt *Value =
+mdconst::dyn_extract_or_null(Op->getOperand(2));
+Assert(Value,
+   "SemanticInterposition metadata requires constant integer argument");
+  }
+
   if (ID->getString() == "CG Profile") {
 for (const MDOperand  : cast(Op->getOperand(2))->operands())
   visitModuleFlagCGProfileEntry(MDO);
Index: llvm/lib/IR/Module.cpp
===
--- llvm/lib/IR/Module.cpp
+++ llvm/lib/IR/Module.cpp
@@ -554,6 +554,20 @@
: getModuleFlag("ProfileSummary"));
 }
 
+bool Module::getSemanticInterposition() const {
+  Metadata *MF = getModuleFlag("SemanticInterposition");
+
+  auto *Val = cast_or_null(MF);
+  if (!Val)
+return false;
+
+  return cast(Val->getValue())->getZExtValue();
+}
+
+void Module::setSemanticInterposition(bool SI) {
+  addModuleFlag(ModFlagBehavior::Error, "SemanticInterposition", SI);
+}
+
 void Module::setOwnedMemoryBuffer(std::unique_ptr MB) {
   OwnedMemoryBuffer = std::move(MB);
 }
Index: llvm/lib/IR/Globals.cpp
===
--- llvm/lib/IR/Globals.cpp
+++ llvm/lib/IR/Globals.cpp
@@ -94,6 +94,13 @@
   llvm_unreachable("not a global");
 }
 
+bool GlobalValue::isInterposable() const {
+  if (isInterposableLinkage(getLinkage()))
+return true;
+  return getParent() && getParent()->getSemanticInterposition() &&
+ !isDSOLocal();
+}
+
 unsigned GlobalValue::getAlignment() const {
   if (auto *GA = dyn_cast(this)) {
 // In general we cannot compute this at the IR level, but we try.
Index: llvm/include/llvm/IR/Module.h
===
--- llvm/include/llvm/IR/Module.h
+++ llvm/include/llvm/IR/Module.h
@@ -848,6 +848,12 @@
   Metadata *getProfileSummary(bool IsCS);
   /// @}
 
+  /// Returns whether semantic interposition is to be respected.
+  bool getSemanticInterposition() const;
+
+  /// Set whether semantic interposition is to be respected.
+  void setSemanticInterposition(bool);
+
   /// Returns true if PLT should be avoided for RTLib calls.
   bool getRtLibUseGOT() const;
 
Index: llvm/include/llvm/IR/GlobalValue.h
===
--- llvm/include/llvm/IR/GlobalValue.h
+++ llvm/include/llvm/IR/GlobalValue.h
@@ -426,7 +426,7 

[PATCH] D73290: [PowerPC] Add clang -msvr4-struct-return for 32-bit ELF

2020-01-23 Thread George Koehler via Phabricator via cfe-commits
kernigh created this revision.
kernigh added reviewers: brad, markmi, chmeee.
kernigh added a project: clang.
Herald added subscribers: cfe-commits, steven.zhang, shchenz, jsji, kbarton, 
krytarowski, arichardson, nemanjai, emaste.

This is a patch for https://bugs.llvm.org/show_bug.cgi?id=40736

**Beware:** This diff passes its own tests, and writes asm that looks correct 
to me, but I have not yet tried running the code on PowerPC. I intend to 
backport the diff to llvm/clang 8.0.1 (the version in OpenBSD), and try it on 
an old and slow PowerPC Macintosh. I upload the diff now, because other people 
might want to see it.

This is only my 2nd patch on reviews.llvm.org, so I might have filled some 
fields wrong. I don't have commit access to LLVM.

[PowerPC] Add clang -msvr4-struct-return for 32-bit ELF

Change the default ABI to be compatible with GCC.  For 32-bit ELF targets other 
than Linux, Clang now returns small structs in registers r3/r4.  This affects 
FreeBSD, NetBSD, OpenBSD.  There is no change for 32-bit Linux, where Clang 
continues to return all structs in memory.

Add clang options -maix-struct-return (to return structs in memory) and 
-msvr4-struct-return (to return structs in registers) to be compatible with 
gcc.  These options are only for PPC32; reject them on PPC64 and other targets. 
 The options are like -fpcc-struct-return and -freg-struct-return for X86_32, 
and use similar code.

To actually return a struct in registers, coerce it to an integer of the same 
size.  LLVM may optimize the code to remove unnecessary accesses to memory, and 
will return i32 in r3 or i64 in r3:r4.

Fixes PR#40736


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73290

Files:
  clang/docs/ClangCommandLineReference.rst
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/ppc32-struct-return.c
  clang/test/Driver/ppc-unsupported.c

Index: clang/test/Driver/ppc-unsupported.c
===
--- /dev/null
+++ clang/test/Driver/ppc-unsupported.c
@@ -0,0 +1,10 @@
+// REQUIRES: powerpc-registered-target
+// RUN: not %clang -target powerpc64-unknown-freebsd -maix-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc64-unknown-freebsd -msvr4-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc64le-unknown-linux -maix-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc64le-unknown-linux -msvr4-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// CHECK: unsupported option
Index: clang/test/CodeGen/ppc32-struct-return.c
===
--- /dev/null
+++ clang/test/CodeGen/ppc32-struct-return.c
@@ -0,0 +1,88 @@
+// REQUIRES: powerpc-registered-target
+// RUN: %clang_cc1 -triple powerpc-unknown-freebsd \
+// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
+// RUN: %clang_cc1 -triple powerpc-unknown-linux \
+// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
+// RUN: %clang_cc1 -triple powerpc-unknown-linux -maix-struct-return \
+// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
+// RUN: %clang_cc1 -triple powerpc-unknown-linux -msvr4-struct-return \
+// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
+// RUN: %clang_cc1 -triple powerpc-unknown-netbsd \
+// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
+// RUN: %clang_cc1 -triple powerpc-unknown-openbsd \
+// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
+// RUN: %clang_cc1 -triple powerpc-unknown-openbsd -maix-struct-return \
+// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
+// RUN: %clang_cc1 -triple powerpc-unknown-openbsd -msvr4-struct-return \
+// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
+
+typedef struct {
+} Zero;
+typedef struct {
+  char c;
+} One;
+typedef struct {
+  short s;
+} Two;
+typedef struct {
+  char c[3];
+} Three;
+typedef struct {
+  float f;
+} Four; // svr4 to return i32, not float
+typedef struct {
+  char c[5];
+} Five;
+typedef struct {
+  short s[3];
+} Six;
+typedef struct {
+  char c[7];
+} Seven;
+typedef struct {
+  int i;
+  char c;
+} Eight; // padded for alignment
+typedef struct {
+  char c[9];
+} Nine;
+
+// CHECK-AIX-LABEL: define void @ret0(%struct.Zero* noalias sret {{[^,]*}})
+// CHECK-SVR4-LABEL: define void @ret0()
+Zero ret0(void) { return (Zero){}; }
+
+// CHECK-AIX-LABEL: define void @ret1(%struct.One* noalias sret {{[^,]*}})
+// CHECK-SVR4-LABEL: define i8 @ret1()
+One ret1(void) { return (One){'a'}; }
+
+// CHECK-AIX-LABEL: define void @ret2(%struct.Two* noalias sret {{[^,]*}})
+// CHECK-SVR4-LABEL: define i16 @ret2()
+Two ret2(void) { return (Two){123}; }
+
+// CHECK-AIX-LABEL: define void 

[PATCH] D73237: [CUDA] Fix order of memcpy arguments in __shfl_*(<64-bit type>).

2020-01-23 Thread Artem Belevich via Phabricator via cfe-commits
tra closed this revision.
tra added a subscriber: hans.
tra added a comment.

Landed in 
https://github.com/llvm/llvm-project/commit/cc14de88da27a8178976972bdc8211c31f7ca9ae
@hans -- can we cherry-pick it into 10?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73237/new/

https://reviews.llvm.org/D73237



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


[clang] 9c2eb22 - [ThinLTO] Summarize vcall_visibility metadata

2020-01-23 Thread Teresa Johnson via cfe-commits

Author: Teresa Johnson
Date: 2020-01-23T13:19:56-08:00
New Revision: 9c2eb220edd5e831a17bfbde65dcc49e402d7540

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

LOG: [ThinLTO] Summarize vcall_visibility metadata

Summary:
Second patch in series to support Safe Whole Program Devirtualization
Enablement, see RFC here:
http://lists.llvm.org/pipermail/llvm-dev/2019-December/137543.html

Summarize vcall_visibility metadata in ThinLTO global variable summary.

Depends on D71907.

Reviewers: pcc, evgeny777, steven_wu

Subscribers: mehdi_amini, Prazek, inglorion, hiraditya, dexonsmith, arphaman, 
ostannard, llvm-commits, cfe-commits, davidxl

Tags: #clang, #llvm

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

Added: 


Modified: 
clang/test/CodeGenCXX/vcall-visibility-metadata.cpp
llvm/include/llvm/IR/ModuleSummaryIndex.h
llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
llvm/lib/AsmParser/LLLexer.cpp
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/AsmParser/LLToken.h
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/IR/AsmWriter.cpp
llvm/test/Assembler/thinlto-vtable-summary.ll

Removed: 




diff  --git a/clang/test/CodeGenCXX/vcall-visibility-metadata.cpp 
b/clang/test/CodeGenCXX/vcall-visibility-metadata.cpp
index 074c7564dbfd..b770ad767fc2 100644
--- a/clang/test/CodeGenCXX/vcall-visibility-metadata.cpp
+++ b/clang/test/CodeGenCXX/vcall-visibility-metadata.cpp
@@ -1,6 +1,9 @@
 // RUN: %clang_cc1 -flto -flto-unit -triple x86_64-unknown-linux -emit-llvm 
-fvirtual-function-elimination -fwhole-program-vtables -o - %s | FileCheck %s 
--check-prefix=CHECK --check-prefix=CHECK-VFE
 // RUN: %clang_cc1 -flto -flto-unit -triple x86_64-unknown-linux -emit-llvm 
-fwhole-program-vtables -o - %s | FileCheck %s --check-prefix=CHECK 
--check-prefix=CHECK-NOVFE
 
+// Check that in ThinLTO we also get vcall_visibility summary entries in the 
bitcode
+// RUN: %clang_cc1 -flto=thin -flto-unit -triple x86_64-unknown-linux 
-emit-llvm-bc -fwhole-program-vtables -o - %s | llvm-dis -o - | FileCheck %s 
--check-prefix=CHECK --check-prefix=CHECK-NOVFE --check-prefix=CHECK-SUMMARY
+
 
 // Anonymous namespace.
 namespace {
@@ -88,3 +91,11 @@ void *construct_G() {
 // CHECK-DAG: [[VIS_TU]] = !{i64 2}
 // CHECK-VFE-DAG: !{i32 1, !"Virtual Function Elim", i32 1}
 // CHECK-NOVFE-DAG: !{i32 1, !"Virtual Function Elim", i32 0}
+
+// CHECK-SUMMARY-DAG: gv: (name: "_ZTV1B", {{.*}} vcall_visibility: 1
+// CHECK-SUMMARY-DAG: gv: (name: "_ZTVN12_GLOBAL__N_11FE", {{.*}} 
vcall_visibility: 0
+// CHECK-SUMMARY-DAG: gv: (name: "_ZTV1D", {{.*}} vcall_visibility: 0
+// CHECK-SUMMARY-DAG: gv: (name: "_ZTV1C", {{.*}} vcall_visibility: 0
+// CHECK-SUMMARY-DAG: gv: (name: "_ZTV1E", {{.*}} vcall_visibility: 0
+// CHECK-SUMMARY-DAG: gv: (name: "_ZTVN12_GLOBAL__N_11AE", {{.*}} 
vcall_visibility: 2
+// CHECK-SUMMARY-DAG: gv: (name: "_ZTVN12_GLOBAL__N_11GE", {{.*}} 
vcall_visibility: 1

diff  --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h 
b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index 2c6357421354..a34f6e38a616 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -757,9 +757,10 @@ class GlobalVarSummary : public GlobalValueSummary {
 
 public:
   struct GVarFlags {
-GVarFlags(bool ReadOnly, bool WriteOnly, bool Constant)
+GVarFlags(bool ReadOnly, bool WriteOnly, bool Constant,
+  GlobalObject::VCallVisibility Vis)
 : MaybeReadOnly(ReadOnly), MaybeWriteOnly(WriteOnly),
-  Constant(Constant) {}
+  Constant(Constant), VCallVisibility(Vis) {}
 
 // If true indicates that this global variable might be accessed
 // purely by non-volatile load instructions. This in turn means
@@ -780,6 +781,9 @@ class GlobalVarSummary : public GlobalValueSummary {
 // opportunity to make some extra optimizations. Readonly constants
 // are also internalized.
 unsigned Constant : 1;
+// Set from metadata on vtable definitions during the module summary
+// analysis.
+unsigned VCallVisibility : 2;
   } VarFlags;
 
   GlobalVarSummary(GVFlags Flags, GVarFlags VarFlags,
@@ -798,6 +802,12 @@ class GlobalVarSummary : public GlobalValueSummary {
   bool maybeReadOnly() const { return VarFlags.MaybeReadOnly; }
   bool maybeWriteOnly() const { return VarFlags.MaybeWriteOnly; }
   bool isConstant() const { return VarFlags.Constant; }
+  void setVCallVisibility(GlobalObject::VCallVisibility Vis) {
+VarFlags.VCallVisibility = Vis;
+  }
+  GlobalObject::VCallVisibility getVCallVisibility() const {
+return (GlobalObject::VCallVisibility)VarFlags.VCallVisibility;
+  }
 
   void setVTableFuncs(VTableFuncList Funcs) {
 assert(!VTableFuncs);

diff  --git 

[clang] cc14de8 - [CUDA] Fix order of memcpy arguments in __shfl_*(<64-bit type>).

2020-01-23 Thread Artem Belevich via cfe-commits

Author: Artem Belevich
Date: 2020-01-23T13:17:52-08:00
New Revision: cc14de88da27a8178976972bdc8211c31f7ca9ae

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

LOG: [CUDA] Fix order of memcpy arguments in __shfl_*(<64-bit type>).

Wrong argument order resulted in broken shfl ops for 64-bit types.

Added: 


Modified: 
clang/lib/Headers/__clang_cuda_intrinsics.h

Removed: 




diff  --git a/clang/lib/Headers/__clang_cuda_intrinsics.h 
b/clang/lib/Headers/__clang_cuda_intrinsics.h
index b67461a146fc..c7bff6a9d8fe 100644
--- a/clang/lib/Headers/__clang_cuda_intrinsics.h
+++ b/clang/lib/Headers/__clang_cuda_intrinsics.h
@@ -45,7 +45,7 @@
 _Static_assert(sizeof(__val) == sizeof(__Bits));   
\
 _Static_assert(sizeof(__Bits) == 2 * sizeof(int)); 
\
 __Bits __tmp;  
\
-memcpy(&__val, &__tmp, sizeof(__val)); 
\
+memcpy(&__tmp, &__val, sizeof(__val));\
 __tmp.__a = ::__FnName(__tmp.__a, __offset, __width);  
\
 __tmp.__b = ::__FnName(__tmp.__b, __offset, __width);  
\
 long long __ret;   
\
@@ -129,7 +129,7 @@ __MAKE_SHUFFLES(__shfl_xor, __nvvm_shfl_bfly_i32, 
__nvvm_shfl_bfly_f32, 0x1f,
 _Static_assert(sizeof(__val) == sizeof(__Bits));   
\
 _Static_assert(sizeof(__Bits) == 2 * sizeof(int)); 
\
 __Bits __tmp;  
\
-memcpy(&__val, &__tmp, sizeof(__val)); 
\
+memcpy(&__tmp, &__val, sizeof(__val)); 
\
 __tmp.__a = ::__FnName(__mask, __tmp.__a, __offset, __width);  
\
 __tmp.__b = ::__FnName(__mask, __tmp.__b, __offset, __width);  
\
 long long __ret;   
\



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


[PATCH] D72553: [clang-tidy] Add performance-prefer-preincrement check

2020-01-23 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon times-circle color=red} Unit tests: fail. 62129 tests passed, 5 failed 
and 807 were skipped.

  failed: libc++.std/language_support/cmp/cmp_partialord/partialord.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_strongeq/cmp.strongeq.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_strongord/strongord.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_weakeq/cmp.weakeq.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_weakord/weakord.pass.cpp

{icon times-circle color=red} clang-tidy: fail. clang-tidy found 0 errors and 1 
warnings 
.
 0 of them are added as review comments below (why? 
).

{icon check-circle color=green} clang-format: pass.

Build artifacts 
: 
diff.json 
,
 clang-tidy.txt 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 


//Pre-merge checks is in beta. Report issue 
.
 Please join beta  or enable 
it for your project 
.//


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72553/new/

https://reviews.llvm.org/D72553



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


[PATCH] D73285: [OpenMP][OMPIRBuilder][BugFix] Handle Unreachable Finalization blocks in `parallel` generation

2020-01-23 Thread Fady Ghanim via Phabricator via cfe-commits
fghanim updated this revision to Diff 239991.
fghanim added a comment.

- Cleaning up some leftover code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73285/new/

https://reviews.llvm.org/D73285

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Index: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
===
--- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -439,6 +439,18 @@
 Worklist.push_back(SuccBB);
   }
 
+  // If we didn't emit a branch to FiniBB during body generation, it means
+  // FiniBB is unreachable (e.g. while(1);). stop generating all the
+  // unreachable blocks, and remove anything we are not going to use.
+  // Check to see if PRegPreFiniBB is reachable from PRegionBodyBB.
+  bool FoundPreFiniBB = false;
+  for (auto BI : ParallelRegionBlocks) {
+if (BI == PRegPreFiniBB) {
+  FoundPreFiniBB = true;
+  break;
+}
+  }
+
   CodeExtractorAnalysisCache CEAC(*OuterFn);
   CodeExtractor Extractor(ParallelRegionBlocks, /* DominatorTree */ nullptr,
   /* AggregateArgs */ false,
@@ -564,7 +576,7 @@
 }
   }
 
-  Builder.CreateCall(RTLFn, RealArgs);
+  CallInst *ForkCall = Builder.CreateCall(RTLFn, RealArgs);
 
   LLVM_DEBUG(dbgs() << "With fork_call placed: "
 << *Builder.GetInsertBlock()->getParent() << "\n");
@@ -583,7 +595,6 @@
   if (!ElseTI) {
 CI->eraseFromParent();
   } else {
-
 // If an "if" clause was present we are now generating the serialized
 // version into the "else" branch.
 Builder.SetInsertPoint(ElseTI);
@@ -608,26 +619,53 @@
   << *Builder.GetInsertBlock()->getParent() << "\n");
   }
 
-  // Adjust the finalization stack, verify the adjustment, and call the
-  // finalize function a last time to finalize values between the pre-fini block
-  // and the exit block if we left the parallel "the normal way".
+  assert(!FinalizationStack.empty() && "Unexpected finalization stack state!");
   auto FiniInfo = FinalizationStack.pop_back_val();
-  (void)FiniInfo;
   assert(FiniInfo.DK == OMPD_parallel &&
  "Unexpected finalization stack state!");
+  if (FoundPreFiniBB) {
+// PRegPreFiniBB is reachable. Adjust the finalization stack, verify the
+// adjustment, and call the finalize function a last time to finalize values
+// between the pre-fini block and the exit block if we left the parallel
+// "the normal way".
+(void)FiniInfo;
+
+Instruction *PreFiniTI = PRegPreFiniBB->getTerminator();
+assert(PreFiniTI->getNumSuccessors() == 1 &&
+   PreFiniTI->getSuccessor(0)->size() == 1 &&
+   isa(PreFiniTI->getSuccessor(0)->getTerminator()) &&
+   "Unexpected CFG structure!");
+
+InsertPointTy PreFiniIP(PRegPreFiniBB, PreFiniTI->getIterator());
+FiniCB(PreFiniIP);
+  } else {
+// PRegPreFiniBB is unreachable. remove the unreachable blocks
+// and discard the finalization callback
+llvm::SmallVector ToBeDeletedBB;
+ToBeDeletedBB.push_back(PRegPreFiniBB);
+BranchInst *BBTerminator =
+dyn_cast_or_null(PRegPreFiniBB->getTerminator());
+while (BBTerminator) {
+  assert(!BBTerminator->isConditional() &&
+ "unexpected conditional branch in unreachable blocks");
+  BasicBlock *next = BBTerminator->getSuccessor(0);
+  ToBeDeletedBB.push_back(next);
+  BBTerminator = dyn_cast_or_null(next->getTerminator());
+}
 
-  Instruction *PreFiniTI = PRegPreFiniBB->getTerminator();
-  assert(PreFiniTI->getNumSuccessors() == 1 &&
- PreFiniTI->getSuccessor(0)->size() == 1 &&
- isa(PreFiniTI->getSuccessor(0)->getTerminator()) &&
- "Unexpected CFG structure!");
+for (auto BB : ToBeDeletedBB) {
+  BB->eraseFromParent();
+}
 
-  InsertPointTy PreFiniIP(PRegPreFiniBB, PreFiniTI->getIterator());
-  FiniCB(PreFiniIP);
+BasicBlock *ForkBB = ForkCall->getParent();
+ForkBB->getTerminator()->eraseFromParent();
+AfterIP = InsertPointTy(ForkBB, ForkBB->end());
+  }
 
   for (Instruction *I : ToBeDeleted)
 I->eraseFromParent();
 
+  AfterIP.getBlock()->dump();
   return AfterIP;
 }
 
Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1377,15 +1377,15 @@
   ReturnBlock = getJumpDestInCurrentScope();
 
   llvm::BasicBlock *CodeGenIPBB = CodeGenIP.getBlock();
-  CodeGenIPBB->splitBasicBlock(CodeGenIP.getPoint());
   llvm::Instruction *CodeGenIPBBTI = CodeGenIPBB->getTerminator();
-  CodeGenIPBBTI->removeFromParent();
+  CodeGenIPBBTI->eraseFromParent();
 
   Builder.SetInsertPoint(CodeGenIPBB);
 
   EmitStmt(ParallelRegionBodyStmt);
 
-  Builder.Insert(CodeGenIPBBTI);
+  if 

[PATCH] D72553: [clang-tidy] Add performance-prefer-preincrement check

2020-01-23 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 239988.
njames93 added a comment.

- Rebase trunk and fix a few nits with test file


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72553/new/

https://reviews.llvm.org/D72553

Files:
  clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp
  clang-tools-extra/clang-tidy/performance/CMakeLists.txt
  clang-tools-extra/clang-tidy/performance/PerformanceTidyModule.cpp
  clang-tools-extra/clang-tidy/performance/PreferPreIncrementCheck.cpp
  clang-tools-extra/clang-tidy/performance/PreferPreIncrementCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/checks/llvm-prefer-pre-increment.rst
  clang-tools-extra/docs/clang-tidy/checks/performance-prefer-pre-increment.rst
  
clang-tools-extra/test/clang-tidy/checkers/performance-prefer-pre-increment-disable-cpp-opcalls.cpp
  clang-tools-extra/test/clang-tidy/checkers/performance-prefer-pre-increment.c
  
clang-tools-extra/test/clang-tidy/checkers/performance-prefer-pre-increment.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/performance-prefer-pre-increment.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/performance-prefer-pre-increment.cpp
@@ -0,0 +1,82 @@
+// RUN: %check_clang_tidy %s performance-prefer-pre-increment %t
+
+template 
+class Iterator {
+  T *Current;
+
+public:
+  Iterator(T *Pointer) : Current(Pointer) {}
+  T *() const { return *Current; }
+  Iterator ++() { return ++Current, *this; }
+  Iterator operator++(int) {
+Iterator Copy = *this;
+++Current;
+return Copy;
+  }
+  Iterator () { return --Current, *this; }
+  Iterator operator--(int) {
+Iterator Copy = *this;
+--Current;
+return Copy;
+  }
+};
+
+template 
+class PostfixIterator {
+  T *Current;
+
+public:
+  PostfixIterator(T *Pointer) : Current(Pointer) {}
+  T *() const { return *Current; }
+  PostfixIterator operator++(int) {
+PostfixIterator Copy = *this;
+++Current;
+return Copy;
+  }
+  PostfixIterator operator--(int) {
+PostfixIterator Copy = *this;
+--Current;
+return Copy;
+  }
+};
+
+void foo() {
+  int Array[32];
+  Iterator It([0]);
+  It++;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: Use Pre-increment instead of Post-increment
+  // CHECK-FIXES: {{^}}  ++It;
+  It--;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: Use Pre-decrement instead of Post-decrement
+  // CHECK-FIXES: {{^}}  --It;
+  (*It)++;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: Use Pre-increment instead of Post-increment
+  // CHECK-FIXES: {{^}}  ++(*It);
+  (*It)--;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: Use Pre-decrement instead of Post-decrement
+  // CHECK-FIXES: {{^}}  --(*It);
+
+  *It++;
+  // CHECK-MESSAGES-NOT: [[@LINE-1]]:{{\d*}}: warning: Use Pre-increment instead of Post-increment
+  *It--;
+  // CHECK-MESSAGES-NOT: [[@LINE-1]]:{{\d*}}: warning: Use Pre-decrement instead of Post-decrement
+
+  PostfixIterator PfIt([0]);
+  PfIt++;
+  // CHECK-MESSAGES-NOT: [[@LINE-1]]:{{\d*}}: warning: Use Pre-increment instead of Post-increment
+  // CHECK-FIXES-NOT: {{^}}  ++PfIt;
+  PfIt--;
+  // CHECK-MESSAGES-NOT: [[@LINE-1]]:{{\d*}}: warning: Use Pre-decrement instead of Post-decrement
+  // CHECK-FIXES-NOT: {{^}}  --PfIt;
+  (*PfIt)++;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: Use Pre-increment instead of Post-increment
+  // CHECK-FIXES: {{^}}  ++(*PfIt);
+  (*PfIt)--;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: Use Pre-decrement instead of Post-decrement
+  // CHECK-FIXES: {{^}}  --(*PfIt);
+
+  *PfIt++;
+  // CHECK-MESSAGES-NOT: [[@LINE-1]]:{{\d*}}: warning: Use Pre-increment instead of Post-increment
+  *PfIt--;
+  // CHECK-MESSAGES-NOT: [[@LINE-1]]:{{\d*}}: warning: Use Pre-decrement instead of Post-decrement
+}
Index: clang-tools-extra/test/clang-tidy/checkers/performance-prefer-pre-increment.c
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/performance-prefer-pre-increment.c
@@ -0,0 +1,128 @@
+// RUN: %check_clang_tidy %s performance-prefer-pre-increment %t
+
+#define INC(X) X++
+#define DEC(X) X--
+
+void foo(int A) {
+  for (int I = 0; I < 10; I++) {
+// CHECK-MESSAGES: [[@LINE-1]]:27: warning: Use Pre-increment instead of Post-increment
+// CHECK-FIXES: {{^}}  for (int I = 0; I < 10; ++I) {
+  }
+  for (int I = 0; I < 10; ++I) {
+// CHECK-MESSAGES-NOT: [[@LINE-1]]:{{\d*}}: warning: Use Pre-increment instead of Post-increment
+  }
+  for (int I = 0; I < 10; A = I++) {
+// CHECK-MESSAGES-NOT: [[@LINE-1]]:{{\d*}}: warning: Use Pre-increment instead of Post-increment
+  }
+
+  for (int I = 10; I < 0; I--) {
+// CHECK-MESSAGES: [[@LINE-1]]:27: warning: Use Pre-decrement instead of Post-decrement
+// CHECK-FIXES: {{^}}  for (int I = 10; I < 0; --I) {
+  }
+  for (int I = 10; I < 0; 

[PATCH] D73261: [dwarf5] Support DebugInfo for constexpr for C++ variables and functions

2020-01-23 Thread Paul Robinson via Phabricator via cfe-commits
probinson added a comment.

I put in a lot of comments about spelling for the new parameter (constExpr, 
isConstexpr, isConstExpr) which should be named consistently throughout.  
Please do not use Constant or any variant, as that tends to mean something else.

But, what I would rather see instead of a new parameter everywhere: define a 
new DIFlag bit.  Most of the churn goes away, and there's no bitcode 
compatibility issue.  It's true that there are not many DIFlag bits left, but 
as this attribute can apply to both variables and functions, it seems 
appropriate to put it there.




Comment at: llvm/include/llvm/IR/DIBuilder.h:585
 ///specified)
+/// \isConstExpr   Boolean flag indicating wheather this variable is
+///constexpr or not

`\param isConstExpr` 
also wheather -> whether



Comment at: llvm/include/llvm/IR/DIBuilder.h:666
 /// \param SPFlags   Additional flags specific to subprograms.
 /// \param TParams   Function template parameters.
 /// \param ThrownTypes   Exception types this function may throw.

Add `\param constExpr` here.




Comment at: llvm/include/llvm/IR/DIBuilder.h:702
 ///  This flags are used to emit dwarf attributes.
 /// \param SPFlags   Additional flags specific to subprograms.
 /// \param TParams   Function template parameters.

Add `\param isConstExpr` here



Comment at: llvm/include/llvm/IR/DebugInfoMetadata.h:1694
 getThisAdjustment(), getFlags(), getSPFlags(),
+false, /*todo*/
 getUnit(), getTemplateParams(), getDeclaration(),

todo?



Comment at: llvm/include/llvm/IR/DebugInfoMetadata.h:2293
   Metadata *getRawType() const { return getOperand(3); }
+  bool isConstant() const { return ConstExpr; }
 

`isConstExpr`



Comment at: llvm/include/llvm/IR/DebugInfoMetadata.h:2635
bool IsLocalToUnit, bool IsDefinition, uint32_t AlignInBits,
-   ArrayRef Ops)
-  : DIVariable(C, DIGlobalVariableKind, Storage, Line, Ops, AlignInBits),
+   bool IsConstant, ArrayRef Ops)
+  : DIVariable(C, DIGlobalVariableKind, Storage, Line, Ops, AlignInBits,

`IsConstExpr` as this flag is specifically tied to the const_expr attribute; 
"constant" means something different.



Comment at: llvm/include/llvm/IR/DebugInfoMetadata.h:2666
 isDefinition(), getStaticDataMemberDeclaration(),
-getTemplateParams(), getAlignInBits());
+getTemplateParams(), getAlignInBits(), false /*TODO*/);
   }

TODO?



Comment at: llvm/include/llvm/IR/DebugInfoMetadata.h:2675
+   DIDerivedType *StaticDataMemberDeclaration, MDTuple *TemplateParams,
+   uint32_t AlignInBits, bool IsConstant),
+  (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition,

`IsConstExpr`



Comment at: llvm/include/llvm/IR/DebugInfoMetadata.h:2683
+   Metadata *StaticDataMemberDeclaration, Metadata *TemplateParams,
+   uint32_t AlignInBits, bool IsConstant),
+  (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition,

`IsConstExpr`



Comment at: llvm/include/llvm/IR/DebugInfoMetadata.h:2778
   unsigned Arg, DIFlags Flags, uint32_t AlignInBits,
-  ArrayRef Ops)
-  : DIVariable(C, DILocalVariableKind, Storage, Line, Ops, AlignInBits),
+  bool IsConstant, ArrayRef Ops)
+  : DIVariable(C, DILocalVariableKind, Storage, Line, Ops, AlignInBits,

`IsConstExpr`



Comment at: llvm/include/llvm/IR/DebugInfoMetadata.h:2789
   DIType *Type, unsigned Arg, DIFlags Flags,
-  uint32_t AlignInBits, StorageType Storage,
+  uint32_t AlignInBits, bool IsConstant,
+  StorageType Storage,

`IsConstExpr`



Comment at: llvm/include/llvm/IR/DebugInfoMetadata.h:2799
   Metadata *Type, unsigned Arg, DIFlags Flags,
-  uint32_t AlignInBits, StorageType Storage,
+  uint32_t AlignInBits, bool IsConstant,
+  StorageType Storage,

`IsConstExpr`



Comment at: llvm/include/llvm/IR/DebugInfoMetadata.h:2813
  unsigned Line, DIType *Type, unsigned Arg, DIFlags Flags,
- uint32_t AlignInBits),
-(Scope, Name, File, Line, Type, Arg, Flags, 

[PATCH] D73237: [CUDA] Fix order of memcpy arguments in __shfl_*(<64-bit type>).

2020-01-23 Thread Tim Shen via Phabricator via cfe-commits
timshen accepted this revision.
timshen added a comment.
This revision is now accepted and ready to land.

What's the test situation for these headers?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73237/new/

https://reviews.llvm.org/D73237



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


[PATCH] D67678: PR17164: Change clang's default behavior from -flax-vector-conversions=all to -flax-vector-conversions=integer.

2020-01-23 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added a comment.

In D67678#1836922 , @rsmith wrote:

> In D67678#1836668 , @dexonsmith 
> wrote:
>
> > In D67678#1836628 , @steven_wu 
> > wrote:
> >
> > > In D67678#1834957 , @rsmith 
> > > wrote:
> > >
> > > > In D67678#1834542 , @steven_wu 
> > > > wrote:
> > > >
> > > > > @rsmith This also breaks macOS SDK. Can we revert this as we discuss 
> > > > > a less aggressive option?
> > > >
> > > >
> > > > Do you have a timeline for how long it would take to fix the MacOS SDK? 
> > > > Is this something we could realistically aim to do in Clang 11 instead? 
> > > > I would really prefer for us to not have different defaults for Darwin 
> > > > versus everywhere else, so if waiting one release cycle is enough, that 
> > > > seems fine.
> > >
> > >
> > > I am also not sure if we have rules about SDK compatibility for releases 
> > > and I can't say macOS SDK can definitely be fixed before clang 11 
> > > release. @dexonsmith @arphaman might have more info.
> >
> >
> > We can't comment on future releases.
> >
> > That said, if this is urgent, let @arphaman know and we can try to qualify 
> > internally sometime in the next few months and we can report back what 
> > issues we find.
>
>
> Understood. The current situation is deeply unpalatable (the conversions we 
> allow by default that this patch would have disabled are *evil* and have 
> never been supported by GCC; it looks like Clang only ever allowed them as a 
> bug, and we really need to turn them off by default for safety as much as for 
> GCC compatibility). But this isn't a regression, at least, so I don't think 
> this is especially urgent. (I was working on this because Agner Fog made an 
> impassioned plea that we fix this, and I think our community owes Agner a 
> favor or two...)


Yeah, it definitely seems like a good change.

> If there's no timeline to update the macOS SDK, then perhaps we could add a 
> hack to Clang to allow these conversions only in limited contexts (the 
> specific parts of the macOS SDK that are relying on them). Do you know how 
> many such places there might be? If it's just a few functions, we could match 
> against the function names, or depending on what `SIMD_CFUNC` expands to, 
> perhaps we could match that. Failing that, we could set a platform-specific 
> default or similar.

A hack like this sounds pragmatic to me.  An initial look suggests it's a small 
number of frameworks; I suspect many functions, but we could potentially match 
on partial file path or `SIMD_CFUNC`.  We need a deeper audit across our 
internal stack to be sure, though.  I don't think we'll have bandwidth for that 
until ~late February.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67678/new/

https://reviews.llvm.org/D67678



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


[clang] 1624cba - Partially revert "[IR] Attribute/AttrBuilder: use Value::MaximumAlignment magic constant"

2020-01-23 Thread Roman Lebedev via cfe-commits

Author: Roman Lebedev
Date: 2020-01-23T23:30:42+03:00
New Revision: 1624cba7824967c15ac36d9fdd41bb9878463dbe

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

LOG: Partially revert "[IR] Attribute/AttrBuilder: use Value::MaximumAlignment 
magic constant"

Apparently makes bots angry.

This reverts commit d096f8d306b2b16a25f65ffb70849ca7963a0dac.

Added: 


Modified: 
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaDeclAttr.cpp

Removed: 




diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 92d964d6603d..fae1ade80ca9 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -372,15 +372,6 @@ class Sema final {
   QualType ResultTy,
   ArrayRef Args);
 
-  /// The maximum alignment, same as in llvm::Value. We duplicate them here
-  /// because that allows us not to duplicate the constants in clang code,
-  /// which we must to since we can't directly use the llvm constants.
-  ///
-  /// This is the greatest alignment value supported by load, store, and alloca
-  /// instructions, and global values.
-  static const unsigned MaxAlignmentExponent = 29;
-  static const unsigned MaximumAlignment = 1u << MaxAlignmentExponent;
-
 public:
   typedef OpaquePtr DeclGroupPtrTy;
   typedef OpaquePtr TemplateTy;

diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 1539f3375c41..1f361569e09d 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5373,9 +5373,11 @@ bool Sema::SemaBuiltinAssumeAligned(CallExpr *TheCall) {
   return Diag(TheCall->getBeginLoc(), diag::err_alignment_not_power_of_two)
  << Arg->getSourceRange();
 
-if (Result > Sema::MaximumAlignment)
+// Alignment calculations can wrap around if it's greater than 2**29.
+unsigned MaximumAlignment = 536870912;
+if (Result > MaximumAlignment)
   Diag(TheCall->getBeginLoc(), diag::warn_assume_aligned_too_great)
-  << Arg->getSourceRange() << Sema::MaximumAlignment;
+  << Arg->getSourceRange() << MaximumAlignment;
   }
 
   if (NumArgs > 2) {

diff  --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index b404b45fec59..8aff975b8f2d 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -3810,9 +3810,13 @@ void Sema::AddAlignedAttr(Decl *D, const 
AttributeCommonInfo , Expr *E,
 }
   }
 
-  if (AlignVal > Sema::MaximumAlignment) {
+  // Alignment calculations can wrap around if it's greater than 2**28.
+  unsigned MaxValidAlignment =
+  Context.getTargetInfo().getTriple().isOSBinFormatCOFF() ? 8192
+  : 268435456;
+  if (AlignVal > MaxValidAlignment) {
 Diag(AttrLoc, diag::err_attribute_aligned_too_great)
-<< Sema::MaximumAlignment << E->getSourceRange();
+<< MaxValidAlignment << E->getSourceRange();
 return;
   }
 



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


[PATCH] D72222: [Driver][CodeGen] Add -fpatchable-function-entry=N[,0]

2020-01-23 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment.

In D7#1836687 , @MaskRay wrote:

> (I really dislike how the feature was developed on the GCC side. Yet another 
> Linux-kernel specific GCC option when there are already 4 existing options 
> for the same feature)


Maybe I'm reading too much into it, but please always have respect for the 
competition, as a representative of the company and LLVM community you 
represent, as well as my friend.  It should be clear why that's important and 
why I won't tolerate anything less.  If you still disagree, I'm happy to talk 
more about it privately.

Can you enumerate the 4 existing options?  If we do already have an existing 
tool in our toolbox, it would be good to consider their strengths and 
limitations before building a new tool.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D7/new/

https://reviews.llvm.org/D7



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


[clang] fa2fc81 - Re-add documentation for -flax-vector-conversions= removed in

2020-01-23 Thread Richard Smith via cfe-commits

Author: Richard Smith
Date: 2020-01-23T12:28:03-08:00
New Revision: fa2fc81d3464aa9b6e5e9d2ad8f512904712d2b7

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

LOG: Re-add documentation for -flax-vector-conversions= removed in
edd4398f4cd33a305afbca76ac4e6590e9337f4d.

The documentation remains correct despite the revert of the patch.

Added: 


Modified: 
clang/docs/CommandGuide/clang.rst

Removed: 




diff  --git a/clang/docs/CommandGuide/clang.rst 
b/clang/docs/CommandGuide/clang.rst
index 7b0873600fc3..6947450beb43 100644
--- a/clang/docs/CommandGuide/clang.rst
+++ b/clang/docs/CommandGuide/clang.rst
@@ -278,9 +278,18 @@ Language Selection and Mode Options
  Make all string literals default to writable.  This disables uniquing of
  strings and other optimizations.
 
-.. option:: -flax-vector-conversions
+.. option:: -flax-vector-conversions, -flax-vector-conversions=, 
-fno-lax-vector-conversions
 
  Allow loose type checking rules for implicit vector conversions.
+ Possible values of :
+
+ - ``none``: allow no implicit conversions between vectors
+ - ``integer``: allow implicit bitcasts between integer vectors of the same
+   overall bit-width
+ - ``all``: allow implicit bitcasts between any vectors of the same
+   overall bit-width
+
+  defaults to ``integer`` if unspecified.
 
 .. option:: -fblocks
 



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


[PATCH] D72553: [clang-tidy] Add performance-prefer-preincrement check

2020-01-23 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon times-circle color=red} Unit tests: fail. 61939 tests passed, 5 failed 
and 782 were skipped.

  failed: libc++.std/language_support/cmp/cmp_partialord/partialord.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_strongeq/cmp.strongeq.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_strongord/strongord.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_weakeq/cmp.weakeq.pass.cpp
  failed: libc++.std/language_support/cmp/cmp_weakord/weakord.pass.cpp

{icon times-circle color=red} clang-tidy: fail. clang-tidy found 0 errors and 1 
warnings 
.
 0 of them are added as review comments below (why? 
).

{icon times-circle color=red} clang-format: fail. Please format your changes 
with clang-format by running `git-clang-format HEAD^` or applying this patch 
.

Build artifacts 
: 
diff.json 
,
 clang-tidy.txt 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 


//Pre-merge checks is in beta. Report issue 
.
 Please join beta  or enable 
it for your project 
.//


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72553/new/

https://reviews.llvm.org/D72553



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


[PATCH] D73140: [clangd] Add C++20 concepts support to TargetFinder

2020-01-23 Thread Nathan Ridge via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcbcd07a4815f: [clangd] Add C++20 concepts support to 
TargetFinder (authored by nridge).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73140/new/

https://reviews.llvm.org/D73140

Files:
  clang-tools-extra/clangd/FindTarget.cpp
  clang-tools-extra/clangd/unittests/FindTargetTests.cpp


Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -339,6 +339,24 @@
{"struct Test", Rel::TemplatePattern});
 }
 
+TEST_F(TargetDeclTest, Concept) {
+  Code = R"cpp(
+template 
+concept Fooable = requires (T t) { t.foo(); };
+
+template  requires [[Fooable]]
+void bar(T t) {
+  t.foo();
+}
+  )cpp";
+  Flags.push_back("-std=c++2a");
+  EXPECT_DECLS(
+  "ConceptSpecializationExpr",
+  // FIXME: Should we truncate the pretty-printed form of a concept decl
+  // somewhere?
+  {"template  concept Fooable = requires (T t) { t.foo(); 
};"});
+}
+
 TEST_F(TargetDeclTest, FunctionTemplate) {
   Code = R"cpp(
 // Implicit specialization.
Index: clang-tools-extra/clangd/FindTarget.cpp
===
--- clang-tools-extra/clangd/FindTarget.cpp
+++ clang-tools-extra/clangd/FindTarget.cpp
@@ -17,6 +17,7 @@
 #include "clang/AST/DeclarationName.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
+#include "clang/AST/ExprConcepts.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/PrettyPrinter.h"
@@ -279,6 +280,9 @@
   void VisitCallExpr(const CallExpr *CE) {
 Outer.add(CE->getCalleeDecl(), Flags);
   }
+  void VisitConceptSpecializationExpr(const ConceptSpecializationExpr *E) {
+Outer.add(E->getNamedConcept(), Flags);
+  }
   void VisitDeclRefExpr(const DeclRefExpr *DRE) {
 const Decl *D = DRE->getDecl();
 // UsingShadowDecl allows us to record the UsingDecl.


Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -339,6 +339,24 @@
{"struct Test", Rel::TemplatePattern});
 }
 
+TEST_F(TargetDeclTest, Concept) {
+  Code = R"cpp(
+template 
+concept Fooable = requires (T t) { t.foo(); };
+
+template  requires [[Fooable]]
+void bar(T t) {
+  t.foo();
+}
+  )cpp";
+  Flags.push_back("-std=c++2a");
+  EXPECT_DECLS(
+  "ConceptSpecializationExpr",
+  // FIXME: Should we truncate the pretty-printed form of a concept decl
+  // somewhere?
+  {"template  concept Fooable = requires (T t) { t.foo(); };"});
+}
+
 TEST_F(TargetDeclTest, FunctionTemplate) {
   Code = R"cpp(
 // Implicit specialization.
Index: clang-tools-extra/clangd/FindTarget.cpp
===
--- clang-tools-extra/clangd/FindTarget.cpp
+++ clang-tools-extra/clangd/FindTarget.cpp
@@ -17,6 +17,7 @@
 #include "clang/AST/DeclarationName.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
+#include "clang/AST/ExprConcepts.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/PrettyPrinter.h"
@@ -279,6 +280,9 @@
   void VisitCallExpr(const CallExpr *CE) {
 Outer.add(CE->getCalleeDecl(), Flags);
   }
+  void VisitConceptSpecializationExpr(const ConceptSpecializationExpr *E) {
+Outer.add(E->getNamedConcept(), Flags);
+  }
   void VisitDeclRefExpr(const DeclRefExpr *DRE) {
 const Decl *D = DRE->getDecl();
 // UsingShadowDecl allows us to record the UsingDecl.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   3   >