[PATCH] D72901: [OpenMP] [DOCS] Update OMP5.0 feature status table [NFC]

2020-01-16 Thread Kelvin Li via Phabricator via cfe-commits
kkwli0 created this revision.
kkwli0 added reviewers: ABataev, RaviNarayanaswamy, jdoerfert.
Herald added a subscriber: guansong.

Add missing OMP5.0 features.


https://reviews.llvm.org/D72901

Files:
  clang/docs/OpenMPSupport.rst


Index: clang/docs/OpenMPSupport.rst
===
--- clang/docs/OpenMPSupport.rst
+++ clang/docs/OpenMPSupport.rst
@@ -191,7 +191,7 @@
 
+--+--+--+---+
 | device extension | allow access to the reference count 
(omp_target_is_present)  | :part:`worked on`|   
|
 
+--+--+--+---+
-| device extension | requires directive (unified shared memory)
   | :good:`done` | 
  |
+| device extension | requires directive
   | :good:`done` | 
  |
 
+--+--+--+---+
 | device extension | clause: unified_address, 
unified_shared_memory   | :good:`done` | D52625,D52359  
   |
 
+--+--+--+---+
@@ -207,12 +207,14 @@
 
+--+--+--+---+
 | device extension | clause: use_device_addr for target data   
   | :part:`worked on`| 
  |
 
+--+--+--+---+
-| device extension | map(replicate) or map(local) when requires 
unified_shared_me | :part:`worked on`| D55719,D55892
 |
+| device extension | map(local) when requires 
unified_shared_memory   | :part:`worked on`| D55719,D55892  
   |
 
+--+--+--+---+
 | device extension | teams construct on the host device
   | :part:`worked on`| Clang part is done, r371553.
  |
 
+--+--+--+---+
 | device extension | support non-contiguous array sections for 
target update  | :part:`worked on`| 
  |
 
+--+--+--+---+
+| device extension | pointer attachment
   | :none:`unclaimed`| 
  |
++--+--+--+---+
 | atomic extension | hints for the atomic construct
   | :part:`worked on`| D51233  
  |
 
+--+--+--+---+
 | base language| C11 support   
   | :none:`unclaimed`| 
  |
@@ 

[PATCH] D72883: [clangd][test] Disable a particular testcase in FindExplicitReferencesTest when LLVM_ENABLE_EXPENSIVE_CHECKS

2020-01-16 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added a comment.

Hi @jkorous, reverting this as d54d71b67e60 
 should've 
fixed this. Please let us know if that's not the case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72883



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


[clang-tools-extra] 4df94d5 - Revert "[clangd][test] Disable a particular testcase in FindExplicitReferencesTest when LLVM_ENABLE_EXPENSIVE_CHECKS"

2020-01-16 Thread Kadir Cetinkaya via cfe-commits

Author: Kadir Cetinkaya
Date: 2020-01-17T08:51:13+01:00
New Revision: 4df94d5b513c20842f5eeeb1e0d059bfa6741d91

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

LOG: Revert "[clangd][test] Disable a particular testcase in 
FindExplicitReferencesTest when LLVM_ENABLE_EXPENSIVE_CHECKS"

This reverts commit 42b3c38903c9c80e129ce678db7f522967e91eeb.

Should've been fixed by d54d71b67e60

Added: 


Modified: 
clang-tools-extra/clangd/unittests/FindTargetTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp 
b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
index c96b3a572322..408ebe24e773 100644
--- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -770,10 +770,6 @@ TEST_F(FindExplicitReferencesTest, All) {
 "1: targets = {vector}\n"
 "2: targets = {x}\n"},
// Handle UnresolvedLookupExpr.
-   // FIXME
-   // This case fails when expensive checks are enabled.
-   // Seems like the order of ns1::func and ns2::func isn't defined.
-   #ifndef EXPENSIVE_CHECKS
{R"cpp(
 namespace ns1 { void func(char*); }
 namespace ns2 { void func(int*); }
@@ -787,7 +783,6 @@ TEST_F(FindExplicitReferencesTest, All) {
 )cpp",
 "0: targets = {ns1::func, ns2::func}\n"
 "1: targets = {t}\n"},
-#endif
// Handle UnresolvedMemberExpr.
{R"cpp(
 struct X {



___
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-16 Thread Pierre Habouzit via Phabricator via cfe-commits
MadCoder updated this revision to Diff 238698.
MadCoder added a comment.

Added some more tests to make sure it works along inheritance chains as expected


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


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-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)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D72841: [RFC] Add support for pragma float_control, to control precision and exception behavior at the source level

2020-01-16 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added inline comments.



Comment at: clang/docs/LanguageExtensions.rst:3031
 
+The ``#pragma float_control`` pragma allows floating-point precision and
+floating-point exception behavior to be specified

Floating-point precision refers to the number of bits in mantissa, here the 
term `precise floating-point semantics` looks more appropriate.



Comment at: clang/docs/LanguageExtensions.rst:3056
+a = b[i] * c[i] + e;
+  }
 Specifying an attribute for multiple declarations (#pragma clang attribute)

Blank line is needed after the end of paragraph.



Comment at: clang/include/clang/AST/Decl.h:180
+/// Support for `#pragma float_control` line.
+class PragmaFloatControlDecl {
+

What is the purpose of this class? Do you plan to extend it? If you need to 
restrict the scope of constants like `FC_Unknown` it is better to use scoped 
enumerations.



Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:1279
   "compound statement">;
+def err_pragma_fc_scope : Error<
+  "'#pragma float_control' can only appear at file scope or at the start of a "

We already have several pragmas that require the same restriction (`clang fp`, 
`STDC FENV_ACCESS`) and will add some more (`STDC FENV_ROUND`), probably it 
makes sense to use generic message and supply pragma name as argument?



Comment at: clang/include/clang/Sema/Sema.h:543
 
+  typedef struct {
+bool HasPragma;

Why typedef, not simply `struct FpPragmaStateType`?
Usually we use C++ style of struct declarations.



Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:111
 // the corresponding enum in the IR.
-static llvm::fp::RoundingMode ToConstrainedRoundingMD(
+llvm::fp::RoundingMode clang::ToConstrainedRoundingMD(
   LangOptions::FPRoundingModeKind Kind) {

Is `clang::` necessary here? The file already has `using namespace clang;`.



Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:126
 // the corresponding enum in the IR.
-static llvm::fp::ExceptionBehavior ToConstrainedExceptMD(
+llvm::fp::ExceptionBehavior clang::ToConstrainedExceptMD(
   LangOptions::FPExceptionModeKind Kind) {

Ditto.



Comment at: clang/lib/Parse/ParsePragma.cpp:2522
+  IdentifierInfo *II = Tok.getIdentifierInfo();
+  PragmaFloatControlDecl::FloatControlKind Kind =
+llvm::StringSwitch(

Does such treatment allow a pragma like:

#pragma #pragma float_control(except, on), push

The comment to `PragmaFloatControlHandler::HandlePragma` says it is valid.



Comment at: clang/lib/Sema/SemaAttr.cpp:430
+break;
+  case PragmaFloatControlDecl::FC_Push:
+  case PragmaFloatControlDecl::FC_Pop:

`push` cannot be combined with `precise`?



Comment at: clang/lib/Sema/SemaExpr.cpp:13129
 if (FunctionDecl *F = dyn_cast(CurContext)) {
+  // If the expression occurs inside an internal global_var_init_function
+  // then the FunctionDecl is not availble

The standard says that static initializers execute in default FP mode.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72841



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


[PATCH] D71566: New checks for fortified sprintf

2020-01-16 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added reviewers: aaron.ballman, rsmith.
erik.pilkington added inline comments.



Comment at: clang/lib/Sema/SemaChecking.cpp:422
+  size_t StrLen =
+  std::min(std::max(TypeSize, size_t(1)) - 1, FormatStrRef.size());
+  if (!analyze_format_string::ParsePrintfString(

Wait, does this actually return a smaller length if there is a null-terminator 
embedded in the string? It looks like Format->getString() returns a StringRef 
with embedded nul bytes and .size() is returning the length. You might have to 
do something like: `FormatStrRef.find('0');`. Can you add a test for this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71566



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


[PATCH] D72897: List implicit operator== after implicit destructors in a vtable.

2020-01-16 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

I see two reasonable approaches here: we can rely on the implicit members being 
added in the right order by Sema, as this patch seems to do, or we can broaden 
the special treatment of implicit virtual functions in the v-table layout code. 
 The latter is more complex (we'd basically need to collect and sort all the 
implicit virtual functions), but it reliably isolates the ABI from 
implementation decisions like the order in which Sema processes implicit 
members and whether some lookup might have triggered an implicit declaration at 
a point we didn't expect.

I know that Sema used to have a lot of issues with implicitly declaring special 
members, but I also know that that was bound up with how we tracked special 
state for the class, and that code has changed a lot.   If you feel that that's 
an unlikely problem now, and you're comfortable with potentially having to 
generate implicit declarations of special members in different orders to 
satisfy different ABIs, I can accept this approach.  (It would be good to know 
what order MSVC will emit these members in, though.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72897



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


[PATCH] D69740: [profile] Support counter relocation at runtime

2020-01-16 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 238689.
phosek marked an inline comment as done.
phosek added a comment.

Addressed the comment and also added a test for Linux.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69740

Files:
  clang/docs/SourceBasedCodeCoverage.rst
  clang/lib/Driver/ToolChains/Darwin.cpp
  compiler-rt/lib/profile/CMakeLists.txt
  compiler-rt/lib/profile/InstrProfiling.h
  compiler-rt/lib/profile/InstrProfilingBiasVar.c
  compiler-rt/lib/profile/InstrProfilingBuffer.c
  compiler-rt/lib/profile/InstrProfilingFile.c
  compiler-rt/lib/profile/InstrProfilingInternal.h
  compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c
  compiler-rt/test/profile/ContinuousSyncMode/basic.c
  compiler-rt/test/profile/ContinuousSyncMode/lit.local.cfg.py
  compiler-rt/test/profile/ContinuousSyncMode/multiple-DSOs.c
  compiler-rt/test/profile/ContinuousSyncMode/online-merging.c
  compiler-rt/test/profile/ContinuousSyncMode/pid-substitution.c
  compiler-rt/test/profile/ContinuousSyncMode/runtime-counter-relocation.c
  compiler-rt/test/profile/ContinuousSyncMode/set-file-object.c
  compiler-rt/test/profile/ContinuousSyncMode/set-filename.c
  llvm/include/llvm/ProfileData/InstrProf.h
  llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h
  llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
  llvm/test/Instrumentation/InstrProfiling/runtime-counter-relocation.ll

Index: llvm/test/Instrumentation/InstrProfiling/runtime-counter-relocation.ll
===
--- /dev/null
+++ llvm/test/Instrumentation/InstrProfiling/runtime-counter-relocation.ll
@@ -0,0 +1,25 @@
+; RUN: opt < %s -S -instrprof | FileCheck %s
+; RUN: opt < %s -S -instrprof -runtime-counter-relocation | FileCheck -check-prefixes=RELOC %s
+
+target triple = "x86_64-unknown-linux-gnu"
+
+@__profn_foo = hidden constant [3 x i8] c"foo"
+; RELOC: @__llvm_profile_counter_bias = linkonce_odr global i64 0
+
+; CHECK-LABEL: define void @foo
+; CHECK-NEXT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i64 0, i64 0)
+; CHECK-NEXT: %1 = add i64 %pgocount, 1
+; CHECK-NEXT: store i64 %1, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i64 0, i64 0)
+; RELOC-LABEL: define void @foo
+; RELOC-NEXT: %1 = load i64, i64* @__llvm_profile_counter_bias
+; RELOC-NEXT: %2 = add i64 ptrtoint ([1 x i64]* @__profc_foo to i64), %1
+; RELOC-NEXT: %3 = inttoptr i64 %2 to i64*
+; RELOC-NEXT: %pgocount = load i64, i64* %3
+; RELOC-NEXT: %4 = add i64 %pgocount, 1
+; RELOC-NEXT: store i64 %4, i64* %3
+define void @foo() {
+  call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 0, i32 1, i32 0)
+  ret void
+}
+
+declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
Index: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
===
--- llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -83,6 +83,11 @@
 cl::desc("Rename counter variable of a comdat function based on cfg hash"),
 cl::init(true));
 
+cl::opt RuntimeCounterRelocation(
+"runtime-counter-relocation",
+cl::desc("Enable relocating counters at runtime."),
+cl::init(false));
+
 cl::opt ValueProfileStaticAlloc(
 "vp-static-alloc",
 cl::desc("Do static counter allocation for value profiler"),
@@ -431,6 +436,13 @@
   return true;
 }
 
+bool InstrProfiling::isRuntimeCounterRelocationEnabled() const {
+  if (RuntimeCounterRelocation.getNumOccurrences() > 0)
+return RuntimeCounterRelocation;
+
+  return TT.isOSFuchsia();
+}
+
 bool InstrProfiling::isCounterPromotionEnabled() const {
   if (DoCounterPromotion.getNumOccurrences() > 0)
 return DoCounterPromotion;
@@ -641,6 +653,26 @@
   Value *Addr = Builder.CreateConstInBoundsGEP2_64(Counters->getValueType(),
Counters, 0, Index);
 
+  if (isRuntimeCounterRelocationEnabled()) {
+Type *Int64Ty = Type::getInt64Ty(M->getContext());
+Type *Int64PtrTy = Type::getInt64PtrTy(M->getContext());
+Function *Fn = Inc->getParent()->getParent();
+Instruction  = Fn->getEntryBlock().front();
+LoadInst *LI = dyn_cast();
+if (!LI) {
+  IRBuilder<> Builder();
+  Type *Int64Ty = Type::getInt64Ty(M->getContext());
+  GlobalVariable *Bias = M->getGlobalVariable(getInstrProfCounterBiasVarName());
+  if (!Bias)
+Bias = new GlobalVariable(*M, Int64Ty, false, GlobalValue::LinkOnceODRLinkage,
+  Constant::getNullValue(Int64Ty),
+  getInstrProfCounterBiasVarName());
+  LI = Builder.CreateLoad(Int64Ty, Bias);
+}
+auto *Add = Builder.CreateAdd(Builder.CreatePtrToInt(Addr, Int64Ty), LI);
+Addr = 

[PATCH] D50360: [Concepts] Requires Expressions

2020-01-16 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/include/clang/Parse/Parser.h:804-807
+  bool TryAnnotateTypeOrScopeToken(bool ClassTemplateDeductionContext = true);
+  bool TryAnnotateTypeOrScopeTokenAfterScopeSpec(
+  CXXScopeSpec , bool IsNewScope,
+  bool ClassTemplateDeductionContext = true);

Looks like the flag you're adding here is never actually used any more. Please 
remove it again.



Comment at: clang/lib/AST/StmtPrinter.cpp:2296
+  S.flush();
+  if (Buf.find("typename ") != 0)
+OS << "typename ";

rsmith wrote:
> I can see why this is the most straightforward way to implement this, but ... 
> yuck. Please add a FIXME :)
I think you've actually fixed this now: we always build a `typename` type, so 
never need to print an extra `typename` here.



Comment at: clang/lib/Sema/SemaExprCXX.cpp:8291-8292
+
+  // Maintain an efficient lookup of params we have seen so far.
+  llvm::SmallSet ParamsSoFar;
+

This variable is now unused; please remove it.



Comment at: clang/lib/Sema/SemaExprCXX.cpp:8309
+  CheckShadow(BodyScope, Param);
+  PushOnScopeChains(Param, BodyScope);
+}

If we only do this now, do we properly handle `requires (int x, decltype(x) 
y)`? (Or is that handled in a separate function prototype scope which we've 
already left?)



Comment at: clang/lib/Sema/SemaTemplate.cpp:10259-10261
+  else
+Diag(CondRange.getBegin(), diag::err_typename_not_found_enable_if)
+<< CondRange;

Minor cleanup: I don't think we can ever reasonably get here for 
`enable_if<...>::type` with no `Ctx`. I mean, it's possible, but only from 
lexically within the definition of `enable_if` itself (or possibly a class 
derived from it?), and that's really not worth checking for. We could just skip 
calling `isEnableIf` and this whole `if` block if we don't have a `Ctx`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D50360



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


[clang] 01a6cd4 - Don't dump IR output from this test to stdout.

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

Author: Richard Smith
Date: 2020-01-16T19:19:45-08:00
New Revision: 01a6cd471f019cfeda057c3b1b6fc6213575217c

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

LOG: Don't dump IR output from this test to stdout.

Added: 


Modified: 
clang/test/CodeGenHIP/printf-aggregate.cpp

Removed: 




diff  --git a/clang/test/CodeGenHIP/printf-aggregate.cpp 
b/clang/test/CodeGenHIP/printf-aggregate.cpp
index 83e8f899c412..9dfbfac2754f 100644
--- a/clang/test/CodeGenHIP/printf-aggregate.cpp
+++ b/clang/test/CodeGenHIP/printf-aggregate.cpp
@@ -1,6 +1,6 @@
 // REQUIRES: amdgpu-registered-target
 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x hip -fcuda-is-device \
-// RUN:-verify -emit-llvm %s
+// RUN:-verify -emit-llvm-only %s
 
 #define __device__ __attribute__((device))
 extern "C" __device__ int printf(const char *format, ...);



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


[PATCH] D72890: [xray] Allow instrumenting only function entry and/or only function exit

2020-01-16 Thread Dean Michael Berris via Phabricator via cfe-commits
dberris accepted this revision.
dberris added a comment.
This revision is now accepted and ready to land.

LGTM

Do you mind adding x86 tests too?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72890



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


[PATCH] D72897: List implicit operator== after implicit destructors in a vtable.

2020-01-16 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith created this revision.
rsmith added a reviewer: rjmccall.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

We previously listed first declared members, then implicit operator=,
then implicit operator==, then implicit destructors. Per discussion on
https://github.com/itanium-cxx-abi/cxx-abi/issues/88, put the implicit
equality comparison operators at the very end, after all special member
functions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72897

Files:
  clang/lib/AST/VTableBuilder.cpp
  clang/test/CodeGenCXX/virtual-compare.cpp


Index: clang/test/CodeGenCXX/virtual-compare.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/virtual-compare.cpp
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 -std=c++2a -triple %itanium_abi_triple -emit-llvm %s -o - | 
FileCheck %s
+
+#include "Inputs/std-compare.h"
+
+// CHECK: @_ZTV1A =
+struct A;
+struct X {
+  // CHECK-SAME: @_ZN1X1xEv
+  virtual void x();
+  friend auto operator<=>(X, X) = default;
+};
+struct Y {
+  virtual ~Y();
+  virtual A =(const A &);
+  friend auto operator<=>(Y, Y) = default;
+};
+struct A : X, Y {
+  // CHECK-SAME: @_ZN1A1fEv
+  virtual void f();
+  // CHECK-SAME: @_ZNKR1AssERKS_
+  virtual std::strong_ordering operator<=>(const A &) const & = default;
+  // CHECK-SAME: @_ZN1A1gEv
+  virtual void g();
+  // CHECK-SAME: @_ZNKO1AssERKS_
+  virtual std::strong_ordering operator<=>(const A &) const && = default;
+  // CHECK-SAME: @_ZN1A1hEv
+  virtual void h();
+
+  // CHECK-SAME: @_ZN1AaSERKS_
+  // implicit virtual A =(const A&) = default;
+
+  // CHECK-SAME: @_ZN1AD1Ev
+  // CHECK-SAME: @_ZN1AD0Ev
+  // implicit virtual ~A();
+
+  // CHECK-SAME: @_ZNKR1AeqERKS_
+  // implicit virtual A ==(const A&) const & = default;
+
+  // CHECK-SAME: @_ZNKO1AeqERKS_
+  // implicit virtual A ==(const A&) const && = default;
+};
+
+// For Y:
+// CHECK-SAME: @_ZTI1A
+
+// CHECK-SAME: @_ZThn8_N1AD1Ev
+// CHECK-SAME: @_ZThn8_N1AD0Ev
+// virtual ~Y();
+
+// CHECK-SAME: @_ZThn8_N1AaSERKS_
+// virtual A =(const A &);
+
+void A::f() {}
Index: clang/lib/AST/VTableBuilder.cpp
===
--- clang/lib/AST/VTableBuilder.cpp
+++ clang/lib/AST/VTableBuilder.cpp
@@ -1474,8 +1474,6 @@
   llvm_unreachable("Found a duplicate primary base!");
   }
 
-  const CXXDestructorDecl *ImplicitVirtualDtor = nullptr;
-
   typedef llvm::SmallVector NewVirtualFunctionsTy;
   NewVirtualFunctionsTy NewVirtualFunctions;
 
@@ -1542,25 +1540,9 @@
   }
 }
 
-if (const CXXDestructorDecl *DD = dyn_cast(MD)) {
-  if (MD->isImplicit()) {
-// Itanium C++ ABI 2.5.2:
-//   If a class has an implicitly-defined virtual destructor,
-//   its entries come after the declared virtual function pointers.
-
-assert(!ImplicitVirtualDtor &&
-   "Did already see an implicit virtual dtor!");
-ImplicitVirtualDtor = DD;
-continue;
-  }
-}
-
 NewVirtualFunctions.push_back(MD);
   }
 
-  if (ImplicitVirtualDtor)
-NewVirtualFunctions.push_back(ImplicitVirtualDtor);
-
   for (const CXXMethodDecl *MD : NewVirtualFunctions) {
 // Get the final overrider.
 FinalOverriders::OverriderInfo Overrider =


Index: clang/test/CodeGenCXX/virtual-compare.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/virtual-compare.cpp
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 -std=c++2a -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
+
+#include "Inputs/std-compare.h"
+
+// CHECK: @_ZTV1A =
+struct A;
+struct X {
+  // CHECK-SAME: @_ZN1X1xEv
+  virtual void x();
+  friend auto operator<=>(X, X) = default;
+};
+struct Y {
+  virtual ~Y();
+  virtual A =(const A &);
+  friend auto operator<=>(Y, Y) = default;
+};
+struct A : X, Y {
+  // CHECK-SAME: @_ZN1A1fEv
+  virtual void f();
+  // CHECK-SAME: @_ZNKR1AssERKS_
+  virtual std::strong_ordering operator<=>(const A &) const & = default;
+  // CHECK-SAME: @_ZN1A1gEv
+  virtual void g();
+  // CHECK-SAME: @_ZNKO1AssERKS_
+  virtual std::strong_ordering operator<=>(const A &) const && = default;
+  // CHECK-SAME: @_ZN1A1hEv
+  virtual void h();
+
+  // CHECK-SAME: @_ZN1AaSERKS_
+  // implicit virtual A =(const A&) = default;
+
+  // CHECK-SAME: @_ZN1AD1Ev
+  // CHECK-SAME: @_ZN1AD0Ev
+  // implicit virtual ~A();
+
+  // CHECK-SAME: @_ZNKR1AeqERKS_
+  // implicit virtual A ==(const A&) const & = default;
+
+  // CHECK-SAME: @_ZNKO1AeqERKS_
+  // implicit virtual A ==(const A&) const && = default;
+};
+
+// For Y:
+// CHECK-SAME: @_ZTI1A
+
+// CHECK-SAME: @_ZThn8_N1AD1Ev
+// CHECK-SAME: @_ZThn8_N1AD0Ev
+// virtual ~Y();
+
+// CHECK-SAME: @_ZThn8_N1AaSERKS_
+// virtual A =(const A &);
+
+void A::f() {}
Index: clang/lib/AST/VTableBuilder.cpp
===
--- clang/lib/AST/VTableBuilder.cpp
+++ 

[clang] b78e8e0 - Add extra test file forgotten in 45d7080.

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

Author: Richard Smith
Date: 2020-01-16T18:13:49-08:00
New Revision: b78e8e0d79c47a6698a0abc10a37b8a253cb6064

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

LOG: Add extra test file forgotten in 45d7080.

Added: 
clang/test/Parser/explicit-bool.cpp

Modified: 


Removed: 




diff  --git a/clang/test/Parser/explicit-bool.cpp 
b/clang/test/Parser/explicit-bool.cpp
new file mode 100644
index ..bdd91dbbafc9
--- /dev/null
+++ b/clang/test/Parser/explicit-bool.cpp
@@ -0,0 +1,62 @@
+// RUN: %clang_cc1 -std=c++17 -verify=cxx17 -Wc++2a-compat %s
+// RUN: %clang_cc1 -std=c++2a -verify=cxx2a -Wc++17-compat %s
+
+namespace disambig {
+
+// Cases that are valid in C++17 and before, ill-formed in C++20, and that we
+// should not treat as explicit(bool) as an extension.
+struct A { // cxx2a-note +{{}}
+  constexpr A() {}
+  constexpr operator bool() { return true; }
+
+  constexpr explicit (A)(int); // #1
+  // cxx17-warning@#1 {{will be parsed as explicit(bool)}}
+  // cxx2a-error@#1 +{{}} cxx2a-note@#1 +{{}}
+  // cxx2a-warning@#1 {{incompatible with C++ standards before C++2a}}
+
+  // This is ill-formed (via a DR change), and shouldn't be recognized as a
+  // constructor (the function declarator cannot be parenthesized in a
+  // constructor declaration). But accepting it as an extension seems
+  // reasonable.
+  // FIXME: Produce an ExtWarn for this.
+  constexpr explicit (A(float)); // #1b
+  // cxx17-warning@#1b {{will be parsed as explicit(bool)}}
+  // cxx2a-error@#1b +{{}}
+  // cxx2a-warning@#1b {{incompatible with C++ standards before C++2a}}
+
+  explicit (operator int)(); // #2
+  // cxx17-warning@#2 {{will be parsed as explicit(bool)}}
+  // cxx2a-error@#2 +{{}}
+  // cxx2a-warning@#2 {{incompatible with C++ standards before C++2a}}
+
+  explicit (A::operator float)(); // #2b
+  // cxx17-warning@#2b {{will be parsed as explicit(bool)}}
+  // cxx17-error@#2b {{extra qualification on member}}
+  // cxx2a-error@#2b +{{}}
+  // cxx2a-warning@#2b {{incompatible with C++ standards before C++2a}}
+};
+
+constexpr bool operator+(A) { return true; }
+
+constexpr bool C = false;
+
+// Cases that should (ideally) be disambiguated as explicit(bool) in earlier
+// language modes as an extension.
+struct B {
+  // Looks like a constructor, but not the constructor of B.
+  explicit (A()) B(); // #3
+  // cxx17-warning@#3 {{C++2a extension}}
+  // cxx2a-warning@#3 {{incompatible with C++ standards before C++2a}}
+
+  // Looks like a 'constructor' of C. Actually a constructor of B.
+  explicit (C)(B)(A); // #4
+  // cxx17-warning@#4 {{C++2a extension}}
+  // cxx2a-warning@#4 {{incompatible with C++ standards before C++2a}}
+
+  explicit (operator+(A())) operator int(); // #5
+  // cxx17-error@#5 {{requires a type specifier}} cxx17-error@#5 {{expected 
';'}}
+  // cxx17-warning@#5 {{will be parsed as explicit(bool)}}
+  // cxx2a-warning@#5 {{incompatible with C++ standards before C++2a}}
+};
+
+}



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


Re: [clang] 45d7080 - PR42694 Support explicit(bool) in older language modes as an extension.

2020-01-16 Thread Richard Smith via cfe-commits
Also b78e8e0d79c47a6698a0abc10a37b8a253cb6064 which has an extra test file
that I forgot to git add.

On Wed, 15 Jan 2020 at 18:52, Richard Smith  wrote:

> Hans, could this change be ported to the Clang 10 branch? In PR42694 the
> MSVC stdlib developers requested that Clang support this because their
> standard library will soon rely on it.
>
> On Wed, 15 Jan 2020 at 18:50, Richard Smith via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>>
>> Author: Richard Smith
>> Date: 2020-01-15T18:38:23-08:00
>> New Revision: 45d70806f4386adfb62b0d75949a8aad58e0576f
>>
>> URL:
>> https://github.com/llvm/llvm-project/commit/45d70806f4386adfb62b0d75949a8aad58e0576f
>> DIFF:
>> https://github.com/llvm/llvm-project/commit/45d70806f4386adfb62b0d75949a8aad58e0576f.diff
>>
>> LOG: PR42694 Support explicit(bool) in older language modes as an
>> extension.
>>
>> This needs somewhat careful disambiguation, as C++2a explicit(bool) is a
>> breaking change. We only enable it in cases where the source construct
>> could not possibly be anything else.
>>
>> Added:
>>
>>
>> Modified:
>> clang/include/clang/Basic/DiagnosticParseKinds.td
>> clang/include/clang/Parse/Parser.h
>> clang/lib/Parse/ParseDecl.cpp
>> clang/lib/Parse/ParseTentative.cpp
>> clang/lib/Parse/Parser.cpp
>> clang/test/SemaCXX/cxx2a-explicit-bool.cpp
>>
>> Removed:
>>
>>
>>
>>
>> 
>> diff  --git a/clang/include/clang/Basic/DiagnosticParseKinds.td
>> b/clang/include/clang/Basic/DiagnosticParseKinds.td
>> index cc6a74ac3e6d..41f788e7d9bd 100644
>> --- a/clang/include/clang/Basic/DiagnosticParseKinds.td
>> +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
>> @@ -33,10 +33,6 @@ def err_asm_goto_cannot_have_output : Error<
>>
>>  let CategoryName = "Parse Issue" in {
>>
>> -def warn_cxx2a_compat_explicit_bool : Warning<
>> -  "this expression will be parsed as explicit(bool) in C++2a">,
>> -  InGroup, DefaultIgnore;
>> -
>>  def ext_empty_translation_unit : Extension<
>>"ISO C requires a translation unit to contain at least one
>> declaration">,
>>InGroup>;
>> @@ -684,6 +680,15 @@ def err_ms_property_expected_comma_or_rparen : Error<
>>  def err_ms_property_initializer : Error<
>>"property declaration cannot have an in-class initializer">;
>>
>> +def warn_cxx2a_compat_explicit_bool : Warning<
>> +  "this expression will be parsed as explicit(bool) in C++2a">,
>> +  InGroup, DefaultIgnore;
>> +def warn_cxx17_compat_explicit_bool : Warning<
>> +  "explicit(bool) is incompatible with C++ standards before C++2a">,
>> +  InGroup, DefaultIgnore;
>> +def ext_explicit_bool : ExtWarn<"explicit(bool) is a C++2a extension">,
>> +  InGroup;
>> +
>>  /// C++ Templates
>>  def err_expected_template : Error<"expected template">;
>>  def err_unknown_template_name : Error<
>>
>> diff  --git a/clang/include/clang/Parse/Parser.h
>> b/clang/include/clang/Parse/Parser.h
>> index e320c9647818..b7bed4713992 100644
>> --- a/clang/include/clang/Parse/Parser.h
>> +++ b/clang/include/clang/Parse/Parser.h
>> @@ -806,6 +806,16 @@ class Parser : public CodeCompletionHandler {
>>   bool IsNewScope);
>>bool TryAnnotateCXXScopeToken(bool EnteringContext = false);
>>
>> +  bool MightBeCXXScopeToken() {
>> +return Tok.is(tok::identifier) || Tok.is(tok::coloncolon) ||
>> +   (Tok.is(tok::annot_template_id) &&
>> +NextToken().is(tok::coloncolon)) ||
>> +   Tok.is(tok::kw_decltype) || Tok.is(tok::kw___super);
>> +  }
>> +  bool TryAnnotateOptionalCXXScopeToken(bool EnteringContext = false) {
>> +return MightBeCXXScopeToken() &&
>> TryAnnotateCXXScopeToken(EnteringContext);
>> +  }
>> +
>>  private:
>>enum AnnotatedNameKind {
>>  /// Annotation has failed and emitted an error.
>> @@ -2395,6 +2405,11 @@ class Parser : public CodeCompletionHandler {
>>/// rather than a less-than expression.
>>TPResult isTemplateArgumentList(unsigned TokensToSkip);
>>
>> +  /// Determine whether an '(' after an 'explicit' keyword is part of a
>> C++20
>> +  /// 'explicit(bool)' declaration, in earlier language modes where that
>> is an
>> +  /// extension.
>> +  TPResult isExplicitBool();
>> +
>>/// Determine whether an identifier has been tentatively declared as a
>>/// non-type. Such tentative declarations should not be found to name
>> a type
>>/// during a tentative parse, but also should not be annotated as a
>> non-type.
>>
>> diff  --git a/clang/lib/Parse/ParseDecl.cpp
>> b/clang/lib/Parse/ParseDecl.cpp
>> index 69a3ed9cbad7..d8c5a0ab02d3 100644
>> --- a/clang/lib/Parse/ParseDecl.cpp
>> +++ b/clang/lib/Parse/ParseDecl.cpp
>> @@ -3617,7 +3617,11 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec
>> ,
>>ConsumedEnd = ExplicitLoc;
>>ConsumeToken(); // kw_explicit
>>if (Tok.is(tok::l_paren)) {
>> -if (getLangOpts().CPlusPlus2a) {
>> +if 

[PATCH] D72825: [NFC] Fix options name typo

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

> These three options may be used in other projects compiled by gcc.

We can add them on demand. I don't see a rationale to add them preemptively.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72825



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


[PATCH] D69878: Consoldiate internal denormal flushing controls

2020-01-16 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm marked an inline comment as done.
arsenm added inline comments.



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:2757
   // subsequent options conflict then emit warning diagnostic.
+  // TODO: How should this interact with DenormalFP32Math?
   if (HonorINFs && HonorNaNs &&

I think this should just follow along with DenormalFPMath, but I'll put this 
off to the later patch since this one still is slightly awkward trying to avoid 
changing the meaning of the absence of the option


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

https://reviews.llvm.org/D69878



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


[PATCH] D72825: [NFC] Fix options name typo

2020-01-16 Thread Jim Lin via Phabricator via cfe-commits
Jim added a comment.

It should be kept for compatibility. These three options may be used in other 
projects compiled by gcc.
Clang should ignore it.
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72825



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


[PATCH] D69878: Consoldiate internal denormal flushing controls

2020-01-16 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm updated this revision to Diff 238670.
arsenm added a comment.

Forgot clang parts


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

https://reviews.llvm.org/D69878

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/CC1Options.td
  clang/include/clang/Driver/Options.td
  clang/include/clang/Driver/ToolChain.h
  clang/lib/Basic/Targets/AMDGPU.cpp
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/ToolChains/AMDGPU.cpp
  clang/lib/Driver/ToolChains/AMDGPU.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/Cuda.cpp
  clang/lib/Driver/ToolChains/Cuda.h
  clang/lib/Driver/ToolChains/HIP.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGenCUDA/flush-denormals.cu
  clang/test/CodeGenCUDA/propagate-metadata.cu
  clang/test/CodeGenOpenCL/amdgpu-features.cl
  clang/test/CodeGenOpenCL/denorms-are-zero.cl
  clang/test/CodeGenOpenCL/gfx9-fp32-denorms.cl
  clang/test/Driver/cl-denorms-are-zero.cl
  clang/test/Driver/cuda-flush-denormals-to-zero.cu
  clang/test/Driver/denormal-fp-math.c
  clang/test/Driver/opencl.cl
  llvm/docs/LangRef.rst
  llvm/lib/CodeGen/MachineFunction.cpp
  llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/test/CodeGen/NVPTX/fast-math.ll
  llvm/test/CodeGen/NVPTX/math-intrins.ll
  llvm/test/CodeGen/NVPTX/sqrt-approx.ll
  llvm/test/Transforms/InstCombine/NVPTX/nvvm-intrins.ll

Index: llvm/test/Transforms/InstCombine/NVPTX/nvvm-intrins.ll
===
--- llvm/test/Transforms/InstCombine/NVPTX/nvvm-intrins.ll
+++ llvm/test/Transforms/InstCombine/NVPTX/nvvm-intrins.ll
@@ -5,11 +5,11 @@
 ; hackery:
 
 ; RUN: cat %s > %t.ftz
-; RUN: echo 'attributes #0 = { "nvptx-f32ftz" = "true" }' >> %t.ftz
+; RUN: echo 'attributes #0 = { "denormal-fp-math-f32" = "preserve-sign" }' >> %t.ftz
 ; RUN: opt < %t.ftz -instcombine -S | FileCheck %s --check-prefix=CHECK --check-prefix=FTZ
 
 ; RUN: cat %s > %t.noftz
-; RUN: echo 'attributes #0 = { "nvptx-f32ftz" = "false" }' >> %t.noftz
+; RUN: echo 'attributes #0 = { "denormal-fp-math-f32" = "ieee" }' >> %t.noftz
 ; RUN: opt < %t.noftz -instcombine -S | FileCheck %s --check-prefix=CHECK --check-prefix=NOFTZ
 
 ; We handle nvvm intrinsics with ftz variants as follows:
Index: llvm/test/CodeGen/NVPTX/sqrt-approx.ll
===
--- llvm/test/CodeGen/NVPTX/sqrt-approx.ll
+++ llvm/test/CodeGen/NVPTX/sqrt-approx.ll
@@ -146,5 +146,5 @@
 }
 
 attributes #0 = { "unsafe-fp-math" = "true" }
-attributes #1 = { "nvptx-f32ftz" = "true" }
+attributes #1 = { "denormal-fp-math-f32" = "preserve-sign" }
 attributes #2 = { "reciprocal-estimates" = "rsqrtf:1,rsqrtd:1,sqrtf:1,sqrtd:1" }
Index: llvm/test/CodeGen/NVPTX/math-intrins.ll
===
--- llvm/test/CodeGen/NVPTX/math-intrins.ll
+++ llvm/test/CodeGen/NVPTX/math-intrins.ll
@@ -289,4 +289,4 @@
 }
 
 attributes #0 = { nounwind readnone }
-attributes #1 = { "nvptx-f32ftz" = "true" }
+attributes #1 = { "denormal-fp-math-f32" = "preserve-sign" }
Index: llvm/test/CodeGen/NVPTX/fast-math.ll
===
--- llvm/test/CodeGen/NVPTX/fast-math.ll
+++ llvm/test/CodeGen/NVPTX/fast-math.ll
@@ -162,4 +162,4 @@
 }
 
 attributes #0 = { "unsafe-fp-math" = "true" }
-attributes #1 = { "nvptx-f32ftz" = "true" }
+attributes #1 = { "denormal-fp-math-f32" = "preserve-sign" }
Index: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
===
--- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -15,6 +15,7 @@
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/FloatingPointMode.h"
 #include "llvm/ADT/None.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLExtras.h"
@@ -1709,9 +1710,10 @@
   // intrinsic, we don't have to look up any module metadata, as
   // FtzRequirementTy will be FTZ_Any.)
   if (Action.FtzRequirement != FTZ_Any) {
-bool FtzEnabled =
-II->getFunction()->getFnAttribute("nvptx-f32ftz").getValueAsString() ==
-"true";
+StringRef Attr = II->getFunction()
+ ->getFnAttribute("denormal-fp-math-f32")
+ .getValueAsString();
+bool FtzEnabled = parseDenormalFPAttribute(Attr) != DenormalMode::IEEE;
 
 if (FtzEnabled != (Action.FtzRequirement == FTZ_MustBeOn))
   return nullptr;
Index: llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
===
--- llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -121,14 +121,10 @@
   if 

[PATCH] D72860: [modules] Do not cache invalid state for modules that we attempted to load.

2020-01-16 Thread Volodymyr Sapsai via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG83f4c3af021c: [modules] Do not cache invalid state for 
modules that we attempted to load. (authored by vsapsai).

Changed prior to commit:
  https://reviews.llvm.org/D72860?vs=238562=238668#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72860

Files:
  clang/include/clang/Serialization/InMemoryModuleCache.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/lib/Serialization/InMemoryModuleCache.cpp
  clang/lib/Serialization/ModuleManager.cpp
  clang/test/Modules/Inputs/implicit-invalidate-chain/A.h
  clang/test/Modules/Inputs/implicit-invalidate-chain/B.h
  clang/test/Modules/Inputs/implicit-invalidate-chain/C.h
  clang/test/Modules/Inputs/implicit-invalidate-chain/module.modulemap
  clang/test/Modules/implicit-invalidate-chain.c
  clang/unittests/Frontend/FrontendActionTest.cpp
  clang/unittests/Serialization/InMemoryModuleCacheTest.cpp

Index: clang/unittests/Serialization/InMemoryModuleCacheTest.cpp
===
--- clang/unittests/Serialization/InMemoryModuleCacheTest.cpp
+++ clang/unittests/Serialization/InMemoryModuleCacheTest.cpp
@@ -24,12 +24,11 @@
 
 TEST(InMemoryModuleCacheTest, initialState) {
   InMemoryModuleCache Cache;
-  EXPECT_EQ(InMemoryModuleCache::Unknown, Cache.getPCMState("B"));
+  EXPECT_EQ(nullptr, Cache.lookupPCM("B"));
   EXPECT_FALSE(Cache.isPCMFinal("B"));
-  EXPECT_FALSE(Cache.shouldBuildPCM("B"));
 
 #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST
-  EXPECT_DEATH(Cache.tryToDropPCM("B"), "PCM to remove is unknown");
+  EXPECT_DEATH(Cache.tryToRemovePCM("B"), "PCM to remove is unknown");
   EXPECT_DEATH(Cache.finalizePCM("B"), "PCM to finalize is unknown");
 #endif
 }
@@ -40,37 +39,33 @@
 
   InMemoryModuleCache Cache;
   EXPECT_EQ(RawB, ("B", std::move(B)));
-  EXPECT_EQ(InMemoryModuleCache::Tentative, Cache.getPCMState("B"));
   EXPECT_EQ(RawB, Cache.lookupPCM("B"));
   EXPECT_FALSE(Cache.isPCMFinal("B"));
-  EXPECT_FALSE(Cache.shouldBuildPCM("B"));
 
 #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST
   EXPECT_DEATH(Cache.addPCM("B", getBuffer(2)), "Already has a PCM");
-  EXPECT_DEATH(Cache.addBuiltPCM("B", getBuffer(2)),
-   "Trying to override tentative PCM");
+  EXPECT_DEATH(Cache.addFinalPCM("B", getBuffer(2)),
+   "Already has a non-final PCM");
 #endif
 }
 
-TEST(InMemoryModuleCacheTest, addBuiltPCM) {
+TEST(InMemoryModuleCacheTest, addFinalPCM) {
   auto B = getBuffer(1);
   auto *RawB = B.get();
 
   InMemoryModuleCache Cache;
-  EXPECT_EQ(RawB, ("B", std::move(B)));
-  EXPECT_EQ(InMemoryModuleCache::Final, Cache.getPCMState("B"));
+  EXPECT_EQ(RawB, ("B", std::move(B)));
   EXPECT_EQ(RawB, Cache.lookupPCM("B"));
   EXPECT_TRUE(Cache.isPCMFinal("B"));
-  EXPECT_FALSE(Cache.shouldBuildPCM("B"));
 
 #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST
   EXPECT_DEATH(Cache.addPCM("B", getBuffer(2)), "Already has a PCM");
-  EXPECT_DEATH(Cache.addBuiltPCM("B", getBuffer(2)),
+  EXPECT_DEATH(Cache.addFinalPCM("B", getBuffer(2)),
"Trying to override finalized PCM");
 #endif
 }
 
-TEST(InMemoryModuleCacheTest, tryToDropPCM) {
+TEST(InMemoryModuleCacheTest, tryToRemovePCM) {
   auto B1 = getBuffer(1);
   auto B2 = getBuffer(2);
   auto *RawB1 = B1.get();
@@ -78,27 +73,22 @@
   ASSERT_NE(RawB1, RawB2);
 
   InMemoryModuleCache Cache;
-  EXPECT_EQ(InMemoryModuleCache::Unknown, Cache.getPCMState("B"));
   EXPECT_EQ(RawB1, ("B", std::move(B1)));
-  EXPECT_FALSE(Cache.tryToDropPCM("B"));
+  EXPECT_FALSE(Cache.tryToRemovePCM("B"));
   EXPECT_EQ(nullptr, Cache.lookupPCM("B"));
-  EXPECT_EQ(InMemoryModuleCache::ToBuild, Cache.getPCMState("B"));
   EXPECT_FALSE(Cache.isPCMFinal("B"));
-  EXPECT_TRUE(Cache.shouldBuildPCM("B"));
 
 #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST
-  EXPECT_DEATH(Cache.addPCM("B", getBuffer(2)), "Already has a PCM");
-  EXPECT_DEATH(Cache.tryToDropPCM("B"),
-   "PCM to remove is scheduled to be built");
-  EXPECT_DEATH(Cache.finalizePCM("B"), "Trying to finalize a dropped PCM");
+  EXPECT_DEATH(Cache.tryToRemovePCM("B"), "PCM to remove is unknown");
+  EXPECT_DEATH(Cache.finalizePCM("B"), "PCM to finalize is unknown");
 #endif
 
   // Add a new one.
-  EXPECT_EQ(RawB2, ("B", std::move(B2)));
+  EXPECT_EQ(RawB2, ("B", std::move(B2)));
   EXPECT_TRUE(Cache.isPCMFinal("B"));
 
   // Can try to drop again, but this should error and do nothing.
-  EXPECT_TRUE(Cache.tryToDropPCM("B"));
+  EXPECT_TRUE(Cache.tryToRemovePCM("B"));
   EXPECT_EQ(RawB2, Cache.lookupPCM("B"));
 }
 
@@ -107,12 +97,10 @@
   auto *RawB = B.get();
 
   InMemoryModuleCache Cache;
-  EXPECT_EQ(InMemoryModuleCache::Unknown, Cache.getPCMState("B"));
   EXPECT_EQ(RawB, ("B", std::move(B)));
 
   // Call finalize.
   Cache.finalizePCM("B");
-  EXPECT_EQ(InMemoryModuleCache::Final, 

[clang] 83f4c3a - [modules] Do not cache invalid state for modules that we attempted to load.

2020-01-16 Thread Volodymyr Sapsai via cfe-commits

Author: Volodymyr Sapsai
Date: 2020-01-16T17:12:41-08:00
New Revision: 83f4c3af021cd5322ea10fd1c4e839874c1dae49

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

LOG: [modules] Do not cache invalid state for modules that we attempted to load.

Partially reverts 0a2be46cfdb698fefcc860a56b47dde0884d5335 as it turned
out to cause redundant module rebuilds in multi-process incremental builds.
When a module was getting out of date, all compilation processes started at the
same time were marking it as `ToBuild`. So each process was building the same
module instead of checking if it was built by someone else and using that
result. In addition to the work duplication, contention on the same .pcm file
wasn't making builds faster.

Note that for a single-process build this change would cause redundant module
reads and validations. But reading a module is faster than building it and
multi-process builds are more common than single-process. So I'm willing to
make such a trade-off.

rdar://problem/54395127

Reviewed By: dexonsmith

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

Added: 


Modified: 
clang/include/clang/Serialization/InMemoryModuleCache.h
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/lib/Serialization/InMemoryModuleCache.cpp
clang/lib/Serialization/ModuleManager.cpp
clang/unittests/Frontend/FrontendActionTest.cpp
clang/unittests/Serialization/InMemoryModuleCacheTest.cpp

Removed: 
clang/test/Modules/Inputs/implicit-invalidate-chain/A.h
clang/test/Modules/Inputs/implicit-invalidate-chain/B.h
clang/test/Modules/Inputs/implicit-invalidate-chain/C.h
clang/test/Modules/Inputs/implicit-invalidate-chain/module.modulemap
clang/test/Modules/implicit-invalidate-chain.c



diff  --git a/clang/include/clang/Serialization/InMemoryModuleCache.h 
b/clang/include/clang/Serialization/InMemoryModuleCache.h
index 7b5b5c1cf1be..c4814c40e1df 100644
--- a/clang/include/clang/Serialization/InMemoryModuleCache.h
+++ b/clang/include/clang/Serialization/InMemoryModuleCache.h
@@ -45,61 +45,35 @@ class InMemoryModuleCache : public 
llvm::RefCountedBase {
   llvm::StringMap PCMs;
 
 public:
-  /// There are four states for a PCM.  It must monotonically increase.
-  ///
-  ///  1. Unknown: the PCM has neither been read from disk nor built.
-  ///  2. Tentative: the PCM has been read from disk but not yet imported or
-  /// built.  It might work.
-  ///  3. ToBuild: the PCM read from disk did not work but a new one has not
-  /// been built yet.
-  ///  4. Final: indicating that the current PCM was either built in this
-  /// process or has been successfully imported.
-  enum State { Unknown, Tentative, ToBuild, Final };
-
-  /// Get the state of the PCM.
-  State getPCMState(llvm::StringRef Filename) const;
-
   /// Store the PCM under the Filename.
   ///
-  /// \pre state is Unknown
-  /// \post state is Tentative
+  /// \pre PCM for the same Filename shouldn't be in cache already.
   /// \return a reference to the buffer as a convenience.
   llvm::MemoryBuffer (llvm::StringRef Filename,
  std::unique_ptr Buffer);
 
-  /// Store a just-built PCM under the Filename.
+  /// Store a final PCM under the Filename.
   ///
-  /// \pre state is Unknown or ToBuild.
-  /// \pre state is not Tentative.
+  /// \pre PCM for the same Filename shouldn't be in cache already.
   /// \return a reference to the buffer as a convenience.
-  llvm::MemoryBuffer (llvm::StringRef Filename,
+  llvm::MemoryBuffer (llvm::StringRef Filename,
   std::unique_ptr Buffer);
 
-  /// Try to remove a buffer from the cache.  No effect if state is Final.
+  /// Try to remove a PCM from the cache.  No effect if it is Final.
   ///
-  /// \pre state is Tentative/Final.
-  /// \post Tentative => ToBuild or Final => Final.
-  /// \return false on success, i.e. if Tentative => ToBuild.
-  bool tryToDropPCM(llvm::StringRef Filename);
+  /// \return false on success.
+  bool tryToRemovePCM(llvm::StringRef Filename);
 
   /// Mark a PCM as final.
-  ///
-  /// \pre state is Tentative or Final.
-  /// \post state is Final.
   void finalizePCM(llvm::StringRef Filename);
 
-  /// Get a pointer to the pCM if it exists; else nullptr.
+  /// Get a pointer to the PCM if it exists; else nullptr.
   llvm::MemoryBuffer *lookupPCM(llvm::StringRef Filename) const;
 
   /// Check whether the PCM is final and has been shown to work.
   ///
   /// \return true iff state is Final.
   bool isPCMFinal(llvm::StringRef Filename) const;
-
-  /// Check whether the PCM is waiting to be built.
-  ///
-  /// \return true iff state is ToBuild.
-  bool shouldBuildPCM(llvm::StringRef Filename) const;
 };
 
 } // end 

[PATCH] D72722: [FPEnv] [SystemZ] Platform-specific builtin constrained FP enablement

2020-01-16 Thread Ulrich Weigand via Phabricator via cfe-commits
uweigand added a comment.

> What are the semantics of vfnmadb with respect to when it rounds vs the 
> negation?

Hmm, interesting.  The z/Architecture Principles of Operation states:

> The results for each element of VECTOR FP NEGA-
>  TIVE MULTIPLY AND ADD and VECTOR FP NEGA-
>  TIVE MULTIPLY AND SUBTRACT are the same as
>  for VECTOR FP MULTIPLY AND ADD and VECTOR
>  FP MULTIPLY AND SUBTRACT, respectively, except
>  the sign bit of numeric results are inverted. When the
>  result is a NaN it’s sign bit is unchanged.

So as far as rounding is concerned, the vfnmadb should have the exact same 
result as a vfmadb ; vflcdb sequence we'd get from a fma/fneg.

I hadn't realized the NaN special treatment before.  This makes the result 
actually different in that case.  OTOH I guess IEEE only says the result has to 
some NaN, not particularly **which** NaN, so that's probably also OK.  (In any 
case it's unrelated to strict FP.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72722



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


[PATCH] D72869: Add __warn_memset_zero_len builtin as a workaround for glibc issue

2020-01-16 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

We currently don't have any mechanism for restricting builtins to specific 
operating systems.  I guess we could add one, but this change doesn't seem like 
a compelling argument to add that capability.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72869



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


[PATCH] D72890: [xray] Allow instrumenting only function entry and/or only function exit

2020-01-16 Thread Ian Levesque via Phabricator via cfe-commits
ianlevesque created this revision.
ianlevesque added a reviewer: dberris.
Herald added subscribers: llvm-commits, cfe-commits, hiraditya.
Herald added projects: clang, LLVM.

Extend -fxray-instrumentation-bundle to split function-entry and
function-exit into two separate options, so that it is possible to
instrument only function entry or only function exit.  For use cases
that only care about one or the other this will save significant overhead
and code size.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72890

Files:
  clang/include/clang/Basic/XRayInstr.h
  clang/include/clang/Driver/Options.td
  clang/lib/Basic/XRayInstr.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/Driver/XRayArgs.cpp
  clang/test/CodeGen/xray-instrumentation-bundles.cpp
  llvm/lib/CodeGen/XRayInstrumentation.cpp
  llvm/test/CodeGen/AArch64/xray-partial-instrumentation-skip-entry.ll
  llvm/test/CodeGen/AArch64/xray-partial-instrumentation-skip-exit.ll

Index: llvm/test/CodeGen/AArch64/xray-partial-instrumentation-skip-exit.ll
===
--- /dev/null
+++ llvm/test/CodeGen/AArch64/xray-partial-instrumentation-skip-exit.ll
@@ -0,0 +1,21 @@
+; RUN: llc -filetype=asm -o - -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s
+
+define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" "xray-skip-exit" {
+; CHECK-LABEL: Lxray_sled_0:
+; CHECK-NEXT:  b  #32
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-LABEL: Ltmp0:
+  ret i32 0
+; CHECK-NOT: Lxray_sled_1:
+; CHECK:  ret
+}
+; CHECK-LABEL: xray_instr_map
+; CHECK-LABEL: Lxray_sleds_start0
+; CHECK:   .xword .Lxray_sled_0
+; CHECK-LABEL: Lxray_sleds_end0
Index: llvm/test/CodeGen/AArch64/xray-partial-instrumentation-skip-entry.ll
===
--- /dev/null
+++ llvm/test/CodeGen/AArch64/xray-partial-instrumentation-skip-entry.ll
@@ -0,0 +1,21 @@
+; RUN: llc -filetype=asm -o - -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s
+
+define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" "xray-skip-entry" {
+; CHECK-NOT: Lxray_sled_0:
+  ret i32 0
+; CHECK-LABEL: Lxray_sled_0:
+; CHECK-NEXT:  b  #32
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop
+; CHECK-LABEL: Ltmp0:
+; CHECK-NEXT:  ret
+}
+; CHECK-LABEL: xray_instr_map
+; CHECK-LABEL: Lxray_sleds_start0
+; CHECK:   .xword .Lxray_sled_0
+; CHECK-LABEL: Lxray_sleds_end0
Index: llvm/lib/CodeGen/XRayInstrumentation.cpp
===
--- llvm/lib/CodeGen/XRayInstrumentation.cpp
+++ llvm/lib/CodeGen/XRayInstrumentation.cpp
@@ -201,43 +201,47 @@
 return false;
   }
 
-  // First, insert an PATCHABLE_FUNCTION_ENTER as the first instruction of the
-  // MachineFunction.
-  BuildMI(FirstMBB, FirstMI, FirstMI.getDebugLoc(),
-  TII->get(TargetOpcode::PATCHABLE_FUNCTION_ENTER));
-
-  switch (MF.getTarget().getTargetTriple().getArch()) {
-  case Triple::ArchType::arm:
-  case Triple::ArchType::thumb:
-  case Triple::ArchType::aarch64:
-  case Triple::ArchType::mips:
-  case Triple::ArchType::mipsel:
-  case Triple::ArchType::mips64:
-  case Triple::ArchType::mips64el: {
-// For the architectures which don't have a single return instruction
-InstrumentationOptions op;
-op.HandleTailcall = false;
-op.HandleAllReturns = true;
-prependRetWithPatchableExit(MF, TII, op);
-break;
-  }
-  case Triple::ArchType::ppc64le: {
-// PPC has conditional returns. Turn them into branch and plain returns.
-InstrumentationOptions op;
-op.HandleTailcall = false;
-op.HandleAllReturns = true;
-replaceRetWithPatchableRet(MF, TII, op);
-break;
-  }
-  default: {
-// For the architectures that have a single return instruction (such as
-//   RETQ on x86_64).
-InstrumentationOptions op;
-op.HandleTailcall = true;
-op.HandleAllReturns = false;
-replaceRetWithPatchableRet(MF, TII, op);
-break;
+  if (!F.hasFnAttribute("xray-skip-entry")) {
+// First, insert an PATCHABLE_FUNCTION_ENTER as the first instruction of the
+// MachineFunction.
+BuildMI(FirstMBB, FirstMI, FirstMI.getDebugLoc(),
+TII->get(TargetOpcode::PATCHABLE_FUNCTION_ENTER));
   }
+
+  if (!F.hasFnAttribute("xray-skip-exit")) {
+switch (MF.getTarget().getTargetTriple().getArch()) {
+case Triple::ArchType::arm:
+case Triple::ArchType::thumb:
+case Triple::ArchType::aarch64:
+case Triple::ArchType::mips:
+case Triple::ArchType::mipsel:
+case Triple::ArchType::mips64:
+case Triple::ArchType::mips64el: {
+  // For the architectures which don't have a single return instruction
+  InstrumentationOptions op;
+  op.HandleTailcall = 

[PATCH] D72304: [OpenMP]{OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.

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

The commit title has a stray `{` instead of `[`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72304



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


[PATCH] D72869: Add __warn_memset_zero_len builtin as a workaround for glibc issue

2020-01-16 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment.

Can this be restricted to Linux?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72869



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


[PATCH] D72304: [OpenMP]{OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.

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

Phab is not involved in the merge process, it just is a normal git push on top 
of the llmv-project.
Do you have commit rights already? If not I can commit this for you in a few 
days.




Comment at: llvm/lib/Frontend/OpenMP/OMPConstants.cpp:45
 ///{
-
 #define OMP_TYPE(VarName, InitValue) Type *llvm::omp::types::VarName = nullptr;

fghanim wrote:
> jdoerfert wrote:
> > Leftover
> what is this referring to?
You deleted an empty new line ;)



Comment at: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp:749
+BasicBlock *ExitPredBB = SplitPos->getParent();
+auto InsertBB = merged ? ExitPredBB : ExitBB;
+if (!isa_and_nonnull(SplitPos))

fghanim wrote:
> jdoerfert wrote:
> > I have the feeling the merging makes it harder without providing a benefit 
> > but I'm OK with it for now
> more difficult in what way?
We need things like `auto InsertBB = merged ? ExitPredBB : ExitBB;` now for 
example.



Comment at: llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp:686
+break;
+  else
+MasterEndCI = nullptr;

Nit: The `else` is not needed.



Comment at: llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp:745
+break;
+  else
+CriticalEntryCI = nullptr;

Nit: The `else` is not needed.



Comment at: llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp:762
+break;
+  else
+CriticalEndCI = nullptr;

Nit: The `else` is not needed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72304



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


[PATCH] D72855: Make LLVM_APPEND_VC_REV=OFF affect clang, lld, and lldb as well.

2020-01-16 Thread Nico Weber via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfb5fafb23cc2: Make LLVM_APPEND_VC_REV=OFF affect clang, lld, 
and lldb as well. (authored by thakis).
Herald added projects: clang, LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72855

Files:
  clang/lib/Basic/CMakeLists.txt
  lld/Common/CMakeLists.txt
  lldb/source/CMakeLists.txt
  llvm/cmake/modules/LLVMConfig.cmake.in
  llvm/docs/CMake.rst


Index: llvm/docs/CMake.rst
===
--- llvm/docs/CMake.rst
+++ llvm/docs/CMake.rst
@@ -272,7 +272,7 @@
   Generate build targets for the LLVM benchmarks. Defaults to ON.
 
 **LLVM_APPEND_VC_REV**:BOOL
-  Embed version control revision info (svn revision number or Git revision id).
+  Embed version control revision info (Git revision id).
   The version info is provided by the ``LLVM_REVISION`` macro in
   ``llvm/include/llvm/Support/VCSRevision.h``. Developers using git who don't
   need revision info can disable this option to avoid re-linking most binaries
Index: llvm/cmake/modules/LLVMConfig.cmake.in
===
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -78,6 +78,8 @@
 set(LLVM_INCLUDE_DIRS "@LLVM_CONFIG_INCLUDE_DIRS@")
 set(LLVM_LIBRARY_DIRS "@LLVM_CONFIG_LIBRARY_DIRS@")
 
+set(LLVM_APPEND_VC_REV "@LLVM_APPEND_VC_REV@")
+
 # These variables are duplicated for install tree but they have different
 # values for build tree.  LLVM_INCLUDE_DIRS contains both source
 # and generated include directories while the following variables have
Index: lldb/source/CMakeLists.txt
===
--- lldb/source/CMakeLists.txt
+++ lldb/source/CMakeLists.txt
@@ -18,14 +18,14 @@
 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
 set(generate_vcs_version_script 
"${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
 
-if(lldb_vc)
+if(lldb_vc AND LLVM_APPEND_VC_REV)
   set(lldb_source_dir ${LLDB_SOURCE_DIR})
 endif()
 
 add_custom_command(OUTPUT "${version_inc}"
   DEPENDS "${lldb_vc}" "${generate_vcs_version_script}"
   COMMAND ${CMAKE_COMMAND} "-DNAMES=LLDB"
-   "-DLLDB_SOURCE_DIR=${LLDB_SOURCE_DIR}"
+   "-DLLDB_SOURCE_DIR=${lldb_source_dir}"
"-DHEADER_FILE=${version_inc}"
-P "${generate_vcs_version_script}")
 
Index: lld/Common/CMakeLists.txt
===
--- lld/Common/CMakeLists.txt
+++ lld/Common/CMakeLists.txt
@@ -8,14 +8,14 @@
 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
 set(generate_vcs_version_script 
"${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
 
-if(lld_vc)
+if(lld_vc AND LLVM_APPEND_VC_REV)
   set(lld_source_dir ${LLD_SOURCE_DIR})
 endif()
 
 add_custom_command(OUTPUT "${version_inc}"
   DEPENDS "${lld_vc}" "${generate_vcs_version_script}"
   COMMAND ${CMAKE_COMMAND} "-DNAMES=LLD"
-  "-DLLD_SOURCE_DIR=${LLD_SOURCE_DIR}"
+  "-DLLD_SOURCE_DIR=${lld_source_dir}"
   "-DHEADER_FILE=${version_inc}"
   -P "${generate_vcs_version_script}")
 
Index: clang/lib/Basic/CMakeLists.txt
===
--- clang/lib/Basic/CMakeLists.txt
+++ clang/lib/Basic/CMakeLists.txt
@@ -12,10 +12,10 @@
 
 set(generate_vcs_version_script 
"${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
 
-if(llvm_vc)
+if(llvm_vc AND LLVM_APPEND_VC_REV)
   set(llvm_source_dir ${LLVM_MAIN_SRC_DIR})
 endif()
-if(clang_vc)
+if(clang_vc AND LLVM_APPEND_VC_REV)
   set(clang_source_dir ${CLANG_SOURCE_DIR})
 endif()
 


Index: llvm/docs/CMake.rst
===
--- llvm/docs/CMake.rst
+++ llvm/docs/CMake.rst
@@ -272,7 +272,7 @@
   Generate build targets for the LLVM benchmarks. Defaults to ON.
 
 **LLVM_APPEND_VC_REV**:BOOL
-  Embed version control revision info (svn revision number or Git revision id).
+  Embed version control revision info (Git revision id).
   The version info is provided by the ``LLVM_REVISION`` macro in
   ``llvm/include/llvm/Support/VCSRevision.h``. Developers using git who don't
   need revision info can disable this option to avoid re-linking most binaries
Index: llvm/cmake/modules/LLVMConfig.cmake.in
===
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -78,6 +78,8 @@
 set(LLVM_INCLUDE_DIRS "@LLVM_CONFIG_INCLUDE_DIRS@")
 set(LLVM_LIBRARY_DIRS "@LLVM_CONFIG_LIBRARY_DIRS@")
 
+set(LLVM_APPEND_VC_REV "@LLVM_APPEND_VC_REV@")
+
 # These variables are duplicated for install tree but they have different
 # values for build tree.  LLVM_INCLUDE_DIRS contains both source
 # and generated include directories while the 

[clang] fb5fafb - Make LLVM_APPEND_VC_REV=OFF affect clang, lld, and lldb as well.

2020-01-16 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2020-01-16T19:04:08-05:00
New Revision: fb5fafb23cc2d8613f8be2487afe94d8594a88ce

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

LOG: Make LLVM_APPEND_VC_REV=OFF affect clang, lld, and lldb as well.

When LLVM_APPEND_VC_REV=OFF is set, the current git hash is no
longer embedded into binaries (mostly for --version output).
Without it, most binaries need to relink after every single
commit, even if they didn't change otherwise (due to, say,
a documentation-only commit).

LLVM_APPEND_VC_REV is ON by default, so this doesn't change the
default behavior of anything.

With this, all clients of GenerateVersionFromVCS.cmake honor
LLVM_APPEND_VC_REV.

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

Added: 


Modified: 
clang/lib/Basic/CMakeLists.txt
lld/Common/CMakeLists.txt
lldb/source/CMakeLists.txt
llvm/cmake/modules/LLVMConfig.cmake.in
llvm/docs/CMake.rst

Removed: 




diff  --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt
index be739c70468e..328e616698cc 100644
--- a/clang/lib/Basic/CMakeLists.txt
+++ b/clang/lib/Basic/CMakeLists.txt
@@ -12,10 +12,10 @@ set(version_inc 
"${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
 
 set(generate_vcs_version_script 
"${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
 
-if(llvm_vc)
+if(llvm_vc AND LLVM_APPEND_VC_REV)
   set(llvm_source_dir ${LLVM_MAIN_SRC_DIR})
 endif()
-if(clang_vc)
+if(clang_vc AND LLVM_APPEND_VC_REV)
   set(clang_source_dir ${CLANG_SOURCE_DIR})
 endif()
 

diff  --git a/lld/Common/CMakeLists.txt b/lld/Common/CMakeLists.txt
index 1a04a8074bed..7d5ad654925e 100644
--- a/lld/Common/CMakeLists.txt
+++ b/lld/Common/CMakeLists.txt
@@ -8,14 +8,14 @@ find_first_existing_vc_file("${LLD_SOURCE_DIR}" lld_vc)
 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
 set(generate_vcs_version_script 
"${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
 
-if(lld_vc)
+if(lld_vc AND LLVM_APPEND_VC_REV)
   set(lld_source_dir ${LLD_SOURCE_DIR})
 endif()
 
 add_custom_command(OUTPUT "${version_inc}"
   DEPENDS "${lld_vc}" "${generate_vcs_version_script}"
   COMMAND ${CMAKE_COMMAND} "-DNAMES=LLD"
-  "-DLLD_SOURCE_DIR=${LLD_SOURCE_DIR}"
+  "-DLLD_SOURCE_DIR=${lld_source_dir}"
   "-DHEADER_FILE=${version_inc}"
   -P "${generate_vcs_version_script}")
 

diff  --git a/lldb/source/CMakeLists.txt b/lldb/source/CMakeLists.txt
index d229f74904a8..b196147e68e7 100644
--- a/lldb/source/CMakeLists.txt
+++ b/lldb/source/CMakeLists.txt
@@ -18,14 +18,14 @@ endforeach()
 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
 set(generate_vcs_version_script 
"${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
 
-if(lldb_vc)
+if(lldb_vc AND LLVM_APPEND_VC_REV)
   set(lldb_source_dir ${LLDB_SOURCE_DIR})
 endif()
 
 add_custom_command(OUTPUT "${version_inc}"
   DEPENDS "${lldb_vc}" "${generate_vcs_version_script}"
   COMMAND ${CMAKE_COMMAND} "-DNAMES=LLDB"
-   "-DLLDB_SOURCE_DIR=${LLDB_SOURCE_DIR}"
+   "-DLLDB_SOURCE_DIR=${lldb_source_dir}"
"-DHEADER_FILE=${version_inc}"
-P "${generate_vcs_version_script}")
 

diff  --git a/llvm/cmake/modules/LLVMConfig.cmake.in 
b/llvm/cmake/modules/LLVMConfig.cmake.in
index 082393212b67..87684ecba0f5 100644
--- a/llvm/cmake/modules/LLVMConfig.cmake.in
+++ b/llvm/cmake/modules/LLVMConfig.cmake.in
@@ -78,6 +78,8 @@ set(LLVM_LIBDIR_SUFFIX @LLVM_LIBDIR_SUFFIX@)
 set(LLVM_INCLUDE_DIRS "@LLVM_CONFIG_INCLUDE_DIRS@")
 set(LLVM_LIBRARY_DIRS "@LLVM_CONFIG_LIBRARY_DIRS@")
 
+set(LLVM_APPEND_VC_REV "@LLVM_APPEND_VC_REV@")
+
 # These variables are duplicated for install tree but they have 
diff erent
 # values for build tree.  LLVM_INCLUDE_DIRS contains both source
 # and generated include directories while the following variables have

diff  --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst
index 94ed7cc623d2..a86ebb3a37bd 100644
--- a/llvm/docs/CMake.rst
+++ b/llvm/docs/CMake.rst
@@ -272,7 +272,7 @@ LLVM-specific variables
   Generate build targets for the LLVM benchmarks. Defaults to ON.
 
 **LLVM_APPEND_VC_REV**:BOOL
-  Embed version control revision info (svn revision number or Git revision id).
+  Embed version control revision info (Git revision id).
   The version info is provided by the ``LLVM_REVISION`` macro in
   ``llvm/include/llvm/Support/VCSRevision.h``. Developers using git who don't
   need revision info can disable this option to avoid re-linking most binaries



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


[PATCH] D72806: [HIP] fix paths for executables not in clang bin directory

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

In D72806#1825400 , @DieGoldeneEnte 
wrote:

>




> Even in case we don't add the extra directories for llvm and lld, it would be 
> a good idea to use the getProgramPath function instead of building it 
> manually (so only the changes in HIP.cpp except lines 273-282). This was 
> planned anyways according to the comments in HIP.cpp line 270-271:
> 
>>   // Lookup binaries into the driver directory, this is used to
>>   // discover the clang-offload-bundler executable.

Agreed. GetProgramPath() change makes sense on its own merits.

In the future it may help to keep intependent changes in separate patches. It 
makes it easier to review and land them that way. I.e. the patch with 
GetProgramPath()  would be stamped w/o problems as it's an obvious clean up 
local to HIP only. Changing build for everyone will need more scrutiny and 
would be easier to deal with if it's not commingled with other changes.

It's not too late to split this patch in two. :-)


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

https://reviews.llvm.org/D72806



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


[PATCH] D71469: [AArch64] Add sq(r)dmulh_lane(q) LLVM IR intrinsics

2020-01-16 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

> This makes it impossible to do a neat trick when using NEON intrinsics: one 
> can load a number of constants using a single vector load, which are then 
> repeatedly used to multiply whole vectors by one of the constants. This trick 
> is used for a nice performance upside (2.5% to 4% on one microbenchmark) in 
> libjpeg-turbo.

I'm not completely sure I follow here.  The "trick" is something like the 
following?

  int16x8_t v = {2,3,4,5,6,7,8,9};
  a = vqdmulh_laneq_s16(a, v, 0);
  b = vqdmulh_laneq_s16(b, v, 1);
  c = vqdmulh_laneq_s16(c, v, 2);
  d = vqdmulh_laneq_s16(d, v, 3);
  [...]

I can see how that could be helpful.  The compiler could probably be taught to 
recover something like the original structure, but it would probably require a 
dedicated pass.  Or I guess you could hack the source to use "volatile", but 
that would be ugly.

I'm a little unhappy we're forced to introduce more intrinsics here, but it 
might be the best solution to avoid breaking carefully tuned code like this.




Comment at: llvm/lib/IR/Function.cpp:1374
+  auto *RefVTy = dyn_cast(ArgTys[D.getArgumentNumber()]);
+  if (!VTy || !RefVTy || VTy->getBitWidth() != 64)
+return true;

Hardcoding "64" and "128" in target-independent code here seems like a bad idea.

Can we just let both vector operands have any vector type, and reject in the 
backend if we see an unexpected type?



Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:6054
+  if (VT.getSizeInBits() == 64)
+return std::make_pair(0U, ::FPR64_loRegClass);
   if (VT.getSizeInBits() == 128)

Is this related somehow?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71469



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


[PATCH] D72806: [HIP] fix paths for executables not in clang bin directory

2020-01-16 Thread Holger Wünsche via Phabricator via cfe-commits
DieGoldeneEnte added a comment.

In D72806#1825362 , @tra wrote:

> In D72806#1825333 , @DieGoldeneEnte 
> wrote:
>
> > In D72806#1824560 , @yaxunl wrote:
> >
> > > What's the use case of this change?
> > >
> > > Normally clang needs to call opt/llc/lld from the same directory of 
> > > clang. Why do we need to find them in other directories?
> >
> >
> > My motivation is the nix-package manager, which has llvm, lld and clang in 
> > different packages (which results in different directories).
>
>
> We've had similar issues with use of clang for CUDA on Debian (I think), 
> where CUDA was scattered all over the place.
>  The way to do it was to create a 'shim' directory structure which would put 
> all relevant tools in the right places.
>  Something similar could be done in your case -- make a package which would 
> depend on individual tool packages and which would symlink all of them into 
> one dir and point your compiler there.


That's what I will do if we don't fix this here. But I think it would be 
cleaner if one can set the directories.

Even in case we don't add the extra directories for llvm and lld, it would be a 
good idea to use the getProgramPath function instead of building it manually 
(so only the changes in HIP.cpp except lines 273-282). This was planned anyways 
according to the comments in HIP.cpp line 270-271:

>   // Lookup binaries into the driver directory, this is used to
>   // discover the clang-offload-bundler executable.




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

https://reviews.llvm.org/D72806



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


[PATCH] D72855: Make LLVM_APPEND_VC_REV=OFF affect clang, lld, and lldb as well.

2020-01-16 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




Comment at: llvm/cmake/modules/LLVMConfig.cmake.in:81
 
+set(LLVM_APPEND_VC_REV "@LLVM_APPEND_VC_REV@")
+

This here should make the standalone build configs work, I think.


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

https://reviews.llvm.org/D72855



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


[clang] 65eb74e - PointerLikeTypeTraits: Standardize NumLowBitsAvailable on static constexpr rather than anonymous enum

2020-01-16 Thread David Blaikie via cfe-commits

Author: David Blaikie
Date: 2020-01-16T15:30:50-08:00
New Revision: 65eb74e94b414fcde6bfa810d1c30c7fcb136b77

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

LOG: PointerLikeTypeTraits: Standardize NumLowBitsAvailable on static constexpr 
rather than anonymous enum

This is (more?) usable by GDB pretty printers and seems nicer to write.

There's one tricky caveat that in C++14 (LLVM's codebase today) the
static constexpr member declaration is not a definition - so odr use of
this constant requires an out of line definition, which won't be
provided (that'd make all these trait classes more annoyidng/expensive
to maintain). But the use of this constant in the library implementation
is/should always be in a non-odr context - only two unit tests needed to
be touched to cope with this/avoid odr using these constants.

Based on/expanded from D72590 by Christian Sigg.

Added: 


Modified: 
clang/include/clang/AST/CanonicalType.h
clang/include/clang/AST/DeclGroup.h
clang/include/clang/AST/ExternalASTSource.h
clang/include/clang/AST/TemplateName.h
clang/include/clang/AST/Type.h
clang/include/clang/Basic/IdentifierTable.h
clang/include/clang/Basic/SourceLocation.h
clang/include/clang/CodeGen/ConstantInitFuture.h
clang/include/clang/Sema/Ownership.h
llvm/include/llvm/ADT/IntervalMap.h
llvm/include/llvm/ADT/PointerEmbeddedInt.h
llvm/include/llvm/ADT/PointerIntPair.h
llvm/include/llvm/IR/Use.h
llvm/include/llvm/Support/PointerLikeTypeTraits.h
llvm/lib/Analysis/GlobalsModRef.cpp
llvm/unittests/ADT/PointerEmbeddedIntTest.cpp
llvm/unittests/ADT/PointerIntPairTest.cpp
mlir/include/mlir/IR/Attributes.h
mlir/include/mlir/IR/Function.h
mlir/include/mlir/IR/Identifier.h
mlir/include/mlir/IR/Location.h
mlir/include/mlir/IR/Module.h
mlir/include/mlir/IR/OperationSupport.h
mlir/include/mlir/IR/Types.h
mlir/include/mlir/IR/Value.h
polly/include/polly/CodeGen/IslExprBuilder.h

Removed: 




diff  --git a/clang/include/clang/AST/CanonicalType.h 
b/clang/include/clang/AST/CanonicalType.h
index 2e00d344533d..64ec1c0ce471 100644
--- a/clang/include/clang/AST/CanonicalType.h
+++ b/clang/include/clang/AST/CanonicalType.h
@@ -384,7 +384,7 @@ struct PointerLikeTypeTraits> {
   }
 
   // qualifier information is encoded in the low bits.
-  enum { NumLowBitsAvailable = 0 };
+  static constexpr int NumLowBitsAvailable = 0;
 };
 
 } // namespace llvm

diff  --git a/clang/include/clang/AST/DeclGroup.h 
b/clang/include/clang/AST/DeclGroup.h
index 2be9dae9431e..672b7b0a9fe2 100644
--- a/clang/include/clang/AST/DeclGroup.h
+++ b/clang/include/clang/AST/DeclGroup.h
@@ -147,7 +147,7 @@ namespace llvm {
   return clang::DeclGroupRef::getFromOpaquePtr(P);
 }
 
-enum { NumLowBitsAvailable = 0 };
+static constexpr int NumLowBitsAvailable = 0;
   };
 
 } // namespace llvm

diff  --git a/clang/include/clang/AST/ExternalASTSource.h 
b/clang/include/clang/AST/ExternalASTSource.h
index 899ac3f66937..75671f777f4f 100644
--- a/clang/include/clang/AST/ExternalASTSource.h
+++ b/clang/include/clang/AST/ExternalASTSource.h
@@ -504,9 +504,8 @@ struct PointerLikeTypeTraits<
   static void *getAsVoidPointer(Ptr P) { return P.getOpaqueValue(); }
   static Ptr getFromVoidPointer(void *P) { return Ptr::getFromOpaqueValue(P); }
 
-  enum {
-NumLowBitsAvailable = PointerLikeTypeTraits::NumLowBitsAvailable - 1
-  };
+  static constexpr int NumLowBitsAvailable =
+  PointerLikeTypeTraits::NumLowBitsAvailable - 1;
 };
 
 } // namespace llvm

diff  --git a/clang/include/clang/AST/TemplateName.h 
b/clang/include/clang/AST/TemplateName.h
index cbbcbf6af8ab..e1315facc966 100644
--- a/clang/include/clang/AST/TemplateName.h
+++ b/clang/include/clang/AST/TemplateName.h
@@ -559,7 +559,7 @@ struct PointerLikeTypeTraits {
   }
 
   // No bits are available!
-  enum { NumLowBitsAvailable = 0 };
+  static constexpr int NumLowBitsAvailable = 0;
 };
 
 } // namespace llvm.

diff  --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index f5955c45fafc..2291d776db3e 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -85,7 +85,7 @@ namespace llvm {
   return static_cast< ::clang::Type*>(P);
 }
 
-enum { NumLowBitsAvailable = clang::TypeAlignmentInBits };
+static constexpr int NumLowBitsAvailable = clang::TypeAlignmentInBits;
   };
 
   template<>
@@ -96,7 +96,7 @@ namespace llvm {
   return static_cast< ::clang::ExtQuals*>(P);
 }
 
-enum { NumLowBitsAvailable = clang::TypeAlignmentInBits };
+static constexpr int NumLowBitsAvailable = clang::TypeAlignmentInBits;
   };
 
 } // namespace llvm
@@ -1295,7 +1295,7 @@ struct PointerLikeTypeTraits {
   }
 
   // 

[PATCH] D72883: [clangd][test] Disable a particular testcase in FindExplicitReferencesTest when LLVM_ENABLE_EXPENSIVE_CHECKS

2020-01-16 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment.

Please revert this, it was already fixed by d54d71b67e60 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72883



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


[PATCH] D72806: [HIP] fix paths for executables not in clang bin directory

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

In D72806#1825333 , @DieGoldeneEnte 
wrote:

> In D72806#1824560 , @yaxunl wrote:
>
> > What's the use case of this change?
> >
> > Normally clang needs to call opt/llc/lld from the same directory of clang. 
> > Why do we need to find them in other directories?
>
>
> My motivation is the nix-package manager, which has llvm, lld and clang in 
> different packages (which results in different directories).


We've had similar issues with use of clang for CUDA on Debian (I think), where 
CUDA was scattered all over the place.
The way to do it was to create a 'shim' directory structure which would put all 
relevant tools in the right places.
Something similar could be done in your case -- make a package which would 
depend on individual tool packages and which would symlink all of them into one 
dir and point your compiler there.


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

https://reviews.llvm.org/D72806



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


[PATCH] D72806: [HIP] fix paths for executables not in clang bin directory

2020-01-16 Thread Holger Wünsche via Phabricator via cfe-commits
DieGoldeneEnte updated this revision to Diff 238645.
DieGoldeneEnte added a comment.

The build doesn't fail anymore if lld is not present, also one can set 
LLD_BINARY_DIR manually. I also exchanged TOOLS_BINARY_DIR with 
LLVM_TOOLS_BINARY_DIR, since it is better readable and if compiled with llvm 
this is necessary to populate the variable (although the path is already 
present in that case, because clang and all the other utils should be in the 
same directory.

Tests still work as before.


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

https://reviews.llvm.org/D72806

Files:
  clang/CMakeLists.txt
  clang/lib/Driver/ToolChains/HIP.cpp

Index: clang/lib/Driver/ToolChains/HIP.cpp
===
--- clang/lib/Driver/ToolChains/HIP.cpp
+++ clang/lib/Driver/ToolChains/HIP.cpp
@@ -105,9 +105,8 @@
   CmdArgs.push_back("-o");
   auto OutputFileName = getOutputFileName(C, OutputFilePrefix, "-linked", "bc");
   CmdArgs.push_back(OutputFileName);
-  SmallString<128> ExecPath(C.getDriver().Dir);
-  llvm::sys::path::append(ExecPath, "llvm-link");
-  const char *Exec = Args.MakeArgString(ExecPath);
+  const char *Exec =
+  Args.MakeArgString(getToolChain().GetProgramPath("llvm-link"));
   C.addCommand(std::make_unique(JA, *this, Exec, CmdArgs, Inputs));
   return OutputFileName;
 }
@@ -133,9 +132,8 @@
   auto OutputFileName =
   getOutputFileName(C, OutputFilePrefix, "-optimized", "bc");
   OptArgs.push_back(OutputFileName);
-  SmallString<128> OptPath(C.getDriver().Dir);
-  llvm::sys::path::append(OptPath, "opt");
-  const char *OptExec = Args.MakeArgString(OptPath);
+  const char *OptExec =
+  Args.MakeArgString(getToolChain().GetProgramPath("opt"));
   C.addCommand(std::make_unique(JA, *this, OptExec, OptArgs, Inputs));
   return OutputFileName;
 }
@@ -180,9 +178,7 @@
   auto LlcOutputFile =
   getOutputFileName(C, OutputFilePrefix, "", OutputIsAsm ? "s" : "o");
   LlcArgs.push_back(LlcOutputFile);
-  SmallString<128> LlcPath(C.getDriver().Dir);
-  llvm::sys::path::append(LlcPath, "llc");
-  const char *Llc = Args.MakeArgString(LlcPath);
+  const char *Llc = Args.MakeArgString(getToolChain().GetProgramPath("llc"));
   C.addCommand(std::make_unique(JA, *this, Llc, LlcArgs, Inputs));
   return LlcOutputFile;
 }
@@ -196,9 +192,7 @@
   // The output from ld.lld is an HSA code object file.
   ArgStringList LldArgs{
   "-flavor", "gnu", "-shared", "-o", Output.getFilename(), InputFileName};
-  SmallString<128> LldPath(C.getDriver().Dir);
-  llvm::sys::path::append(LldPath, "lld");
-  const char *Lld = Args.MakeArgString(LldPath);
+  const char *Lld = Args.MakeArgString(getToolChain().GetProgramPath("lld"));
   C.addCommand(std::make_unique(JA, *this, Lld, LldArgs, Inputs));
 }
 
@@ -230,9 +224,8 @@
   Args.MakeArgString(std::string("-outputs=").append(OutputFileName));
   BundlerArgs.push_back(BundlerOutputArg);
 
-  SmallString<128> BundlerPath(C.getDriver().Dir);
-  llvm::sys::path::append(BundlerPath, "clang-offload-bundler");
-  const char *Bundler = Args.MakeArgString(BundlerPath);
+  const char *Bundler = Args.MakeArgString(
+  T.getToolChain().GetProgramPath("clang-offload-bundler"));
   C.addCommand(std::make_unique(JA, T, Bundler, BundlerArgs, Inputs));
 }
 
@@ -277,6 +270,16 @@
   // Lookup binaries into the driver directory, this is used to
   // discover the clang-offload-bundler executable.
   getProgramPaths().push_back(getDriver().Dir);
+
+// add llvm binaries in case they are not in the driver directory
+#if defined(LLVM_TOOLS_BINARY_DIR)
+  getProgramPaths().push_back(LLVM_TOOLS_BINARY_DIR);
+#endif
+
+// add lld binary in case they are not in the driver directory
+#if defined(LLD_BINARY_DIR)
+  getProgramPaths().push_back(LLD_BINARY_DIR);
+#endif
 }
 
 void HIPToolChain::addClangTargetOptions(
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -866,6 +866,24 @@
   llvm_distribution_add_targets()
 endif()
 
+# add LLVM_TOOLS_BINARY_DIR to Defines to make llc, llvm-link and opt available
+# for HIP toolchain
+if(DEFINED LLVM_TOOLS_BINARY_DIR)
+  add_definitions( -DLLVM_TOOLS_BINARY_DIR="${LLVM_TOOLS_BINARY_DIR} " )
+  message(STATUS "found llvm executable dir: ${LLVM_TOOLS_BINARY_DIR}")
+endif()
+
+# add LLD_BINARY_DIR to Defines to make lld available for HIP toolchain
+find_program(LLD_BINARY NAMES lld)
+if(NOT LLD_BINARY MATCHES "-NOTFOUND" AND NOT DEFINED LLD_BINARY_DIR)
+  message(STATUS "found lld executable: ${LLD_BINARY}")
+  get_filename_component(LLD_BINARY_DIR ${LLD_BINARY} DIRECTORY)
+endif()
+if(DEFINED LLD_BINARY)
+  add_definitions( -DLLD_BINARY_DIR="${LLD_BINARY_DIR} " )
+endif()
+
+
 configure_file(
   ${CLANG_SOURCE_DIR}/include/clang/Config/config.h.cmake
   ${CLANG_BINARY_DIR}/include/clang/Config/config.h)
___
cfe-commits mailing list

[clang] 25b542c - [OPENMP]Do not emit RTTI descriptor for NVPTX devices.

2020-01-16 Thread Alexey Bataev via cfe-commits

Author: Alexey Bataev
Date: 2020-01-16T18:12:50-05:00
New Revision: 25b542c61fe364fa86163723b9e35cb7db28bcb4

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

LOG: [OPENMP]Do not emit RTTI descriptor for NVPTX devices.

Need to disable emission of RTTI descriptors for NVPTX devices to be
able to use dynamic classes without unresolved symbols at link stage.

Added: 


Modified: 
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/OpenMP/nvptx_target_pure_deleted_codegen.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CodeGenModule.cpp 
b/clang/lib/CodeGen/CodeGenModule.cpp
index feb8d000eca3..e347f3b6f7e0 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -5762,7 +5762,9 @@ llvm::Constant 
*CodeGenModule::GetAddrOfRTTIDescriptor(QualType Ty,
   // Return a bogus pointer if RTTI is disabled, unless it's for EH.
   // FIXME: should we even be calling this method if RTTI is disabled
   // and it's not for EH?
-  if ((!ForEH && !getLangOpts().RTTI) || getLangOpts().CUDAIsDevice)
+  if ((!ForEH && !getLangOpts().RTTI) || getLangOpts().CUDAIsDevice ||
+  (getLangOpts().OpenMP && getLangOpts().OpenMPIsDevice &&
+   getTriple().isNVPTX()))
 return llvm::Constant::getNullValue(Int8PtrTy);
 
   if (ForEH && Ty->isObjCObjectPointerType() &&

diff  --git a/clang/test/OpenMP/nvptx_target_pure_deleted_codegen.cpp 
b/clang/test/OpenMP/nvptx_target_pure_deleted_codegen.cpp
index 1e83cf6f8704..e38fcfb08000 100644
--- a/clang/test/OpenMP/nvptx_target_pure_deleted_codegen.cpp
+++ b/clang/test/OpenMP/nvptx_target_pure_deleted_codegen.cpp
@@ -1,6 +1,6 @@
 // Test target codegen - host bc file has to be created first.
 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown 
-fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
-// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown 
-fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device 
-fopenmp-host-ir-file-path %t-ppc-host.bc -o - -fno-rtti | FileCheck %s
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown 
-fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device 
-fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s
 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple i386-unknown-unknown 
-fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc
 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx-unknown-unknown 
-fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device 
-fopenmp-host-ir-file-path %t-x86-host.bc -o - -fno-rtti | FileCheck %s
 // RUN: %clang_cc1 -verify -fopenmp -fexceptions -fcxx-exceptions -x c++ 
-triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s 
-fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - -fno-rtti | 
FileCheck %s
@@ -9,9 +9,10 @@
 #ifndef HEADER
 #define HEADER
 
-
+// CHECK-NOT: class_type_info
 // CHECK-DAG: @_ZTV7Derived = linkonce_odr hidden unnamed_addr constant { [3 x 
i8*] } { [3 x i8*] [i8* null, i8* null, i8* bitcast (void (%class.Derived*)* 
@_ZN7Derived3fooEv to i8*)] }
 // CHECK-DAG: @_ZTV4Base = linkonce_odr hidden unnamed_addr constant { [3 x 
i8*] } zeroinitializer
+// CHECK-NOT: class_type_info
 class Base {
   public:
   virtual void foo() = 0;



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


[PATCH] D72883: [clangd][test] Disable a particular testcase in FindExplicitReferencesTest when LLVM_ENABLE_EXPENSIVE_CHECKS

2020-01-16 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment.

kadir has a pending (or landed?) fix for this.

It's just a usual fragile test - it's asserting the order, but 
findExplicitReferences just returns the order given by targetDecls which isn't 
stable.

We settled on defining a stable (but arbitrary) order for targetDecl as this 
pattern may be replicated elsewhere.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72883



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


[PATCH] D72806: [HIP] fix paths for executables not in clang bin directory

2020-01-16 Thread Holger Wünsche via Phabricator via cfe-commits
DieGoldeneEnte added a comment.

In D72806#1824560 , @yaxunl wrote:

> What's the use case of this change?
>
> Normally clang needs to call opt/llc/lld from the same directory of clang. 
> Why do we need to find them in other directories?


My motivation is the nix-package manager, which has llvm, lld and clang in 
different packages (which results in different directories).

> Where is TOOLS_BINARY_DIR defined?

If clang is compiled standalone with llvm as external library the 
TOOLS_BINARY_DIR is pulled from the LLVMConfig.cmake. If clang is compiled 
together with llvm the variable is set in the llvm/CMakeLists.txt .
Upon closer inspection I noticed I can/should use LLVM_TOOLS_BINARY_DIR (which 
is more readable). In the end it points to the llvm/bin directory.

> Also we cannot let the build fail because of lld not found, since users may 
> be building clang for other language and they do not need lld.

Removed the message, so build doesn't fail. Since I check for the existence of 
the define in the code only the cmake rules needed to be changed.


Repository:
  rC Clang

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

https://reviews.llvm.org/D72806



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


[PATCH] D72883: [clangd][test] Disable a particular testcase in FindExplicitReferencesTest when LLVM_ENABLE_EXPENSIVE_CHECKS

2020-01-16 Thread Jan Korous via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG42b3c38903c9: [clangd][test] Disable a particular testcase 
in FindExplicitReferencesTest when… (authored by jkorous).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72883

Files:
  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
@@ -770,6 +770,10 @@
 "1: targets = {vector}\n"
 "2: targets = {x}\n"},
// Handle UnresolvedLookupExpr.
+   // FIXME
+   // This case fails when expensive checks are enabled.
+   // Seems like the order of ns1::func and ns2::func isn't defined.
+   #ifndef EXPENSIVE_CHECKS
{R"cpp(
 namespace ns1 { void func(char*); }
 namespace ns2 { void func(int*); }
@@ -783,6 +787,7 @@
 )cpp",
 "0: targets = {ns1::func, ns2::func}\n"
 "1: targets = {t}\n"},
+#endif
// Handle UnresolvedMemberExpr.
{R"cpp(
 struct X {


Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -770,6 +770,10 @@
 "1: targets = {vector}\n"
 "2: targets = {x}\n"},
// Handle UnresolvedLookupExpr.
+   // FIXME
+   // This case fails when expensive checks are enabled.
+   // Seems like the order of ns1::func and ns2::func isn't defined.
+   #ifndef EXPENSIVE_CHECKS
{R"cpp(
 namespace ns1 { void func(char*); }
 namespace ns2 { void func(int*); }
@@ -783,6 +787,7 @@
 )cpp",
 "0: targets = {ns1::func, ns2::func}\n"
 "1: targets = {t}\n"},
+#endif
// Handle UnresolvedMemberExpr.
{R"cpp(
 struct X {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D72378: [clang-tidy] Add `bugprone-reserved-identifier`

2020-01-16 Thread Logan Smith via Phabricator via cfe-commits
logan-5 updated this revision to Diff 238640.
logan-5 added a comment.

Should be good now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72378

Files:
  clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
  clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
  clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.h
  clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/bugprone-reserved-identifier.rst
  clang-tools-extra/docs/clang-tidy/checks/cert-dcl37-c.rst
  clang-tools-extra/docs/clang-tidy/checks/cert-dcl51-cpp.rst
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/bugprone-reserved-identifier/system/system-header.h
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/bugprone-reserved-identifier/user-header.h
  clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier-c.c
  
clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier-invert.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier.cpp
@@ -0,0 +1,206 @@
+// RUN: %check_clang_tidy %s bugprone-reserved-identifier %t -- -- \
+// RUN:   -I%S/Inputs/bugprone-reserved-identifier \
+// RUN:   -isystem %S/Inputs/bugprone-reserved-identifier/system
+
+// no warnings expected without -header-filter=
+#include "user-header.h"
+#include 
+
+#define _MACRO(m) int m = 0
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: declaration uses identifier '_MACRO', which is a reserved identifier [bugprone-reserved-identifier]
+// CHECK-FIXES: {{^}}#define MACRO(m) int m = 0{{$}}
+
+namespace _Ns {
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: declaration uses identifier '_Ns', which is a reserved identifier [bugprone-reserved-identifier]
+// CHECK-FIXES: {{^}}namespace Ns {{{$}}
+
+class _Object {
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '_Object', which is a reserved identifier [bugprone-reserved-identifier]
+  // CHECK-FIXES: {{^}}class Object {{{$}}
+  int _Member;
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '_Member', which is a reserved identifier [bugprone-reserved-identifier]
+  // CHECK-FIXES: {{^}}  int Member;{{$}}
+};
+
+float _Global;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '_Global', which is a reserved identifier [bugprone-reserved-identifier]
+// CHECK-FIXES: {{^}}float Global;{{$}}
+
+void _Function() {}
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration uses identifier '_Function', which is a reserved identifier [bugprone-reserved-identifier]
+// CHECK-FIXES: {{^}}void Function() {}{{$}}
+
+using _Alias = int;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '_Alias', which is a reserved identifier [bugprone-reserved-identifier]
+// CHECK-FIXES: {{^}}using Alias = int;{{$}}
+
+template 
+// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: declaration uses identifier '_TemplateParam', which is a reserved identifier [bugprone-reserved-identifier]
+// CHECK-FIXES: {{^}}template {{$}}
+struct S {};
+
+} // namespace _Ns
+
+//
+
+#define __macro(m) int m = 0
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: declaration uses identifier '__macro', which is a reserved identifier [bugprone-reserved-identifier]
+// CHECK-FIXES: {{^}}#define macro(m) int m = 0{{$}}
+
+namespace __ns {
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: declaration uses identifier '__ns', which is a reserved identifier [bugprone-reserved-identifier]
+// CHECK-FIXES: {{^}}namespace ns {{{$}}
+class __object {
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '__object', which is a reserved identifier [bugprone-reserved-identifier]
+  // CHECK-FIXES: {{^}}class _object {{{$}}
+  int __member;
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '__member', which is a reserved identifier [bugprone-reserved-identifier]
+  // CHECK-FIXES: {{^}}  int _member;{{$}}
+};
+
+float __global;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '__global', which is a reserved identifier [bugprone-reserved-identifier]
+// CHECK-FIXES: {{^}}float _global;{{$}}
+
+void __function() {}
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration uses identifier '__function', which is a reserved identifier [bugprone-reserved-identifier]
+// CHECK-FIXES: {{^}}void _function() {}{{$}}
+
+using __alias = int;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: declaration uses identifier '__alias', which is a reserved identifier [bugprone-reserved-identifier]
+// CHECK-FIXES: {{^}}using 

[clang] 9b549f2 - AMDGPU: Update clang test

2020-01-16 Thread Matt Arsenault via cfe-commits

Author: Matt Arsenault
Date: 2020-01-16T18:10:29-05:00
New Revision: 9b549f26fab6900b5328c0c6239fd77c7527159c

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

LOG: AMDGPU: Update clang test

Added: 


Modified: 
clang/test/CodeGenOpenCL/builtins-amdgcn-gfx10.cl

Removed: 




diff  --git a/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx10.cl 
b/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx10.cl
index 3921cb90c3a5..a90d55fa8a78 100644
--- a/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx10.cl
+++ b/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx10.cl
@@ -6,15 +6,15 @@
 typedef unsigned int uint;
 
 // CHECK-LABEL: @test_permlane16(
-// CHECK: call i32 @llvm.amdgcn.permlane16(i32 %a, i32 %b, i32 %c, i32 %d, i1 
true, i1 true)
+// CHECK: call i32 @llvm.amdgcn.permlane16(i32 %a, i32 %b, i32 %c, i32 %d, i1 
false, i1 false)
 void test_permlane16(global uint* out, uint a, uint b, uint c, uint d) {
-  *out = __builtin_amdgcn_permlane16(a, b, c, d, 1, 1);
+  *out = __builtin_amdgcn_permlane16(a, b, c, d, 0, 0);
 }
 
 // CHECK-LABEL: @test_permlanex16(
-// CHECK: call i32 @llvm.amdgcn.permlanex16(i32 %a, i32 %b, i32 %c, i32 %d, i1 
true, i1 true)
+// CHECK: call i32 @llvm.amdgcn.permlanex16(i32 %a, i32 %b, i32 %c, i32 %d, i1 
false, i1 false)
 void test_permlanex16(global uint* out, uint a, uint b, uint c, uint d) {
-  *out = __builtin_amdgcn_permlanex16(a, b, c, d, 1, 1);
+  *out = __builtin_amdgcn_permlanex16(a, b, c, d, 0, 0);
 }
 
 // CHECK-LABEL: @test_mov_dpp8(



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


[clang-tools-extra] 42b3c38 - [clangd][test] Disable a particular testcase in FindExplicitReferencesTest when LLVM_ENABLE_EXPENSIVE_CHECKS

2020-01-16 Thread Jan Korous via cfe-commits

Author: Jan Korous
Date: 2020-01-16T15:07:08-08:00
New Revision: 42b3c38903c9c80e129ce678db7f522967e91eeb

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

LOG: [clangd][test] Disable a particular testcase in FindExplicitReferencesTest 
when LLVM_ENABLE_EXPENSIVE_CHECKS

The test is failing on our CI bots.
Seems like the order of results for one target is undefined.

(post-commit review)
Differential Revision: https://reviews.llvm.org/D72883

Added: 


Modified: 
clang-tools-extra/clangd/unittests/FindTargetTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp 
b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
index 408ebe24e773..c96b3a572322 100644
--- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -770,6 +770,10 @@ TEST_F(FindExplicitReferencesTest, All) {
 "1: targets = {vector}\n"
 "2: targets = {x}\n"},
// Handle UnresolvedLookupExpr.
+   // FIXME
+   // This case fails when expensive checks are enabled.
+   // Seems like the order of ns1::func and ns2::func isn't defined.
+   #ifndef EXPENSIVE_CHECKS
{R"cpp(
 namespace ns1 { void func(char*); }
 namespace ns2 { void func(int*); }
@@ -783,6 +787,7 @@ TEST_F(FindExplicitReferencesTest, All) {
 )cpp",
 "0: targets = {ns1::func, ns2::func}\n"
 "1: targets = {t}\n"},
+#endif
// Handle UnresolvedMemberExpr.
{R"cpp(
 struct X {



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


[PATCH] D69585: PerformPendingInstatiations() already in the PCH

2020-01-16 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

In D69585#1825252 , @llunak wrote:

> In D69585#1825133 , @ABataev wrote:
>
> > I thought you were going to add an option or a flag to control the 
> > behavior? If so, just provide an option in tests to avoid triggering of the 
> > new behavior (except for declare_target... test and those 2 you modified 
> > already) and that's it.
>
>
> It's not included in the latest version of the patch. As written above, I'm 
> reasonably sure I was mistaken about the need for a flag, and it should be ok 
> to simply do the change unconditionally. I can put the flag back just for the 
> purpose of the tests if you want, that'd certainly make handling of the tests 
> trivial, but then the tests wouldn't really test "normal" PCHs, so do you 
> really want that?


Of course not. I was just wandering if you still going to use a flag. If you're 
not going to use it, then there is only one choice - update the tests. The 
tests are written so to test that emitting/including PCH does not break the 
codegen. So it should be tested.


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

https://reviews.llvm.org/D69585



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


[PATCH] D69585: PerformPendingInstatiations() already in the PCH

2020-01-16 Thread Luboš Luňák via Phabricator via cfe-commits
llunak added a comment.

In D69585#1825133 , @ABataev wrote:

> I thought you were going to add an option or a flag to control the behavior? 
> If so, just provide an option in tests to avoid triggering of the new 
> behavior (except for declare_target... test and those 2 you modified already) 
> and that's it.


It's not included in the latest version of the patch. As written above, I'm 
reasonably sure I was mistaken about the need for a flag, and it should be ok 
to simply do the change unconditionally. I can put the flag back just for the 
purpose of the tests if you want, that'd certainly make handling of the tests 
trivial, but then the tests wouldn't really test "normal" PCHs, so do you 
really want that?


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

https://reviews.llvm.org/D69585



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


[PATCH] D72635: Add "context" capability to Thread Safety Analysis

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

Hmm, I have been wondering about this as well. The way I see it, all of these 
things are what we call //capabilities//, and we treat them all the same. The 
names are just meant to make warning messages more readable, because what the 
analysis considers a capability, the user might know as a //mutex//, or 
//role//, or //sequence//.

I think I'll read a bit of code to see if this is really true and there are no 
functional differences between the differently named capabilities, but other 
than that I've no objections to allowing arbitrary names. I'm trying to come up 
with potential problems caused by opening the flood gates, but frankly I don't 
see any.


Repository:
  rC Clang

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

https://reviews.llvm.org/D72635



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


[PATCH] D72869: Add __warn_memset_zero_len builtin as a workaround for glibc issue

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

{icon check-circle color=green} Unit tests: pass. 61934 tests passed, 0 failed 
and 783 were skipped.

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

{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-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72869



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


[PATCH] D72722: [FPEnv] [SystemZ] Platform-specific builtin constrained FP enablement

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



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:13347
   case SystemZ::BI__builtin_s390_vfnmadb: {
 llvm::Type *ResultType = ConvertType(E->getType());
 Value *X = EmitScalarExpr(E->getArg(0));

What are the semantics of vfnmadb with respect to when it rounds vs the 
negation? If the rounding mode is for ceil/floor and the negate is applied 
after, that would be different that if it was before.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:13369
+  Value *NegZ = Builder.CreateFNeg(Z, "sub");
+  return Builder.CreateFNeg(Builder.CreateConstrainedFPCall(F, {X, Y, 
NegZ}));
+} else {

Same question as above.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72722



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


[PATCH] D72876: Create a clang-tidy check to warn when -dealloc is implemented inside an ObjC class category.

2020-01-16 Thread Michael Wyman via Phabricator via cfe-commits
mwyman updated this revision to Diff 238621.
mwyman added a comment.

Fixed missing end quote pointed out in review comment.


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

https://reviews.llvm.org/D72876

Files:
  clang-tools-extra/clang-tidy/objc/CMakeLists.txt
  clang-tools-extra/clang-tidy/objc/DeallocInCategoriesCheck.cpp
  clang-tools-extra/clang-tidy/objc/DeallocInCategoriesCheck.h
  clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/checks/objc-dealloc-in-categories.rst
  clang-tools-extra/test/clang-tidy/checkers/objc-dealloc-in-categories.m

Index: clang-tools-extra/test/clang-tidy/checkers/objc-dealloc-in-categories.m
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/objc-dealloc-in-categories.m
@@ -0,0 +1,36 @@
+// RUN: %check_clang_tidy %s objc-dealloc-in-categories %t
+
+@interface NSObject
+// Used to quash warning about missing base class.
+- (void)dealloc;
+@end
+
+@interface Foo : NSObject
+@end
+
+@implementation Foo
+- (void)dealloc {
+  // No warning should be generated here.
+}
+@end
+
+@interface Bar : NSObject
+@end
+
+@interface Bar (Category)
+@end
+
+@implementation Bar (Category)
+- (void)dealloc {
+  // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: method -dealloc should not be implemented in a category [objc-dealloc-in-categories]
+}
+@end
+
+@interface Baz : NSObject
+@end
+
+@interface Baz (Category)
+// A declaration in a category @interface does not by itself provide an
+// overriding implementation, and should not generate a warning.
+- (void)dealloc;
+@end
Index: clang-tools-extra/docs/clang-tidy/checks/objc-dealloc-in-categories.rst
===
--- /dev/null
+++ clang-tools-extra/docs/clang-tidy/checks/objc-dealloc-in-categories.rst
@@ -0,0 +1,13 @@
+.. title:: clang-tidy - objc-dealloc-in-categories
+
+objc-dealloc-in-categories
+==
+
+Finds implementations of ``-dealloc`` in Objective-C categories. The category
+implementation will override any dealloc in the class implementation,
+potentially causing issues.
+
+Classes implement ``-dealloc`` to perform important actions just before an
+object is deallocated, but if a category on the class implements ``-dealloc``
+it will override the class's implementation and those important actions may
+not be handled by the overriding ``-dealloc``.
Index: clang-tools-extra/docs/clang-tidy/checks/list.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -230,6 +230,7 @@
`mpi-buffer-deref `_, "Yes"
`mpi-type-mismatch `_, "Yes"
`objc-avoid-nserror-init `_,
+   `objc-dealloc-in-categories `_,
`objc-forbidden-subclassing `_,
`objc-missing-hash `_,
`objc-property-declaration `_, "Yes"
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -70,6 +70,10 @@
 New checks
 ^^
 
+- New :doc:`objc-dealloc-in-categories
+  ` check.
+
+  Finds implementations of -dealloc in Objective-C categories.
 
 New aliases
 ^^^
Index: clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
===
--- clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
+++ clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
@@ -10,6 +10,7 @@
 #include "../ClangTidyModule.h"
 #include "../ClangTidyModuleRegistry.h"
 #include "AvoidNSErrorInitCheck.h"
+#include "DeallocInCategoriesCheck.h"
 #include "ForbiddenSubclassingCheck.h"
 #include "MissingHashCheck.h"
 #include "PropertyDeclarationCheck.h"
@@ -26,6 +27,8 @@
   void addCheckFactories(ClangTidyCheckFactories ) override {
 CheckFactories.registerCheck(
 "objc-avoid-nserror-init");
+CheckFactories.registerCheck(
+"objc-dealloc-in-categories");
 CheckFactories.registerCheck(
 "objc-forbidden-subclassing");
 CheckFactories.registerCheck(
Index: clang-tools-extra/clang-tidy/objc/DeallocInCategoriesCheck.h
===
--- /dev/null
+++ clang-tools-extra/clang-tidy/objc/DeallocInCategoriesCheck.h
@@ -0,0 +1,36 @@
+//===--- DeallocInCategoriesCheck.h - clang-tidy *- C++ -*-===//
+//
+// 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
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_DEALLOCINCATEGORIESCHECK_H

[PATCH] D68049: Propeller: Clang options for basic block sections

2020-01-16 Thread Sriraman Tallam via Phabricator via cfe-commits
tmsriram updated this revision to Diff 238620.
tmsriram added a comment.

clang-formatted.


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

https://reviews.llvm.org/D68049

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/CC1Options.td
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/CodeGen/CGDeclCXX.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/basicblock-sections.c
  clang/test/CodeGen/basicblock-sections.funcnames
  clang/test/CodeGen/unique_internal_funcnames.c
  clang/test/Driver/propeller-flags.c
  clang/tools/driver/cc1as_main.cpp

Index: clang/tools/driver/cc1as_main.cpp
===
--- clang/tools/driver/cc1as_main.cpp
+++ clang/tools/driver/cc1as_main.cpp
@@ -90,6 +90,7 @@
   unsigned SaveTemporaryLabels : 1;
   unsigned GenDwarfForAssembly : 1;
   unsigned RelaxELFRelocations : 1;
+  unsigned RelocateWithSymbols : 1;
   unsigned DwarfVersion;
   std::string DwarfDebugFlags;
   std::string DwarfDebugProducer;
@@ -236,6 +237,7 @@
   }
 
   Opts.RelaxELFRelocations = Args.hasArg(OPT_mrelax_relocations);
+  Opts.RelocateWithSymbols = Args.hasArg(OPT_mrelocate_with_symbols);
   Opts.DwarfVersion = getLastArgIntValue(Args, OPT_dwarf_version_EQ, 2, Diags);
   Opts.DwarfDebugFlags = Args.getLastArgValue(OPT_dwarf_debug_flags);
   Opts.DwarfDebugProducer = Args.getLastArgValue(OPT_dwarf_debug_producer);
@@ -363,6 +365,7 @@
   MAI->setCompressDebugSections(Opts.CompressDebugSections);
 
   MAI->setRelaxELFRelocations(Opts.RelaxELFRelocations);
+  MAI->setRelocateWithSymbols(Opts.RelocateWithSymbols);
 
   bool IsBinary = Opts.OutputType == AssemblerInvocation::FT_Obj;
   if (Opts.OutputPath.empty())
Index: clang/test/Driver/propeller-flags.c
===
--- /dev/null
+++ clang/test/Driver/propeller-flags.c
@@ -0,0 +1,13 @@
+// Check that -fpropeller flag invokes the correct options.
+// RUN: %clang -### %s -target x86_64-unknown-linux -fpropeller-label -flto=thin 2>&1 | FileCheck %s -check-prefix=CHECK_PROPELLER_LABEL
+// RUN: %clang -### %s -target x86_64-unknown-linux -fpropeller-optimize=perf.propeller -flto=thin 2>&1 | FileCheck %s -check-prefix=CHECK_PROPELLER_OPT
+
+// CHECK_PROPELLER_LABEL: "-fbasicblock-sections=labels"
+// CHECK_PROPELLER_LABEL: "-funique-internal-funcnames"
+// CHECK_PROPELLER_LABEL: "--lto-basicblock-sections=labels"
+//
+// CHECK_PROPELLER_OPT: "-fbasicblock-sections=perf.propeller"
+// CHECK_PROPELLER_OPT: "-funique-internal-funcnames"
+// CHECK_PROPELLER_OPT: "--propeller=perf.propeller"
+// CHECK_PROPELLER_OPT: "--lto-basicblock-sections=perf.propeller"
+// CHECK_PROPELLER_OPT: "--optimize-bb-jumps"
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.$
Index: clang/test/CodeGen/basicblock-sections.funcnames
===
--- /dev/null
+++ clang/test/CodeGen/basicblock-sections.funcnames
@@ -0,0 +1 @@
+!world
Index: clang/test/CodeGen/basicblock-sections.c
===
--- /dev/null
+++ clang/test/CodeGen/basicblock-sections.c
@@ -0,0 +1,47 @@
+// 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 -fbasicblock-sections=all -fbasicblock-sections=none -o - < %s | FileCheck %s --check-prefix=PLAIN
+
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -fbasicblock-sections=labels -o - < %s | FileCheck %s --check-prefix=BB_LABELS
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -fbasicblock-sections=all -o - < %s | FileCheck %s --check-prefix=BB_WORLD --check-prefix=BB_ALL
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -fbasicblock-sections=%S/basicblock-sections.funcnames -o - < %s | FileCheck %s --check-prefix=BB_WORLD --check-prefix=BB_LIST
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -fbasicblock-sections=all -funique-bb-section-names -o - < %s | FileCheck %s 

[PATCH] D72869: Add __warn_memset_zero_len builtin as a workaround for glibc issue

2020-01-16 Thread Amy Huang via Phabricator via cfe-commits
akhuang added a comment.

In D72869#1824927 , @serge-sans-paille 
wrote:

> @akhuang can you confirm this fixes your issue? I've tested locally and it 
> works fine on my side.


Yes, this fixes the __warn_memset_zero_len issue, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72869



___
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-16 Thread Andy Kaylor via Phabricator via cfe-commits
andrew.w.kaylor added inline comments.



Comment at: clang/lib/CodeGen/CGExprScalar.cpp:3436
+}
+  }
+

cameron.mcinally wrote:
> cameron.mcinally wrote:
> > cameron.mcinally wrote:
> > > I don't think it's safe to fuse a FMUL and FADD if the intermediate 
> > > rounding isn't exactly the same as those individual operations. FMULADD 
> > > doesn't guarantee that, does it?
> > To be clear, we could miss very-edge-case overflow/underflow exceptions.
> Ah, but I see C/C++ FP_CONTRACT allows the exceptions to be optimized away. 
> Sorry for the noise.
We've talked about this before but I don't think we ever documented a decision 
as to whether we want to allow constrained intrinsics and fast math flags to be 
combined. This patch moves that decision into clang's decision to generate this 
intrinsic or not.

I think it definitely makes sense in the case of fp contraction, because even 
if a user cares about value safety they might want FMA, which is theorectically 
more accurate than the separate values even though it produces a different 
value. This is consistent with gcc (which produces FMA under 
"-ffp-contract=fast -fno-fast-math") and icc (which produced FMA under 
"-fp-model strict -fma").

For the record, I also think it makes sense to use nnan, ninf, and nsz with 
constrained intrinsics.


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] D72869: Add __warn_memset_zero_len builtin as a workaround for glibc issue

2020-01-16 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72869



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


[PATCH] D72876: Create a clang-tidy check to warn when -dealloc is implemented inside an ObjC class category.

2020-01-16 Thread Dave MacLachlan via Phabricator via cfe-commits
dmaclach requested changes to this revision.
dmaclach added inline comments.
This revision now requires changes to proceed.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/objc-dealloc-in-categories.rst:10
+
+Classes implement ``-dealloc` to perform important actions just before an
+object is deallocated, but if a category on the class implements ``-dealloc``

Need an end quote on dealloc


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D72876



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


[PATCH] D69585: PerformPendingInstatiations() already in the PCH

2020-01-16 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

In D69585#1823969 , @llunak wrote:

> In D69585#1821831 , @aganea wrote:
>
> > What is the error?
>
>
> I take that part back, actually. I don't quite remember anymore what exactly 
> I did in October, but if I now revert the PCH tweaks in LibreOffice I did to 
> avoid the error, the compilation fails even without the patch or with GCC. So 
> I assume what really happened was that code changes triggered the error and I 
> incorrectly assumed it was because of my patch. So, unless proven otherwise, 
> I take it that my patch is actually technically correct without causing any 
> code regressions (the OpenMP problem has just been fixed).
>
> What remains is those 22 tests which fail because moving the instantiations 
> reorders the code that is expected by FileCheck. This patch handles 2 of 
> them, and it's already rather tedious (the OpenMP tests are large). Is this 
> really the way to handle them, or does somebody have a better idea?


I thought you were going to add an option or a flag to control the behavior? If 
so, just provide an option in tests to avoid triggering of the new behavior 
(except for declare_target... test and those 2 you modified already) and that's 
it.


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

https://reviews.llvm.org/D69585



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


[PATCH] D72869: Add __warn_memset_zero_len builtin as a workaround for glibc issue

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

Add test case


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72869

Files:
  clang/include/clang/Basic/Builtins.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/builtins.c


Index: clang/test/CodeGen/builtins.c
===
--- clang/test/CodeGen/builtins.c
+++ clang/test/CodeGen/builtins.c
@@ -453,6 +453,13 @@
   int *d = __builtin_launder(p);
 }
 
+// __warn_memset_zero_len should be NOP, see 
https://sourceware.org/bugzilla/show_bug.cgi?id=25399
+// CHECK-LABEL: define void @test___warn_memset_zero_len
+void test___warn_memset_zero_len() {
+  // CHECK-NOT: @__warn_memset_zero_len
+  __warn_memset_zero_len();
+}
+
 // Behavior of __builtin_os_log differs between platforms, so only test on X86
 #ifdef __x86_64__
 
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -3222,6 +3222,8 @@
 Builder.CreateZExt(EmitSignBit(*this, EmitScalarExpr(E->getArg(0))),
ConvertType(E->getType(;
   }
+  case Builtin::BI__warn_memset_zero_len:
+return RValue::getIgnored();
   case Builtin::BI__annotation: {
 // Re-encode each wide string to UTF8 and make an MDString.
 SmallVector Strings;
Index: clang/include/clang/Basic/Builtins.def
===
--- clang/include/clang/Basic/Builtins.def
+++ clang/include/clang/Basic/Builtins.def
@@ -788,6 +788,9 @@
 BUILTIN(__builtin_index, "c*cC*i", "Fn")
 BUILTIN(__builtin_rindex, "c*cC*i", "Fn")
 
+// ignored glibc builtin, see 
https://sourceware.org/bugzilla/show_bug.cgi?id=25399
+BUILTIN(__warn_memset_zero_len, "v", "nU")
+
 // Microsoft builtins.  These are only active with -fms-extensions.
 LANGBUILTIN(_alloca,  "v*z", "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(__annotation, "wC*.","n", ALL_MS_LANGUAGES)


Index: clang/test/CodeGen/builtins.c
===
--- clang/test/CodeGen/builtins.c
+++ clang/test/CodeGen/builtins.c
@@ -453,6 +453,13 @@
   int *d = __builtin_launder(p);
 }
 
+// __warn_memset_zero_len should be NOP, see https://sourceware.org/bugzilla/show_bug.cgi?id=25399
+// CHECK-LABEL: define void @test___warn_memset_zero_len
+void test___warn_memset_zero_len() {
+  // CHECK-NOT: @__warn_memset_zero_len
+  __warn_memset_zero_len();
+}
+
 // Behavior of __builtin_os_log differs between platforms, so only test on X86
 #ifdef __x86_64__
 
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -3222,6 +3222,8 @@
 Builder.CreateZExt(EmitSignBit(*this, EmitScalarExpr(E->getArg(0))),
ConvertType(E->getType(;
   }
+  case Builtin::BI__warn_memset_zero_len:
+return RValue::getIgnored();
   case Builtin::BI__annotation: {
 // Re-encode each wide string to UTF8 and make an MDString.
 SmallVector Strings;
Index: clang/include/clang/Basic/Builtins.def
===
--- clang/include/clang/Basic/Builtins.def
+++ clang/include/clang/Basic/Builtins.def
@@ -788,6 +788,9 @@
 BUILTIN(__builtin_index, "c*cC*i", "Fn")
 BUILTIN(__builtin_rindex, "c*cC*i", "Fn")
 
+// ignored glibc builtin, see https://sourceware.org/bugzilla/show_bug.cgi?id=25399
+BUILTIN(__warn_memset_zero_len, "v", "nU")
+
 // Microsoft builtins.  These are only active with -fms-extensions.
 LANGBUILTIN(_alloca,  "v*z", "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(__annotation, "wC*.","n", ALL_MS_LANGUAGES)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D72869: Add __warn_memset_zero_len builtin as a workaround for glibc issue

2020-01-16 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

In D72869#1824951 , @efriedma wrote:

> This is very hacky,


Yeah, I know...

> but it might be the least-bad alternative.  I mean, we could change D71082 
>  so it doesn't allow system headers to 
> define memset, but that seems worse.

Definitively

> Please add a testcase.

Done


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72869



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


[PATCH] D72876: Create a clang-tidy check to warn when -dealloc is implemented inside an ObjC class category.

2020-01-16 Thread Michael Wyman via Phabricator via cfe-commits
mwyman created this revision.
mwyman added reviewers: stephanemoore, benhamilton.
mwyman added projects: clang-tools-extra, clang.
Herald added subscribers: cfe-commits, mgehre, mgorny.

Such implementations may override the class's own implementation, and even be a 
danger in case someone later comes and adds one to the class itself. Most times 
this has been encountered have been a mistake.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D72876

Files:
  clang-tools-extra/clang-tidy/objc/CMakeLists.txt
  clang-tools-extra/clang-tidy/objc/DeallocInCategoriesCheck.cpp
  clang-tools-extra/clang-tidy/objc/DeallocInCategoriesCheck.h
  clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/checks/objc-dealloc-in-categories.rst
  clang-tools-extra/test/clang-tidy/checkers/objc-dealloc-in-categories.m

Index: clang-tools-extra/test/clang-tidy/checkers/objc-dealloc-in-categories.m
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/objc-dealloc-in-categories.m
@@ -0,0 +1,36 @@
+// RUN: %check_clang_tidy %s objc-dealloc-in-categories %t
+
+@interface NSObject
+// Used to quash warning about missing base class.
+- (void)dealloc;
+@end
+
+@interface Foo : NSObject
+@end
+
+@implementation Foo
+- (void)dealloc {
+  // No warning should be generated here.
+}
+@end
+
+@interface Bar : NSObject
+@end
+
+@interface Bar (Category)
+@end
+
+@implementation Bar (Category)
+- (void)dealloc {
+  // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: method -dealloc should not be implemented in a category [objc-dealloc-in-categories]
+}
+@end
+
+@interface Baz : NSObject
+@end
+
+@interface Baz (Category)
+// A declaration in a category @interface does not by itself provide an
+// overriding implementation, and should not generate a warning.
+- (void)dealloc;
+@end
Index: clang-tools-extra/docs/clang-tidy/checks/objc-dealloc-in-categories.rst
===
--- /dev/null
+++ clang-tools-extra/docs/clang-tidy/checks/objc-dealloc-in-categories.rst
@@ -0,0 +1,13 @@
+.. title:: clang-tidy - objc-dealloc-in-categories
+
+objc-dealloc-in-categories
+==
+
+Finds implementations of ``-dealloc`` in Objective-C categories. The category
+implementation will override any dealloc in the class implementation,
+potentially causing issues.
+
+Classes implement ``-dealloc` to perform important actions just before an
+object is deallocated, but if a category on the class implements ``-dealloc``
+it will override the class's implementation and those important actions may
+not be handled by the overriding ``-dealloc``.
Index: clang-tools-extra/docs/clang-tidy/checks/list.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -230,6 +230,7 @@
`mpi-buffer-deref `_, "Yes"
`mpi-type-mismatch `_, "Yes"
`objc-avoid-nserror-init `_,
+   `objc-dealloc-in-categories `_,
`objc-forbidden-subclassing `_,
`objc-missing-hash `_,
`objc-property-declaration `_, "Yes"
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -70,6 +70,10 @@
 New checks
 ^^
 
+- New :doc:`objc-dealloc-in-categories
+  ` check.
+
+  Finds implementations of -dealloc in Objective-C categories.
 
 New aliases
 ^^^
Index: clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
===
--- clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
+++ clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
@@ -10,6 +10,7 @@
 #include "../ClangTidyModule.h"
 #include "../ClangTidyModuleRegistry.h"
 #include "AvoidNSErrorInitCheck.h"
+#include "DeallocInCategoriesCheck.h"
 #include "ForbiddenSubclassingCheck.h"
 #include "MissingHashCheck.h"
 #include "PropertyDeclarationCheck.h"
@@ -26,6 +27,8 @@
   void addCheckFactories(ClangTidyCheckFactories ) override {
 CheckFactories.registerCheck(
 "objc-avoid-nserror-init");
+CheckFactories.registerCheck(
+"objc-dealloc-in-categories");
 CheckFactories.registerCheck(
 "objc-forbidden-subclassing");
 CheckFactories.registerCheck(
Index: clang-tools-extra/clang-tidy/objc/DeallocInCategoriesCheck.h
===
--- /dev/null
+++ clang-tools-extra/clang-tidy/objc/DeallocInCategoriesCheck.h
@@ -0,0 +1,36 @@
+//===--- DeallocInCategoriesCheck.h - clang-tidy *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for 

[PATCH] D72875: [clang][cmake] Include generated rst files in html built by docs-clang-html target

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

{icon check-circle color=green} Unit tests: pass. 61925 tests passed, 0 failed 
and 783 were skipped.

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

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

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



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72875



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


[PATCH] D72874: [clangd] Add a textual fallback for go-to-definition

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

{icon check-circle color=green} Unit tests: pass. 61850 tests passed, 0 failed 
and 781 were skipped.

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

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

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



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72874



___
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-16 Thread Cameron McInally via Phabricator via cfe-commits
cameron.mcinally added inline comments.



Comment at: clang/lib/CodeGen/CGExprScalar.cpp:3436
+}
+  }
+

cameron.mcinally wrote:
> cameron.mcinally wrote:
> > I don't think it's safe to fuse a FMUL and FADD if the intermediate 
> > rounding isn't exactly the same as those individual operations. FMULADD 
> > doesn't guarantee that, does it?
> To be clear, we could miss very-edge-case overflow/underflow exceptions.
Ah, but I see C/C++ FP_CONTRACT allows the exceptions to be optimized away. 
Sorry for the noise.


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] D72820: [FPEnv] Add pragma FP_CONTRACT support under strict FP.

2020-01-16 Thread Cameron McInally via Phabricator via cfe-commits
cameron.mcinally added inline comments.



Comment at: clang/lib/CodeGen/CGExprScalar.cpp:3436
+}
+  }
+

cameron.mcinally wrote:
> I don't think it's safe to fuse a FMUL and FADD if the intermediate rounding 
> isn't exactly the same as those individual operations. FMULADD doesn't 
> guarantee that, does it?
To be clear, we could miss very-edge-case overflow/underflow exceptions.


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


[clang] 202446c - Add BuiltinsHexagonDep.def to clang module map

2020-01-16 Thread Krzysztof Parzyszek via cfe-commits

Author: Krzysztof Parzyszek
Date: 2020-01-16T15:54:24-06:00
New Revision: 202446c639fdd27a54c3be268154a7c66af4f36d

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

LOG: Add BuiltinsHexagonDep.def to clang module map

Added: 


Modified: 
clang/include/clang/module.modulemap

Removed: 




diff  --git a/clang/include/clang/module.modulemap 
b/clang/include/clang/module.modulemap
index b3e2108d3fa6..f36fc6bd55a4 100644
--- a/clang/include/clang/module.modulemap
+++ b/clang/include/clang/module.modulemap
@@ -38,6 +38,7 @@ module Clang_Basic {
   textual header "Basic/BuiltinsBPF.def"
   textual header "Basic/Builtins.def"
   textual header "Basic/BuiltinsHexagon.def"
+  textual header "Basic/BuiltinsHexagonDep.def"
   textual header "Basic/BuiltinsLe64.def"
   textual header "Basic/BuiltinsMips.def"
   textual header "Basic/BuiltinsNEON.def"



___
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-16 Thread Cameron McInally via Phabricator via cfe-commits
cameron.mcinally added inline comments.



Comment at: clang/lib/CodeGen/CGExprScalar.cpp:3436
+}
+  }
+

I don't think it's safe to fuse a FMUL and FADD if the intermediate rounding 
isn't exactly the same as those individual operations. FMULADD doesn't 
guarantee that, does it?


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] D72872: [ObjC generics] Fix not inheriting type bounds in categories/extensions.

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

{icon check-circle color=green} Unit tests: pass. 61930 tests passed, 0 failed 
and 783 were skipped.

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

{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-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72872



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


[PATCH] D72875: [clang][cmake] Include generated rst files in html built by docs-clang-html target

2020-01-16 Thread Tom Stellard via Phabricator via cfe-commits
tstellar created this revision.
tstellar added reviewers: rsmith, aaron.ballman, beanz, smeenai, phosek, 
compnerd.
Herald added subscribers: llvm-commits, mgorny.
Herald added projects: clang, LLVM.

This is an attempt to simply the process of building the clang
documentation, which should help avoid some of the recent issues we've
had generating the documentation for the website.

The html documentation for clang is generated by sphinx from the
reStructuredText (rst) files we have in the clang/docs directory.
There are also some rst files that need to be generated by TableGen,
before they can be passed to sphinx.  Prior to this patch we were not
generating those rst files as part with the build system and they had to be
generated manually.

This patch enables the automatic generation of these rst files, but
since they are generated at build time the cannot be placed in the
clang/docs directory and must go into the cmake build directory.

Unfortunately sphinx does not currently support multiple source
directories[1], so in order to be able to generate the full
documentation, we need to work around this by copying the
rst files from the clang/docs into the  build directory before
generating the html documentation.

[1] https://github.com/sphinx-doc/sphinx/issues/3132


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72875

Files:
  clang/docs/CMakeLists.txt
  llvm/cmake/modules/AddSphinxTarget.cmake


Index: llvm/cmake/modules/AddSphinxTarget.cmake
===
--- llvm/cmake/modules/AddSphinxTarget.cmake
+++ llvm/cmake/modules/AddSphinxTarget.cmake
@@ -18,6 +18,7 @@
 #
 # ``project`` should be the project name
 function (add_sphinx_target builder project)
+  cmake_parse_arguments(ARG "" "SOURCE_DIR" "" ${ARGN})
   set(SPHINX_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/${builder}")
   set(SPHINX_DOC_TREE_DIR 
"${CMAKE_CURRENT_BINARY_DIR}/_doctrees-${project}-${builder}")
   set(SPHINX_TARGET_NAME docs-${project}-${builder})
@@ -28,13 +29,17 @@
 set(SPHINX_WARNINGS_AS_ERRORS_FLAG "")
   endif()
 
+  if (NOT ARG_SOURCE_DIR)
+set(ARG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+  endif()
+
   add_custom_target(${SPHINX_TARGET_NAME}
 COMMAND ${SPHINX_EXECUTABLE}
 -b ${builder}
 -d "${SPHINX_DOC_TREE_DIR}"
 -q # Quiet: no output other than errors and 
warnings.
 ${SPHINX_WARNINGS_AS_ERRORS_FLAG} # Treat warnings 
as errors if requested
-"${CMAKE_CURRENT_SOURCE_DIR}" # Source
+"${ARG_SOURCE_DIR}" # Source
 "${SPHINX_BUILD_DIR}" # Output
 COMMENT
 "Generating ${builder} Sphinx documentation for ${project} 
into \"${SPHINX_BUILD_DIR}\"")
Index: clang/docs/CMakeLists.txt
===
--- clang/docs/CMakeLists.txt
+++ clang/docs/CMakeLists.txt
@@ -90,15 +90,40 @@
 endif()
 endif()
 
+function (gen_rst_file output_file td_option source)
+  get_filename_component(TABLEGEN_INCLUDE_DIR 
"${CMAKE_CURRENT_SOURCE_DIR}/${source}" DIRECTORY)
+  list(APPEND LLVM_TABLEGEN_FLAGS "-I${TABLEGEN_INCLUDE_DIR}")
+  clang_tablegen(${output_file} ${td_option} SOURCE ${source} TARGET 
"gen-${output_file}")
+  add_dependencies(docs-clang-html "gen-${output_file}")
+endfunction()
+
 if (LLVM_ENABLE_SPHINX)
   include(AddSphinxTarget)
   if (SPHINX_FOUND)
 if (${SPHINX_OUTPUT_HTML})
-  add_sphinx_target(html clang)
+  add_sphinx_target(html clang SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR})
+
+  # Copy rst files to build directory before generating the html
+  # documentation.  Some of the rst files are generated, so they
+  # only exist in the build directory.  Sphinx needs all files in
+  # the same directory in order to genrate the html, so we need to
+  # copy all the non-gnerated rst files from the source to the build
+  # directory before we run sphinx.
+  add_custom_target(copy-clang-rst-docs
+   COMMAND ${CMAKE_COMMAND} -E copy_directory
+   ${CMAKE_CURRENT_SOURCE_DIR}
+   ${CMAKE_CURRENT_BINARY_DIR})
+  add_dependencies(docs-clang-html copy-clang-rst-docs)
+
   add_custom_command(TARGET docs-clang-html POST_BUILD
 COMMAND ${CMAKE_COMMAND} -E copy
 "${CMAKE_CURRENT_SOURCE_DIR}/LibASTMatchersReference.html"
 "${CMAKE_CURRENT_BINARY_DIR}/html/LibASTMatchersReference.html")
+
+  # Generated files
+  gen_rst_file(AttributeReference.rst -gen-attr-docs 
../include/clang/Basic/Attr.td)
+  gen_rst_file(DiagnosticsReference.rst -gen-diag-docs 
../include/clang/Basic/Diagnostic.td)
+  gen_rst_file(ClangCommandLineReference.rst -gen-opt-docs 
../include/clang/Driver/ClangOptionDocs.td)
 endif()
 if (${SPHINX_OUTPUT_MAN})
   add_sphinx_target(man clang)


Index: 

[PATCH] D69878: Consoldiate internal denormal flushing controls

2020-01-16 Thread Andy Kaylor via Phabricator via cfe-commits
andrew.w.kaylor added inline comments.



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:2311
+  bool TrappingMath = true;
 // overriden by ffp-exception-behavior?
   bool RoundingFPMath = false;

arsenm wrote:
> cameron.mcinally wrote:
> > Last line of comment was not removed.
> > 
> > Also, is it safe to remove `TrappingMathPresent`? Is that part of the 
> > work-in-progress to support `ffp-exception-behavior`?
> I think this is a rebase gone bad. The patch changing the strict math was 
> revered and recommitted and I probably broke this
Looks like this is still wrong. You didn't intend to change either TrappingMath 
flag, did you?



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:2657
   // -fno_unsafe_math_optimizations restores default denormal handling
-  DenormalFPMath = "";
+  DenormalFPMath = DefaultDenormalFPMath;
   break;

Shouldn't this also restore DenormalFP32Math to its default value?


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

https://reviews.llvm.org/D69878



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


[clang] 8b32192 - [OPENMP]Avoid string concat where possible and use standard name

2020-01-16 Thread Alexey Bataev via cfe-commits

Author: Alexey Bataev
Date: 2020-01-16T16:39:45-05:00
New Revision: 8b321929483ee3c4070a10c457733c1bddd10b51

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

LOG: [OPENMP]Avoid string concat where possible and use standard name
generation function, NFC.

Added: 


Modified: 
clang/lib/CodeGen/CGOpenMPRuntime.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 97b17799a03e..e1ba4c63a70f 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -24,6 +24,7 @@
 #include "clang/CodeGen/ConstantInitBuilder.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SetOperations.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/Bitcode/BitcodeReader.h"
 #include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
 #include "llvm/IR/DerivedTypes.h"
@@ -9085,8 +9086,9 @@ void CGOpenMPRuntime::emitUDMapperArrayInitOrDel(
 
   // Evaluate if this is an array section.
   llvm::BasicBlock *IsDeleteBB =
-  MapperCGF.createBasicBlock("omp.array" + Prefix + ".evaldelete");
-  llvm::BasicBlock *BodyBB = MapperCGF.createBasicBlock("omp.array" + Prefix);
+  MapperCGF.createBasicBlock(getName({"omp.array", Prefix, 
".evaldelete"}));
+  llvm::BasicBlock *BodyBB =
+  MapperCGF.createBasicBlock(getName({"omp.array", Prefix}));
   llvm::Value *IsArray = MapperCGF.Builder.CreateICmpSGE(
   Size, MapperCGF.Builder.getInt64(1), "omp.arrayinit.isarray");
   MapperCGF.Builder.CreateCondBr(IsArray, IsDeleteBB, ExitBB);
@@ -9099,10 +9101,10 @@ void CGOpenMPRuntime::emitUDMapperArrayInitOrDel(
   llvm::Value *DeleteCond;
   if (IsInit) {
 DeleteCond = MapperCGF.Builder.CreateIsNull(
-DeleteBit, "omp.array" + Prefix + ".delete");
+DeleteBit, getName({"omp.array", Prefix, ".delete"}));
   } else {
 DeleteCond = MapperCGF.Builder.CreateIsNotNull(
-DeleteBit, "omp.array" + Prefix + ".delete");
+DeleteBit, getName({"omp.array", Prefix, ".delete"}));
   }
   MapperCGF.Builder.CreateCondBr(DeleteCond, BodyBB, ExitBB);
 
@@ -11000,7 +11002,7 @@ Address 
CGOpenMPRuntime::getAddressOfLocalVariable(CodeGenFunction ,
 
   llvm::Value *Addr =
   CGF.EmitRuntimeCall(createRuntimeFunction(OMPRTL__kmpc_alloc), Args,
-  CVD->getName() + ".void.addr");
+  getName({CVD->getName(), ".void.addr"}));
   llvm::Value *FiniArgs[OMPAllocateCleanupTy::CleanupArgs] = {ThreadID, Addr,
   Allocator};
   llvm::FunctionCallee FiniRTLFn = createRuntimeFunction(OMPRTL__kmpc_free);
@@ -11010,7 +11012,7 @@ Address 
CGOpenMPRuntime::getAddressOfLocalVariable(CodeGenFunction ,
   Addr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
   Addr,
   CGF.ConvertTypeForMem(CGM.getContext().getPointerType(CVD->getType())),
-  CVD->getName() + ".addr");
+  getName({CVD->getName(), ".addr"}));
   return Address(Addr, Align);
 }
 
@@ -11361,8 +11363,6 @@ 
CGOpenMPRuntime::LastprivateConditionalRAII::LastprivateConditionalRAII(
 Data.UseOriginalIV = true;
 return;
   }
-  llvm::SmallString<16> Buffer;
-  llvm::raw_svector_ostream OS(Buffer);
   PresumedLoc PLoc =
   CGM.getContext().getSourceManager().getPresumedLoc(S.getBeginLoc());
   assert(PLoc.isValid() && "Source location is expected to be always valid.");
@@ -11371,9 +11371,9 @@ 
CGOpenMPRuntime::LastprivateConditionalRAII::LastprivateConditionalRAII(
   if (auto EC = llvm::sys::fs::getUniqueID(PLoc.getFilename(), ID))
 CGM.getDiags().Report(diag::err_cannot_open_file)
 << PLoc.getFilename() << EC.message();
-  OS << "$pl_cond_" << ID.getDevice() << "_" << ID.getFile() << "_"
- << PLoc.getLine() << "_" << PLoc.getColumn() << "$iv";
-  Data.IVName = OS.str();
+  Data.IVName = CGM.getOpenMPRuntime().getName(
+  {"pl_cond", llvm::utostr(ID.getDevice()), llvm::utostr(ID.getFile()),
+   llvm::utostr(PLoc.getLine()), llvm::utostr(PLoc.getColumn()), "iv"});
 }
 
 CGOpenMPRuntime::LastprivateConditionalRAII::~LastprivateConditionalRAII() {
@@ -11496,7 +11496,7 @@ void 
CGOpenMPRuntime::checkAndEmitLastprivateConditional(CodeGenFunction ,
   // int last_iv = 0;
   llvm::Type *LLIVTy = CGF.ConvertTypeForMem(IVLVal.getType());
   llvm::Constant *LastIV =
-  getOrCreateInternalVariable(LLIVTy, UniqueDeclName + "$iv");
+  getOrCreateInternalVariable(LLIVTy, getName({UniqueDeclName, "iv"}));
   cast(LastIV)->setAlignment(
   IVLVal.getAlignment().getAsAlign());
   LValue LastIVLVal = CGF.MakeNaturalAlignAddrLValue(LastIV, IVLVal.getType());



___
cfe-commits mailing list
cfe-commits@lists.llvm.org

[PATCH] D72873: [clang][xray] Add -fxray-ignore-loops option

2020-01-16 Thread Ian Levesque via Phabricator via cfe-commits
ianlevesque created this revision.
ianlevesque added a reviewer: dberris.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
ianlevesque updated this revision to Diff 238600.
ianlevesque added a comment.

fix clang-format


XRay allows tuning by minimum function size, but also always instruments
functions with loops in them. If the minimum function size is set to a
large value the loop instrumention ends up causing most functions to be
instrumented anyway. This adds a new flag, -fxray-ignore-loops, to disable
the loop detection logic.

The LLVM change to take the new function attribute into account is in D72659 



Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72873

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/xray-ignore-loops.cpp


Index: clang/test/CodeGen/xray-ignore-loops.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xray-ignore-loops.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fxray-instrument -fxray-ignore-loops -x c++ -std=c++11 
-emit-llvm -o - %s -triple x86_64-unknown-linux-gnu | FileCheck %s
+
+int foo() {
+  return 1;
+}
+
+// CHECK: define i32 @_Z3foov() #[[ATTRS:[0-9]+]] {
+// CHECK-DAG: attributes #[[ATTRS]] = {{.*}} "xray-ignore-loops" {{.*}}
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1091,6 +1091,8 @@
   Args.hasArg(OPT_fxray_always_emit_typedevents);
   Opts.XRayInstructionThreshold =
   getLastArgIntValue(Args, OPT_fxray_instruction_threshold_EQ, 200, Diags);
+  Opts.XRayIgnoreLoops =
+  Args.hasArg(OPT_fxray_ignore_loops, OPT_fno_xray_ignore_loops, false);
 
   auto XRayInstrBundles =
   Args.getAllArgValues(OPT_fxray_instrumentation_bundle);
Index: clang/lib/CodeGen/CodeGenFunction.cpp
===
--- clang/lib/CodeGen/CodeGenFunction.cpp
+++ clang/lib/CodeGen/CodeGenFunction.cpp
@@ -818,6 +818,9 @@
 Fn->addFnAttr(
 "xray-instruction-threshold",
 llvm::itostr(CGM.getCodeGenOpts().XRayInstructionThreshold));
+  if (CGM.getCodeGenOpts().XRayIgnoreLoops) {
+Fn->addFnAttr("xray-ignore-loops");
+  }
 }
 
 if (const auto *Attr = D->getAttr()) {
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1292,6 +1292,13 @@
 def fnoxray_always_emit_typedevents : Flag<["-"], 
"fno-xray-always-emit-typedevents">, Group,
   Flags<[CC1Option]>;
 
+def fxray_ignore_loops : Flag<["-"], "fxray-ignore-loops">, Group,
+  Flags<[CC1Option]>,
+  HelpText<"Don't instrument functions with loops unless they also meet the 
minimum function size">;
+def fno_xray_ignore_loops : Flag<["-"], "fno-xray-ignore-loops">, 
Group,
+  Flags<[CC1Option]>;
+
+
 def fxray_link_deps : Flag<["-"], "fxray-link-deps">, Group,
   Flags<[CC1Option]>,
   HelpText<"Tells clang to add the link dependencies for XRay.">;
Index: clang/include/clang/Basic/CodeGenOptions.def
===
--- clang/include/clang/Basic/CodeGenOptions.def
+++ clang/include/clang/Basic/CodeGenOptions.def
@@ -106,6 +106,10 @@
 ///< Set when -fxray-always-emit-typedevents is enabled.
 CODEGENOPT(XRayAlwaysEmitTypedEvents , 1, 0)
 
+///< Set when -fxray-ignore-loops is enabled.
+CODEGENOPT(XRayIgnoreLoops , 1, 0)
+
+
 ///< Set the minimum number of instructions in a function to determine 
selective
 ///< XRay instrumentation.
 VALUE_CODEGENOPT(XRayInstructionThreshold , 32, 200)


Index: clang/test/CodeGen/xray-ignore-loops.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xray-ignore-loops.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fxray-instrument -fxray-ignore-loops -x c++ -std=c++11 -emit-llvm -o - %s -triple x86_64-unknown-linux-gnu | FileCheck %s
+
+int foo() {
+  return 1;
+}
+
+// CHECK: define i32 @_Z3foov() #[[ATTRS:[0-9]+]] {
+// CHECK-DAG: attributes #[[ATTRS]] = {{.*}} "xray-ignore-loops" {{.*}}
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1091,6 +1091,8 @@
   Args.hasArg(OPT_fxray_always_emit_typedevents);
   Opts.XRayInstructionThreshold =
   getLastArgIntValue(Args, OPT_fxray_instruction_threshold_EQ, 200, Diags);
+  Opts.XRayIgnoreLoops =
+  Args.hasArg(OPT_fxray_ignore_loops, OPT_fno_xray_ignore_loops, false);
 
   auto XRayInstrBundles =
   

[PATCH] D72874: [clangd] Add a textual fallback for go-to-definition

2020-01-16 Thread Nathan Ridge via Phabricator via cfe-commits
nridge created this revision.
nridge added a reviewer: sammccall.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, jkorous, 
MaskRay, ilya-biryukov.
Herald added a project: clang.

This facilitates performing go-to-definition inside comments, strings,
invalid code, and dependent contexts where AST-based heuristics are
insufficient.

Fixes https://github.com/clangd/clangd/issues/241


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72874

Files:
  clang-tools-extra/clangd/SourceCode.cpp
  clang-tools-extra/clangd/SourceCode.h
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/unittests/XRefsTests.cpp

Index: clang-tools-extra/clangd/unittests/XRefsTests.cpp
===
--- clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -585,6 +585,51 @@
   }
 }
 
+TEST(LocateSymbol, Textual) {
+  const char *Tests[] = {
+  R"cpp(// Comment
+struct [[Foo]] {};
+// Comment mentioning F^oo
+  )cpp",
+  R"cpp(// String
+struct [[Foo]] {};
+const char* = "String literal mentioning F^oo";
+  )cpp",
+  R"cpp(// Invalid code
+int [[foo]](int);
+int var = f^oo();
+  )cpp",
+  R"cpp(// Dependent type
+struct Foo {
+  void [[uniqueMethodName]]();
+};
+template 
+void f(T t) {
+  t->u^niqueMethodName();
+}
+  )cpp"};
+
+  for (const char *Test : Tests) {
+Annotations T(Test);
+llvm::Optional WantDecl;
+if (!T.ranges().empty())
+  WantDecl = T.range();
+
+auto TU = TestTU::withCode(T.code());
+
+auto AST = TU.build();
+auto Index = TU.index();
+auto Results = locateSymbolAt(AST, T.point(), Index.get());
+
+if (!WantDecl) {
+  EXPECT_THAT(Results, IsEmpty()) << Test;
+} else {
+  ASSERT_THAT(Results, ::testing::SizeIs(1)) << Test;
+  EXPECT_EQ(Results[0].PreferredDeclaration.range, *WantDecl) << Test;
+}
+  }
+}
+
 TEST(LocateSymbol, Ambiguous) {
   auto T = Annotations(R"cpp(
 struct Foo {
@@ -659,6 +704,27 @@
Sym("baz", T.range("StaticOverload2";
 }
 
+TEST(LocateSymbol, TextualAmbiguous) {
+  auto T = Annotations(R"cpp(
+struct Foo {
+  void $FooLoc[[uniqueMethodName]]();
+};
+struct Bar {
+  void $BarLoc[[uniqueMethodName]]();
+};
+template 
+void f(T t) {
+  t->u^niqueMethodName();
+}
+  )cpp");
+  auto TU = TestTU::withCode(T.code());
+  auto AST = TU.build();
+  auto Index = TU.index();
+  EXPECT_THAT(locateSymbolAt(AST, T.point(), Index.get()),
+  UnorderedElementsAre(Sym("uniqueMethodName", T.range("FooLoc")),
+   Sym("uniqueMethodName", T.range("BarLoc";
+}
+
 TEST(LocateSymbol, TemplateTypedefs) {
   auto T = Annotations(R"cpp(
 template  struct function {};
Index: clang-tools-extra/clangd/XRefs.cpp
===
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -187,6 +187,32 @@
   return Result;
 }
 
+std::vector navigationFallback(ParsedAST ,
+  const SymbolIndex *Index,
+  Position Pos,
+  const std::string ) {
+  const auto  = AST.getSourceManager();
+  auto SourceRange = getWordAtPosition(Pos, SM, AST.getLangOpts());
+  auto QueryString = toSourceCode(SM, SourceRange);
+  // Choose a limit that's large enough that it contains the user's desired
+  // target even in the presence of some false positives, but small enough that
+  // it doesn't generate too much noise.
+  int Limit = 5;
+  auto Symbols = getWorkspaceSymbols(QueryString, Limit, Index, MainFilePath);
+  if (!Symbols) {
+elog("Workspace symbols failed", Symbols.takeError());
+  }
+  std::vector Result;
+  for (auto  : *Symbols) {
+LocatedSymbol Located;
+Located.Name = Sym.name;
+Located.PreferredDeclaration = Sym.location;
+// TODO: Populate Definition?
+Result.push_back(std::move(Located));
+  }
+  return Result;
+}
+
 std::vector locateSymbolAt(ParsedAST , Position Pos,
   const SymbolIndex *Index) {
   const auto  = AST.getSourceManager();
@@ -318,6 +344,10 @@
 });
   }
 
+  if (Result.empty()) {
+return navigationFallback(AST, Index, Pos, *MainFilePath);
+  }
+
   return Result;
 }
 
Index: clang-tools-extra/clangd/SourceCode.h
===
--- clang-tools-extra/clangd/SourceCode.h
+++ clang-tools-extra/clangd/SourceCode.h
@@ -68,7 +68,7 @@
 /// FIXME: This should return an error if the location is invalid.
 Position sourceLocToPosition(const SourceManager , SourceLocation Loc);
 
-/// 

[PATCH] D72284: [clang-tidy] Factor out renaming logic from readability-identifier-naming

2020-01-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Thank you for the patch, I've commit on your behalf in 
d5c6b8407c12d39a78f42a216369407cb2d7b511 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72284



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


[PATCH] D72378: [clang-tidy] Add `bugprone-reserved-identifier`

2020-01-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D72378#1824586 , @logan-5 wrote:

> Great! In that case, I'll need help committing this, as well as the thing it 
> depends on, https://reviews.llvm.org/D72284 (which has also been LGTM'd).


Great, can you rebase this patch on master? It does not apply cleanly currently.

  c:\llvm-project>git apply C:\Users\aballman\Desktop\D72378.diff
  C:/Users/aballman/Desktop/D72378.diff:364: trailing whitespace.
  Checks for usages of identifiers reserved for use by the implementation.
  C:/Users/aballman/Desktop/D72378.diff:371: trailing whitespace.
  while the C++ standard strengthens this to reserve names with a double
  C:/Users/aballman/Desktop/D72378.diff:378: trailing whitespace.
namespace NS {
  C:/Users/aballman/Desktop/D72378.diff:385: trailing whitespace.
  The check can also be inverted, i.e. it can be configured to flag any
  C:/Users/aballman/Desktop/D72378.diff:386: trailing whitespace.
  identifier that is _not_ a reserved identifier. This mode is for use by e.g.
  error: patch failed: 
clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp:271
  error: clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp: patch 
does not apply
  error: patch failed: clang-tools-extra/docs/ReleaseNotes.rst:94
  error: clang-tools-extra/docs/ReleaseNotes.rst: patch does not apply


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72378



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


[PATCH] D72873: [clang][xray] Add -fxray-ignore-loops option

2020-01-16 Thread Ian Levesque via Phabricator via cfe-commits
ianlevesque updated this revision to Diff 238600.
ianlevesque added a comment.

fix clang-format


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72873

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/xray-ignore-loops.cpp


Index: clang/test/CodeGen/xray-ignore-loops.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xray-ignore-loops.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fxray-instrument -fxray-ignore-loops -x c++ -std=c++11 
-emit-llvm -o - %s -triple x86_64-unknown-linux-gnu | FileCheck %s
+
+int foo() {
+  return 1;
+}
+
+// CHECK: define i32 @_Z3foov() #[[ATTRS:[0-9]+]] {
+// CHECK-DAG: attributes #[[ATTRS]] = {{.*}} "xray-ignore-loops" {{.*}}
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1091,6 +1091,8 @@
   Args.hasArg(OPT_fxray_always_emit_typedevents);
   Opts.XRayInstructionThreshold =
   getLastArgIntValue(Args, OPT_fxray_instruction_threshold_EQ, 200, Diags);
+  Opts.XRayIgnoreLoops =
+  Args.hasArg(OPT_fxray_ignore_loops, OPT_fno_xray_ignore_loops, false);
 
   auto XRayInstrBundles =
   Args.getAllArgValues(OPT_fxray_instrumentation_bundle);
Index: clang/lib/CodeGen/CodeGenFunction.cpp
===
--- clang/lib/CodeGen/CodeGenFunction.cpp
+++ clang/lib/CodeGen/CodeGenFunction.cpp
@@ -818,6 +818,9 @@
 Fn->addFnAttr(
 "xray-instruction-threshold",
 llvm::itostr(CGM.getCodeGenOpts().XRayInstructionThreshold));
+  if (CGM.getCodeGenOpts().XRayIgnoreLoops) {
+Fn->addFnAttr("xray-ignore-loops");
+  }
 }
 
 if (const auto *Attr = D->getAttr()) {
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1292,6 +1292,13 @@
 def fnoxray_always_emit_typedevents : Flag<["-"], 
"fno-xray-always-emit-typedevents">, Group,
   Flags<[CC1Option]>;
 
+def fxray_ignore_loops : Flag<["-"], "fxray-ignore-loops">, Group,
+  Flags<[CC1Option]>,
+  HelpText<"Don't instrument functions with loops unless they also meet the 
minimum function size">;
+def fno_xray_ignore_loops : Flag<["-"], "fno-xray-ignore-loops">, 
Group,
+  Flags<[CC1Option]>;
+
+
 def fxray_link_deps : Flag<["-"], "fxray-link-deps">, Group,
   Flags<[CC1Option]>,
   HelpText<"Tells clang to add the link dependencies for XRay.">;
Index: clang/include/clang/Basic/CodeGenOptions.def
===
--- clang/include/clang/Basic/CodeGenOptions.def
+++ clang/include/clang/Basic/CodeGenOptions.def
@@ -106,6 +106,10 @@
 ///< Set when -fxray-always-emit-typedevents is enabled.
 CODEGENOPT(XRayAlwaysEmitTypedEvents , 1, 0)
 
+///< Set when -fxray-ignore-loops is enabled.
+CODEGENOPT(XRayIgnoreLoops , 1, 0)
+
+
 ///< Set the minimum number of instructions in a function to determine 
selective
 ///< XRay instrumentation.
 VALUE_CODEGENOPT(XRayInstructionThreshold , 32, 200)


Index: clang/test/CodeGen/xray-ignore-loops.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xray-ignore-loops.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fxray-instrument -fxray-ignore-loops -x c++ -std=c++11 -emit-llvm -o - %s -triple x86_64-unknown-linux-gnu | FileCheck %s
+
+int foo() {
+  return 1;
+}
+
+// CHECK: define i32 @_Z3foov() #[[ATTRS:[0-9]+]] {
+// CHECK-DAG: attributes #[[ATTRS]] = {{.*}} "xray-ignore-loops" {{.*}}
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1091,6 +1091,8 @@
   Args.hasArg(OPT_fxray_always_emit_typedevents);
   Opts.XRayInstructionThreshold =
   getLastArgIntValue(Args, OPT_fxray_instruction_threshold_EQ, 200, Diags);
+  Opts.XRayIgnoreLoops =
+  Args.hasArg(OPT_fxray_ignore_loops, OPT_fno_xray_ignore_loops, false);
 
   auto XRayInstrBundles =
   Args.getAllArgValues(OPT_fxray_instrumentation_bundle);
Index: clang/lib/CodeGen/CodeGenFunction.cpp
===
--- clang/lib/CodeGen/CodeGenFunction.cpp
+++ clang/lib/CodeGen/CodeGenFunction.cpp
@@ -818,6 +818,9 @@
 Fn->addFnAttr(
 "xray-instruction-threshold",
 llvm::itostr(CGM.getCodeGenOpts().XRayInstructionThreshold));
+  if (CGM.getCodeGenOpts().XRayIgnoreLoops) {
+

[clang-tools-extra] d5c6b84 - Factor out renaming logic from readability-identifier-naming

2020-01-16 Thread Aaron Ballman via cfe-commits

Author: Logan Smith
Date: 2020-01-16T16:34:56-05:00
New Revision: d5c6b8407c12d39a78f42a216369407cb2d7b511

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

LOG: Factor out renaming logic from readability-identifier-naming

Before this patch, readability-identifier-naming contained a significant amount
of logic for (a) checking the style of identifiers, followed by (b) renaming/
applying fix-its. This patch factors out (b) into a separate base class so that
it can be reused by other checks that want to do renaming. This also cleans up
readability-identifier-naming significantly, since now it only needs to be
concerned with the interesting details of (a).

Added: 
clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.h

Modified: 
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
clang-tools-extra/clang-tidy/utils/CMakeLists.txt

Removed: 




diff  --git 
a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
index 8146cb36cf21..6a39ece09777 100644
--- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -22,44 +22,6 @@
 
 using namespace clang::ast_matchers;
 
-namespace llvm {
-/// Specialisation of DenseMapInfo to allow NamingCheckId objects in DenseMaps
-template <>
-struct DenseMapInfo<
-clang::tidy::readability::IdentifierNamingCheck::NamingCheckId> {
-  using NamingCheckId =
-  clang::tidy::readability::IdentifierNamingCheck::NamingCheckId;
-
-  static inline NamingCheckId getEmptyKey() {
-return NamingCheckId(
-clang::SourceLocation::getFromRawEncoding(static_cast(-1)),
-"EMPTY");
-  }
-
-  static inline NamingCheckId getTombstoneKey() {
-return NamingCheckId(
-clang::SourceLocation::getFromRawEncoding(static_cast(-2)),
-"TOMBSTONE");
-  }
-
-  static unsigned getHashValue(NamingCheckId Val) {
-assert(Val != getEmptyKey() && "Cannot hash the empty key!");
-assert(Val != getTombstoneKey() && "Cannot hash the tombstone key!");
-
-std::hash SecondHash;
-return Val.first.getRawEncoding() + SecondHash(Val.second);
-  }
-
-  static bool isEqual(const NamingCheckId , const NamingCheckId ) {
-if (RHS == getEmptyKey())
-  return LHS == getEmptyKey();
-if (RHS == getTombstoneKey())
-  return LHS == getTombstoneKey();
-return LHS == RHS;
-  }
-};
-} // namespace llvm
-
 namespace clang {
 namespace tidy {
 namespace readability {
@@ -164,7 +126,7 @@ class IdentifierNamingCheckPPCallbacks : public PPCallbacks 
{
 
 IdentifierNamingCheck::IdentifierNamingCheck(StringRef Name,
  ClangTidyContext *Context)
-: ClangTidyCheck(Name, Context) {
+: RenamerClangTidyCheck(Name, Context) {
   auto const fromString = [](StringRef Str) {
 return llvm::StringSwitch>(Str)
 .Case("aNy_CasE", CT_AnyCase)
@@ -233,39 +195,6 @@ void 
IdentifierNamingCheck::storeOptions(ClangTidyOptions::OptionMap ) {
   Options.store(Opts, "IgnoreFailedSplit", IgnoreFailedSplit);
 }
 
-void IdentifierNamingCheck::registerMatchers(MatchFinder *Finder) {
-  Finder->addMatcher(namedDecl().bind("decl"), this);
-  Finder->addMatcher(usingDecl().bind("using"), this);
-  Finder->addMatcher(declRefExpr().bind("declRef"), this);
-  Finder->addMatcher(cxxConstructorDecl(unless(isImplicit())).bind("classRef"),
- this);
-  Finder->addMatcher(cxxDestructorDecl(unless(isImplicit())).bind("classRef"),
- this);
-  Finder->addMatcher(typeLoc().bind("typeLoc"), this);
-  Finder->addMatcher(nestedNameSpecifierLoc().bind("nestedNameLoc"), this);
-  Finder->addMatcher(
-  functionDecl(unless(cxxMethodDecl(isImplicit())),
-   
hasBody(forEachDescendant(memberExpr().bind("memberExpr",
-  this);
-  Finder->addMatcher(
-  cxxConstructorDecl(
-  unless(isImplicit()),
-  forEachConstructorInitializer(
-  allOf(isWritten(), withInitializer(forEachDescendant(
- memberExpr().bind("memberExpr")),
-  this);
-  Finder->addMatcher(fieldDecl(hasInClassInitializer(
- forEachDescendant(memberExpr().bind("memberExpr",
- this);
-}
-
-void IdentifierNamingCheck::registerPPCallbacks(
-const SourceManager , Preprocessor *PP, Preprocessor *ModuleExpanderPP) 
{
-  ModuleExpanderPP->addPPCallbacks(
-  std::make_unique(ModuleExpanderPP,
- 

[PATCH] D72675: [Clang][Driver] Fix -ffast-math/-ffp-contract interaction

2020-01-16 Thread Warren Ristow via Phabricator via cfe-commits
wristow updated this revision to Diff 238595.
wristow retitled this revision from "Fix -ffast-math/-ffp-contract interaction" 
to "[Clang][Driver] Fix -ffast-math/-ffp-contract interaction".
wristow added a comment.

Changing this to address only the Clang driver aspect, as discussed in the 
comments.  Will spin off a separate patch for the LLVM side.


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

https://reviews.llvm.org/D72675

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/fast-math.c


Index: clang/test/Driver/fast-math.c
===
--- clang/test/Driver/fast-math.c
+++ clang/test/Driver/fast-math.c
@@ -180,6 +180,21 @@
 // CHECK-FAST-MATH: "-ffast-math"
 // CHECK-FAST-MATH: "-ffinite-math-only"
 //
+// -ffp-contract=off and -ffp-contract=on must disable the fast-math umbrella,
+// and the unsafe-fp-math umbrella (-ffp-conteact=fast leaves them enabled).
+// RUN: %clang -### -ffast-math -ffp-contract=off -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
+// RUN: %clang -### -ffast-math -ffp-contract=off -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -ffast-math -ffp-contract=on -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
+// RUN: %clang -### -ffast-math -ffp-contract=on -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -ffast-math -ffp-contract=fast -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FAST-MATH %s
+// RUN: %clang -### -ffast-math -ffp-contract=fast -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-UNSAFE-MATH %s
+//
 // RUN: %clang -### -ffast-math -fno-fast-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
 // RUN: %clang -### -ffast-math -fno-finite-math-only -c %s 2>&1 \
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -2760,8 +2760,10 @@
   if (MathErrno)
 CmdArgs.push_back("-fmath-errno");
 
+  // If -ffp-contract=off has been specified on the command line, then we must
+  // suppress the emission of -ffast-math and -menable-unsafe-fp-math to cc1.
   if (!MathErrno && AssociativeMath && ReciprocalMath && !SignedZeros &&
-  !TrappingMath)
+  !TrappingMath && !(FPContract.equals("off") || FPContract.equals("on")))
 CmdArgs.push_back("-menable-unsafe-fp-math");
 
   if (!SignedZeros)
@@ -2804,7 +2806,8 @@
   // that's consistent with gcc's behaviour.
   if (!HonorINFs && !HonorNaNs && !MathErrno && AssociativeMath &&
   ReciprocalMath && !SignedZeros && !TrappingMath && !RoundingFPMath) {
-CmdArgs.push_back("-ffast-math");
+if (!(FPContract.equals("off") || FPContract.equals("on")))
+  CmdArgs.push_back("-ffast-math");
 if (FPModel.equals("fast")) {
   if (FPContract.equals("fast"))
 // All set, do nothing.


Index: clang/test/Driver/fast-math.c
===
--- clang/test/Driver/fast-math.c
+++ clang/test/Driver/fast-math.c
@@ -180,6 +180,21 @@
 // CHECK-FAST-MATH: "-ffast-math"
 // CHECK-FAST-MATH: "-ffinite-math-only"
 //
+// -ffp-contract=off and -ffp-contract=on must disable the fast-math umbrella,
+// and the unsafe-fp-math umbrella (-ffp-conteact=fast leaves them enabled).
+// RUN: %clang -### -ffast-math -ffp-contract=off -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
+// RUN: %clang -### -ffast-math -ffp-contract=off -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -ffast-math -ffp-contract=on -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
+// RUN: %clang -### -ffast-math -ffp-contract=on -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -ffast-math -ffp-contract=fast -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FAST-MATH %s
+// RUN: %clang -### -ffast-math -ffp-contract=fast -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-UNSAFE-MATH %s
+//
 // RUN: %clang -### -ffast-math -fno-fast-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
 // RUN: %clang -### -ffast-math -fno-finite-math-only -c %s 2>&1 \
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -2760,8 +2760,10 @@
   if (MathErrno)
 CmdArgs.push_back("-fmath-errno");
 
+  // If -ffp-contract=off has been specified on the command line, then we must
+  // suppress the emission of -ffast-math and -menable-unsafe-fp-math to cc1.
   if (!MathErrno && AssociativeMath && ReciprocalMath && !SignedZeros &&
-  !TrappingMath)
+  !TrappingMath && 

[PATCH] D72869: Add __warn_memset_zero_len builtin as a workaround for glibc issue

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

{icon check-circle color=green} Unit tests: pass. 61933 tests passed, 0 failed 
and 783 were skipped.

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

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

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



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72869



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


[PATCH] D72872: [ObjC generics] Fix not inheriting type bounds in categories/extensions.

2020-01-16 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai created this revision.
vsapsai added reviewers: erik.pilkington, ahatanak.
Herald added subscribers: ributzka, dexonsmith, jkorous.
Herald added a project: clang.

When a category/extension doesn't repeat a type bound, corresponding
type parameter is substituted with `id` when used as a type argument. As
a result, in the added test case it was causing errors like

> type argument 'T' (aka 'id') does not satisfy the bound ('id') of 
> type parameter 'T'

We are already checking that type parameters should be consistent
everywhere (see `checkTypeParamListConsistency`) and update
`ObjCTypeParamDecl` to have correct underlying type. And when we use the
type parameter as a method return type or a method parameter type, it is
substituted to the bounded type. But when we use the type parameter as a
type argument, we check `ObjCTypeParamType` that wasn't updated and
remains `id`.

Fix by updating not only `ObjCTypeParamDecl` UnderlyingType but also
TypeForDecl as we use the underlying type to create a canonical type for
`ObjCTypeParamType` (see `ASTContext::getObjCTypeParamType`).

This is a different approach to fixing the issue. The previous one was
02c2ab3d8872416589bd1a6ca3dfb96ba373a3b9 which was reverted in
4c539e8da1b3de38a53ef3f7497f5c45a3243b61. The problem with the previous
approach was that `ObjCTypeParamType::desugar` was returning underlying
type for `ObjCTypeParamDecl` without applying any protocols stored in
`ObjCTypeParamType`. It caused inconsistencies in comparing types before
and after desugaring.

rdar://problem/54329242


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72872

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/Type.cpp
  clang/lib/Sema/SemaDeclObjC.cpp
  clang/test/SemaObjC/parameterized_classes_collection_literal.m
  clang/test/SemaObjC/parameterized_classes_subst.m

Index: clang/test/SemaObjC/parameterized_classes_subst.m
===
--- clang/test/SemaObjC/parameterized_classes_subst.m
+++ clang/test/SemaObjC/parameterized_classes_subst.m
@@ -467,3 +467,17 @@
 - (void)mapUsingBlock2:(id)block { // expected-warning{{conflicting parameter types in implementation}}
 }
 @end
+
+// --
+// Use a type parameter as a type argument.
+// --
+// Type bounds in a category/extension are omitted. rdar://problem/54329242
+@interface ParameterizedContainer>
+- (ParameterizedContainer *)inInterface;
+@end
+@interface ParameterizedContainer (Cat)
+- (ParameterizedContainer *)inCategory;
+@end
+@interface ParameterizedContainer ()
+- (ParameterizedContainer *)inExtension;
+@end
Index: clang/test/SemaObjC/parameterized_classes_collection_literal.m
===
--- clang/test/SemaObjC/parameterized_classes_collection_literal.m
+++ clang/test/SemaObjC/parameterized_classes_collection_literal.m
@@ -29,7 +29,7 @@
 @end
 
 @interface NSDictionary : NSObject 
-+ (instancetype)dictionaryWithObjects:(const V [])objects forKeys:(const K [])keys count:(NSUInteger)cnt;
++ (instancetype)dictionaryWithObjects:(const V [])objects forKeys:(const K  [])keys count:(NSUInteger)cnt;
 @end
 
 void testArrayLiteral(void) {
@@ -50,3 +50,9 @@
 @"world" : @"blah" // expected-warning{{object of type 'NSString *' is not compatible with dictionary value type 'NSNumber *'}}
   };
 }
+
+void testCastingInDictionaryLiteral(NSString *arg) {
+  NSDictionary *dict = @{
+(id)arg: @"foo",
+  };
+}
Index: clang/lib/Sema/SemaDeclObjC.cpp
===
--- clang/lib/Sema/SemaDeclObjC.cpp
+++ clang/lib/Sema/SemaDeclObjC.cpp
@@ -937,8 +937,7 @@
 
   // Override the new type parameter's bound type with the previous type,
   // so that it's consistent.
-  newTypeParam->setTypeSourceInfo(
-S.Context.getTrivialTypeSourceInfo(prevTypeParam->getUnderlyingType()));
+  S.Context.adjustObjCTypeParamBoundType(prevTypeParam, newTypeParam);
   continue;
 }
 
@@ -965,8 +964,7 @@
 }
 
 // Update the new type parameter's bound to match the previous one.
-newTypeParam->setTypeSourceInfo(
-  S.Context.getTrivialTypeSourceInfo(prevTypeParam->getUnderlyingType()));
+S.Context.adjustObjCTypeParamBoundType(prevTypeParam, newTypeParam);
   }
 
   return false;
Index: clang/lib/AST/Type.cpp
===
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -3535,6 +3535,7 @@
 const ObjCTypeParamDecl *OTPDecl,
 ArrayRef protocols) {
   ID.AddPointer(OTPDecl);
+  ID.AddPointer(OTPDecl->getUnderlyingType().getAsOpaquePtr());
   ID.AddInteger(protocols.size());
   for (auto proto : protocols)
 

[PATCH] D72869: Add __warn_memset_zero_len builtin as a workaround for glibc issue

2020-01-16 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

This is very hacky, but it might be the least-bad alternative.  I mean, we 
could change D71082  so it doesn't allow 
system headers to define memset, but that seems worse.

Please add a testcase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72869



___
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-16 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon check-circle color=green} Unit tests: pass. 61929 tests passed, 0 failed 
and 783 were skipped.

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

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

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



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] D72867: [clangd] Support renaming designated initializers

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

{icon times-circle color=red} Unit tests: fail. 61928 tests passed, 1 failed 
and 783 were skipped.

  failed: 
libc++.std/thread/thread_mutex/thread_mutex_requirements/thread_sharedtimedmutex_requirements/thread_sharedtimedmutex_class/try_lock.pass.cpp

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

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

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



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] D72380: [DataFlow] Factor two worklist implementations out

2020-01-16 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun updated this revision to Diff 238592.
xazax.hun added a comment.

- Fix typo.


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

https://reviews.llvm.org/D72380

Files:
  clang/include/clang/Analysis/FlowSensitive/DataflowValues.h
  clang/include/clang/Analysis/FlowSensitive/DataflowWorklist.h
  clang/lib/Analysis/LiveVariables.cpp
  clang/lib/Analysis/UninitializedValues.cpp
  clang/unittests/Analysis/CFGBuildResult.h
  clang/unittests/Analysis/CFGTest.cpp

Index: clang/unittests/Analysis/CFGTest.cpp
===
--- clang/unittests/Analysis/CFGTest.cpp
+++ clang/unittests/Analysis/CFGTest.cpp
@@ -7,10 +7,14 @@
 //===--===//
 
 #include "CFGBuildResult.h"
+#include "clang/AST/Decl.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Analysis/AnalysisDeclContext.h"
 #include "clang/Analysis/CFG.h"
+#include "clang/Analysis/FlowSensitive/DataflowWorklist.h"
 #include "clang/Tooling/Tooling.h"
 #include "gtest/gtest.h"
+#include 
 #include 
 #include 
 
@@ -73,14 +77,14 @@
 EXPECT_EQ(IsLinear, B.getCFG()->isLinear());
   };
 
-  expectLinear(true,  "void foo() {}");
-  expectLinear(true,  "void foo() { if (true) return; }");
-  expectLinear(true,  "void foo() { if constexpr (false); }");
+  expectLinear(true, "void foo() {}");
+  expectLinear(true, "void foo() { if (true) return; }");
+  expectLinear(true, "void foo() { if constexpr (false); }");
   expectLinear(false, "void foo(bool coin) { if (coin) return; }");
   expectLinear(false, "void foo() { for(;;); }");
   expectLinear(false, "void foo() { do {} while (true); }");
-  expectLinear(true,  "void foo() { do {} while (false); }");
-  expectLinear(true,  "void foo() { foo(); }"); // Recursion is not our problem.
+  expectLinear(true, "void foo() { do {} while (false); }");
+  expectLinear(true, "void foo() { foo(); }"); // Recursion is not our problem.
 }
 
 TEST(CFG, ElementRefIterator) {
@@ -216,6 +220,54 @@
   EXPECT_EQ(++(CMainBlock->rref_begin()), CMainBlock->rref_begin() + 1);
 }
 
+TEST(CFG, Worklists) {
+  const char *Code = "int f(bool cond) {\n"
+ "  int a = 5;\n"
+ "  if (cond)\n"
+ "a += 1;\n"
+ "  return a;\n"
+ "}\n";
+  BuildResult B = BuildCFG(Code);
+  EXPECT_EQ(BuildResult::BuiltCFG, B.getStatus());
+  const FunctionDecl *Func = B.getFunc();
+  AnalysisDeclContext AC(nullptr, Func);
+  auto *CFG = AC.getCFG();
+
+  std::vector ReferenceOrder;
+  for (const auto *B : *AC.getAnalysis())
+ReferenceOrder.push_back(B);
+
+  {
+ForwardDataflowWorklist ForwardWorklist(*CFG, AC);
+for (const auto *B : *CFG)
+  ForwardWorklist.enqueueBlock(B);
+
+std::vector ForwardNodes;
+while (const CFGBlock *B = ForwardWorklist.dequeue())
+  ForwardNodes.push_back(B);
+
+EXPECT_EQ(ForwardNodes.size(), ReferenceOrder.size());
+EXPECT_TRUE(std::equal(ReferenceOrder.begin(), ReferenceOrder.end(),
+   ForwardNodes.begin()));
+  }
+
+  std::reverse(ReferenceOrder.begin(), ReferenceOrder.end());
+
+  {
+BackwardDataflowWorklist BackwardWorklist(*CFG, AC);
+for (const auto *B : *CFG)
+  BackwardWorklist.enqueueBlock(B);
+
+std::vector BackwardNodes;
+while (const CFGBlock *B = BackwardWorklist.dequeue())
+  BackwardNodes.push_back(B);
+
+EXPECT_EQ(BackwardNodes.size(), ReferenceOrder.size());
+EXPECT_TRUE(std::equal(ReferenceOrder.begin(), ReferenceOrder.end(),
+   BackwardNodes.begin()));
+  }
+}
+
 } // namespace
 } // namespace analysis
 } // namespace clang
Index: clang/unittests/Analysis/CFGBuildResult.h
===
--- clang/unittests/Analysis/CFGBuildResult.h
+++ clang/unittests/Analysis/CFGBuildResult.h
@@ -23,18 +23,21 @@
 BuiltCFG,
   };
 
-  BuildResult(Status S, std::unique_ptr Cfg = nullptr,
+  BuildResult(Status S, const FunctionDecl *Func = nullptr,
+  std::unique_ptr Cfg = nullptr,
   std::unique_ptr AST = nullptr)
-  : S(S), Cfg(std::move(Cfg)), AST(std::move(AST)) {}
+  : S(S), Cfg(std::move(Cfg)), AST(std::move(AST)), Func(Func) {}
 
   Status getStatus() const { return S; }
   CFG *getCFG() const { return Cfg.get(); }
   ASTUnit *getAST() const { return AST.get(); }
+  const FunctionDecl *getFunc() const { return Func; }
 
 private:
   Status S;
   std::unique_ptr Cfg;
   std::unique_ptr AST;
+  const FunctionDecl *Func;
 };
 
 class CFGCallback : public ast_matchers::MatchFinder::MatchCallback {
@@ -54,7 +57,8 @@
 Options.AddImplicitDtors = true;
 if (std::unique_ptr Cfg =
 CFG::buildCFG(nullptr, Body, Result.Context, Options))
-  TheBuildResult = {BuildResult::BuiltCFG, std::move(Cfg), std::move(AST)};
+  TheBuildResult = 

[PATCH] D72869: Add __warn_memset_zero_len builtin as a workaround for glibc issue

2020-01-16 Thread serge via Phabricator via cfe-commits
serge-sans-paille created this revision.
serge-sans-paille added reviewers: rnk, george.burgess.iv, akhuang.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
serge-sans-paille added a comment.

@akhuang can you confirm this fixes your issue? I've tested locally and it 
works fine on my side.


Glibc issue: https://sourceware.org/bugzilla/show_bug.cgi?id=25399

The fix consist in considering the missing function as a builtin lowered to a 
nop.

See https://reviews.llvm.org/D71082 for the original discussion that led to 
that patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72869

Files:
  clang/include/clang/Basic/Builtins.def
  clang/lib/CodeGen/CGBuiltin.cpp


Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -3222,6 +3222,8 @@
 Builder.CreateZExt(EmitSignBit(*this, EmitScalarExpr(E->getArg(0))),
ConvertType(E->getType(;
   }
+  case Builtin::BI__warn_memset_zero_len:
+return RValue::getIgnored();
   case Builtin::BI__annotation: {
 // Re-encode each wide string to UTF8 and make an MDString.
 SmallVector Strings;
Index: clang/include/clang/Basic/Builtins.def
===
--- clang/include/clang/Basic/Builtins.def
+++ clang/include/clang/Basic/Builtins.def
@@ -788,6 +788,9 @@
 BUILTIN(__builtin_index, "c*cC*i", "Fn")
 BUILTIN(__builtin_rindex, "c*cC*i", "Fn")
 
+// ignored glibc builtin, see 
https://sourceware.org/bugzilla/show_bug.cgi?id=25399
+BUILTIN(__warn_memset_zero_len, "v", "nU")
+
 // Microsoft builtins.  These are only active with -fms-extensions.
 LANGBUILTIN(_alloca,  "v*z", "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(__annotation, "wC*.","n", ALL_MS_LANGUAGES)


Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -3222,6 +3222,8 @@
 Builder.CreateZExt(EmitSignBit(*this, EmitScalarExpr(E->getArg(0))),
ConvertType(E->getType(;
   }
+  case Builtin::BI__warn_memset_zero_len:
+return RValue::getIgnored();
   case Builtin::BI__annotation: {
 // Re-encode each wide string to UTF8 and make an MDString.
 SmallVector Strings;
Index: clang/include/clang/Basic/Builtins.def
===
--- clang/include/clang/Basic/Builtins.def
+++ clang/include/clang/Basic/Builtins.def
@@ -788,6 +788,9 @@
 BUILTIN(__builtin_index, "c*cC*i", "Fn")
 BUILTIN(__builtin_rindex, "c*cC*i", "Fn")
 
+// ignored glibc builtin, see https://sourceware.org/bugzilla/show_bug.cgi?id=25399
+BUILTIN(__warn_memset_zero_len, "v", "nU")
+
 // Microsoft builtins.  These are only active with -fms-extensions.
 LANGBUILTIN(_alloca,  "v*z", "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(__annotation, "wC*.","n", ALL_MS_LANGUAGES)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D72304: [OpenMP]{OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.

2020-01-16 Thread Fady Ghanim via Phabricator via cfe-commits
fghanim marked an inline comment as done and an inline comment as not done.
fghanim added a comment.

Thanks for reviewing this.

After I address the last two comments below, How do I merge with llvm using 
phab? I'd appreciate an llvm specific link if possible.




Comment at: llvm/lib/Frontend/OpenMP/OMPConstants.cpp:45
 ///{
-
 #define OMP_TYPE(VarName, InitValue) Type *llvm::omp::types::VarName = nullptr;

jdoerfert wrote:
> Leftover
what is this referring to?



Comment at: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp:749
+BasicBlock *ExitPredBB = SplitPos->getParent();
+auto InsertBB = merged ? ExitPredBB : ExitBB;
+if (!isa_and_nonnull(SplitPos))

jdoerfert wrote:
> I have the feeling the merging makes it harder without providing a benefit 
> but I'm OK with it for now
more difficult in what way?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72304



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


[PATCH] D71082: Allow system header to provide their own implementation of some builtin

2020-01-16 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

>> The simplest one I can think of is to make `__warn_memset_zero_len` a 
>> recognized builtin that generates no code.
> 
> +1, simple and easy.

See https://reviews.llvm.org/D72869


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71082



___
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-16 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

Hmm, we still need to find some basic decl to remap it successfully at the 
codegen. Not sure that we'll be able to support it in full. It would be good to 
investigate how we can handle them at the codegen.


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] D72304: [OpenMP]{OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.

2020-01-16 Thread Fady Ghanim via Phabricator via cfe-commits
fghanim updated this revision to Diff 238591.
fghanim marked 9 inline comments as done.
fghanim added a comment.

Addressing reviewer's comments

- fixed styling and naming according to llvm conventions


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72304

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/test/OpenMP/critical_codegen.cpp
  clang/test/OpenMP/master_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
  llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Frontend/OpenMP/OMPConstants.cpp
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

Index: llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
===
--- llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+++ llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
@@ -613,4 +613,164 @@
   }
 }
 
+TEST_F(OpenMPIRBuilderTest, MasterDirective) {
+  using InsertPointTy = OpenMPIRBuilder::InsertPointTy;
+  OpenMPIRBuilder OMPBuilder(*M);
+  OMPBuilder.initialize();
+  F->setName("func");
+  IRBuilder<> Builder(BB);
+
+  OpenMPIRBuilder::LocationDescription Loc({Builder.saveIP(), DL});
+
+  AllocaInst *PrivAI = nullptr;
+
+  BasicBlock *EntryBB = nullptr;
+  BasicBlock *ExitBB = nullptr;
+  BasicBlock *ThenBB = nullptr;
+
+  auto BodyGenCB = [&](InsertPointTy AllocaIP, InsertPointTy CodeGenIP,
+   BasicBlock ) {
+if (AllocaIP.isSet())
+  Builder.restoreIP(AllocaIP);
+else
+  Builder.SetInsertPoint(&*(F->getEntryBlock().getFirstInsertionPt()));
+PrivAI = Builder.CreateAlloca(F->arg_begin()->getType());
+Builder.CreateStore(F->arg_begin(), PrivAI);
+
+llvm::BasicBlock *CodeGenIPBB = CodeGenIP.getBlock();
+llvm::Instruction *CodeGenIPInst = &*CodeGenIP.getPoint();
+EXPECT_EQ(CodeGenIPBB->getTerminator(), CodeGenIPInst);
+
+Builder.restoreIP(CodeGenIP);
+
+// collect some info for checks later
+ExitBB = FiniBB.getUniqueSuccessor();
+ThenBB = Builder.GetInsertBlock();
+EntryBB = ThenBB->getUniquePredecessor();
+
+// simple instructions for body
+Value *PrivLoad = Builder.CreateLoad(PrivAI, "local.use");
+Builder.CreateICmpNE(F->arg_begin(), PrivLoad);
+  };
+
+  auto FiniCB = [&](InsertPointTy IP) {
+BasicBlock *IPBB = IP.getBlock();
+EXPECT_NE(IPBB->end(), IP.getPoint());
+  };
+
+  Builder.restoreIP(OMPBuilder.CreateMaster(Builder, BodyGenCB, FiniCB));
+  Value *EntryBBTI = EntryBB->getTerminator();
+  EXPECT_NE(EntryBBTI, nullptr);
+  EXPECT_TRUE(isa(EntryBBTI));
+  BranchInst *EntryBr = cast(EntryBB->getTerminator());
+  EXPECT_TRUE(EntryBr->isConditional());
+  EXPECT_EQ(EntryBr->getSuccessor(0), ThenBB);
+  EXPECT_EQ(ThenBB->getUniqueSuccessor(), ExitBB);
+  EXPECT_EQ(EntryBr->getSuccessor(1), ExitBB);
+
+  CmpInst *CondInst = cast(EntryBr->getCondition());
+  EXPECT_TRUE(isa(CondInst->getOperand(0)));
+
+  CallInst *MasterEntryCI = cast(CondInst->getOperand(0));
+  EXPECT_EQ(MasterEntryCI->getNumArgOperands(), 2U);
+  EXPECT_EQ(MasterEntryCI->getCalledFunction()->getName(), "__kmpc_master");
+  EXPECT_TRUE(isa(MasterEntryCI->getArgOperand(0)));
+
+  CallInst *MasterEndCI = nullptr;
+  for (auto  : *ThenBB) {
+Instruction *cur = 
+if (isa(cur)) {
+  MasterEndCI = cast(cur);
+  if (MasterEndCI->getCalledFunction()->getName() == "__kmpc_end_master")
+break;
+  else
+MasterEndCI = nullptr;
+}
+  }
+  EXPECT_NE(MasterEndCI, nullptr);
+  EXPECT_EQ(MasterEndCI->getNumArgOperands(), 2U);
+  EXPECT_TRUE(isa(MasterEndCI->getArgOperand(0)));
+  EXPECT_EQ(MasterEndCI->getArgOperand(1), MasterEntryCI->getArgOperand(1));
+}
+
+TEST_F(OpenMPIRBuilderTest, CriticalDirective) {
+  using InsertPointTy = OpenMPIRBuilder::InsertPointTy;
+  OpenMPIRBuilder OMPBuilder(*M);
+  OMPBuilder.initialize();
+  F->setName("func");
+  IRBuilder<> Builder(BB);
+
+  OpenMPIRBuilder::LocationDescription Loc({Builder.saveIP(), DL});
+
+  AllocaInst *PrivAI = Builder.CreateAlloca(F->arg_begin()->getType());
+
+  BasicBlock *EntryBB = nullptr;
+
+  auto BodyGenCB = [&](InsertPointTy AllocaIP, InsertPointTy CodeGenIP,
+   BasicBlock ) {
+// collect some info for checks later
+EntryBB = FiniBB.getUniquePredecessor();
+
+// actual start for bodyCB
+llvm::BasicBlock *CodeGenIPBB = CodeGenIP.getBlock();
+llvm::Instruction *CodeGenIPInst = &*CodeGenIP.getPoint();
+EXPECT_EQ(CodeGenIPBB->getTerminator(), CodeGenIPInst);
+EXPECT_EQ(EntryBB, CodeGenIPBB);
+
+// body begin
+Builder.restoreIP(CodeGenIP);
+Builder.CreateStore(F->arg_begin(), PrivAI);
+Value *PrivLoad = Builder.CreateLoad(PrivAI, "local.use");
+Builder.CreateICmpNE(F->arg_begin(), PrivLoad);
+  };
+
+  auto FiniCB = [&](InsertPointTy IP) {
+BasicBlock *IPBB = IP.getBlock();
+

[PATCH] D72869: Add __warn_memset_zero_len builtin as a workaround for glibc issue

2020-01-16 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

@akhuang can you confirm this fixes your issue? I've tested locally and it 
works fine on my side.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72869



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


[clang-tools-extra] 40514a7 - [clangd] Add workaround for GCC5 host compilers. NFC.

2020-01-16 Thread Michael Liao via cfe-commits

Author: Michael Liao
Date: 2020-01-16T16:05:22-05:00
New Revision: 40514a7d7a3b745ba43c2d014e54a0d78d65d957

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

LOG: [clangd] Add workaround for GCC5 host compilers. NFC.

Added: 


Modified: 
clang-tools-extra/clangd/Hover.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/Hover.cpp 
b/clang-tools-extra/clangd/Hover.cpp
index cfa5e3bf93fb..ad715db4d5eb 100644
--- a/clang-tools-extra/clangd/Hover.cpp
+++ b/clang-tools-extra/clangd/Hover.cpp
@@ -439,7 +439,13 @@ bool isLiteral(const Expr *E) {
 
 llvm::StringLiteral getNameForExpr(const Expr *E) {
   // FIXME: Come up with names for `special` expressions.
-  return "expression";
+  //
+  // It's an known issue for GCC5, https://godbolt.org/z/Z_tbgi. Work around
+  // that by using explicit conversion constructor.
+  //
+  // TODO: Once GCC5 is fully retired and not the minimal requirement as stated
+  // in `GettingStarted`, please remove the explicit conversion constructor.
+  return llvm::StringLiteral("expression");
 }
 
 // Generates hover info for evaluatable expressions.



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


[PATCH] D72675: Fix -ffast-math/-ffp-contract interaction

2020-01-16 Thread Warren Ristow via Phabricator via cfe-commits
wristow added a comment.

> One commit for the clang changes should be ok; it's a very small diff. But 
> I'm still not sure if the driver change induces frontend diffs that we should 
> make visible via tests.

The only thing I can think of is that it changes whether/when `__FAST_MATH__` 
is defined.  But that'll be indirectly tested, via the updated tests in 
"Driver/fast-math.c", which will verify that "-ffast-math" is passed 
appropriately (and the `__FAST_MATH__` dependency on "-ffast-math" is already 
tested in "Preprocessor/predefined-macros.c").

In addition to adding the second pair of driver tests you suggested for 
`-ffp-contract=on`, I'll also add another pair for `-ffp-contract=fast` to 
verify that "-ffast-math" is passed in that case (no change in behavior for 
that pair, but just confirming it continues to work correctly).


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

https://reviews.llvm.org/D72675



___
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-16 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 238586.
kbobyrev added a comment.

Remove duplicated testt


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72867

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


Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -403,6 +403,14 @@
 template  class Z> struct Bar { };
 template <> struct Bar<[[Foo]]> {};
   )cpp",
+
+  // Designated initializer.
+  R"cpp(
+struct Bar {
+  int [[Fo^o]];
+};
+Bar bar { .[[^Foo]]= 42 };
+  )cpp",
   };
   for (llvm::StringRef T : Tests) {
 Annotations Code(T);
Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -563,7 +563,7 @@
 // FIXME: Auto-completion in a template requires disabling delayed template
 // parsing.
 TU.ExtraArgs.push_back("-fno-delayed-template-parsing");
-TU.ExtraArgs.push_back("-std=c++17");
+TU.ExtraArgs.push_back("-std=c++2a");
 
 auto AST = TU.build();
 for (auto  : AST.getDiagnostics()) {
@@ -969,7 +969,21 @@
   }
 )cpp",
"0: targets = {Test}\n"
-   "1: targets = {a}, decl\n"}};
+   "1: targets = {a}, decl\n"},
+   // Designated initializers.
+   {R"cpp(
+void foo() {
+  struct $0^Foo {
+int $1^Bar;
+  };
+  $2^Foo $3^f { .$4^Bar = 42 };
+}
+)cpp",
+"0: targets = {Foo}, decl\n"
+"1: targets = {foo()::Foo::Bar}, decl\n"
+"2: targets = {Foo}\n"
+"3: targets = {f}, decl\n"
+"4: targets = {foo()::Foo::Bar}\n"}};
 
   for (const auto  : Cases) {
 llvm::StringRef ExpectedCode = C.first;
Index: clang-tools-extra/clangd/FindTarget.cpp
===
--- clang-tools-extra/clangd/FindTarget.cpp
+++ clang-tools-extra/clangd/FindTarget.cpp
@@ -634,6 +634,17 @@
   /*IsDecl=*/false,
   {E->getPack()}});
 }
+
+void VisitDesignatedInitExpr(const DesignatedInitExpr *DIE) {
+  for (const DesignatedInitExpr::Designator  : DIE->designators()) {
+if (!D.isFieldDesignator())
+  continue;
+Refs.push_back(ReferenceLoc{NestedNameSpecifierLoc(),
+D.getFieldLoc(),
+/*IsDecl=*/false,
+{D.getField()}});
+  }
+}
   };
 
   Visitor V;


Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -403,6 +403,14 @@
 template  class Z> struct Bar { };
 template <> struct Bar<[[Foo]]> {};
   )cpp",
+
+  // Designated initializer.
+  R"cpp(
+struct Bar {
+  int [[Fo^o]];
+};
+Bar bar { .[[^Foo]]= 42 };
+  )cpp",
   };
   for (llvm::StringRef T : Tests) {
 Annotations Code(T);
Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -563,7 +563,7 @@
 // FIXME: Auto-completion in a template requires disabling delayed template
 // parsing.
 TU.ExtraArgs.push_back("-fno-delayed-template-parsing");
-TU.ExtraArgs.push_back("-std=c++17");
+TU.ExtraArgs.push_back("-std=c++2a");
 
 auto AST = TU.build();
 for (auto  : AST.getDiagnostics()) {
@@ -969,7 +969,21 @@
   }
 )cpp",
"0: targets = {Test}\n"
-   "1: targets = {a}, decl\n"}};
+   "1: targets = {a}, decl\n"},
+   // Designated initializers.
+   {R"cpp(
+void foo() {
+  struct $0^Foo {
+int $1^Bar;
+  };
+  $2^Foo $3^f { .$4^Bar = 42 };
+}
+)cpp",
+"0: targets = {Foo}, decl\n"
+"1: targets = {foo()::Foo::Bar}, decl\n"
+"2: targets = {Foo}\n"
+"3: targets = {f}, decl\n"
+"4: targets = {foo()::Foo::Bar}\n"}};
 
   for (const auto  : Cases) {
 llvm::StringRef ExpectedCode = C.first;
Index: clang-tools-extra/clangd/FindTarget.cpp

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

2020-01-16 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev created this revision.
kbobyrev added a reviewer: sammccall.
Herald added subscribers: usaxena95, kadircet, arphaman, jkorous, MaskRay, 
ilya-biryukov.
Herald added a project: clang.
kbobyrev updated this revision to Diff 238586.
kbobyrev added a comment.

Remove duplicated testt


Clangd does not find references of designated iniitializers yet and, as a
result, is unable to rename such references. This patch addresses this issue.

Resolves: https://github.com/clangd/clangd/issues/247


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72867

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


Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -403,6 +403,14 @@
 template  class Z> struct Bar { };
 template <> struct Bar<[[Foo]]> {};
   )cpp",
+
+  // Designated initializer.
+  R"cpp(
+struct Bar {
+  int [[Fo^o]];
+};
+Bar bar { .[[^Foo]]= 42 };
+  )cpp",
   };
   for (llvm::StringRef T : Tests) {
 Annotations Code(T);
Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -563,7 +563,7 @@
 // FIXME: Auto-completion in a template requires disabling delayed template
 // parsing.
 TU.ExtraArgs.push_back("-fno-delayed-template-parsing");
-TU.ExtraArgs.push_back("-std=c++17");
+TU.ExtraArgs.push_back("-std=c++2a");
 
 auto AST = TU.build();
 for (auto  : AST.getDiagnostics()) {
@@ -969,7 +969,21 @@
   }
 )cpp",
"0: targets = {Test}\n"
-   "1: targets = {a}, decl\n"}};
+   "1: targets = {a}, decl\n"},
+   // Designated initializers.
+   {R"cpp(
+void foo() {
+  struct $0^Foo {
+int $1^Bar;
+  };
+  $2^Foo $3^f { .$4^Bar = 42 };
+}
+)cpp",
+"0: targets = {Foo}, decl\n"
+"1: targets = {foo()::Foo::Bar}, decl\n"
+"2: targets = {Foo}\n"
+"3: targets = {f}, decl\n"
+"4: targets = {foo()::Foo::Bar}\n"}};
 
   for (const auto  : Cases) {
 llvm::StringRef ExpectedCode = C.first;
Index: clang-tools-extra/clangd/FindTarget.cpp
===
--- clang-tools-extra/clangd/FindTarget.cpp
+++ clang-tools-extra/clangd/FindTarget.cpp
@@ -634,6 +634,17 @@
   /*IsDecl=*/false,
   {E->getPack()}});
 }
+
+void VisitDesignatedInitExpr(const DesignatedInitExpr *DIE) {
+  for (const DesignatedInitExpr::Designator  : DIE->designators()) {
+if (!D.isFieldDesignator())
+  continue;
+Refs.push_back(ReferenceLoc{NestedNameSpecifierLoc(),
+D.getFieldLoc(),
+/*IsDecl=*/false,
+{D.getField()}});
+  }
+}
   };
 
   Visitor V;


Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -403,6 +403,14 @@
 template  class Z> struct Bar { };
 template <> struct Bar<[[Foo]]> {};
   )cpp",
+
+  // Designated initializer.
+  R"cpp(
+struct Bar {
+  int [[Fo^o]];
+};
+Bar bar { .[[^Foo]]= 42 };
+  )cpp",
   };
   for (llvm::StringRef T : Tests) {
 Annotations Code(T);
Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -563,7 +563,7 @@
 // FIXME: Auto-completion in a template requires disabling delayed template
 // parsing.
 TU.ExtraArgs.push_back("-fno-delayed-template-parsing");
-TU.ExtraArgs.push_back("-std=c++17");
+TU.ExtraArgs.push_back("-std=c++2a");
 
 auto AST = TU.build();
 for (auto  : AST.getDiagnostics()) {
@@ -969,7 +969,21 @@
   }
 )cpp",
"0: targets = {Test}\n"
-   "1: targets = {a}, decl\n"}};
+   "1: targets = {a}, decl\n"},
+   // Designated initializers.
+   {R"cpp(
+void foo() {
+  struct $0^Foo {
+int $1^Bar;
+  };
+  $2^Foo $3^f { .$4^Bar = 42 };
+}
+)cpp",
+"0: 

[PATCH] D72850: [CMake] Use LinuxRemoteTI instead of LinuxLocalTI in CrossWinToARMLinux cmake cache

2020-01-16 Thread Vlad Vereschaka via Phabricator via cfe-commits
vvereschaka accepted this revision.
vvereschaka added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72850



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


[PATCH] D72717: [CMake] Disable libc++ filesystem tests in CrossWinToARMLinux cache file

2020-01-16 Thread Vlad Vereschaka via Phabricator via cfe-commits
vvereschaka added a comment.

May be just keep a note in the comments that this lit parameter is required for 
the remote libcxx tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72717



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


[PATCH] D72717: [CMake] Disable libc++ filesystem tests in CrossWinToARMLinux cache file

2020-01-16 Thread Vlad Vereschaka via Phabricator via cfe-commits
vvereschaka added a comment.

Hi Sergej,

as far as I understood '--param enable_filesystem=False' argument is libc++ 
specific, but we pass those parameters to all the library tests.
I think it is optimal to pass this parameter directly in the builder 
configuration only for libcxx as '-DLLVM_LIT_ARGS="--param 
enable_filesystem=False"'.
Everything else looks good to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72717



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


[PATCH] D72860: [modules] Do not cache invalid state for modules that we attempted to load.

2020-01-16 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith accepted this revision.
dexonsmith added a comment.
This revision is now accepted and ready to land.

LGTM.




Comment at: clang/lib/Serialization/ModuleManager.cpp:183
   // Get a buffer of the file and close the file descriptor when done.
-  Buf = FileMgr.getBufferForFile(NewModule->File, /*isVolatile=*/false);
+  Buf = FileMgr.getBufferForFile(NewModule->File, /*isVolatile=*/true);
 }

vsapsai wrote:
> Made this change because if we don't have a valid module but opened a 
> corresponding .pcm file earlier, there is a high chance that .pcm file was 
> rebuilt.
Please add a comment in the code explaining that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72860



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


[PATCH] D72860: [modules] Do not cache invalid state for modules that we attempted to load.

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

{icon check-circle color=green} Unit tests: pass. 61863 tests passed, 0 failed 
and 781 were skipped.

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

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

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



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72860



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


[PATCH] D72675: Fix -ffast-math/-ffp-contract interaction

2020-01-16 Thread Sanjay Patel via Phabricator via cfe-commits
spatel added a comment.

In D72675#1824659 , @wristow wrote:

> This all sounds good to me.
>
> So to make sure we're all on the same page, my understanding is that the plan 
> forward is:
>
> 1. Make the Clang change first (including adding another pair of tests for 
> `-ffp-contract=on`).
> 2. Update the LLVM tests illustrating the current baseline state.
> 3. Make the LLVM change shown here, and update the tests with the fixes.
> 4. Bring in the DAG combiner work that Michael has done internally at Apple.
>
>   Points 1, 2, and 3 are essentially the points in the patch posted here, so 
> I'll do that.  And of course Michael will then take on point 4.
>
>   Is that the plan?  If yes, I'll transition this item to just be the Clang 
> pieces, and I'll spin off a new one to do the LLVM portion of what is posted 
> here.


SGTM

> Sanjay, regarding:
> 
>> But it would be better to have all of the baseline tests in place, so we 
>> know where we stand currently.
> 
> I'm interpreting that as applying to the LLVM tests.  That is, the Clang 
> change, along with the updated tests, can be in one commit, rather than first 
> updating the Clang driver tests with the current state.  If you'd prefer two 
> commits on the Clang side as well, let me know.

One commit for the clang changes should be ok; it's a very small diff. But I'm 
still not sure if the driver change induces frontend diffs that we should make 
visible via tests.


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

https://reviews.llvm.org/D72675



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


[PATCH] D72860: [modules] Do not cache invalid state for modules that we attempted to load.

2020-01-16 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai marked an inline comment as done.
vsapsai added a comment.

Anecdotal build time measurements before and after the change. First row is a 
clean build, subsequent rows are incremental builds.

| Revision | Before change | After change | Change (after - before) | Relative 
change |
|  | - |  | --- | 
--- |
| 5da385fb56c 
| 
27:40 | 28:20| +40s| +2.41%  |
| d4e006e8446 
| 
30:50 | 28:29| -141s   | -7.62%  |
| 77d049d0c65 
| 
0:28  | 0:28 | 0s  | 0%  |
| 1b9ef3bbb59 
| 
0:10  | 0:11 | +1s | +10%|
| ab411801b82 
| 
11:34 | 11:15| -19s| -2.74%  |
|

Cannot claim huge build time improvements but seems like there are no real 
regressions.




Comment at: clang/lib/Serialization/ModuleManager.cpp:183
   // Get a buffer of the file and close the file descriptor when done.
-  Buf = FileMgr.getBufferForFile(NewModule->File, /*isVolatile=*/false);
+  Buf = FileMgr.getBufferForFile(NewModule->File, /*isVolatile=*/true);
 }

Made this change because if we don't have a valid module but opened a 
corresponding .pcm file earlier, there is a high chance that .pcm file was 
rebuilt.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72860



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


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

2020-01-16 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson updated this revision to Diff 238569.
tejohnson added a comment.

Rebase


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/test/CodeGen/thinlto-distributed-cfi-devirt.ll
  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/import-indir.ll
  llvm/test/Transforms/WholeProgramDevirt/import-no-dominating-assume.ll
  llvm/test/Transforms/WholeProgramDevirt/import.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] D72820: [FPEnv] Add pragma FP_CONTRACT support under strict FP.

2020-01-16 Thread Andy Kaylor via Phabricator via cfe-commits
andrew.w.kaylor added inline comments.



Comment at: clang/lib/CodeGen/CGExprScalar.cpp:3381
+ Addend->getType()),
+{MulOp0, MulOp1, Addend, MulOp->getOperand(2), MulOp->getOperand(3)});
+  else

You shouldn't just assume that MulOp is a constrained intrinsic. Cast to 
ConstrainedFPIntrinsic and use ConstrainedFPIntrinsic::getRoundingMode() and 
ConstrainedFPIntrinsic::getExceptionBehavior(). The cast will effectively 
assert that MulOp is a constrained intrisic. I think that should always be true.



Comment at: clang/lib/CodeGen/CGExprScalar.cpp:3423
 
+  if (Builder.getIsFPConstrained()) {
+if (auto *LHSBinOp = dyn_cast(op.LHS)) {

I don't think we should ever non-constrained create FMul instructions if 
Builder is in FP constrained mode, but you should assert that somewhere above. 
Maybe move this block above line 3409 and add:

assert(LHSBinOp->getOpcode() != llvm::Instruction::FMul && 
RHSBinOp->getOpcode() != llvm::Instruction::FMul);



Comment at: clang/test/CodeGen/constrained-math-builtins.c:160
+// CHECK: declare x86_fp80 
@llvm.experimental.constrained.fmuladd.f80(x86_fp80, x86_fp80, x86_fp80, 
metadata, metadata)
+};

I'd like to see a test that verifies the calls generated in the function and 
specifically a test that verifies that the constrained fneg is generated if 
needed.



Comment at: llvm/docs/LangRef.rst:16094
+
+The fourth and fifth arguments specifie the exception behavior as described
+above.

s/specifie/specify

s/the exception behavior/the rounding mode and exception behavior



Comment at: llvm/docs/LangRef.rst:16104
+
+  %0 = call float @llvm.experimental.constrained.fmuladd.f32(%a, %b, %c)
+

missing metadata arguments



Comment at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:1515
  ConcreteTTI->getArithmeticInstrCost(BinaryOperator::FAdd, RetTy);
+// FIXME: Is constrained intrinsic' cost equal to it's no strict one?
+if (IID == Intrinsic::experimental_constrained_fmuladd)

I don't think that matters. The cost calculation here is a conservative 
estimate based on the cost if we are unable to generate an FMA instruction. So 
a constrained fmuladd that can't be lowered to FMA will be lower the same way a 
contrained mul followed by a constrained add would be.



Comment at: llvm/include/llvm/CodeGen/ISDOpcodes.h:355
 
+/// FMULADD/STRICT_FMULADD - A intermediate node, made functions handle
+/// constrained fmuladd the same as other constrained intrinsics.

Something is wrong with this comment. I'm not sure what it's trying to say but 
the grammar is wrong.

After looking through the rest of the code, I think I understand what's going 
on. I think we need a verbose comment to explain it. Here's my suggestion

```
FMULADD/STRICT_FMULADD -- These are intermediate opcodes used to handle the 
constrained.fmuladd intrinsic. The FMULADD opcode only exists because it is 
required for correct macro expansion and default handling (which is never 
reached). There should never be a node with ISD::FMULADD. The STRICT_FMULADD 
opcode is used to allow selectionDAGBuilder::visitConstrainedFPIntrinsic to 
determine (based on TargetOptions and target cost information) whether the 
constrained.fmuladd intrinsic should be lowered to FMA or separate FMUL and 
FADD operations.
```
Having thought through that, however, it strikes me as a lot of overhead. Can 
we just add special handling for the constrained.fmuladd intrinsic and make the 
decision then to create either a STRICT_FMA node or separate STRICT_FMUL and 
STRICT_FADD?

The idea that ISD::FMULADD is going to exist as a defined opcode but we never 
intend to add any support for handling it is particularly bad.


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


  1   2   3   >