[PATCH] D88498: [FPEnv] Evaluate initializers in constant rounding mode

2020-09-30 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added inline comments.



Comment at: clang/lib/Parse/ParseDecl.cpp:2290
+  // rounding mode.
+  if (VD->isFileVarDecl() || VD->isConstexpr() ||
+  (!getLangOpts().CPlusPlus && VD->isStaticLocal())) {

rsmith wrote:
> It's far from clear to me that this is correct in C++. In principle, for a 
> dynamic initializer, the rounding mode could have been set by an earlier 
> initializer.
> 
> Perhaps we can make an argument that, due to the permission to interleave 
> initializers from different TUs, every dynamic initializer must leave the 
> program in the default rounding mode, but I don't think even that makes this 
> approach correct, because an initializer could do this:
> 
> ```
> double d;
> double e = (fesetround(...), d = some calculation, fesetround(...default...), 
> d);
> ```
> 
> I think we can only do this in C and will need something different for C++.
> 
> (I think this also has problems in C++ due to constexpr functions: it's not 
> the case that all floating point operations that will be evaluated as part of 
> the initializer lexically appear within it.)
I changed the code to confine it with C and constexpr only. Hopefully this 
would be enough to enable build of SPECS attempted by @mibintc 
(https://reviews.llvm.org/D87528#2295015). However in long-term perspective we 
should return to this code.

The intent was to align behavior of C and C++. If an initializer is valid in C, 
then it should produce the same code in C++. If the source code like
```
float appx_coeffs_fp32[3 * 256] = {
SEGMENT_BIAS + 1.4426950216,
…
```
produces compact table in C mode and huge initialization code in C++, it would 
be strange from user viewpoint and would not give any advantage.

C in C2x presents pretty consistent model, provided that `#pragma STDC 
FENV_ROUND FE_DYNAMIC` does not set constant rounding mode. Initializers for 
variables with static allocation are always evaluated in constant rounding mode 
and user can chose the mode using pragma FENV_ROUND.

When extending this model to C++ we must solve the problem of dynamic 
initialization. It obviously occurs in runtime rounding mode, so changing 
between static and dynamic initialization may change semantics. If however 
dynamic initialization of global variable occurs in constant rounding mode 
(changing FP control modes in initializers without restoring them is UB), 
static and dynamic initialization would be semantically equivalent.

We cannot apply the same rule to local static variables, as they are treated 
differently in C and C++. So the code:
```
float func_01(float x) {
  #pragma STDC FENV_ACCESS ON
  static float val = 1.0/3.0;
  return val;
}
```
Would be compiled differently in C and C++.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88498

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


[PATCH] D88469: [clangd] Heuristic resolution for dependent type and template names

2020-09-30 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments.



Comment at: clang-tools-extra/clangd/FindTarget.cpp:128
 const auto ValueFilter = [](const NamedDecl *D) { return isa(D); };
+const auto TypeFilter = [](const NamedDecl *D) { return !isa(D); };
 

nridge wrote:
> hokein wrote:
> > why not using `isa(D)`?
> Heh. When I wrote this, I searched for `TypeDecl` via `workspaceSymbols`, did 
> not see it in the first few results, and concluded that there is no such type.
> 
> Now I see it is there, just further down (and below **partial** matches like 
> `CFConstantStringTypeDecl`). Maybe I should file a `workspaceSymbols` bug 
> about this :)
yeah, I reproduced that, I think it is probably a ranking bug -- but if you 
type `clang::TypeDecl`, you will get it from the first result. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88469

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


[PATCH] D88536: [clangd] Split DecisionForest Evaluate() into one func per tree.

2020-09-30 Thread Utkarsh Saxena via Phabricator via cfe-commits
usaxena95 created this revision.
Herald added subscribers: cfe-commits, kadircet, arphaman.
Herald added a project: clang.
usaxena95 requested review of this revision.
Herald added subscribers: MaskRay, ilya-biryukov.

This allows us MSAN to instrument this function. Previous version is not
instrumentable due to it shear volume.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88536

Files:
  clang-tools-extra/clangd/quality/CompletionModelCodegen.py

Index: clang-tools-extra/clangd/quality/CompletionModelCodegen.py
===
--- clang-tools-extra/clangd/quality/CompletionModelCodegen.py
+++ clang-tools-extra/clangd/quality/CompletionModelCodegen.py
@@ -1,7 +1,7 @@
 """Code generator for Code Completion Model Inference.
 
 Tool runs on the Decision Forest model defined in {model} directory.
-It generates two files: {output_dir}/{filename}.h and {output_dir}/{filename}.cpp 
+It generates two files: {output_dir}/{filename}.h and {output_dir}/{filename}.cpp
 The generated files defines the Example class named {cpp_class} having all the features as class members.
 The generated runtime provides an `Evaluate` function which can be used to score a code completion candidate.
 """
@@ -41,32 +41,31 @@
 def boost_node(n, label, next_label):
 """Returns code snippet for a leaf/boost node.
 Adds value of leaf to the score and jumps to the root of the next tree."""
-return "%s: Score += %s; goto %s;" % (
-label, n['score'], next_label)
+return "%s: return %s;" % (label, n['score'])
 
 
 def if_greater_node(n, label, next_label):
 """Returns code snippet for a if_greater node.
-Jumps to true_label if the Example feature (NUMBER) is greater than the threshold. 
-Comparing integers is much faster than comparing floats. Assuming floating points 
+Jumps to true_label if the Example feature (NUMBER) is greater than the threshold.
+Comparing integers is much faster than comparing floats. Assuming floating points
 are represented as IEEE 754, it order-encodes the floats to integers before comparing them.
 Control falls through if condition is evaluated to false."""
 threshold = n["threshold"]
-return "%s: if (E.%s >= %s /*%s*/) goto %s;" % (
-label, n['feature'], order_encode(threshold), threshold, next_label)
+return "%s: if (%s >= %s /*%s*/) goto %s;" % (
+label, n['feature'], order_encode(threshold), threshold, next_label)
 
 
 def if_member_node(n, label, next_label):
 """Returns code snippet for a if_member node.
-Jumps to true_label if the Example feature (ENUM) is present in the set of enum values 
+Jumps to true_label if the Example feature (ENUM) is present in the set of enum values
 described in the node.
 Control falls through if condition is evaluated to false."""
 members = '|'.join([
 "BIT(%s_type::%s)" % (n['feature'], member)
 for member in n["set"]
 ])
-return "%s: if (E.%s & (%s)) goto %s;" % (
-label, n['feature'], members, next_label)
+return "%s: if (%s & (%s)) goto %s;" % (
+label, n['feature'], members, next_label)
 
 
 def node(n, label, next_label):
@@ -94,8 +93,6 @@
 """
 label = "t%d_n%d" % (tree_num, node_num)
 code = []
-if node_num == 0:
-code.append("t%d:" % tree_num)
 
 if t["operation"] == "boost":
 code.append(node(t, label=label, next_label="t%d" % (tree_num + 1)))
@@ -115,11 +112,11 @@
 return code+false_code+true_code, 1+false_size+true_size
 
 
-def gen_header_code(features_json, cpp_class, filename):
+def gen_header_code(features_json, cpp_class, filename, num_trees):
 """Returns code for header declaring the inference runtime.
 
 Declares the Example class named {cpp_class} inside relevant namespaces.
-The Example class contains all the features as class members. This 
+The Example class contains all the features as class members. This
 class can be used to represent a code completion candidate.
 Provides `float Evaluate()` function which can be used to score the Example.
 """
@@ -145,7 +142,6 @@
 return """#ifndef %s
 #define %s
 #include 
-#include "llvm/Support/Compiler.h"
 
 %s
 class %s {
@@ -158,17 +154,20 @@
   // Produces an integer that sorts in the same order as F.
   // That is: a < b <==> orderEncode(a) < orderEncode(b).
   static uint32_t OrderEncode(float F);
+
+  // Evaluation functions for each tree.
+%s
+
   friend float Evaluate(const %s&);
 };
 
-// The function may have large number of lines of code. MSAN
-// build times out in such case.
-LLVM_NO_SANITIZE("memory")
 float Evaluate(const %s&);
 %s
 #endif // %s
 """ % (guard, guard, cpp_class.ns_begin(), cpp_class.name, nline.join(setters),
-nline.join(class_members), cpp_class.name, cpp_class.name,
+   nline.join(class_members),
+nline.join(["  float EvaluateTree%d() const;" % tree_num for 

[clang-tools-extra] 8392685 - [clangd] Mark code action as "preferred" if it's the sole quickfix action

2020-09-30 Thread Sam McCall via cfe-commits

Author: Sam McCall
Date: 2020-09-30T10:11:30+02:00
New Revision: 8392685c2b9f3c2025100dd25b6c6e5eae312d92

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

LOG: [clangd] Mark code action as "preferred" if it's the sole quickfix action

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

Added: 


Modified: 
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/Diagnostics.cpp
clang-tools-extra/clangd/Protocol.cpp
clang-tools-extra/clangd/Protocol.h
clang-tools-extra/clangd/test/fixits-embed-in-diagnostic.test

Removed: 




diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp 
b/clang-tools-extra/clangd/ClangdLSPServer.cpp
index a85736b94830..4d9c0a43d68d 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -1007,6 +1007,20 @@ void ClangdLSPServer::onCodeAction(const 
CodeActionParams ,
 for (const auto  : *Tweaks)
   Actions.push_back(toCodeAction(T, File, Selection));
 
+// If there's exactly one quick-fix, call it "preferred".
+// We never consider refactorings etc as preferred.
+CodeAction *OnlyFix = nullptr;
+for (auto  : Actions) {
+  if (Action.kind && *Action.kind == CodeAction::QUICKFIX_KIND) {
+if (OnlyFix) {
+  OnlyFix->isPreferred = false;
+  break;
+}
+Action.isPreferred = true;
+OnlyFix = 
+  }
+}
+
 if (SupportsCodeAction)
   return Reply(llvm::json::Array(Actions));
 std::vector Commands;

diff  --git a/clang-tools-extra/clangd/Diagnostics.cpp 
b/clang-tools-extra/clangd/Diagnostics.cpp
index afa72f9d4051..ca3d6c5f8ca9 100644
--- a/clang-tools-extra/clangd/Diagnostics.cpp
+++ b/clang-tools-extra/clangd/Diagnostics.cpp
@@ -411,6 +411,8 @@ void toLSPDiags(
 Main.codeActions.emplace();
 for (const auto  : D.Fixes)
   Main.codeActions->push_back(toCodeAction(Fix, File));
+if (Main.codeActions->size() == 1)
+  Main.codeActions->front().isPreferred = true;
   }
   if (Opts.SendDiagnosticCategory && !D.Category.empty())
 Main.category = D.Category;

diff  --git a/clang-tools-extra/clangd/Protocol.cpp 
b/clang-tools-extra/clangd/Protocol.cpp
index 00ac071f496a..61a691f2048f 100644
--- a/clang-tools-extra/clangd/Protocol.cpp
+++ b/clang-tools-extra/clangd/Protocol.cpp
@@ -740,6 +740,8 @@ llvm::json::Value toJSON(const CodeAction ) {
 CodeAction["kind"] = *CA.kind;
   if (CA.diagnostics)
 CodeAction["diagnostics"] = llvm::json::Array(*CA.diagnostics);
+  if (CA.isPreferred)
+CodeAction["isPreferred"] = true;
   if (CA.edit)
 CodeAction["edit"] = *CA.edit;
   if (CA.command)

diff  --git a/clang-tools-extra/clangd/Protocol.h 
b/clang-tools-extra/clangd/Protocol.h
index 3f717e8467fc..4ef94e6e01db 100644
--- a/clang-tools-extra/clangd/Protocol.h
+++ b/clang-tools-extra/clangd/Protocol.h
@@ -952,6 +952,13 @@ struct CodeAction {
   /// The diagnostics that this code action resolves.
   llvm::Optional> diagnostics;
 
+  /// Marks this as a preferred action. Preferred actions are used by the
+  /// `auto fix` command and can be targeted by keybindings.
+  /// A quick fix should be marked preferred if it properly addresses the
+  /// underlying error. A refactoring should be marked preferred if it is the
+  /// most reasonable choice of actions to take.
+  bool isPreferred = false;
+
   /// The workspace edit this code action performs.
   llvm::Optional edit;
 

diff  --git a/clang-tools-extra/clangd/test/fixits-embed-in-diagnostic.test 
b/clang-tools-extra/clangd/test/fixits-embed-in-diagnostic.test
index cfa47210d7d8..debe4dfa5e78 100644
--- a/clang-tools-extra/clangd/test/fixits-embed-in-diagnostic.test
+++ b/clang-tools-extra/clangd/test/fixits-embed-in-diagnostic.test
@@ -28,6 +28,7 @@
 # CHECK-NEXT:]
 # CHECK-NEXT:  }
 # CHECK-NEXT:},
+# CHECK-NEXT:"isPreferred": true,
 # CHECK-NEXT:"kind": "quickfix",
 # CHECK-NEXT:"title": "change 'union' to 'struct'"
 # CHECK-NEXT:  }



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


[PATCH] D88489: [clangd] Mark code action as "preferred" if it's the sole quickfix action

2020-09-30 Thread Sam McCall via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8392685c2b9f: [clangd] Mark code action as 
preferred if its the sole quickfix action (authored by 
sammccall).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88489

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/Diagnostics.cpp
  clang-tools-extra/clangd/Protocol.cpp
  clang-tools-extra/clangd/Protocol.h
  clang-tools-extra/clangd/test/fixits-embed-in-diagnostic.test


Index: clang-tools-extra/clangd/test/fixits-embed-in-diagnostic.test
===
--- clang-tools-extra/clangd/test/fixits-embed-in-diagnostic.test
+++ clang-tools-extra/clangd/test/fixits-embed-in-diagnostic.test
@@ -28,6 +28,7 @@
 # CHECK-NEXT:]
 # CHECK-NEXT:  }
 # CHECK-NEXT:},
+# CHECK-NEXT:"isPreferred": true,
 # CHECK-NEXT:"kind": "quickfix",
 # CHECK-NEXT:"title": "change 'union' to 'struct'"
 # CHECK-NEXT:  }
Index: clang-tools-extra/clangd/Protocol.h
===
--- clang-tools-extra/clangd/Protocol.h
+++ clang-tools-extra/clangd/Protocol.h
@@ -952,6 +952,13 @@
   /// The diagnostics that this code action resolves.
   llvm::Optional> diagnostics;
 
+  /// Marks this as a preferred action. Preferred actions are used by the
+  /// `auto fix` command and can be targeted by keybindings.
+  /// A quick fix should be marked preferred if it properly addresses the
+  /// underlying error. A refactoring should be marked preferred if it is the
+  /// most reasonable choice of actions to take.
+  bool isPreferred = false;
+
   /// The workspace edit this code action performs.
   llvm::Optional edit;
 
Index: clang-tools-extra/clangd/Protocol.cpp
===
--- clang-tools-extra/clangd/Protocol.cpp
+++ clang-tools-extra/clangd/Protocol.cpp
@@ -740,6 +740,8 @@
 CodeAction["kind"] = *CA.kind;
   if (CA.diagnostics)
 CodeAction["diagnostics"] = llvm::json::Array(*CA.diagnostics);
+  if (CA.isPreferred)
+CodeAction["isPreferred"] = true;
   if (CA.edit)
 CodeAction["edit"] = *CA.edit;
   if (CA.command)
Index: clang-tools-extra/clangd/Diagnostics.cpp
===
--- clang-tools-extra/clangd/Diagnostics.cpp
+++ clang-tools-extra/clangd/Diagnostics.cpp
@@ -411,6 +411,8 @@
 Main.codeActions.emplace();
 for (const auto  : D.Fixes)
   Main.codeActions->push_back(toCodeAction(Fix, File));
+if (Main.codeActions->size() == 1)
+  Main.codeActions->front().isPreferred = true;
   }
   if (Opts.SendDiagnosticCategory && !D.Category.empty())
 Main.category = D.Category;
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -1007,6 +1007,20 @@
 for (const auto  : *Tweaks)
   Actions.push_back(toCodeAction(T, File, Selection));
 
+// If there's exactly one quick-fix, call it "preferred".
+// We never consider refactorings etc as preferred.
+CodeAction *OnlyFix = nullptr;
+for (auto  : Actions) {
+  if (Action.kind && *Action.kind == CodeAction::QUICKFIX_KIND) {
+if (OnlyFix) {
+  OnlyFix->isPreferred = false;
+  break;
+}
+Action.isPreferred = true;
+OnlyFix = 
+  }
+}
+
 if (SupportsCodeAction)
   return Reply(llvm::json::Array(Actions));
 std::vector Commands;


Index: clang-tools-extra/clangd/test/fixits-embed-in-diagnostic.test
===
--- clang-tools-extra/clangd/test/fixits-embed-in-diagnostic.test
+++ clang-tools-extra/clangd/test/fixits-embed-in-diagnostic.test
@@ -28,6 +28,7 @@
 # CHECK-NEXT:]
 # CHECK-NEXT:  }
 # CHECK-NEXT:},
+# CHECK-NEXT:"isPreferred": true,
 # CHECK-NEXT:"kind": "quickfix",
 # CHECK-NEXT:"title": "change 'union' to 'struct'"
 # CHECK-NEXT:  }
Index: clang-tools-extra/clangd/Protocol.h
===
--- clang-tools-extra/clangd/Protocol.h
+++ clang-tools-extra/clangd/Protocol.h
@@ -952,6 +952,13 @@
   /// The diagnostics that this code action resolves.
   llvm::Optional> diagnostics;
 
+  /// Marks this as a preferred action. Preferred actions are used by the
+  /// `auto fix` command and can be targeted by keybindings.
+  /// A quick fix should be marked preferred if it properly addresses the
+  /// 

[PATCH] D88265: Fix comma with half vectors.

2020-09-30 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added a comment.

Could you adjust the commit message to be a bit more descriptive, e.g something 
like `[Sema] Support Comma operator for fp16 vectors.`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88265

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


[PATCH] D88498: [FPEnv] Evaluate initializers in constant rounding mode

2020-09-30 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff updated this revision to Diff 295194.
sepavloff added a comment.

Updated patch


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88498

Files:
  clang/include/clang/Basic/LangOptions.h
  clang/include/clang/Sema/Sema.h
  clang/lib/Parse/ParseDecl.cpp
  clang/test/AST/const-fpfeatures-strict.c

Index: clang/test/AST/const-fpfeatures-strict.c
===
--- /dev/null
+++ clang/test/AST/const-fpfeatures-strict.c
@@ -0,0 +1,41 @@
+// RUN: %clang_cc1 -S -emit-llvm -ffp-exception-behavior=strict -Wno-unknown-pragmas %s -o - | FileCheck %s
+
+// nextUp(1.F) == 0x1.02p0F
+
+struct S {
+  float f;
+};
+
+static struct S var_01 = {0x1.01p0};
+struct S *func_01() {
+  return _01;
+}
+
+struct S var_02 = {0x1.01p0};
+
+struct S *func_03() {
+  static struct S var_03 = {0x1.01p0};
+  return _03;
+}
+
+// CHECK: @var_01 = {{.*}} %struct.S { float 1.00e+00 }
+// CHECK: @var_02 = {{.*}} %struct.S { float 1.00e+00 }
+// CHECK: @func_03.var_03 = {{.*}} %struct.S { float 1.00e+00 }
+
+#pragma STDC FENV_ROUND FE_UPWARD
+
+static struct S var_04 = {0x1.01p0};
+struct S *func_04() {
+  return _04;
+}
+
+struct S var_05 = {0x1.01p0};
+
+struct S *func_06() {
+  static struct S var_06 = {0x1.01p0};
+  return _06;
+}
+
+// CHECK: @var_04 = {{.*}} %struct.S { float 0x3FF02000 }
+// CHECK: @var_05 = {{.*}} %struct.S { float 0x3FF02000 }
+// CHECK: @func_06.var_06 = {{.*}} %struct.S { float 0x3FF02000 }
Index: clang/lib/Parse/ParseDecl.cpp
===
--- clang/lib/Parse/ParseDecl.cpp
+++ clang/lib/Parse/ParseDecl.cpp
@@ -2281,6 +2281,27 @@
   }
 
   PreferredType.enterVariableInit(Tok.getLocation(), ThisDecl);
+
+  Sema::FPFeaturesStateRAII FPO(Actions);
+  if (auto VD = dyn_cast_or_null(ThisDecl))
+if (!VD->isInvalidDecl()) {
+  // If variable requires constant initialization, set constant
+  // rounding mode.
+  if ((!getLangOpts().CPlusPlus &&
+   (VD->isStaticLocal() || VD->isFileVarDecl())) ||
+  VD->isConstexpr()) {
+if (Actions.getCurFPFeatures().getRoundingMode() ==
+llvm::RoundingMode::Dynamic) {
+  // If current rounding mode is 'dynamic', it means that a command
+  // line option line like `-ffpmodel=strict` is in effect. Set
+  // constant rounding to default in this case.
+  FPOptions NewFPO = Actions.getCurFPFeatures();
+  NewFPO.setRoundingMode(llvm::RoundingMode::NearestTiesToEven);
+  Actions.setCurFPFeatures(NewFPO);
+}
+  }
+}
+
   ExprResult Init = ParseInitializer();
 
   // If this is the only decl in (possibly) range based for statement,
Index: clang/include/clang/Sema/Sema.h
===
--- clang/include/clang/Sema/Sema.h
+++ clang/include/clang/Sema/Sema.h
@@ -589,13 +589,7 @@
   // This stack tracks the current state of Sema.CurFPFeatures.
   PragmaStack FpPragmaStack;
   FPOptionsOverride CurFPFeatureOverrides() {
-FPOptionsOverride result;
-if (!FpPragmaStack.hasValue()) {
-  result = FPOptionsOverride();
-} else {
-  result = FpPragmaStack.CurrentValue;
-}
-return result;
+return FpPragmaStack.CurrentValue;
   }
 
   // RAII object to push / pop sentinel slots for all MS #pragma stacks.
@@ -1429,7 +1423,6 @@
 
   const LangOptions () const { return LangOpts; }
   OpenCLOptions () { return OpenCLFeatures; }
-  FPOptions () { return CurFPFeatures; }
 
   DiagnosticsEngine () const { return Diags; }
   SourceManager () const { return SourceMgr; }
@@ -1439,6 +1432,12 @@
   ASTMutationListener *getASTMutationListener() const;
   ExternalSemaSource* getExternalSource() const { return ExternalSource; }
 
+  const FPOptions () const { return CurFPFeatures; }
+  void setCurFPFeatures(FPOptions FPO) {
+FpPragmaStack.CurrentValue = FPOptionsOverride(FPO, CurFPFeatures);
+CurFPFeatures = FPO;
+  }
+
   ///Registers an external source. If an external source already exists,
   /// creates a multiplex external source and appends to it.
   ///
Index: clang/include/clang/Basic/LangOptions.h
===
--- clang/include/clang/Basic/LangOptions.h
+++ clang/include/clang/Basic/LangOptions.h
@@ -450,6 +450,15 @@
 return Opts;
   }
 
+  storage_type getDiffWith(FPOptions FPO) const {
+storage_type Diff = 0;
+#define OPTION(NAME, TYPE, WIDTH, PREVIOUS)\
+  if (get##NAME() != FPO.get##NAME())  \
+Diff |= NAME##Mask;
+#include "clang/Basic/FPOptions.def"
+return Diff;
+  }
+
   // We can define most of the 

[PATCH] D88470: [clangd] Extract options struct for ClangdLSPServer. NFC

2020-09-30 Thread Sam McCall via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7ba0779fbb41: [clangd] Extract options struct for 
ClangdLSPServer. NFC (authored by sammccall).

Changed prior to commit:
  https://reviews.llvm.org/D88470?vs=294907=295197#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88470

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/ClangdLSPServer.h
  clang-tools-extra/clangd/tool/ClangdMain.cpp
  clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp

Index: clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp
===
--- clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp
+++ clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp
@@ -8,11 +8,9 @@
 
 #include "Annotations.h"
 #include "ClangdLSPServer.h"
-#include "CodeComplete.h"
 #include "LSPClient.h"
 #include "Protocol.h"
 #include "TestFS.h"
-#include "refactor/Rename.h"
 #include "support/Logger.h"
 #include "support/TestTracer.h"
 #include "llvm/ADT/StringRef.h"
@@ -36,13 +34,14 @@
 
 class LSPTest : public ::testing::Test, private clangd::Logger {
 protected:
-  LSPTest() : LogSession(*this) {}
+  LSPTest() : LogSession(*this) {
+ClangdServer::Options  = Opts;
+Base = ClangdServer::optsForTest();
+  }
 
   LSPClient () {
 EXPECT_FALSE(Server.hasValue()) << "Already initialized";
-Server.emplace(Client.transport(), FS, CCOpts, RenameOpts,
-   /*CompileCommandsDir=*/llvm::None, /*UseDirBasedCDB=*/false,
-   /*ForcedOffsetEncoding=*/llvm::None, Opts);
+Server.emplace(Client.transport(), FS, Opts);
 ServerThread.emplace([&] { EXPECT_TRUE(Server->run()); });
 Client.call("initialize", llvm::json::Object{});
 return Client;
@@ -64,9 +63,7 @@
   }
 
   MockFS FS;
-  CodeCompleteOptions CCOpts;
-  RenameOptions RenameOpts;
-  ClangdServer::Options Opts = ClangdServer::optsForTest();
+  ClangdLSPServer::Options Opts;
 
 private:
   // Color logs so we can distinguish them from test output.
Index: clang-tools-extra/clangd/tool/ClangdMain.cpp
===
--- clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -670,9 +670,11 @@
   if (auto EnvFlags = llvm::sys::Process::GetEnv(FlagsEnvVar))
 log("{0}: {1}", FlagsEnvVar, *EnvFlags);
 
+  ClangdLSPServer::Options Opts;
+  Opts.UseDirBasedCDB = (CompileArgsFrom == FilesystemCompileArgs);
+
   // If --compile-commands-dir arg was invoked, check value and override default
   // path.
-  llvm::Optional CompileCommandsDirPath;
   if (!CompileCommandsDir.empty()) {
 if (llvm::sys::fs::exists(CompileCommandsDir)) {
   // We support passing both relative and absolute paths to the
@@ -686,7 +688,7 @@
  "will be ignored.",
  EC.message());
   } else {
-CompileCommandsDirPath = std::string(Path.str());
+Opts.CompileCommandsDir = std::string(Path.str());
   }
 } else {
   elog("Path specified by --compile-commands-dir does not exist. The "
@@ -694,7 +696,6 @@
 }
   }
 
-  ClangdServer::Options Opts;
   switch (PCHStorage) {
   case PCHStorageFlag::Memory:
 Opts.StorePreamblesInMemory = true;
@@ -744,23 +745,22 @@
   Opts.PreserveRecoveryASTType = RecoveryASTType;
   Opts.FoldingRanges = FoldingRanges;
 
-  clangd::CodeCompleteOptions CCOpts;
-  CCOpts.IncludeIneligibleResults = IncludeIneligibleResults;
-  CCOpts.Limit = LimitResults;
+  Opts.CodeComplete.IncludeIneligibleResults = IncludeIneligibleResults;
+  Opts.CodeComplete.Limit = LimitResults;
   if (CompletionStyle.getNumOccurrences())
-CCOpts.BundleOverloads = CompletionStyle != Detailed;
-  CCOpts.ShowOrigins = ShowOrigins;
-  CCOpts.InsertIncludes = HeaderInsertion;
+Opts.CodeComplete.BundleOverloads = CompletionStyle != Detailed;
+  Opts.CodeComplete.ShowOrigins = ShowOrigins;
+  Opts.CodeComplete.InsertIncludes = HeaderInsertion;
   if (!HeaderInsertionDecorators) {
-CCOpts.IncludeIndicator.Insert.clear();
-CCOpts.IncludeIndicator.NoInsert.clear();
+Opts.CodeComplete.IncludeIndicator.Insert.clear();
+Opts.CodeComplete.IncludeIndicator.NoInsert.clear();
   }
-  CCOpts.SpeculativeIndexRequest = Opts.StaticIndex;
-  CCOpts.EnableFunctionArgSnippets = EnableFunctionArgSnippets;
-  CCOpts.AllScopes = AllScopesCompletion;
-  CCOpts.RunParser = CodeCompletionParse;
-  CCOpts.RankingModel = RankingModel;
-  CCOpts.DecisionForestBase = DecisionForestBase;
+  Opts.CodeComplete.SpeculativeIndexRequest = Opts.StaticIndex;
+  Opts.CodeComplete.EnableFunctionArgSnippets = EnableFunctionArgSnippets;
+  Opts.CodeComplete.AllScopes = AllScopesCompletion;
+  Opts.CodeComplete.RunParser = CodeCompletionParse;
+  

[clang-tools-extra] 7ba0779 - [clangd] Extract options struct for ClangdLSPServer. NFC

2020-09-30 Thread Sam McCall via cfe-commits

Author: Sam McCall
Date: 2020-09-30T10:09:52+02:00
New Revision: 7ba0779fbb41b6fa8213aa31622ff45484037eb4

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

LOG: [clangd] Extract options struct for ClangdLSPServer. NFC

In preparation for making moving TweakFilter from ClangdServer::Options to
a ClangdLSPServer option, and letting it vary per-request.
(In order to implement CodeActionParams.only)

Also a general overdue cleanup.

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

Added: 


Modified: 
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/ClangdLSPServer.h
clang-tools-extra/clangd/tool/ClangdMain.cpp
clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp 
b/clang-tools-extra/clangd/ClangdLSPServer.cpp
index fa4a4ab86a8c..a85736b94830 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -395,7 +395,7 @@ class ClangdLSPServer::MessageHandler : public 
Transport::MessageHandler {
   Context handlerContext() const {
 return Context::current().derive(
 kCurrentOffsetEncoding,
-Server.NegotiatedOffsetEncoding.getValueOr(OffsetEncoding::UTF16));
+Server.Opts.OffsetEncoding.getValueOr(OffsetEncoding::UTF16));
   }
 
   // We run cancelable requests in a context that does two things:
@@ -465,43 +465,42 @@ static std::vector semanticTokenTypes() {
 void ClangdLSPServer::onInitialize(const InitializeParams ,
Callback Reply) {
   // Determine character encoding first as it affects constructed ClangdServer.
-  if (Params.capabilities.offsetEncoding && !NegotiatedOffsetEncoding) {
-NegotiatedOffsetEncoding = OffsetEncoding::UTF16; // fallback
+  if (Params.capabilities.offsetEncoding && !Opts.OffsetEncoding) {
+Opts.OffsetEncoding = OffsetEncoding::UTF16; // fallback
 for (OffsetEncoding Supported : *Params.capabilities.offsetEncoding)
   if (Supported != OffsetEncoding::UnsupportedEncoding) {
-NegotiatedOffsetEncoding = Supported;
+Opts.OffsetEncoding = Supported;
 break;
   }
   }
 
-  ClangdServerOpts.TheiaSemanticHighlighting =
+  Opts.TheiaSemanticHighlighting =
   Params.capabilities.TheiaSemanticHighlighting;
   if (Params.capabilities.TheiaSemanticHighlighting &&
   Params.capabilities.SemanticTokens) {
 log("Client supports legacy semanticHighlights notification and standard "
 "semanticTokens request, choosing the latter (no notifications).");
-ClangdServerOpts.TheiaSemanticHighlighting = false;
+Opts.TheiaSemanticHighlighting = false;
   }
 
   if (Params.rootUri && *Params.rootUri)
-ClangdServerOpts.WorkspaceRoot = std::string(Params.rootUri->file());
+Opts.WorkspaceRoot = std::string(Params.rootUri->file());
   else if (Params.rootPath && !Params.rootPath->empty())
-ClangdServerOpts.WorkspaceRoot = *Params.rootPath;
+Opts.WorkspaceRoot = *Params.rootPath;
   if (Server)
 return Reply(llvm::make_error("server already initialized",
 ErrorCode::InvalidRequest));
   if (const auto  = Params.initializationOptions.compilationDatabasePath)
-CompileCommandsDir = Dir;
-  if (UseDirBasedCDB) {
+Opts.CompileCommandsDir = Dir;
+  if (Opts.UseDirBasedCDB) {
 BaseCDB = std::make_unique(
-CompileCommandsDir);
-BaseCDB = getQueryDriverDatabase(
-llvm::makeArrayRef(ClangdServerOpts.QueryDriverGlobs),
-std::move(BaseCDB));
+Opts.CompileCommandsDir);
+BaseCDB = getQueryDriverDatabase(llvm::makeArrayRef(Opts.QueryDriverGlobs),
+ std::move(BaseCDB));
   }
   auto Mangler = CommandMangler::detect();
-  if (ClangdServerOpts.ResourceDir)
-Mangler.ResourceDir = *ClangdServerOpts.ResourceDir;
+  if (Opts.ResourceDir)
+Mangler.ResourceDir = *Opts.ResourceDir;
   CDB.emplace(BaseCDB.get(), Params.initializationOptions.fallbackFlags,
   tooling::ArgumentsAdjuster(std::move(Mangler)));
   {
@@ -510,19 +509,18 @@ void ClangdLSPServer::onInitialize(const InitializeParams 
,
 // Server, CDB, etc.
 WithContext MainContext(BackgroundContext.clone());
 llvm::Optional WithOffsetEncoding;
-if (NegotiatedOffsetEncoding)
-  WithOffsetEncoding.emplace(kCurrentOffsetEncoding,
- *NegotiatedOffsetEncoding);
-Server.emplace(*CDB, TFS, ClangdServerOpts,
+if (Opts.OffsetEncoding)
+  WithOffsetEncoding.emplace(kCurrentOffsetEncoding, *Opts.OffsetEncoding);
+Server.emplace(*CDB, TFS, Opts,
static_cast(this));
   }
   

Re: Upcoming upgrade of LLVM buildbot

2020-09-30 Thread Galina Kistanova via cfe-commits
Hello everyone,

Starting tomorrow we will be upgrading the staging and production LLVM
build bot.

To make the transition smooth we would not accept any change to zorg from
tomorrow 11:00 AM PDT till the production bot is up and running the new
version. Please feel free to talk to me if you will have a special
situation and if you would absolutely have to make changes. Thanks for your
patience and understanding.

If you are a bot owner, you do not need to do anything at this point,
unless I'll ask you to help.

Here is the plan.

* Tomorrow, on September 30th, 2020, at 11:00 AM PDT we will upgrade the
staging build bot to buildbot v2.8.4.

If you are an owner of one of the staged builders, you would not need to do
anything. The staging will go down for a short period of time, and then a
new version will come up and will accept connections from your bots.

We will be watching the staging and will be improving zorg for the next
week or so. Meaning that staging will be restarted more often than before,
and restarts will be done without further notices.

* Once the staging is reliable you may want to move your bot from
production to staging to make sure it will work as expected after the
upgrade. I will send a note when this could be done.

* After staging is good and we have about a week of running history, we
will upgrade the production bot. I will send a separate announcement for
this closer to the date.

Once the production is up and running, I will need your feedback about
blame e-mails delivery, IRC reporting issues, and anything you could spot
wrong with the new bot. I  hope the transition will go smoothly and we will
handle issues quickly if any would come up.

* After production is good and we have about a week of running history,
I'll ask the bot owners to upgrade buildbots on their side. Please do not
upgrade your buildbots unless I'll ask you to. We are trying to limit a
number of moving parts at this stage.

Thanks for your support and help. And please feel free to ask if you have
questions.

Galina


On Thu, Sep 10, 2020 at 9:35 PM Galina Kistanova 
wrote:

> Hello everyone,
>
> The buildbot upgrade is entering the phase when the results to become
> visible.
>
> No change is required at this time on any of the builders. The bot owners
> could upgrade the buildbot on build computers later, at their convenience,
> as this is not on the critical path.
>
> We are going to upgrade the staging bot first. Then, once that is stable
> and all detected issues are resolved, we will upgrade the production bot.
>
> I will need some help with testing, and will be asking to move some of the
> builders temporarily to the staging. LLVM buildbot is a piece of critical
> infrastructure, so more eyes and hands in making sure it works properly the
> better.
>
> I'll be posting updates and ETA of particular changes in this thread.
>
> Please feel free to ask if you have any questions or concerns.
>
> Thanks
>
> Galina
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D86743: [analyzer] Ignore VLASizeChecker case that could cause crash

2020-09-30 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment.

Yes, @NoQ is right. If the constraint manager cannot reason about a value, then 
then `ProgramState::assume()` will return the same state with the new 
assumption in the constraints. Whenever `ProgramState::assume()` returns 
`nullptr` it means that the assumption is impossible. Thus in this case 
`DynSize` and `*ArraySizeNL` cannot be equal. To me this really seems to be a 
similar issue to Bug 28450 . The 
last comment for that bug is D69726 , but the 
bug is not closed to it seems to me that D69726 
 does not solve it, just takes a single step 
towards the solution.

I see that proper solution is somewhat more complicated and requires deep 
knowledge and takes probably much time. However, this one is a core checker, 
and not even //alpha//. Even //alpha// checkers should not crash at all (for me 
//alpha// means many false positives), but a crashing core checker, that is no 
even alpha completely undermines the users' trust towards the Analyzer. Bug 
28450  is open for almost one and 
half years. Thus something quick should be done even before someone implements 
the proper solution (from @NOQ's suggestions the second one is implemented by 
D69726 , but not the first one). A //FIXME// 
must be added in either case, and the misleading comment deleted. Or if this 
solution is completely unacceptable for the community then `VLASizeChecker` 
should be degraded to //alpha//.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86743

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


[PATCH] D88470: [clangd] Extract options struct for ClangdLSPServer. NFC

2020-09-30 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev accepted this revision.
kbobyrev added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!




Comment at: clang-tools-extra/clangd/ClangdLSPServer.h:56
+  // Features like indexing must be enabled if desired.
+  static Options optsForTest();
+

nit: Maybe move this to the tests? I'm not sure if this would be useful in the 
public interface.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88470

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


[PATCH] D88498: [FPEnv] Evaluate initializers in constant rounding mode

2020-09-30 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added inline comments.



Comment at: clang/test/AST/const-fpfeatures-strict.c:39
+
+// CHECK: @var_04 = {{.*}} %struct.S { float 0x3FF02000 }
+// CHECK: @var_05 = {{.*}} %struct.S { float 0x3FF02000 }

mibintc wrote:
> I think the initializer for var_04 is evaluated at translation time, 
> therefore the initialization expression would look the same as var_01 above, 
> using default rounding mode.  Same for var_05 and var_06. They have "static 
> duration"
The statement `#pragma STDC FENV_ROUND FE_UPWARD` changes constant rounding 
mode, so evaluation of the initializer for `var_04` produces different result 
than in the case of `var_01`, which indeed is evaluated using default rounding 
mode.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88498

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


[clang-tools-extra] 64e8fd5 - [clangd][remote] Make sure relative paths are absolute with respect to posix style

2020-09-30 Thread Kadir Cetinkaya via cfe-commits

Author: Kadir Cetinkaya
Date: 2020-09-30T11:08:49+02:00
New Revision: 64e8fd540ecc38ee3daf942499091589785e2733

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

LOG: [clangd][remote] Make sure relative paths are absolute with respect to 
posix style

Relative paths received from the server are always in posix style. So
we need to ensure they are relative using that style, and not the native one.

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

Added: 


Modified: 
clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp 
b/clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
index 31ce4a44ea55..d61848f295a3 100644
--- a/clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
+++ b/clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
@@ -299,7 +299,7 @@ Marshaller::relativePathToURI(llvm::StringRef RelativePath) 
{
   assert(RelativePath == llvm::sys::path::convert_to_slash(RelativePath));
   if (RelativePath.empty())
 return error("Empty relative path.");
-  if (llvm::sys::path::is_absolute(RelativePath))
+  if (llvm::sys::path::is_absolute(RelativePath, 
llvm::sys::path::Style::posix))
 return error("RelativePath '{0}' is absolute.", RelativePath);
   llvm::SmallString<256> FullPath = llvm::StringRef(*LocalIndexRoot);
   llvm::sys::path::append(FullPath, RelativePath);



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


[PATCH] D88507: [clangd][remote] Make sure relative paths are absolute with respect to posix style

2020-09-30 Thread Kadir Cetinkaya via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG64e8fd540ecc: [clangd][remote] Make sure relative paths are 
absolute with respect to posix… (authored by kadircet).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88507

Files:
  clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp


Index: clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
===
--- clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
+++ clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
@@ -299,7 +299,7 @@
   assert(RelativePath == llvm::sys::path::convert_to_slash(RelativePath));
   if (RelativePath.empty())
 return error("Empty relative path.");
-  if (llvm::sys::path::is_absolute(RelativePath))
+  if (llvm::sys::path::is_absolute(RelativePath, 
llvm::sys::path::Style::posix))
 return error("RelativePath '{0}' is absolute.", RelativePath);
   llvm::SmallString<256> FullPath = llvm::StringRef(*LocalIndexRoot);
   llvm::sys::path::append(FullPath, RelativePath);


Index: clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
===
--- clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
+++ clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
@@ -299,7 +299,7 @@
   assert(RelativePath == llvm::sys::path::convert_to_slash(RelativePath));
   if (RelativePath.empty())
 return error("Empty relative path.");
-  if (llvm::sys::path::is_absolute(RelativePath))
+  if (llvm::sys::path::is_absolute(RelativePath, llvm::sys::path::Style::posix))
 return error("RelativePath '{0}' is absolute.", RelativePath);
   llvm::SmallString<256> FullPath = llvm::StringRef(*LocalIndexRoot);
   llvm::sys::path::append(FullPath, RelativePath);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D88300: [OpenCL] Initial patch for OpenCL C 3.0 support

2020-09-30 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh added a comment.

LGTM!  I'd suggest waiting a bit before committing this though, to give people 
time to catch up on the RFC.


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

https://reviews.llvm.org/D88300

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


[PATCH] D88363: [CodeGen] Improve likelihood attribute branch weights

2020-09-30 Thread Bruno De Fraine via Phabricator via cfe-commits
bdf accepted this revision.
bdf added a comment.
This revision is now accepted and ready to land.

Looks good. Good idea to add tests to verify that we match `__builtin_except()`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88363

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


[PATCH] D88550: [HIP] Fix -fgpu-allow-device-init option

2020-09-30 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.
yaxunl added a reviewer: tra.
yaxunl requested review of this revision.

The option needs to be passed to both host and device compilation.


https://reviews.llvm.org/D88550

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/HIP.cpp
  clang/test/Driver/hip-options.hip


Index: clang/test/Driver/hip-options.hip
===
--- clang/test/Driver/hip-options.hip
+++ clang/test/Driver/hip-options.hip
@@ -9,6 +9,11 @@
 // CHECK: clang{{.*}}" "-cc1" {{.*}} "-fcuda-is-device"
 // CHECK-SAME: "--gpu-max-threads-per-block=1024"
 
+// RUN: %clang -### -nogpuinc -nogpulib -fgpu-allow-device-init \
+// RUN:   %s 2>&1 | FileCheck -check-prefix=DEVINIT %s
+// DEVINIT: clang{{.*}}" "-cc1" {{.*}}"-fgpu-allow-device-init"
+// DEVINIT: clang{{.*}}" "-cc1" {{.*}}"-fgpu-allow-device-init"
+
 // RUN: %clang -### -x hip -target x86_64-pc-windows-msvc -fms-extensions \
 // RUN:   -mllvm -amdgpu-early-inline-all=true  %s 2>&1 | \
 // RUN:   FileCheck -check-prefix=MLLVM %s
Index: clang/lib/Driver/ToolChains/HIP.cpp
===
--- clang/lib/Driver/ToolChains/HIP.cpp
+++ clang/lib/Driver/ToolChains/HIP.cpp
@@ -263,10 +263,6 @@
 CC1Args.push_back(DriverArgs.MakeArgStringRef(ArgStr));
   }
 
-  if (DriverArgs.hasFlag(options::OPT_fgpu_allow_device_init,
- options::OPT_fno_gpu_allow_device_init, false))
-CC1Args.push_back("-fgpu-allow-device-init");
-
   CC1Args.push_back("-fcuda-allow-variadic-functions");
 
   // Default to "hidden" visibility, as object level linking will not be
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -5476,9 +5476,14 @@
   // Forward -cl options to -cc1
   RenderOpenCLOptions(Args, CmdArgs);
 
-  if (IsHIP && Args.hasFlag(options::OPT_fhip_new_launch_api,
-options::OPT_fno_hip_new_launch_api, true))
-CmdArgs.push_back("-fhip-new-launch-api");
+  if (IsHIP) {
+if (Args.hasFlag(options::OPT_fhip_new_launch_api,
+ options::OPT_fno_hip_new_launch_api, true))
+  CmdArgs.push_back("-fhip-new-launch-api");
+if (Args.hasFlag(options::OPT_fgpu_allow_device_init,
+ options::OPT_fno_gpu_allow_device_init, false))
+  CmdArgs.push_back("-fgpu-allow-device-init");
+  }
 
   if (Arg *A = Args.getLastArg(options::OPT_fcf_protection_EQ)) {
 CmdArgs.push_back(


Index: clang/test/Driver/hip-options.hip
===
--- clang/test/Driver/hip-options.hip
+++ clang/test/Driver/hip-options.hip
@@ -9,6 +9,11 @@
 // CHECK: clang{{.*}}" "-cc1" {{.*}} "-fcuda-is-device"
 // CHECK-SAME: "--gpu-max-threads-per-block=1024"
 
+// RUN: %clang -### -nogpuinc -nogpulib -fgpu-allow-device-init \
+// RUN:   %s 2>&1 | FileCheck -check-prefix=DEVINIT %s
+// DEVINIT: clang{{.*}}" "-cc1" {{.*}}"-fgpu-allow-device-init"
+// DEVINIT: clang{{.*}}" "-cc1" {{.*}}"-fgpu-allow-device-init"
+
 // RUN: %clang -### -x hip -target x86_64-pc-windows-msvc -fms-extensions \
 // RUN:   -mllvm -amdgpu-early-inline-all=true  %s 2>&1 | \
 // RUN:   FileCheck -check-prefix=MLLVM %s
Index: clang/lib/Driver/ToolChains/HIP.cpp
===
--- clang/lib/Driver/ToolChains/HIP.cpp
+++ clang/lib/Driver/ToolChains/HIP.cpp
@@ -263,10 +263,6 @@
 CC1Args.push_back(DriverArgs.MakeArgStringRef(ArgStr));
   }
 
-  if (DriverArgs.hasFlag(options::OPT_fgpu_allow_device_init,
- options::OPT_fno_gpu_allow_device_init, false))
-CC1Args.push_back("-fgpu-allow-device-init");
-
   CC1Args.push_back("-fcuda-allow-variadic-functions");
 
   // Default to "hidden" visibility, as object level linking will not be
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -5476,9 +5476,14 @@
   // Forward -cl options to -cc1
   RenderOpenCLOptions(Args, CmdArgs);
 
-  if (IsHIP && Args.hasFlag(options::OPT_fhip_new_launch_api,
-options::OPT_fno_hip_new_launch_api, true))
-CmdArgs.push_back("-fhip-new-launch-api");
+  if (IsHIP) {
+if (Args.hasFlag(options::OPT_fhip_new_launch_api,
+ options::OPT_fno_hip_new_launch_api, true))
+  CmdArgs.push_back("-fhip-new-launch-api");
+if (Args.hasFlag(options::OPT_fgpu_allow_device_init,
+ options::OPT_fno_gpu_allow_device_init, false))
+  CmdArgs.push_back("-fgpu-allow-device-init");
+  }
 
   if (Arg *A = Args.getLastArg(options::OPT_fcf_protection_EQ)) {
 CmdArgs.push_back(
___
cfe-commits mailing 

[PATCH] D88300: [OpenCL] Initial patch for OpenCL C 3.0 support

2020-09-30 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM! Thanks! Even though I don't imagine the discussion on the RFC 
(http://lists.llvm.org/pipermail/cfe-dev/2020-September/066883.html) will 
affect this functionality I think it's good to give some extra time to react 
when starting the implementation of such big features.

It is probably better to commit this next week.


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

https://reviews.llvm.org/D88300

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


[PATCH] D88553: [clangd] Stash a patch piece

2020-09-30 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev created this revision.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman.
Herald added a project: clang.
kbobyrev requested review of this revision.
Herald added subscribers: MaskRay, ilya-biryukov.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88553

Files:
  clang-tools-extra/clangd/SemanticSelection.cpp


Index: clang-tools-extra/clangd/SemanticSelection.cpp
===
--- clang-tools-extra/clangd/SemanticSelection.cpp
+++ clang-tools-extra/clangd/SemanticSelection.cpp
@@ -13,6 +13,8 @@
 #include "SourceCode.h"
 #include "clang/AST/DeclBase.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Tooling/Syntax/BuildTree.h"
+#include "clang/Tooling/Syntax/Tree.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Support/Error.h"
 
@@ -28,19 +30,6 @@
   }
 }
 
-// Recursively collects FoldingRange from a symbol and its children.
-void collectFoldingRanges(DocumentSymbol Symbol,
-  std::vector ) {
-  FoldingRange Range;
-  Range.startLine = Symbol.range.start.line;
-  Range.startCharacter = Symbol.range.start.character;
-  Range.endLine = Symbol.range.end.line;
-  Range.endCharacter = Symbol.range.end.character;
-  Result.push_back(Range);
-  for (const auto  : Symbol.children)
-collectFoldingRanges(Child, Result);
-}
-
 } // namespace
 
 llvm::Expected getSemanticRanges(ParsedAST , Position Pos) 
{
@@ -100,19 +89,12 @@
 // FIXME(kirillbobyrev): Collect comments, PP conditional regions, includes and
 // other code regions (e.g. public/private/protected sections of classes,
 // control flow statement bodies).
-// Related issue:
-// https://github.com/clangd/clangd/issues/310
+// Related issue: https://github.com/clangd/clangd/issues/310
 llvm::Expected> getFoldingRanges(ParsedAST ) {
-  // FIXME(kirillbobyrev): getDocumentSymbols() is conveniently available but
-  // limited (e.g. doesn't yield blocks inside functions and provides ranges 
for
-  // nodes themselves instead of their contents which is less useful). Replace
-  // this with a more general RecursiveASTVisitor implementation instead.
-  auto DocumentSymbols = getDocumentSymbols(AST);
-  if (!DocumentSymbols)
-return DocumentSymbols.takeError();
+  syntax::Arena A(AST.getSourceManager(), AST.getLangOpts(), AST.getTokens());
+  auto *SyntaxTree =
+  syntax::buildSyntaxTree(A, 
*AST.getASTContext().getTranslationUnitDecl());
   std::vector Result;
-  for (const auto  : *DocumentSymbols)
-collectFoldingRanges(Symbol, Result);
   return Result;
 }
 


Index: clang-tools-extra/clangd/SemanticSelection.cpp
===
--- clang-tools-extra/clangd/SemanticSelection.cpp
+++ clang-tools-extra/clangd/SemanticSelection.cpp
@@ -13,6 +13,8 @@
 #include "SourceCode.h"
 #include "clang/AST/DeclBase.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Tooling/Syntax/BuildTree.h"
+#include "clang/Tooling/Syntax/Tree.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Support/Error.h"
 
@@ -28,19 +30,6 @@
   }
 }
 
-// Recursively collects FoldingRange from a symbol and its children.
-void collectFoldingRanges(DocumentSymbol Symbol,
-  std::vector ) {
-  FoldingRange Range;
-  Range.startLine = Symbol.range.start.line;
-  Range.startCharacter = Symbol.range.start.character;
-  Range.endLine = Symbol.range.end.line;
-  Range.endCharacter = Symbol.range.end.character;
-  Result.push_back(Range);
-  for (const auto  : Symbol.children)
-collectFoldingRanges(Child, Result);
-}
-
 } // namespace
 
 llvm::Expected getSemanticRanges(ParsedAST , Position Pos) {
@@ -100,19 +89,12 @@
 // FIXME(kirillbobyrev): Collect comments, PP conditional regions, includes and
 // other code regions (e.g. public/private/protected sections of classes,
 // control flow statement bodies).
-// Related issue:
-// https://github.com/clangd/clangd/issues/310
+// Related issue: https://github.com/clangd/clangd/issues/310
 llvm::Expected> getFoldingRanges(ParsedAST ) {
-  // FIXME(kirillbobyrev): getDocumentSymbols() is conveniently available but
-  // limited (e.g. doesn't yield blocks inside functions and provides ranges for
-  // nodes themselves instead of their contents which is less useful). Replace
-  // this with a more general RecursiveASTVisitor implementation instead.
-  auto DocumentSymbols = getDocumentSymbols(AST);
-  if (!DocumentSymbols)
-return DocumentSymbols.takeError();
+  syntax::Arena A(AST.getSourceManager(), AST.getLangOpts(), AST.getTokens());
+  auto *SyntaxTree =
+  syntax::buildSyntaxTree(A, *AST.getASTContext().getTranslationUnitDecl());
   std::vector Result;
-  for (const auto  : *DocumentSymbols)
-collectFoldingRanges(Symbol, Result);
   return Result;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D88470: [clangd] Extract options struct for ClangdLSPServer. NFC

2020-09-30 Thread Rainer Orth via Phabricator via cfe-commits
ro added a comment.

This patch broke builds with `gcc`, e.g. Builder clang-solaris11-amd64 Build 
#6724 :

  [23/122] Building CXX object 
tools/clang/tools/extra/clangd/tool/CMakeFiles/clangd.dir/ClangdMain.cpp.o
  FAILED: 
tools/clang/tools/extra/clangd/tool/CMakeFiles/clangd.dir/ClangdMain.cpp.o 
  /usr/gcc/9/bin/c++  -DGTEST_HAS_RTTI=0 -D_DEBUG -D_FILE_OFFSET_BITS=64 
-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS 
-D__STDC_LIMIT_MACROS -Itools/clang/tools/extra/clangd/tool 
-I/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool
 -Itools/clang/tools/extra/clangd/../clang-tidy 
-I/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang/include
 -Itools/clang/include -Iinclude 
-I/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/llvm/include
 
-I/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/llvm/include/llvm/Support/Solaris
 
-I/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/..
 -Itools/clang/tools/extra/clangd/tool/.. -Itools/clang/tools/extra/clangd 
-fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra 
-Wno-unused-parameter -Wwrite-strings -Wcast-qual 
-Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough 
-Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move 
-Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment 
-fdiagnostics-color -ffunction-sections -fdata-sections -fno-common 
-Woverloaded-virtual -fno-strict-aliasing -O3 -fno-exceptions -fno-rtti 
-UNDEBUG -std=c++14 -MD -MT 
tools/clang/tools/extra/clangd/tool/CMakeFiles/clangd.dir/ClangdMain.cpp.o -MF 
tools/clang/tools/extra/clangd/tool/CMakeFiles/clangd.dir/ClangdMain.cpp.o.d -o 
tools/clang/tools/extra/clangd/tool/CMakeFiles/clangd.dir/ClangdMain.cpp.o -c 
/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/ClangdMain.cpp
  In file included from 
/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/ClangdMain.cpp:9:
  
/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/../ClangdLSPServer.h:47:36:
 error: declaration of ‘llvm::Optional 
clang::clangd::ClangdLSPServer::Options::OffsetEncoding’ changes meaning of 
‘OffsetEncoding’ [-fpermissive]
 47 | llvm::Optional OffsetEncoding;
|^~
  In file included from 
/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/../Headers.h:12,
   from 
/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/../CodeComplete.h:19,
   from 
/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/../ClangdServer.h:13,
   from 
/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/../ClangdLSPServer.h:12,
   from 
/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/ClangdMain.cpp:9:
  
/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/../Protocol.h:370:12:
 note: ‘OffsetEncoding’ declared here as ‘enum class 
clang::clangd::OffsetEncoding’
370 | enum class OffsetEncoding {
|^~


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88470

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


[PATCH] D88300: [OpenCL] Initial patch for OpenCL C 3.0 support

2020-09-30 Thread Anton Zabaznov via Phabricator via cfe-commits
azabaznov added a comment.

In D88300#2302796 , @svenvh wrote:

> LGTM!  I'd suggest waiting a bit before committing this though, to give 
> people time to catch up on the RFC.

Thanks! Sure, I'm agree with that, let's wait.


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

https://reviews.llvm.org/D88300

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


[PATCH] D87956: [WIP][IR] add fn attr for no_stack_protector; prevent inlining ssp into no-ssp

2020-09-30 Thread Bill Wendling via Phabricator via cfe-commits
void added inline comments.



Comment at: llvm/lib/Transforms/Utils/InlineFunction.cpp:1679
 
+  // Inlining a function the explicitly should not have a stack protector may
+  // break the code if inlined into a function that does have a stack

s/the/that/



Comment at: llvm/lib/Transforms/Utils/InlineFunction.cpp:1682
+  // protector.
+  if (Caller->hasFnAttribute(Attribute::NoStackProtect))
+if (CalledFunc->hasFnAttribute(Attribute::StackProtect) ||

Should we check whether the function with nossp needs an ssp before issuing the 
error?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87956

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


[PATCH] D31383: [inline asm] "=i" output constraint support - gcc compatiblity

2020-09-30 Thread Florian Berchtold via Phabricator via cfe-commits
blackliner added a comment.

I am getting errors with clang-tidy, is this the right place to ask for those 
additional constraints?

CUDA allows a few more output constraints --> 
https://docs.nvidia.com/cuda/inline-ptx-assembly/index.html#constraints

  1.1.2. Constraints
  There is a separate constraint letter for each PTX register type:
  
  "h" = .u16 reg
  "r" = .u32 reg
  "l" = .u64 reg
  "f" = .f32 reg
  "d" = .f64 reg


Repository:
  rL LLVM

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

https://reviews.llvm.org/D31383

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


[clang-tools-extra] 6342b38 - [clangd] Fix member/type name conflict caught by buildbots.

2020-09-30 Thread Sam McCall via cfe-commits

Author: Sam McCall
Date: 2020-09-30T10:56:43+02:00
New Revision: 6342b38c5fee74df94d7b0c34e5a93b9b22763df

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

LOG: [clangd] Fix member/type name conflict caught by buildbots.

Added: 


Modified: 
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/ClangdLSPServer.h
clang-tools-extra/clangd/tool/ClangdMain.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp 
b/clang-tools-extra/clangd/ClangdLSPServer.cpp
index 4d9c0a43d68d..dfd26ad40b89 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -395,7 +395,7 @@ class ClangdLSPServer::MessageHandler : public 
Transport::MessageHandler {
   Context handlerContext() const {
 return Context::current().derive(
 kCurrentOffsetEncoding,
-Server.Opts.OffsetEncoding.getValueOr(OffsetEncoding::UTF16));
+Server.Opts.Encoding.getValueOr(OffsetEncoding::UTF16));
   }
 
   // We run cancelable requests in a context that does two things:
@@ -465,11 +465,11 @@ static std::vector semanticTokenTypes() {
 void ClangdLSPServer::onInitialize(const InitializeParams ,
Callback Reply) {
   // Determine character encoding first as it affects constructed ClangdServer.
-  if (Params.capabilities.offsetEncoding && !Opts.OffsetEncoding) {
-Opts.OffsetEncoding = OffsetEncoding::UTF16; // fallback
+  if (Params.capabilities.offsetEncoding && !Opts.Encoding) {
+Opts.Encoding = OffsetEncoding::UTF16; // fallback
 for (OffsetEncoding Supported : *Params.capabilities.offsetEncoding)
   if (Supported != OffsetEncoding::UnsupportedEncoding) {
-Opts.OffsetEncoding = Supported;
+Opts.Encoding = Supported;
 break;
   }
   }
@@ -509,8 +509,8 @@ void ClangdLSPServer::onInitialize(const InitializeParams 
,
 // Server, CDB, etc.
 WithContext MainContext(BackgroundContext.clone());
 llvm::Optional WithOffsetEncoding;
-if (Opts.OffsetEncoding)
-  WithOffsetEncoding.emplace(kCurrentOffsetEncoding, *Opts.OffsetEncoding);
+if (Opts.Encoding)
+  WithOffsetEncoding.emplace(kCurrentOffsetEncoding, *Opts.Encoding);
 Server.emplace(*CDB, TFS, Opts,
static_cast(this));
   }
@@ -620,8 +620,8 @@ void ClangdLSPServer::onInitialize(const InitializeParams 
,
  }},
 {"typeHierarchyProvider", true},
 ;
-  if (Opts.OffsetEncoding)
-Result["offsetEncoding"] = *Opts.OffsetEncoding;
+  if (Opts.Encoding)
+Result["offsetEncoding"] = *Opts.Encoding;
   if (Opts.TheiaSemanticHighlighting)
 Result.getObject("capabilities")
 ->insert(

diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.h 
b/clang-tools-extra/clangd/ClangdLSPServer.h
index 3dc679c59510..e8823d37c55d 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.h
+++ b/clang-tools-extra/clangd/ClangdLSPServer.h
@@ -44,7 +44,7 @@ class ClangdLSPServer : private ClangdServer::Callbacks {
 /// If not set, we search upward from the source file.
 llvm::Optional CompileCommandsDir;
 /// The offset-encoding to use, or None to negotiate it over LSP.
-llvm::Optional OffsetEncoding;
+llvm::Optional Encoding;
 
 /// Per-feature options. Generally ClangdServer lets these vary
 /// per-request, but LSP allows limited/no customizations.

diff  --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp 
b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index 60a6c267591c..a897a9a3531d 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -820,7 +820,7 @@ clangd accepts flags on the commandline, and in the 
CLANGD_FLAGS environment var
 return true;
   };
   if (ForceOffsetEncoding != OffsetEncoding::UnsupportedEncoding)
-Opts.OffsetEncoding = ForceOffsetEncoding;
+Opts.Encoding = ForceOffsetEncoding;
 
   // Shall we allow to customize the file limit?
   Opts.Rename.AllowCrossFile = CrossFileRename;



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


Re: [PATCH] D88470: [clangd] Extract options struct for ClangdLSPServer. NFC

2020-09-30 Thread Sam McCall via cfe-commits
Yes, sorry about that. It has been fixed
in 6342b38c5fee74df94d7b0c34e5a93b9b22763df.

On Wed, Sep 30, 2020 at 11:12 AM Rainer Orth via Phabricator <
revi...@reviews.llvm.org> wrote:

> ro added a comment.
>
> This patch broke builds with `gcc`, e.g. Builder clang-solaris11-amd64
> Build #6724 <
> http://lab.llvm.org:8014/builders/clang-solaris11-amd64/builds/6724>:
>
>   [23/122] Building CXX object
> tools/clang/tools/extra/clangd/tool/CMakeFiles/clangd.dir/ClangdMain.cpp.o
>   FAILED:
> tools/clang/tools/extra/clangd/tool/CMakeFiles/clangd.dir/ClangdMain.cpp.o
>   /usr/gcc/9/bin/c++  -DGTEST_HAS_RTTI=0 -D_DEBUG -D_FILE_OFFSET_BITS=64
> -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
> -D__STDC_LIMIT_MACROS -Itools/clang/tools/extra/clangd/tool
> -I/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool
> -Itools/clang/tools/extra/clangd/../clang-tidy
> -I/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang/include
> -Itools/clang/include -Iinclude
> -I/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/llvm/include
> -I/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/llvm/include/llvm/Support/Solaris
> -I/opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/..
> -Itools/clang/tools/extra/clangd/tool/.. -Itools/clang/tools/extra/clangd
> -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra
> -Wno-unused-parameter -Wwrite-strings -Wcast-qual
> -Wno-missing-field-initializers -pedantic -Wno-long-long
> -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess
> -Wno-redundant-move -Wno-noexcept-type -Wdelete-non-virtual-dtor
> -Wsuggest-override -Wno-comment -fdiagnostics-color -ffunction-sections
> -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3
>-fno-exceptions -fno-rtti -UNDEBUG -std=c++14 -MD -MT
> tools/clang/tools/extra/clangd/tool/CMakeFiles/clangd.dir/ClangdMain.cpp.o
> -MF
> tools/clang/tools/extra/clangd/tool/CMakeFiles/clangd.dir/ClangdMain.cpp.o.d
> -o
> tools/clang/tools/extra/clangd/tool/CMakeFiles/clangd.dir/ClangdMain.cpp.o
> -c
> /opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/ClangdMain.cpp
>   In file included from
> /opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/ClangdMain.cpp:9:
>
> /opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/../ClangdLSPServer.h:47:36:
> error: declaration of ‘llvm::Optional
> clang::clangd::ClangdLSPServer::Options::OffsetEncoding’ changes meaning of
> ‘OffsetEncoding’ [-fpermissive]
>  47 | llvm::Optional OffsetEncoding;
> |^~
>   In file included from
> /opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/../Headers.h:12,
>from
> /opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/../CodeComplete.h:19,
>from
> /opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/../ClangdServer.h:13,
>from
> /opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/../ClangdLSPServer.h:12,
>from
> /opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/ClangdMain.cpp:9:
>
> /opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/clang-tools-extra/clangd/tool/../Protocol.h:370:12:
> note: ‘OffsetEncoding’ declared here as ‘enum class
> clang::clangd::OffsetEncoding’
> 370 | enum class OffsetEncoding {
> |^~
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D88470/new/
>
> https://reviews.llvm.org/D88470
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D88546: [ARM] Update NEON testcase with missing target string in

2020-09-30 Thread Ranjeet Singh via Phabricator via cfe-commits
rs created this revision.
rs added reviewers: SjoerdMeijer, john.brawn.
Herald added subscribers: cfe-commits, danielkiss, kristof.beyls.
Herald added a project: clang.
rs requested review of this revision.

This is a follow-up from https://reviews.llvm.org/D61717. Where Richard 
described the issue with compiling arm_neon.h under 
-flax-vector-conversions=none. It looks like the example reproducer does 
actually work:

echo '#include ' | clang -target arm64-linux-gnu -arch +neon 
-fsyntax-only -x c - -fno-lax-vector-conversions

but was missing the -ffreestanding compiler option otherwise the compiler would 
select the system headers from /usr. However, arm-neon-header.c test was 
missing this target triple 'arm64-linux-gnu' so I've added it here.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88546

Files:
  clang/test/Headers/arm-neon-header.c


Index: clang/test/Headers/arm-neon-header.c
===
--- clang/test/Headers/arm-neon-header.c
+++ clang/test/Headers/arm-neon-header.c
@@ -22,5 +22,6 @@

 // RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding 
--target=aarch64-none-eabi -march=armv8.2-a+fp16fml+crypto+dotprod -std=c11 -xc 
-flax-vector-conversions=none %s
 // RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding 
--target=aarch64_be-none-eabi -march=armv8.2-a+fp16fml+crypto+dotprod -std=c11 
-xc -flax-vector-conversions=none %s
+// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding 
--target=arm64-linux-gnu -arch +neon -std=c11 -xc -flax-vector-conversions=none 
%s

 #include 


Index: clang/test/Headers/arm-neon-header.c
===
--- clang/test/Headers/arm-neon-header.c
+++ clang/test/Headers/arm-neon-header.c
@@ -22,5 +22,6 @@

 // RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-none-eabi -march=armv8.2-a+fp16fml+crypto+dotprod -std=c11 -xc -flax-vector-conversions=none %s
 // RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64_be-none-eabi -march=armv8.2-a+fp16fml+crypto+dotprod -std=c11 -xc -flax-vector-conversions=none %s
+// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=arm64-linux-gnu -arch +neon -std=c11 -xc -flax-vector-conversions=none %s

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


[PATCH] D88472: [WIP][clangd] Support non-renaming alias underlying decls in TargetDecl.

2020-09-30 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments.



Comment at: clang-tools-extra/clangd/unittests/XRefsTests.cpp:1120
   namespace ns { class [[Foo]] {}; }
-  using ns::F^oo;
+  using ns::[[F^oo]];
 )cpp",

sammccall wrote:
> hokein wrote:
> > this seems a small regression, I think it is fine.
> I can't follow why this is different from the second case of
> 
> TEST_F(TargetDeclTest, UsingDecl), where the usingdecl is not reported at all.
I think you over-look it, the second case of `TEST_F(TargetDeclTest, 
UsingDecl)` does report the using-decl.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88472

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


[PATCH] D88472: [WIP][clangd] Support non-renaming alias underlying decls in TargetDecl.

2020-09-30 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 295238.
hokein added a comment.

refine the patch based on the offline discussion:

- don't set the Underlying bits for using-declaration's underlying decl.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88472

Files:
  clang-tools-extra/clangd/FindTarget.cpp
  clang-tools-extra/clangd/FindTarget.h
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/unittests/FindTargetTests.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
@@ -1118,17 +1118,17 @@
   // decls.
   R"cpp(
   namespace ns { class [[Foo]] {}; }
-  using ns::F^oo;
+  using ns::[[F^oo]];
 )cpp",
 
   R"cpp(
   namespace ns { int [[x]](char); int [[x]](double); }
-  using ns::^x;
+  using ns::[[^x]];
 )cpp",
 
   R"cpp(
   namespace ns { int [[x]](char); int x(double); }
-  using ns::x;
+  using ns::[[x]];
   int y = ^x('a');
 )cpp",
 
@@ -1156,7 +1156,7 @@
   };
   template 
   struct Derived : Base {
-using Base::w^aldo;
+using Base::[[w^aldo]];
   };
 )cpp",
   };
Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -182,7 +182,7 @@
   )cpp";
   // f(char) is not referenced!
   EXPECT_DECLS("DeclRefExpr", {"using foo::f", Rel::Alias},
-   {"int f(int)", Rel::Underlying});
+   {"int f(int)"});
 
   Code = R"cpp(
 namespace foo {
@@ -193,8 +193,8 @@
   )cpp";
   // All overloads are referenced.
   EXPECT_DECLS("UsingDecl", {"using foo::f", Rel::Alias},
-   {"int f(int)", Rel::Underlying},
-   {"int f(char)", Rel::Underlying});
+   {"int f(int)" },
+   {"int f(char)"});
 
   Code = R"cpp(
 struct X {
@@ -206,7 +206,7 @@
 int x = Y().[[foo]]();
   )cpp";
   EXPECT_DECLS("MemberExpr", {"using X::foo", Rel::Alias},
-   {"int foo()", Rel::Underlying});
+   {"int foo()"});
 
   Code = R"cpp(
   template 
@@ -219,7 +219,7 @@
   };
 )cpp";
   EXPECT_DECLS("UnresolvedUsingValueDecl", {"using Base::waldo", Rel::Alias},
-   {"void waldo()", Rel::Underlying});
+   {"void waldo()"});
 }
 
 TEST_F(TargetDeclTest, ConstructorInitList) {
Index: clang-tools-extra/clangd/XRefs.cpp
===
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -343,18 +343,6 @@
   }
 }
 
-// Give the underlying decl if navigation is triggered on a non-renaming
-// alias.
-if (llvm::isa(D) || llvm::isa(D)) {
-  // FIXME: address more complicated cases. TargetDecl(... Underlying) gives
-  // all overload candidates, we only want the targeted one if the cursor is
-  // on an using-alias usage, workround it with getDeclAtPosition.
-  llvm::for_each(
-  getDeclAtPosition(AST, CurLoc, DeclRelation::Underlying, NodeKind),
-  [&](const NamedDecl *UD) { AddResultDecl(UD); });
-  continue;
-}
-
 // Special case: if the class name is selected, also map Objective-C
 // categories and category implementations back to their class interface.
 //
@@ -1144,17 +1132,6 @@
 DeclRelation::TemplatePattern | DeclRelation::Alias;
 std::vector Decls =
 getDeclAtPosition(AST, *CurLoc, Relations);
-std::vector NonrenamingAliasUnderlyingDecls;
-// If the results include a *non-renaming* alias, get its
-// underlying decls as well. (See similar logic in locateASTReferent()).
-for (const NamedDecl *D : Decls) {
-  if (llvm::isa(D) || llvm::isa(D)) {
-for (const NamedDecl *AD :
- getDeclAtPosition(AST, *CurLoc, DeclRelation::Underlying))
-  NonrenamingAliasUnderlyingDecls.push_back(AD);
-  }
-}
-llvm::copy(NonrenamingAliasUnderlyingDecls, std::back_inserter(Decls));
 
 // We traverse the AST to find references in the main file.
 auto MainFileRefs = findRefs(Decls, AST);
Index: clang-tools-extra/clangd/FindTarget.h
===
--- clang-tools-extra/clangd/FindTarget.h
+++ clang-tools-extra/clangd/FindTarget.h
@@ -102,13 +102,20 @@
   TemplatePattern,
 
   // Alias options apply when the declaration is an alias.
-  // e.g. namespace clang { [[StringRef]] S; }
+  // e.g. namespace client { [[X]] x; }
 
   /// This declaration is an alias that was referred to.
-  /// e.g. using llvm::StringRef (the UsingDecl 

[clang-tools-extra] d99f46c - [clangd] Fix fuzzer build after 7ba0779fbb41b6fa8

2020-09-30 Thread Sam McCall via cfe-commits

Author: Sam McCall
Date: 2020-09-30T11:02:05+02:00
New Revision: d99f46c6eb8debaa1a14c122956177dc2a40ef9b

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

LOG: [clangd] Fix fuzzer build after 7ba0779fbb41b6fa8

Added: 


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

Removed: 




diff  --git a/clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp 
b/clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp
index e620342499bf..41c603b5fd21 100644
--- a/clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp
+++ b/clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp
@@ -14,8 +14,6 @@
 
 #include "ClangdLSPServer.h"
 #include "ClangdServer.h"
-#include "CodeComplete.h"
-#include "refactor/Rename.h"
 #include "support/ThreadsafeFS.h"
 #include 
 #include 
@@ -33,12 +31,12 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t 
size) {
 /*Style=*/JSONStreamStyle::Delimited);
   RealThreadsafeFS FS;
   CodeCompleteOptions CCOpts;
-  CCOpts.EnableSnippets = false;
-  ClangdServer::Options Opts;
+  ClangdLSPServer::Options Opts;
+  Opts.CodeComplete.EnableSnippets = false;
+  Opts.UseDirBasedCDB = false;
 
   // Initialize and run ClangdLSPServer.
-  ClangdLSPServer LSPServer(*Transport, FS, CCOpts, RenameOptions(), 
llvm::None,
-false, llvm::None, Opts);
+  ClangdLSPServer LSPServer(*Transport, FS, Opts);
   LSPServer.run();
   return 0;
 }



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


[PATCH] D88370: Emit predefined macro for wavefront size for amdgcn

2020-09-30 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked an inline comment as done.
yaxunl added a comment.

ping


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

https://reviews.llvm.org/D88370

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


[PATCH] D88019: [analyzer][solver] Fix issue with symbol non-equality tracking

2020-09-30 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment.

In D88019#2296337 , @steakhal wrote:

> In D88019#2291953 , @steakhal wrote:
>
>> What are our options mitigating anything similar happening in the future?
>>
>> This way any change touching the `SymbolicRangeInferrer` and any related 
>> parts of the analyzer seems to be way too fragile.
>> Especially, since we might want to add support for comparing SymSyms, just 
>> like we try to do in D77792 .
>
> What about changing the EXPENSIVE_CHECKS 
> 
>  in the assume function in the following way:
> Convert all range constraints into a Z3 model and check if that is `UNSAT`.
> In that case, we would have returned a state with contradictions, so we would 
> prevent this particular bug from lurking around to bite us later.
>
> And another possibility could be to create a debug checker, which registers 
> to the assume callback and does the same conversion and check.
> This is more appealing to me in some way, like decouples the Z3 dependency 
> from the `ConstraintManager` header.
>
> Which approach should I prefer? @NoQ @vsavchenko @martong @xazax.hun 
> @Szelethus

I like the second approach, i.e. to have a debug checker. But I don't see, how 
would this checker validate all constraints at the moment when they are added 
to the State. And if we don't check all constraints then we might end up 
checking a state that is invalid for a while (i.e. that might became invalid 
previously and not because of the lastly added constraint.) So, essentially, my 
gut feeling is that both approaches should be validating all newly added 
constraints against Z3. And that might be too slow, it would have the same 
speed as using z3 instead of the range based solver.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88019

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


[PATCH] D88566: be more specific when testing for no fuse-ld warnings

2020-09-30 Thread Ties Stuij via Phabricator via cfe-commits
stuij created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
stuij requested review of this revision.

This test broke for our toolchain as this test triggered unrelated
warnings. Being more specific about not expecting fuse-ld warnings won't
invalidate the test, while playing a bit nicer with possible unrelated features.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88566

Files:
  clang/test/Driver/fuse-ld.c


Index: clang/test/Driver/fuse-ld.c
===
--- clang/test/Driver/fuse-ld.c
+++ clang/test/Driver/fuse-ld.c
@@ -12,7 +12,7 @@
 // RUN: %clang %s -### -target x86_64-unknown-linux \
 // RUN:   -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 | \
 // RUN:   FileCheck %s --check-prefix=CHECK-NO-WARN
-// CHECK-NO-WARN-NOT: warning:
+// CHECK-NO-WARN-NOT: warning: 'fuse-ld'
 
 // RUN: %clang %s -### \
 // RUN: -target x86_64-unknown-freebsd 2>&1 \


Index: clang/test/Driver/fuse-ld.c
===
--- clang/test/Driver/fuse-ld.c
+++ clang/test/Driver/fuse-ld.c
@@ -12,7 +12,7 @@
 // RUN: %clang %s -### -target x86_64-unknown-linux \
 // RUN:   -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 | \
 // RUN:   FileCheck %s --check-prefix=CHECK-NO-WARN
-// CHECK-NO-WARN-NOT: warning:
+// CHECK-NO-WARN-NOT: warning: 'fuse-ld'
 
 // RUN: %clang %s -### \
 // RUN: -target x86_64-unknown-freebsd 2>&1 \
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D88275: [ASTMatchers] Add matcher `hasParentIgnoringImplicit`.

2020-09-30 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel added a comment.

> I'm not concerned about the basic idea behind the proposed matcher, I'm only 
> worried we're making AST matching more confusing by having two different ways 
> of inconsistently accomplishing the same-ish thing.

Aaron, I appreciate this concern, but I would argue that this matcher isn't 
making things any worse. We already have the various `ignoringImplicit` 
matchers, and this new one simply parallels those, but for parents. So, it is 
in some sense "completing" an existing API, which together is an alternative to 
 `traverse`.

We should decide our general policy on these implict matchers vs the traverse 
matchers. Personally, I view `traverse` as an experimental feature that we're 
still figuring out and so would prefer that it not block progress on new 
matchers. But, I'm open to discussion. I can implement this one in my own 
codebase in the meantime if this requires longer discussion (that is, it's not 
blocking me, fwiw).

Also, I don't believe that traverse work in this case. When I change the test 
to use `traverse`, it fails:

  TEST(HasParentIgnoringImplicit, TraverseMatchesExplicitParents) {
std::string Input = R"cc(
  float f() {
  int x = 3;
  int y = 3.0;
  return y;
  }
)cc";
 // ---> Passes because there are not implicit parents.
EXPECT_TRUE(matches(
Input, integerLiteral(traverse(TK_IgnoreImplicitCastsAndParentheses,
   hasParent(varDecl());
  
EXPECT_TRUE(
matches(Input, 
declRefExpr(traverse(TK_IgnoreImplicitCastsAndParentheses,
hasParent(returnStmt());
EXPECT_TRUE(
matches(Input, 
floatLiteral(traverse(TK_IgnoreImplicitCastsAndParentheses,
 hasParent(varDecl());
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88275

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


[PATCH] D88363: [CodeGen] Improve likelihood attribute branch weights

2020-09-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:1622
 EmitBranchOnBoolExpr(CondOp->getCond(), LHSBlock, RHSBlock,
- getProfileCount(CondOp), Weights);
+ getProfileCount(CondOp), Stmt::LH_None);
 

Why `LH_None` in this case? (Also, given that it's the default value, should 
you skip passing this at all? Or should the parameter not have a default value, 
perhaps?)



Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:1678-1679
 
   // Create branch weights based on the number of times we get here and the
   // number of times the condition should be true.
+  llvm::MDNode *Weights = nullptr;

This comment is now a bit stale.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88363

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


[PATCH] D88526: [clang][Sema] Fix PR47676: Handle dependent AltiVec C-style cast

2020-09-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman 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/D88526/new/

https://reviews.llvm.org/D88526

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


[PATCH] D88370: Emit predefined macro for wavefront size for amdgcn

2020-09-30 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added inline comments.



Comment at: clang/test/Driver/amdgpu-macros.cl:380-381
+// RUN:   -mno-wavefrontsize64 %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
+// RUN: %clang -E -dM -target amdgcn -mcpu=gfx1010 -mwavefrontsize64 \
+// RUN:   -mno-wavefrontsize64 %s 2>&1 | FileCheck --check-prefixes=WAVE32 %s
+// WAVE64-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64

Can you also check with the flags reversed, -mno-wavefrontsize64 
-mwavefrontsize64 


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

https://reviews.llvm.org/D88370

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


[PATCH] D88567: [clangd] Fix invalid UTF8 when extracting doc comments.

2020-09-30 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision.
sammccall added a reviewer: kadircet.
Herald added subscribers: cfe-commits, usaxena95, arphaman.
Herald added a project: clang.
sammccall requested review of this revision.
Herald added subscribers: MaskRay, ilya-biryukov.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88567

Files:
  clang-tools-extra/clangd/CodeCompletionStrings.cpp
  clang-tools-extra/clangd/unittests/CodeCompletionStringsTests.cpp


Index: clang-tools-extra/clangd/unittests/CodeCompletionStringsTests.cpp
===
--- clang-tools-extra/clangd/unittests/CodeCompletionStringsTests.cpp
+++ clang-tools-extra/clangd/unittests/CodeCompletionStringsTests.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "CodeCompletionStrings.h"
+#include "TestTU.h"
 #include "clang/Sema/CodeCompleteConsumer.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
@@ -56,6 +57,14 @@
 "Annotation: Ano\n\nIs this brief?");
 }
 
+TEST_F(CompletionStringTest, GetDeclCommentBadUTF8) {
+  //  is not a valid byte here, should be replaced by encoded .
+  auto TU = TestTU::withCode("/*x\xffy*/ struct X;");
+  auto AST = TU.build();
+  EXPECT_EQ("x\xef\xbf\xbdy",
+getDeclComment(AST.getASTContext(), findDecl(AST, "X")));
+}
+
 TEST_F(CompletionStringTest, MultipleAnnotations) {
   Builder.AddAnnotation("Ano1");
   Builder.AddAnnotation("Ano2");
Index: clang-tools-extra/clangd/CodeCompletionStrings.cpp
===
--- clang-tools-extra/clangd/CodeCompletionStrings.cpp
+++ clang-tools-extra/clangd/CodeCompletionStrings.cpp
@@ -12,6 +12,7 @@
 #include "clang/AST/RawCommentList.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Sema/CodeCompleteConsumer.h"
+#include "llvm/Support/JSON.h"
 #include 
 #include 
 
@@ -86,7 +87,12 @@
   assert(!Ctx.getSourceManager().isLoadedSourceLocation(RC->getBeginLoc()));
   std::string Doc =
   RC->getFormattedText(Ctx.getSourceManager(), Ctx.getDiagnostics());
-  return looksLikeDocComment(Doc) ? Doc : "";
+  if (!looksLikeDocComment(Doc))
+return "";
+  // Clang requires source to be UTF-8, but doesn't enforce this in comments.
+  if (!llvm::json::isUTF8(Doc))
+Doc = llvm::json::fixUTF8(Doc);
+  return Doc;
 }
 
 void getSignature(const CodeCompletionString , std::string *Signature,


Index: clang-tools-extra/clangd/unittests/CodeCompletionStringsTests.cpp
===
--- clang-tools-extra/clangd/unittests/CodeCompletionStringsTests.cpp
+++ clang-tools-extra/clangd/unittests/CodeCompletionStringsTests.cpp
@@ -7,6 +7,7 @@
 //===--===//
 
 #include "CodeCompletionStrings.h"
+#include "TestTU.h"
 #include "clang/Sema/CodeCompleteConsumer.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
@@ -56,6 +57,14 @@
 "Annotation: Ano\n\nIs this brief?");
 }
 
+TEST_F(CompletionStringTest, GetDeclCommentBadUTF8) {
+  //  is not a valid byte here, should be replaced by encoded .
+  auto TU = TestTU::withCode("/*x\xffy*/ struct X;");
+  auto AST = TU.build();
+  EXPECT_EQ("x\xef\xbf\xbdy",
+getDeclComment(AST.getASTContext(), findDecl(AST, "X")));
+}
+
 TEST_F(CompletionStringTest, MultipleAnnotations) {
   Builder.AddAnnotation("Ano1");
   Builder.AddAnnotation("Ano2");
Index: clang-tools-extra/clangd/CodeCompletionStrings.cpp
===
--- clang-tools-extra/clangd/CodeCompletionStrings.cpp
+++ clang-tools-extra/clangd/CodeCompletionStrings.cpp
@@ -12,6 +12,7 @@
 #include "clang/AST/RawCommentList.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Sema/CodeCompleteConsumer.h"
+#include "llvm/Support/JSON.h"
 #include 
 #include 
 
@@ -86,7 +87,12 @@
   assert(!Ctx.getSourceManager().isLoadedSourceLocation(RC->getBeginLoc()));
   std::string Doc =
   RC->getFormattedText(Ctx.getSourceManager(), Ctx.getDiagnostics());
-  return looksLikeDocComment(Doc) ? Doc : "";
+  if (!looksLikeDocComment(Doc))
+return "";
+  // Clang requires source to be UTF-8, but doesn't enforce this in comments.
+  if (!llvm::json::isUTF8(Doc))
+Doc = llvm::json::fixUTF8(Doc);
+  return Doc;
 }
 
 void getSignature(const CodeCompletionString , std::string *Signature,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D88557: [HIP] Add option --gpu-instrument-lib=

2020-09-30 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.
yaxunl added a reviewer: tra.
Herald added a subscriber: dang.
yaxunl requested review of this revision.

Add an option `--gpu-instrument-lib=` to allow users to specify
an instrument device library. This is for supporting -finstrument
in device code for debugging/profiling tools.


https://reviews.llvm.org/D88557

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/HIP.cpp
  clang/test/Driver/Inputs/hip_multiple_inputs/instrument.bc
  clang/test/Driver/hip-device-libs.hip


Index: clang/test/Driver/hip-device-libs.hip
===
--- clang/test/Driver/hip-device-libs.hip
+++ clang/test/Driver/hip-device-libs.hip
@@ -105,6 +105,14 @@
 // RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
 // RUN: 2>&1 | FileCheck %s --check-prefixes=ALL
 
+// Test --gpu-instrument-lib
+// RUN: %clang -### -target x86_64-linux-gnu \
+// RUN:   --cuda-gpu-arch=gfx900 \
+// RUN:   --rocm-path=%S/Inputs/rocm \
+// RUN:   --gpu-instrument-lib=%S/Inputs/hip_multiple_inputs/instrument.bc \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,INST
+
 // ALL: {{"[^"]*clang[^"]*"}}
 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}hip.bc"
 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}ocml.bc"
@@ -118,3 +126,4 @@
 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_correctly_rounded_sqrt_on.bc"
 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_wavefrontsize64_on.bc"
 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_isa_version_{{[0-9]+}}.bc"
+// INST-SAME: "-mlink-builtin-bitcode" "{{.*}}instrument.bc"
Index: clang/lib/Driver/ToolChains/HIP.cpp
===
--- clang/lib/Driver/ToolChains/HIP.cpp
+++ clang/lib/Driver/ToolChains/HIP.cpp
@@ -321,6 +321,15 @@
 RocmInstallation.addCommonBitcodeLibCC1Args(
   DriverArgs, CC1Args, LibDeviceFile, Wave64, DAZ, FiniteOnly,
   UnsafeMathOpt, FastRelaxedMath, CorrectSqrt);
+
+// Add instrument lib.
+auto InstLib =
+DriverArgs.getLastArgValue(options::OPT_gpu_instrument_lib_EQ);
+if (llvm::sys::fs::exists(InstLib)) {
+  CC1Args.push_back("-mlink-builtin-bitcode");
+  CC1Args.push_back(DriverArgs.MakeArgString(InstLib));
+} else
+  getDriver().Diag(diag::err_drv_no_such_file) << InstLib;
   }
 }
 
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -672,6 +672,9 @@
 def gpu_max_threads_per_block_EQ : Joined<["--"], 
"gpu-max-threads-per-block=">,
   Flags<[CC1Option]>,
   HelpText<"Default max threads per block for kernel launch bounds for HIP">;
+def gpu_instrument_lib_EQ : Joined<["--"], "gpu-instrument-lib=">,
+  HelpText<"Instrument device library for HIP, which is a LLVM bitcode 
containing "
+  "__cyg_profile_func_enter and __cyg_profile_func_exit">;
 def libomptarget_nvptx_path_EQ : Joined<["--"], "libomptarget-nvptx-path=">, 
Group,
   HelpText<"Path to libomptarget-nvptx libraries">;
 def dD : Flag<["-"], "dD">, Group, Flags<[CC1Option]>,


Index: clang/test/Driver/hip-device-libs.hip
===
--- clang/test/Driver/hip-device-libs.hip
+++ clang/test/Driver/hip-device-libs.hip
@@ -105,6 +105,14 @@
 // RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
 // RUN: 2>&1 | FileCheck %s --check-prefixes=ALL
 
+// Test --gpu-instrument-lib
+// RUN: %clang -### -target x86_64-linux-gnu \
+// RUN:   --cuda-gpu-arch=gfx900 \
+// RUN:   --rocm-path=%S/Inputs/rocm \
+// RUN:   --gpu-instrument-lib=%S/Inputs/hip_multiple_inputs/instrument.bc \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,INST
+
 // ALL: {{"[^"]*clang[^"]*"}}
 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}hip.bc"
 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}ocml.bc"
@@ -118,3 +126,4 @@
 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_correctly_rounded_sqrt_on.bc"
 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_wavefrontsize64_on.bc"
 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_isa_version_{{[0-9]+}}.bc"
+// INST-SAME: "-mlink-builtin-bitcode" "{{.*}}instrument.bc"
Index: clang/lib/Driver/ToolChains/HIP.cpp
===
--- clang/lib/Driver/ToolChains/HIP.cpp
+++ clang/lib/Driver/ToolChains/HIP.cpp
@@ -321,6 +321,15 @@
 RocmInstallation.addCommonBitcodeLibCC1Args(
   DriverArgs, CC1Args, LibDeviceFile, Wave64, DAZ, FiniteOnly,
   UnsafeMathOpt, FastRelaxedMath, CorrectSqrt);
+
+// Add instrument lib.
+auto InstLib =
+DriverArgs.getLastArgValue(options::OPT_gpu_instrument_lib_EQ);
+if (llvm::sys::fs::exists(InstLib)) {
+  CC1Args.push_back("-mlink-builtin-bitcode");
+  CC1Args.push_back(DriverArgs.MakeArgString(InstLib));
+} else
+

[PATCH] D88566: be more specific when testing for no fuse-ld warnings

2020-09-30 Thread Ties Stuij via Phabricator via cfe-commits
stuij updated this revision to Diff 295262.
stuij added a comment.

slight change in commit message


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88566

Files:
  clang/test/Driver/fuse-ld.c


Index: clang/test/Driver/fuse-ld.c
===
--- clang/test/Driver/fuse-ld.c
+++ clang/test/Driver/fuse-ld.c
@@ -12,7 +12,7 @@
 // RUN: %clang %s -### -target x86_64-unknown-linux \
 // RUN:   -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 | \
 // RUN:   FileCheck %s --check-prefix=CHECK-NO-WARN
-// CHECK-NO-WARN-NOT: warning:
+// CHECK-NO-WARN-NOT: warning: 'fuse-ld'
 
 // RUN: %clang %s -### \
 // RUN: -target x86_64-unknown-freebsd 2>&1 \


Index: clang/test/Driver/fuse-ld.c
===
--- clang/test/Driver/fuse-ld.c
+++ clang/test/Driver/fuse-ld.c
@@ -12,7 +12,7 @@
 // RUN: %clang %s -### -target x86_64-unknown-linux \
 // RUN:   -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 | \
 // RUN:   FileCheck %s --check-prefix=CHECK-NO-WARN
-// CHECK-NO-WARN-NOT: warning:
+// CHECK-NO-WARN-NOT: warning: 'fuse-ld'
 
 // RUN: %clang %s -### \
 // RUN: -target x86_64-unknown-freebsd 2>&1 \
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D86743: [analyzer] Ignore VLASizeChecker case that could cause crash

2020-09-30 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

> Yup, that's pretty bad.

One slightly redeeming thing about this crash is that it's assertion-only. When 
built without assertions clang doesn't crash and this patch doesn't really 
change its behavior (adding transition to a null state is equivalent to adding 
no transitions at all). This means that the assertion did its job and notified 
us of the serious issue but simply removing the assertion doesn't bring *that* 
much benefit and we can probably afford to wait for a more solid fix.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86743

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


[PATCH] D88590: [clangd] Add bencmark for measuring latency of DecisionForest model.

2020-09-30 Thread Utkarsh Saxena via Phabricator via cfe-commits
usaxena95 created this revision.
Herald added subscribers: cfe-commits, kadircet, arphaman, mgorny.
Herald added a project: clang.
usaxena95 requested review of this revision.
Herald added subscribers: MaskRay, ilya-biryukov.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88590

Files:
  clang-tools-extra/clangd/benchmarks/CMakeLists.txt
  clang-tools-extra/clangd/benchmarks/DecisionForestBenchmark.cpp


Index: clang-tools-extra/clangd/benchmarks/DecisionForestBenchmark.cpp
===
--- /dev/null
+++ clang-tools-extra/clangd/benchmarks/DecisionForestBenchmark.cpp
@@ -0,0 +1,59 @@
+//===--- IndexBenchmark.cpp - Clangd index benchmarks ---*- 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
+//
+//===--===//
+
+#include "CompletionModel.h"
+#include "benchmark/benchmark.h"
+
+const char *IndexFilename;
+const char *RequestsFilename;
+
+namespace clang {
+namespace clangd {
+namespace {
+void RunDecisionForestPredicitons() {
+  constexpr int NumExperiments = 1;
+  for (int I = 0; I < NumExperiments; ++I) {
+Example E;
+
+E.setIsDeprecated(Quality.Deprecated);
+E.setIsReservedName(Quality.ReservedName);
+E.setIsImplementationDetail(Quality.ImplementationDetail);
+E.setNumReferences(Quality.References);
+E.setSymbolCategory(Quality.Category);
+
+E.setIsNameInContext(Derived.NameMatchesContext);
+E.setIsForbidden(Relevance.Forbidden);
+E.setIsInBaseClass(Relevance.InBaseClass);
+E.setFileProximityDistance(Derived.FileProximityDistance);
+E.setSemaFileProximityScore(Relevance.SemaFileProximityScore);
+E.setSymbolScopeDistance(Derived.ScopeProximityDistance);
+E.setSemaSaysInScope(Relevance.SemaSaysInScope);
+E.setScope(Relevance.Scope);
+E.setContextKind(Relevance.Context);
+E.setIsInstanceMember(Relevance.IsInstanceMember);
+E.setHadContextType(Relevance.HadContextType);
+E.setHadSymbolType(Relevance.HadSymbolType);
+E.setTypeMatchesPreferred(Relevance.TypeMatchesPreferred);
+E.setFilterLength(Relevance.FilterLength);
+return Evaluate(E);
+  }
+}
+static void DexBuild(benchmark::State ) {
+  for (auto _ : State)
+RunDecisionForestPredicitons();
+}
+BENCHMARK(DexBuild);
+
+} // namespace
+} // namespace clangd
+} // namespace clang
+
+int main(int argc, char *argv[]) {
+  ::benchmark::Initialize(, argv);
+  ::benchmark::RunSpecifiedBenchmarks();
+}
Index: clang-tools-extra/clangd/benchmarks/CMakeLists.txt
===
--- clang-tools-extra/clangd/benchmarks/CMakeLists.txt
+++ clang-tools-extra/clangd/benchmarks/CMakeLists.txt
@@ -7,3 +7,11 @@
   clangDaemon
   LLVMSupport
   )
+
+add_benchmark(DecisionForestBenchmark DecisionForestBenchmark.cpp)
+
+target_link_libraries(DecisionForestBenchmark
+  PRIVATE
+  clangDaemon
+  LLVMSupport
+  )
\ No newline at end of file


Index: clang-tools-extra/clangd/benchmarks/DecisionForestBenchmark.cpp
===
--- /dev/null
+++ clang-tools-extra/clangd/benchmarks/DecisionForestBenchmark.cpp
@@ -0,0 +1,59 @@
+//===--- IndexBenchmark.cpp - Clangd index benchmarks ---*- 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
+//
+//===--===//
+
+#include "CompletionModel.h"
+#include "benchmark/benchmark.h"
+
+const char *IndexFilename;
+const char *RequestsFilename;
+
+namespace clang {
+namespace clangd {
+namespace {
+void RunDecisionForestPredicitons() {
+  constexpr int NumExperiments = 1;
+  for (int I = 0; I < NumExperiments; ++I) {
+Example E;
+
+E.setIsDeprecated(Quality.Deprecated);
+E.setIsReservedName(Quality.ReservedName);
+E.setIsImplementationDetail(Quality.ImplementationDetail);
+E.setNumReferences(Quality.References);
+E.setSymbolCategory(Quality.Category);
+
+E.setIsNameInContext(Derived.NameMatchesContext);
+E.setIsForbidden(Relevance.Forbidden);
+E.setIsInBaseClass(Relevance.InBaseClass);
+E.setFileProximityDistance(Derived.FileProximityDistance);
+E.setSemaFileProximityScore(Relevance.SemaFileProximityScore);
+E.setSymbolScopeDistance(Derived.ScopeProximityDistance);
+E.setSemaSaysInScope(Relevance.SemaSaysInScope);
+E.setScope(Relevance.Scope);
+E.setContextKind(Relevance.Context);
+E.setIsInstanceMember(Relevance.IsInstanceMember);
+E.setHadContextType(Relevance.HadContextType);
+

[PATCH] D86671: [clang-tidy] Add new case type to check variables with Hungarian notation

2020-09-30 Thread Douglas Chen via Phabricator via cfe-commits
dougpuob added a comment.

In D86671#2293128 , @aaron.ballman 
wrote:

> In D86671#2284078 , @dougpuob wrote:
>
>> Hi @aaron.ballman
>> About changing  `size_t nLength` to `cbLength`. I searched MSVC folders with 
>> `size_t`, many names of variable start with `n`, or `i` in MFC related 
>> files. So I prefer to keep it starts with `n`. Another side to name starts 
>> with `cb`, I found variables like cbXxx are defined with ULONG, DWORD, or 
>> UCHAR type.
>
> I think the important point is that `cb` is used for APIs that specify a 
> count of bytes, whereas `i`, `n`, and `l` are used for integers (there is no 
> specific prefix for `size_t` that I'm aware of or that MSDN documents, so the 
> lack of consistency there is not too surprising). That's why I mentioned that 
> using a heuristic approach may allow you to identify the parameters that are 
> intended to be a count of bytes so that you can use the more specific prefix 
> if there's more specific contextual information available.

Hi @aaron.ballman

1. **Making `sz` as a prefix to the `char*` parameters of `strncpy()` and 
`strncat()` functions.** I read the code of `strncpy` function, seems 
null-terminated to parameters is essential. I thought those parameters to 
strXxx() are also able to the parameter of `strlen` function knowing the length 
of a C string(it can be passed to be a parameter or assigned to be a variable, 
those point to the identical memory. strXxx functions tell the end by null 
character in the memory). Moreover, I searched source code of OpenSSL, I found 
the project uses most of `char*` as C string, and data buffer to retrieve data 
with `unsigned char*`.  `unsigned char` is a primitive type in C89 (is portable 
than `uint8_t`). Maybe current mechanism is a good way to hint users that 
`unsigned char*` is more explicit than `char*` if they want to treat it as a 
buffer to retrieve data.

2. **Adding heuristics to pick the correct prefix.** Do you mean that use the 
heuristics approach to give naming suggestion as warning message, or correct it 
with the `--fix` option? Is there any existing in this project can be a sample 
for me? If my thought about the heuristics is correct. The information of 
parameters to functions I can query its **type**, **name**, and **location**. 
As we have discussed that the declaration type is insufficient to tell `sz` for 
`char*`, or `cb` for count of bytes instead `i`, `n`, or `l`, so the **name** 
and **location** provide more information for comparing names with string 
mapping tables and location relationship between parameters/variables. Take 
`FILE * fopen ( const char * filename, const char * mode );` for example(C 
String). It will change `filename` to `szFilename` if the `name` string is in 
the mapping table, change `mode` to `pcMode` if `mode` string is not in the 
mapping table. Take `size_t fread ( void * ptr, size_t size, size_t count, FILE 
* stream );` for example(count of bytes). It will change `size` to `cbSize`, 
because its previous parameter is a void pointer.

  I can smell that there is always exceptional cases, and not good for 
maintainability.

3. **Changing `i`, `n`, and `l` to `cb` for APIs that specify a count of 
bytes.** I have no idea how to distinguish when should add the `cb` instead of 
integer types for heuristics. If I was the user, I wish clang-tidy don't change 
integer types from `cbXxx` to `iCbXxx` or `nCbXxx`. Keep `cb` with default or 
an option in config file, like `IgnoreParameterPrefix`, `IgnoreVariablePrefix`.

4. **Why not use Decl->getType()->getAsString()** I printed the differences as 
a log for your reference. 
(https://gist.github.com/dougpuob/e5a76db6e2c581ba003afec3236ab6ac#file-clang-tidy-readability-identifier-naming-hungarian-notation-log-L191)
 Previous I mentioned "if users haven't specific the include directories, the 
checking result may look messy". This concern will not happened because the 
`clang-diagnostic-error`, if users didn't specific header directories, 
clang-tidy will show the error (L414 
).




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86671

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


[PATCH] D88603: [WebAssembly] Add support for DWARF type units

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



Comment at: llvm/lib/MC/WasmObjectWriter.cpp:1353
   if (Begin) {
 WasmIndices[cast(Begin)] = CustomSections.size();
-if (SectionName != Begin->getName())

Just checking in the case where you were hitting this error the SectionName was 
duplicate but the `Begin` is uniquified ?




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88603

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


[PATCH] D52676: [clang-format] tweaked another case of lambda formatting

2020-09-30 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius added a comment.

I agree with both of you. I shouldn't have used the word "regression" indeed. I 
just meant a change in behaviour. Sorry for that.
I'll try to play around and propose a patch to enhance this feature :).
If you have any pointers about how to check if everything fits on a single line 
(it must be already done somewhere, nope?) then I'm all ears!


Repository:
  rL LLVM

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

https://reviews.llvm.org/D52676

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


[PATCH] D86819: [PowerPC][Power10] Implementation of 128-bit Binary Vector Rotate builtins

2020-09-30 Thread Albion Fung via Phabricator via cfe-commits
Conanap updated this revision to Diff 295393.
Conanap marked 6 inline comments as done.
Conanap added a comment.

Addressed comments and corrected incorrect behaviour on Power10


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

https://reviews.llvm.org/D86819

Files:
  clang/include/clang/Basic/BuiltinsPPC.def
  clang/lib/Headers/altivec.h
  clang/test/CodeGen/builtins-ppc-p10vector.c
  llvm/include/llvm/IR/IntrinsicsPowerPC.td
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/PowerPC/PPCInstrPrefix.td
  llvm/test/CodeGen/PowerPC/p10-vector-rotate.ll

Index: llvm/test/CodeGen/PowerPC/p10-vector-rotate.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/p10-vector-rotate.ll
@@ -0,0 +1,85 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
+; RUN:   -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
+; RUN:   FileCheck %s -check-prefixes=CHECK-LE,CHECK
+
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
+; RUN:   -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
+; RUN:   FileCheck %s -check-prefixes=CHECK-BE,CHECK
+
+; This test case aims to test the builtins for vector rotate instructions
+; on Power10.
+
+
+define <1 x i128> @test_vrlq(<1 x i128> %x, <1 x i128> %y) {
+; CHECK-LABEL: test_vrlq:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:vrlq v2, v3, v2
+; CHECK-NEXT:blr
+  %shl.i = shl <1 x i128> %y, %x
+  %sub.i = sub <1 x i128> , %x
+  %lshr.i = lshr <1 x i128> %y, %sub.i
+  %tmp = or <1 x i128> %shl.i, %lshr.i
+  ret <1 x i128> %tmp
+}
+
+define <1 x i128> @test_vrlq_cost_mult8(<1 x i128> %x) {
+; CHECK-LABEL: test_vrlq_cost_mult8:
+; CHECK: # %bb.0:
+; CHECK: vrlq v2, v3, v2
+; CHECK-NEXT: blr
+  %shl.i = shl <1 x i128> , %x
+  %sub.i = sub <1 x i128> , %x
+  %lshr.i = lshr <1 x i128> , %sub.i
+  %tmp = or <1 x i128> %shl.i, %lshr.i
+  ret <1 x i128> %tmp
+}
+
+define <1 x i128> @test_vrlq_cost_non_mult8(<1 x i128> %x) {
+; CHECK-LABEL: test_vrlq_cost_non_mult8:
+; CHECK: # %bb.0:
+; CHECK: vrlq v2, v3, v2
+; CHECK-NEXT: blr
+  %shl.i = shl <1 x i128> , %x
+  %sub.i = sub <1 x i128> , %x
+  %lshr.i = lshr <1 x i128> , %sub.i
+  %tmp = or <1 x i128> %shl.i, %lshr.i
+  ret <1 x i128> %tmp
+}
+
+; Function Attrs: nounwind readnone
+define <1 x i128> @test_vrlqmi(<1 x i128> %a, <1 x i128> %b, <1 x i128> %c) {
+; CHECK-LABEL: test_vrlqmi:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:vrlqmi v3, v2, v4
+; CHECK-NEXT:vmr v2, v3
+; CHECK-NEXT:blr
+entry:
+  %tmp = tail call <1 x i128> @llvm.ppc.altivec.vrlqmi(<1 x i128> %a, <1 x i128> %c, <1 x i128> %b)
+  ret <1 x i128> %tmp
+}
+
+; Function Attrs: nounwind readnone
+define <1 x i128> @test_vrlqnm(<1 x i128> %a, <1 x i128> %b, <1 x i128> %c) {
+; CHECK-LABEL: test_vrlqnm:
+; CHECK:# %bb.0: # %entry
+; CHECK-BE: lxvx v5
+; CHECK-BE-NEXT:vperm v3, v3, v4, v5
+; CHECK-LE-NEXT:plxv v5
+; CHECK-LE-NEXT:vperm v3, v4, v3, v5
+; CHECK-NEXT:   vrlqnm v2, v2, v3
+; CHECK-NEXT:   blr
+entry:
+  %0 = bitcast <1 x i128> %b to <16 x i8>
+  %1 = bitcast <1 x i128> %c to <16 x i8>
+  %shuffle.i = shufflevector <16 x i8> %0, <16 x i8> %1, <16 x i32> 
+  %d = bitcast <16 x i8> %shuffle.i to <1 x i128>
+  %tmp = tail call <1 x i128> @llvm.ppc.altivec.vrlqnm(<1 x i128> %a, <1 x i128> %d)
+  ret <1 x i128> %tmp
+}
+
+; Function Attrs: nounwind readnone
+declare <1 x i128> @llvm.ppc.altivec.vrlqmi(<1 x i128>, <1 x i128>, <1 x i128>)
+
+; Function Attrs: nounwind readnone
+declare <1 x i128> @llvm.ppc.altivec.vrlqnm(<1 x i128>, <1 x i128>)
Index: llvm/lib/Target/PowerPC/PPCInstrPrefix.td
===
--- llvm/lib/Target/PowerPC/PPCInstrPrefix.td
+++ llvm/lib/Target/PowerPC/PPCInstrPrefix.td
@@ -1461,19 +1461,25 @@
"vcmpuq $BF, $vA, $vB", IIC_VecGeneral, []>;
   def VCMPSQ : VXForm_BF3_VAB5<321, (outs crrc:$BF), (ins vrrc:$vA, vrrc:$vB),
"vcmpsq $BF, $vA, $vB", IIC_VecGeneral, []>;
-  def VRLQNM : VX1_VT5_VA5_VB5<325, "vrlqnm", []>;
-  def VRLQMI : VXForm_1<69, (outs vrrc:$vD),
-(ins vrrc:$vA, vrrc:$vB, vrrc:$vDi),
-"vrlqmi $vD, $vA, $vB", IIC_VecFP, []>,
-RegConstraint<"$vDi = $vD">, NoEncode<"$vDi">;
   def VSLQ : VX1_VT5_VA5_VB5<261, "vslq", []>;
   def VSRAQ : VX1_VT5_VA5_VB5<773, "vsraq", []>;
   def VSRQ : VX1_VT5_VA5_VB5<517, "vsrq", []>;
-  def VRLQ : VX1_VT5_VA5_VB5<5, "vrlq", []>;
   def XSCVQPUQZ : X_VT5_XO5_VB5<63, 0, 836, "xscvqpuqz", []>;
   def XSCVQPSQZ : X_VT5_XO5_VB5<63, 8, 836, "xscvqpsqz", []>;
   def XSCVUQQP : X_VT5_XO5_VB5<63, 3, 836, "xscvuqqp", []>;
   def XSCVSQQP : X_VT5_XO5_VB5<63, 11, 836, "xscvsqqp", []>;
+  def VRLQ : VX1_VT5_VA5_VB5<5, "vrlq", []>;
+  def 

[PATCH] D88603: [WebAssembly] Add support for DWARF type units

2020-09-30 Thread Derek Schuff via Phabricator via cfe-commits
dschuff added inline comments.



Comment at: llvm/lib/MC/MCObjectFileInfo.cpp:962
+  case Triple::Wasm:
+return Ctx->getWasmSection(Name, SectionKind::getMetadata(), utostr(Hash),
+   ~0);

dschuff wrote:
> I may add a couple more tests to this, but I did want to ask @sbc100 about 
> this, since I'm not 100% sure at the uniqueID field is for.
also let me be more clear about the question here: what is `UniqueID` for, and 
is it bad that I'm just passing it a number that is totally not unique?



Comment at: llvm/lib/MC/WasmObjectWriter.cpp:1353
   if (Begin) {
 WasmIndices[cast(Begin)] = CustomSections.size();
-if (SectionName != Begin->getName())

sbc100 wrote:
> Just checking in the case where you were hitting this error the SectionName 
> was duplicate but the `Begin` is uniquified ?
> 
> 
right. There's a second .debug_info section, so the name of `Begin` gets 
uniquified.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88603

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


[clang] 21cf2e6 - Handle unknown OSes in DarwinTargetInfo::getExnObjectAlignment

2020-09-30 Thread Akira Hatanaka via cfe-commits

Author: Akira Hatanaka
Date: 2020-09-30T16:05:17-07:00
New Revision: 21cf2e6c263d7a50654653bce4e83ab463fae580

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

LOG: Handle unknown OSes in DarwinTargetInfo::getExnObjectAlignment

rdar://problem/69727650

Added: 


Modified: 
clang/lib/Basic/Targets/OSTargets.h
clang/test/SemaCXX/warn-overaligned-type-thrown.cpp

Removed: 




diff  --git a/clang/lib/Basic/Targets/OSTargets.h 
b/clang/lib/Basic/Targets/OSTargets.h
index e07067693054..9b96690f413c 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -154,7 +154,8 @@ class LLVM_LIBRARY_VISIBILITY DarwinTargetInfo : public 
OSTargetInfo {
   MinVersion = llvm::VersionTuple(5U);
   break;
 default:
-  llvm_unreachable("Unexpected OS");
+  // Conservatively return 8 bytes if OS is unknown.
+  return 64;
 }
 
 unsigned Major, Minor, Micro;

diff  --git a/clang/test/SemaCXX/warn-overaligned-type-thrown.cpp 
b/clang/test/SemaCXX/warn-overaligned-type-thrown.cpp
index d7468445f8b7..9f2386ddc3c6 100644
--- a/clang/test/SemaCXX/warn-overaligned-type-thrown.cpp
+++ b/clang/test/SemaCXX/warn-overaligned-type-thrown.cpp
@@ -3,6 +3,7 @@
 // RUN: %clang_cc1 -triple arm64-apple-tvos10 -verify -fsyntax-only -std=c++11 
-fcxx-exceptions -fexceptions -DUNDERALIGNED %s
 // RUN: %clang_cc1 -triple arm64-apple-watchos4 -verify -fsyntax-only 
-std=c++11 -fcxx-exceptions -fexceptions -DUNDERALIGNED %s
 // RUN: %clang_cc1 -triple arm-linux-gnueabi -verify -fsyntax-only -std=c++11 
-fcxx-exceptions -fexceptions  -DUNDERALIGNED %s
+// RUN: %clang_cc1 -triple thumbv7em-apple-unknown-macho -verify -fsyntax-only 
-std=c++11 -fcxx-exceptions -fexceptions -DUNDERALIGNED %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.14 -verify -fsyntax-only 
-std=c++11 -fcxx-exceptions -fexceptions %s
 // RUN: %clang_cc1 -triple arm64-apple-ios12 -verify -fsyntax-only -std=c++11 
-fcxx-exceptions -fexceptions %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos12 -verify -fsyntax-only -std=c++11 
-fcxx-exceptions -fexceptions %s



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


[PATCH] D71524: [analyzer] Support tainted objects in GenericTaintChecker

2020-09-30 Thread Borsik Gábor via Phabricator via cfe-commits
boga95 marked an inline comment as done.
boga95 added a comment.

In D71524#2291925 , @steakhal wrote:

> In D71524#2284386 , @Szelethus wrote:
>
>> I figured you're still working on this, sorry! I'd really like to chat about 
>> my earlier comment D71524#1917251 , 
>> as it kind of challenges the high level idea.
>
> What about marking the `std::cin` object itself as tainted and any object 
> created by `ifstream::ifstream(const char*)` or similar functions.
> Then propagate taint via the extraction operator (`operator>>`) only if the 
> stream was tainted.
> This way we could reduce the false-positives of this crude heuristic. What do 
> you think?

As far as I remember I tried to make `std::cin` tainted, but it was 
complicated. I run the checker against many projects and there wasn't any false 
positive related to this heuristic.
We can restrict the `operator>>`  to `std::basic_stream` and cover only the 
standard library. I think most of the programmers will use this in a 
conventional way, therefore it should work for their implementation too.


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

https://reviews.llvm.org/D71524

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


[clang] e4f50e5 - [ARM] Add missing target for Arm neon test case.

2020-09-30 Thread Ranjeet Singh via cfe-commits

Author: Ranjeet Singh
Date: 2020-10-01T00:32:33+01:00
New Revision: e4f50e587f077c246b7f29db0b7daddf583e2b64

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

LOG: [ARM] Add missing target for Arm neon test case.

This is a follow-up from https://reviews.llvm.org/D61717. Where Richard
described the issue with compiling arm_neon.h under
-flax-vector-conversions=none. It looks like the example reproducer does
actually work but what was missing was a test entry for that target.

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

Added: 


Modified: 
clang/test/Headers/arm-neon-header.c

Removed: 




diff  --git a/clang/test/Headers/arm-neon-header.c 
b/clang/test/Headers/arm-neon-header.c
index f6362886010a..8f64633b44d5 100644
--- a/clang/test/Headers/arm-neon-header.c
+++ b/clang/test/Headers/arm-neon-header.c
@@ -22,5 +22,6 @@
 
 // RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding 
--target=aarch64-none-eabi -march=armv8.2-a+fp16fml+crypto+dotprod -std=c11 -xc 
-flax-vector-conversions=none %s
 // RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding 
--target=aarch64_be-none-eabi -march=armv8.2-a+fp16fml+crypto+dotprod -std=c11 
-xc -flax-vector-conversions=none %s
+// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding 
--target=arm64-linux-gnu -arch +neon -std=c11 -xc -flax-vector-conversions=none 
%s
 
 #include 



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


[PATCH] D88546: [ARM] Update NEON testcase with missing target string in

2020-09-30 Thread Ranjeet Singh via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe4f50e587f07: [ARM] Add missing target for Arm neon test 
case. (authored by rs).

Changed prior to commit:
  https://reviews.llvm.org/D88546?vs=295219=295435#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88546

Files:
  clang/test/Headers/arm-neon-header.c


Index: clang/test/Headers/arm-neon-header.c
===
--- clang/test/Headers/arm-neon-header.c
+++ clang/test/Headers/arm-neon-header.c
@@ -22,5 +22,6 @@
 
 // RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding 
--target=aarch64-none-eabi -march=armv8.2-a+fp16fml+crypto+dotprod -std=c11 -xc 
-flax-vector-conversions=none %s
 // RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding 
--target=aarch64_be-none-eabi -march=armv8.2-a+fp16fml+crypto+dotprod -std=c11 
-xc -flax-vector-conversions=none %s
+// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding 
--target=arm64-linux-gnu -arch +neon -std=c11 -xc -flax-vector-conversions=none 
%s
 
 #include 


Index: clang/test/Headers/arm-neon-header.c
===
--- clang/test/Headers/arm-neon-header.c
+++ clang/test/Headers/arm-neon-header.c
@@ -22,5 +22,6 @@
 
 // RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-none-eabi -march=armv8.2-a+fp16fml+crypto+dotprod -std=c11 -xc -flax-vector-conversions=none %s
 // RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64_be-none-eabi -march=armv8.2-a+fp16fml+crypto+dotprod -std=c11 -xc -flax-vector-conversions=none %s
+// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=arm64-linux-gnu -arch +neon -std=c11 -xc -flax-vector-conversions=none %s
 
 #include 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] 85fc5bf - [clangd] Remove dead variable. NFC

2020-09-30 Thread Sam McCall via cfe-commits

Author: Sam McCall
Date: 2020-09-30T23:19:15+02:00
New Revision: 85fc5bf341395171e67490061f6fbc76b297b78d

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

LOG: [clangd] Remove dead variable. NFC

Added: 


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

Removed: 




diff  --git a/clang-tools-extra/clangd/URI.cpp 
b/clang-tools-extra/clangd/URI.cpp
index f9e8fdc46fa7f..80e3a1017312d 100644
--- a/clang-tools-extra/clangd/URI.cpp
+++ b/clang-tools-extra/clangd/URI.cpp
@@ -111,7 +111,6 @@ bool shouldEscape(unsigned char C) {
 /// - Reserved characters always escaped with exceptions like '/'.
 /// - All other characters are escaped.
 void percentEncode(llvm::StringRef Content, std::string ) {
-  std::string Result;
   for (unsigned char C : Content)
 if (shouldEscape(C)) {
   Out.push_back('%');



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


[PATCH] D88477: [analyzer] Overwrite cast type in getBinding only if that was null originally

2020-09-30 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

I'm trying to say that the value produced by the load should not be the same as 
the stored value, because these two values are of different types. When exactly 
does the first value change into the second value is a different story; the 
current grand vision around which the code is written says that it changes 
during load, therefore it's the load code (step #2) that's to blame.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88477

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


[PATCH] D86841: [clang] Add mustprogress and llvm.loop.mustprogress attribute deduction

2020-09-30 Thread Juneyoung Lee via Phabricator via cfe-commits
aqjune added inline comments.



Comment at: clang/lib/CodeGen/CGStmt.cpp:801
+ getLangOpts().CPlusPlus11 || getLangOpts().CPlusPlus14 ||
+ getLangOpts().CPlusPlus17 || getLangOpts().C2x) {
+LoopMustProgress = true;

A silly question: does old C/C++ not guarantee that loops should make forward 
progress?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86841

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


[PATCH] D86671: [clang-tidy] Add new case type to check variables with Hungarian notation

2020-09-30 Thread Douglas Chen via Phabricator via cfe-commits
dougpuob added a comment.

In D86671#2304337 , @njames93 wrote:

> Not strictly relevant here, but this does open up the idea of enforcing the 
> style where an enum constant is prefixed by the initials of the enum name.

I like this idea. There is a case when `EnumConstantPrefix` and 
`EnumConstantCase=szHungarianNotation` options are set, it may take similar 
affect(which will be the first) or be overwritten? I can have it a try later.

Showing my conception as the following:

  // [Before]
  typedef enum {
  RevValid = -1,
  RevNone  = 0, 
  RevCrlReason = 1, 
  RevHold  = 2, 
  RevKeyCompromise = 3, 
  RevCaCompromise  = 4  
  } REVINFO_TYPE;
  
  // [After]
  typedef enum {
  rtRevValid = -1
  rtRevNone  = 0,
  rtRevCrlReason = 1,
  rtRevHold  = 2,
  rtRevKeyCompromise = 3,
  rtRevCaCompromise  = 4 
  } REVINFO_TYPE;
  
  // [After] EnumConstantPrefix first case
  // EnumConstantCase=snHungarianNotation
  // EnumConstantPrefix=pre_
  typedef enum {
  pre_rtRevValid = -1
  pre_rtRevNone  = 0,
  pre_rtRevCrlReason = 1,
  pre_rtRevHold  = 2,
  pre_rtRevKeyCompromise = 3,
  pre_rtRevCaCompromise  = 4 
  } REVINFO_TYPE;




Comment at: 
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-hungarian-notation.cpp:25
+// RUN: {key: readability-identifier-naming.FunctionCase   , value: 
CamelCase },   \
+// RUN: {key: readability-identifier-naming.ClassCase  , value: 
szHungarianNotation }, \
+// RUN: {key: readability-identifier-naming.TypedefCase, value: 
szHungarianNotation }, \

njames93 wrote:
> Class names shouldn't use hungarian notation.
OK~ I have classified CheckOptions, and all test cases one by one in the next 
diff.

```
// RUN:   -config='{ CheckOptions: [ \
// RUN: { key: readability-identifier-naming.ClassMemberCase  , 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.ConstantCase , 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.ConstantMemberCase   , 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.ConstantParameterCase, 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.ConstantPointerParameterCase , 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.ConstexprVariableCase, 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.GlobalConstantCase   , 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.GlobalConstantPointerCase, 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.GlobalVariableCase   , 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.LocalConstantCase, 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.LocalConstantPointerCase , 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.LocalPointerCase , 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.LocalVariableCase, 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.MemberCase   , 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.ParameterCase, 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.PointerParameterCase , 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.PrivateMemberCase, 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.StaticConstantCase   , 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.StaticVariableCase   , 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.StructCase   , 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.UnionCase, 
value: szHungarianNotation }, \
// RUN: { key: readability-identifier-naming.VariableCase , 
value: szHungarianNotation }  \
// RUN:   ]}'
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86671

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


[PATCH] D88477: [analyzer] Overwrite cast type in getBinding only if that was null originally

2020-09-30 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

(in the latest message by "load" i mean the first load that produces a pointer 
(i.e., an `ElementRegion`) as the result)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88477

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


[PATCH] D87974: [Builtin] Add __builtin_zero_non_value_bits.

2020-09-30 Thread Zoe Carver via Phabricator via cfe-commits
zoecarver added inline comments.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:1704
+->getArrayElementTypeNoTypeQual()
+->isRecordType()) {
+  auto FieldElement = CGF.Builder.CreateStructGEP(Ptr, Index);

Is it OK to possibly create hundreds of stores here? I assume later 
optimizations will catch this and turn it into a loop or a call to memset or 
something. But this could potentially be harmful to code size.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87974

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


[PATCH] D87974: [Builtin] Add __builtin_zero_non_value_bits.

2020-09-30 Thread Zoe Carver via Phabricator via cfe-commits
zoecarver updated this revision to Diff 295445.
zoecarver added a comment.

- Support constant arrays
- Format changes with clang-format


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87974

Files:
  clang/include/clang/Basic/Builtins.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGenCXX/builtin-zero-non-value-bits-codegen.cpp
  clang/test/CodeGenCXX/builtin-zero-non-value-bits.cpp
  clang/test/SemaCXX/builtin-zero-non-value-bits.cpp

Index: clang/test/SemaCXX/builtin-zero-non-value-bits.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/builtin-zero-non-value-bits.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct Foo {};
+
+struct Incomplete; // expected-note {{forward declaration of 'Incomplete'}}
+
+void test(int a, Foo b, void *c, int *d, Foo *e, const Foo *f, Incomplete *g) {
+  __builtin_zero_non_value_bits(a); // expected-error {{passing 'int' to parameter of incompatible type structure pointer: type mismatch at 1st parameter ('int' vs structure pointer)}}
+  __builtin_zero_non_value_bits(b); // expected-error {{passing 'Foo' to parameter of incompatible type structure pointer: type mismatch at 1st parameter ('Foo' vs structure pointer)}}
+  __builtin_zero_non_value_bits(c); // expected-error {{passing 'void *' to parameter of incompatible type structure pointer: type mismatch at 1st parameter ('void *' vs structure pointer)}}
+  __builtin_zero_non_value_bits(d); // expected-error {{passing 'int *' to parameter of incompatible type structure pointer: type mismatch at 1st parameter ('int *' vs structure pointer)}}
+  __builtin_zero_non_value_bits(e); // This should not error.
+  __builtin_zero_non_value_bits(f); // expected-error {{read-only variable is not assignable}}
+  __builtin_zero_non_value_bits(g); // expected-error {{variable has incomplete type 'Incomplete'}}
+}
Index: clang/test/CodeGenCXX/builtin-zero-non-value-bits.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/builtin-zero-non-value-bits.cpp
@@ -0,0 +1,249 @@
+// RUN: mkdir -p %t
+// RUN: %clang++ %s -o %t/run
+// RUN: %t/run
+
+#include 
+#include 
+#include 
+#include 
+
+template 
+struct alignas(A1) BasicWithPadding {
+  T x;
+  alignas(A2) T y;
+};
+
+template 
+struct alignas(A1) SpacedArrayMembers {
+  T x[N];
+  alignas(A2) char c;
+  T y[N];
+};
+
+template 
+struct alignas(A1) PaddedPointerMembers {
+  T *x;
+  alignas(A2) T *y;
+};
+
+template 
+struct alignas(A1) ThreeMembers {
+  T x;
+  alignas(A2) T y;
+  alignas(A3) T z;
+};
+
+template 
+struct Normal {
+  T a;
+  T b;
+};
+
+template 
+struct X {
+  T x;
+};
+
+template 
+struct Z {
+  T z;
+};
+
+template 
+struct YZ : public Z {
+  alignas(A) T y;
+};
+
+template 
+struct alignas(A1) HasBase : public X, public YZ {
+  T a;
+  alignas(A2) T b;
+};
+
+template 
+void testAllForType(T a, T b, T c, T d) {
+  using B = BasicWithPadding;
+  B basic1;
+  memset(, 0, sizeof(B));
+  basic1.x = a;
+  basic1.y = b;
+  B basic2;
+  memset(, 42, sizeof(B));
+  basic2.x = a;
+  basic2.y = b;
+  assert(memcmp(, , sizeof(B)) != 0);
+  __builtin_zero_non_value_bits();
+  assert(memcmp(, , sizeof(B)) == 0);
+
+  using A = SpacedArrayMembers;
+  A arr1;
+  memset(, 0, sizeof(A));
+  arr1.x[0] = a;
+  arr1.x[1] = b;
+  arr1.y[0] = c;
+  arr1.y[1] = d;
+  A arr2;
+  memset(, 42, sizeof(A));
+  arr2.x[0] = a;
+  arr2.x[1] = b;
+  arr2.y[0] = c;
+  arr2.y[1] = d;
+  arr2.c = 0;
+  assert(memcmp(, , sizeof(A)) != 0);
+  __builtin_zero_non_value_bits();
+  assert(memcmp(, , sizeof(A)) == 0);
+
+  using P = PaddedPointerMembers;
+  P ptr1;
+  memset(, 0, sizeof(P));
+  ptr1.x = 
+  ptr1.y = 
+  P ptr2;
+  memset(, 42, sizeof(P));
+  ptr2.x = 
+  ptr2.y = 
+  assert(memcmp(, , sizeof(P)) != 0);
+  __builtin_zero_non_value_bits();
+  assert(memcmp(, , sizeof(P)) == 0);
+
+  using Three = ThreeMembers;
+  Three three1;
+  memset(, 0, sizeof(Three));
+  three1.x = a;
+  three1.y = b;
+  three1.z = c;
+  Three three2;
+  memset(, 42, sizeof(Three));
+  three2.x = a;
+  three2.y = b;
+  three2.z = c;
+  __builtin_zero_non_value_bits();
+  assert(memcmp(, , sizeof(Three)) == 0);
+
+  using N = Normal;
+  N normal1;
+  memset(, 0, sizeof(N));
+  normal1.a = a;
+  normal1.b = b;
+  N normal2;
+  memset(, 42, sizeof(N));
+  normal2.a = a;
+  normal2.b = b;
+  __builtin_zero_non_value_bits();
+  assert(memcmp(, , sizeof(N)) == 0);
+
+  using H = HasBase;
+  H base1;
+  memset(, 0, sizeof(H));
+  base1.a = a;
+  base1.b = b;
+  base1.x = c;
+  base1.y = d;
+  base1.z = a;
+  H base2;
+  memset(, 42, sizeof(H));
+  base2.a = a;
+  base2.b = b;
+  base2.x = c;
+  base2.y = d;
+  base2.z = a;
+  assert(memcmp(, , sizeof(H)) != 0);
+  __builtin_zero_non_value_bits();
+  unsigned i = 0;
+  assert(memcmp(, , sizeof(H)) == 0);
+}
+

[PATCH] D87974: [Builtin] Add __builtin_zero_non_value_bits.

2020-09-30 Thread Zoe Carver via Phabricator via cfe-commits
zoecarver marked an inline comment as done.
zoecarver added inline comments.



Comment at: clang/test/CodeGenCXX/builtin-zero-non-value-bits-codegen.cpp:46
+void test(Baz *baz) {
+  __builtin_zero_non_value_bits(baz);
+}

zoecarver wrote:
> jfb wrote:
> > It would be useful to see a test for arrays with a type that contains tail 
> > padding.
> Hmm, this test case doesn't seem to be working. I'll investigate further. 
OK, I've added that. Just to clarify, you mean a type that contains a constant 
array type of types with tail padding (i.e., `Bar [2]`)?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87974

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


[PATCH] D87974: [Builtin] Add __builtin_zero_non_value_bits.

2020-09-30 Thread Zoe Carver via Phabricator via cfe-commits
zoecarver added inline comments.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:1652
+auto Element = CGF.Builder.CreateGEP(I8Ptr, Index);
+CGF.Builder.CreateAlignedStore(Zero, Element, MaybeAlign());
+  };

jfb wrote:
> You should use `alignmentAtOffset` here.
I'm using `CharUnits::One().alignmentAtOffset` to here because this type will 
always have a size of 1 because it's an `i8` ptr.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87974

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


[PATCH] D88630: [clang/CMake] Respect LLVM_TOOLS_INSTALL_DIR

2020-09-30 Thread Keno Fischer via Phabricator via cfe-commits
loladiro created this revision.
loladiro added a reviewer: tstellar.
Herald added subscribers: cfe-commits, mgorny.
Herald added a project: clang.
loladiro requested review of this revision.

Otherwise clang installs all of its tools into `bin/` while
LLVM installs its tools into (LLVM_TOOLS_INSTALL_DIR).
I could swear this used to work (and in fact the julia build system
assumes it), but I can't pin down a specific commit that would
have broken this, and julia has been relying on pre-compiled binaries
for a while now (that don't use this setting), so it may have been
broken for quite a while.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88630

Files:
  clang/cmake/modules/AddClang.cmake


Index: clang/cmake/modules/AddClang.cmake
===
--- clang/cmake/modules/AddClang.cmake
+++ clang/cmake/modules/AddClang.cmake
@@ -170,7 +170,7 @@
 
 install(TARGETS ${name}
   ${export_to_clangtargets}
-  RUNTIME DESTINATION bin
+  RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR}
   COMPONENT ${name})
 
 if(NOT LLVM_ENABLE_IDE)


Index: clang/cmake/modules/AddClang.cmake
===
--- clang/cmake/modules/AddClang.cmake
+++ clang/cmake/modules/AddClang.cmake
@@ -170,7 +170,7 @@
 
 install(TARGETS ${name}
   ${export_to_clangtargets}
-  RUNTIME DESTINATION bin
+  RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR}
   COMPONENT ${name})
 
 if(NOT LLVM_ENABLE_IDE)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D88594: [OpenMP] Add Error Handling for Conflicting Pointer Sizes for Target Offload

2020-09-30 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 closed this revision.
jhuber6 added a comment.

Committed in rG9d2378b59150 
, forgot 
to update the commit message.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88594

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


[clang] 1b60f63 - Revert "[OpenMP] Replace OpenMP RTL Functions With OMPIRBuilder and OMPKinds.def"

2020-09-30 Thread Joseph Huber via cfe-commits

Author: Joseph Huber
Date: 2020-09-30T15:12:21-04:00
New Revision: 1b60f63e4fd041550019b692dc7bf490dce2c75c

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

LOG: Revert "[OpenMP] Replace OpenMP RTL Functions With OMPIRBuilder and 
OMPKinds.def"

Failing tests on Arm due to the tests automatically populating
incomatible pointer width architectures. Reverting until the tests are
updated. Failing tests:

OpenMP/distribute_parallel_for_num_threads_codegen.cpp
OpenMP/distribute_parallel_for_if_codegen.cpp
OpenMP/distribute_parallel_for_simd_if_codegen.cpp
OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp
OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp
OpenMP/teams_distribute_parallel_for_if_codegen.cpp
OpenMP/teams_distribute_parallel_for_simd_if_codegen.cpp

This reverts commit 90eaedda9b8ef46e2c0c1b8bce33e98a3adbb68c.

Added: 


Modified: 
clang/lib/CodeGen/CGOpenMPRuntime.h
clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/test/OpenMP/nvptx_parallel_codegen.cpp
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
llvm/test/Transforms/OpenMP/add_attributes.ll

Removed: 




diff  --git a/clang/lib/CodeGen/CGOpenMPRuntime.h 
b/clang/lib/CodeGen/CGOpenMPRuntime.h
index e39c2e11390e..41fa9f5345aa 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.h
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.h
@@ -306,9 +306,6 @@ class CGOpenMPRuntime {
   CodeGenModule 
   StringRef FirstSeparator, Separator;
 
-  /// An OpenMP-IR-Builder instance.
-  llvm::OpenMPIRBuilder OMPBuilder;
-
   /// Constructor allowing to redefine the name separator for the variables.
   explicit CGOpenMPRuntime(CodeGenModule , StringRef FirstSeparator,
StringRef Separator);
@@ -389,6 +386,8 @@ class CGOpenMPRuntime {
   llvm::Value *getCriticalRegionLock(StringRef CriticalName);
 
 private:
+  /// An OpenMP-IR-Builder instance.
+  llvm::OpenMPIRBuilder OMPBuilder;
 
   /// Map for SourceLocation and OpenMP runtime library debug locations.
   typedef llvm::DenseMap OpenMPDebugLocMapTy;

diff  --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
index dbd24d33cc37..d9ef6c2a1078 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -28,6 +28,96 @@ using namespace CodeGen;
 using namespace llvm::omp;
 
 namespace {
+enum OpenMPRTLFunctionNVPTX {
+  /// Call to void __kmpc_kernel_init(kmp_int32 thread_limit,
+  /// int16_t RequiresOMPRuntime);
+  OMPRTL_NVPTX__kmpc_kernel_init,
+  /// Call to void __kmpc_kernel_deinit(int16_t IsOMPRuntimeInitialized);
+  OMPRTL_NVPTX__kmpc_kernel_deinit,
+  /// Call to void __kmpc_spmd_kernel_init(kmp_int32 thread_limit,
+  /// int16_t RequiresOMPRuntime, int16_t RequiresDataSharing);
+  OMPRTL_NVPTX__kmpc_spmd_kernel_init,
+  /// Call to void __kmpc_spmd_kernel_deinit_v2(int16_t RequiresOMPRuntime);
+  OMPRTL_NVPTX__kmpc_spmd_kernel_deinit_v2,
+  /// Call to void __kmpc_kernel_prepare_parallel(void
+  /// *outlined_function);
+  OMPRTL_NVPTX__kmpc_kernel_prepare_parallel,
+  /// Call to bool __kmpc_kernel_parallel(void **outlined_function);
+  OMPRTL_NVPTX__kmpc_kernel_parallel,
+  /// Call to void __kmpc_kernel_end_parallel();
+  OMPRTL_NVPTX__kmpc_kernel_end_parallel,
+  /// Call to void __kmpc_serialized_parallel(ident_t *loc, kmp_int32
+  /// global_tid);
+  OMPRTL_NVPTX__kmpc_serialized_parallel,
+  /// Call to void __kmpc_end_serialized_parallel(ident_t *loc, kmp_int32
+  /// global_tid);
+  OMPRTL_NVPTX__kmpc_end_serialized_parallel,
+  /// Call to int32_t __kmpc_shuffle_int32(int32_t element,
+  /// int16_t lane_offset, int16_t warp_size);
+  OMPRTL_NVPTX__kmpc_shuffle_int32,
+  /// Call to int64_t __kmpc_shuffle_int64(int64_t element,
+  /// int16_t lane_offset, int16_t warp_size);
+  OMPRTL_NVPTX__kmpc_shuffle_int64,
+  /// Call to __kmpc_nvptx_parallel_reduce_nowait_v2(ident_t *loc, kmp_int32
+  /// global_tid, kmp_int32 num_vars, size_t reduce_size, void* reduce_data,
+  /// void (*kmp_ShuffleReductFctPtr)(void *rhsData, int16_t lane_id, int16_t
+  /// lane_offset, int16_t shortCircuit),
+  /// void (*kmp_InterWarpCopyFctPtr)(void* src, int32_t warp_num));
+  OMPRTL_NVPTX__kmpc_nvptx_parallel_reduce_nowait_v2,
+  /// Call to __kmpc_nvptx_teams_reduce_nowait_v2(ident_t *loc, kmp_int32
+  /// global_tid, void *global_buffer, int32_t num_of_records, void*
+  /// reduce_data,
+  /// void (*kmp_ShuffleReductFctPtr)(void *rhsData, int16_t lane_id, int16_t
+  /// lane_offset, int16_t shortCircuit),
+  /// void (*kmp_InterWarpCopyFctPtr)(void* src, int32_t warp_num), void
+  /// (*kmp_ListToGlobalCpyFctPtr)(void *buffer, int idx, void *reduce_data),

[PATCH] D88370: Emit predefined macro for wavefront size for amdgcn

2020-09-30 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 295326.
yaxunl added a comment.

simplifies wavefrontsize64 target feature


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

https://reviews.llvm.org/D88370

Files:
  clang/lib/Basic/Targets/AMDGPU.cpp
  clang/lib/Basic/Targets/AMDGPU.h
  clang/lib/Driver/ToolChains/AMDGPU.cpp
  clang/test/Driver/amdgpu-features.c
  clang/test/Driver/amdgpu-macros.cl
  clang/test/Driver/hip-macros.hip
  clang/test/Driver/hip-toolchain-features.hip

Index: clang/test/Driver/hip-toolchain-features.hip
===
--- clang/test/Driver/hip-toolchain-features.hip
+++ clang/test/Driver/hip-toolchain-features.hip
@@ -37,8 +37,17 @@
 // RUN:   -mcumode -mcumode -mno-cumode -mwavefrontsize64 -mcumode \
 // RUN:   -mwavefrontsize64 -mno-wavefrontsize64 2>&1 \
 // RUN:   | FileCheck %s -check-prefix=DUP
-// DUP: {{.*}}clang{{.*}} "-target-feature" "-wavefrontsize16"
-// DUP-SAME: "-target-feature" "+wavefrontsize32"
-// DUP-SAME: "-target-feature" "-wavefrontsize64"
-// DUP-SAME: "-target-feature" "+cumode"
-// DUP: {{.*}}lld{{.*}} "-plugin-opt=-mattr=-wavefrontsize16,+wavefrontsize32,-wavefrontsize64,+cumode"
+// DUP: {{.*}}clang{{.*}} "-target-feature" "+cumode"
+// DUP-NOT: "-target-feature" "{{.*}}wavefrontsize16"
+// DUP-NOT: "-target-feature" "{{.*}}wavefrontsize32"
+// DUP-NOT: "-target-feature" "{{.*}}wavefrontsize64"
+// DUP: {{.*}}lld{{.*}} "-plugin-opt=-mattr=+cumode"
+
+// RUN: %clang -### -target x86_64-linux-gnu -fgpu-rdc -nogpulib \
+// RUN:   --cuda-gpu-arch=gfx1010 %s \
+// RUN:   -mno-wavefrontsize64 -mwavefrontsize64 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=WAVE64
+// WAVE64: {{.*}}clang{{.*}} "-target-feature" "+wavefrontsize64"
+// WAVE64-NOT: "-target-feature" "{{.*}}wavefrontsize16"
+// WAVE64-NOT: "-target-feature" "{{.*}}wavefrontsize32"
+// WAVE64: {{.*}}lld{{.*}} "-plugin-opt=-mattr=+wavefrontsize64"
Index: clang/test/Driver/hip-macros.hip
===
--- /dev/null
+++ clang/test/Driver/hip-macros.hip
@@ -0,0 +1,20 @@
+// RUN: %clang -E -dM --offload-arch=gfx906 -mwavefrontsize64 \
+// RUN:   --cuda-device-only -nogpuinc -nogpulib \
+// RUN:   %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
+// RUN: %clang -E -dM --offload-arch=gfx1010 -mwavefrontsize64 \
+// RUN:   --cuda-device-only -nogpuinc -nogpulib \
+// RUN:   %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
+// RUN: %clang -E -dM --offload-arch=gfx906 -mwavefrontsize64 \
+// RUN:   --cuda-device-only -nogpuinc -nogpulib \
+// RUN:   -mno-wavefrontsize64 %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
+// RUN: %clang -E -dM --offload-arch=gfx1010 -mwavefrontsize64 \
+// RUN:   --cuda-device-only -nogpuinc -nogpulib \
+// RUN:   -mno-wavefrontsize64 %s 2>&1 | FileCheck --check-prefixes=WAVE32 %s
+// RUN: %clang -E -dM --offload-arch=gfx906 -mno-wavefrontsize64 \
+// RUN:   --cuda-device-only -nogpuinc -nogpulib \
+// RUN:   -mwavefrontsize64 %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
+// RUN: %clang -E -dM --offload-arch=gfx1010 -mno-wavefrontsize64 \
+// RUN:   --cuda-device-only -nogpuinc -nogpulib \
+// RUN:   -mwavefrontsize64 %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
+// WAVE64-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// WAVE32-DAG: #define __AMDGCN_WAVEFRONT_SIZE 32
Index: clang/test/Driver/amdgpu-macros.cl
===
--- clang/test/Driver/amdgpu-macros.cl
+++ clang/test/Driver/amdgpu-macros.cl
@@ -346,4 +346,42 @@
 // GFX1011-DAG: #define __amdgcn_processor__ "gfx1011"
 // GFX1012-DAG: #define __amdgcn_processor__ "gfx1012"
 // GFX1030-DAG: #define __amdgcn_processor__ "gfx1030"
-// GFX1031-DAG: #define __amdgcn_processor__ "gfx1031"
\ No newline at end of file
+// GFX1031-DAG: #define __amdgcn_processor__ "gfx1031"
+
+// GFX600-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX601-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX700-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX701-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX702-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX703-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX704-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX801-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX802-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX803-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX810-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX900-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX902-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX904-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX906-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX908-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX909-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX1010-DAG: #define __AMDGCN_WAVEFRONT_SIZE 32
+// GFX1011-DAG: #define __AMDGCN_WAVEFRONT_SIZE 32
+// GFX1012-DAG: #define __AMDGCN_WAVEFRONT_SIZE 32
+// GFX1030-DAG: #define __AMDGCN_WAVEFRONT_SIZE 32
+// GFX1031-DAG: #define 

[PATCH] D88430: [OpenMP] Replace OpenMP RTL Functions With OMPIRBuilder and OMPKinds.def

2020-09-30 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

LGTM, that should mean OpenMPKinds lists all OpenMP runtime functions clang 
generates, which is great.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88430

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


[PATCH] D88603: [WebAssembly] Add support for DWARF type units

2020-09-30 Thread Derek Schuff via Phabricator via cfe-commits
dschuff created this revision.
dschuff added reviewers: aardappel, sbc100.
Herald added subscribers: llvm-commits, cfe-commits, ecnelises, sunfish, 
hiraditya, jgravelle-google.
Herald added projects: clang, LLVM.
dschuff requested review of this revision.
Herald added subscribers: ormris, aheejin.

Since Wasm comdat sections work similarly to ELF, we can use that mechanism
to eliminate duplicate dwarf type information in the same way.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88603

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/debug-options.c
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/lib/MC/MCObjectFileInfo.cpp
  llvm/lib/MC/WasmObjectWriter.cpp
  llvm/test/DebugInfo/WebAssembly/dwarf-headers.ll

Index: llvm/test/DebugInfo/WebAssembly/dwarf-headers.ll
===
--- /dev/null
+++ llvm/test/DebugInfo/WebAssembly/dwarf-headers.ll
@@ -0,0 +1,116 @@
+; RUN: llc -dwarf-version=4 -generate-type-units \
+; RUN: -filetype=obj -O0 -mtriple=wasm32-unknown-unknown < %s \
+; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=SINGLE-4
+
+; RUN: llc -split-dwarf-file=foo.dwo -split-dwarf-output=%t.dwo \
+; RUN: -dwarf-version=4 -generate-type-units \
+; RUN: -filetype=obj -O0 -mtriple=wasm32-unknown-unknown < %s \
+; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=O-4
+; RUN: llvm-dwarfdump -v %t.dwo | FileCheck %s --check-prefix=DWO-4
+
+; TODO: enable testing for dwarf v5
+; RUN: llc -dwarf-version=5 -generate-type-units \
+; RUN: -filetype=obj -O0 -mtriple= < %s \
+; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=SINGLE-5
+
+; RUN: llc -split-dwarf-file=foo.dwo -split-dwarf-output=%t.dwo \
+; RUN: -dwarf-version=5 -generate-type-units \
+; RUN: -filetype=obj -O0 -mtriple= < %s \
+; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=O-5
+; RUN: llvm-dwarfdump -v %t.dwo | FileCheck %s --check-prefix=DWO-5
+
+; This test is derived from test/CodeGen/X86/dwarf-headers.ll
+
+; Looking for DWARF headers to be generated correctly.
+; There are 8 variants with 5 formats: v4 CU, v4 TU, v5 normal/partial CU,
+; v5 skeleton/split CU, v5 normal/split TU.  Some v5 variants differ only
+; in the unit_type code, and the skeleton/split CU differs from normal/partial
+; by having one extra field (dwo_id).
+; (v2 thru v4 CUs are all the same, and TUs were invented in v4,
+; so we don't bother checking older versions.)
+
+; Test case built from:
+;struct S {
+;  int s1;
+;};
+;
+;S s;
+
+; Verify the v4 non-split headers.
+; Note that we check the exact offset of the DIEs because that tells us
+; the length of the header.
+;
+; SINGLE-4: .debug_info contents:
+; SINGLE-4: 0x: Compile Unit: {{.*}} version = 0x0004, abbr_offset
+; SINGLE-4: 0x000b: DW_TAG_compile_unit
+;
+; SINGLE-4: .debug_types contents:
+; SINGLE-4: 0x: Type Unit: {{.*}} version = 0x0004, abbr_offset
+; SINGLE-4: 0x0017: DW_TAG_type_unit
+
+; Verify the v4 split headers.
+;
+; O-4: .debug_info contents:
+; O-4: 0x: Compile Unit: {{.*}} version = 0x0004, abbr_offset
+; O-4: 0x000b: DW_TAG_compile_unit
+;
+; DWO-4: .debug_info.dwo contents:
+; DWO-4: 0x: Compile Unit: {{.*}} version = 0x0004, abbr_offset
+; DWO-4: 0x000b: DW_TAG_compile_unit
+;
+; DWO-4: .debug_types.dwo contents:
+; DWO-4: 0x: Type Unit: {{.*}} version = 0x0004, abbr_offset
+; DWO-4: 0x0017: DW_TAG_type_unit
+
+; Verify the v5 non-split headers. Type units come first.
+; All .debug_info sections are reported in one go, but the offset resets for
+; each new section.
+;
+; SINGLE-5: .debug_info contents:
+; SINGLE-5: 0x: Type Unit: {{.*}} version = 0x0005, unit_type = DW_UT_type, abbr_offset
+; SINGLE-5: 0x0018: DW_TAG_type_unit
+; SINGLE-5-NOT: contents:
+; SINGLE-5: 0x: Compile Unit: {{.*}} version = 0x0005, unit_type = DW_UT_compile, abbr_offset
+; SINGLE-5: 0x000c: DW_TAG_compile_unit
+
+; Verify the v5 split headers.
+;
+; O-5: .debug_info contents:
+; O-5: 0x: Compile Unit: {{.*}} version = 0x0005, unit_type = DW_UT_skeleton, abbr_offset
+; O-5-SAME:DWO_id = 0xccd7e58ef8bf4aa6
+; O-5: 0x0014: DW_TAG_skeleton_unit 
+;
+; DWO-5: .debug_info.dwo contents:
+; DWO-5: 0x: Type Unit: {{.*}} version = 0x0005, unit_type = DW_UT_split_type, abbr_offset
+; DWO-5: 0x0018: DW_TAG_type_unit
+; DWO-5: 0x0033: Compile Unit: {{.*}} version = 0x0005, unit_type = DW_UT_split_compile, abbr_offset
+; DWO-5-SAME:DWO_id = 0xccd7e58ef8bf4aa6
+; DWO-5: 0x0047: DW_TAG_compile_unit
+
+
+; ModuleID = 't.cpp'
+source_filename = "t.cpp"
+target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
+target triple = "wasm32-unknown-unknown-wasm"
+
+%struct.S = type { i32 }
+
+@s = global %struct.S zeroinitializer, align 4, !dbg !0
+
+!llvm.dbg.cu = !{!2}
+!llvm.module.flags = !{!10, !11}
+!llvm.ident = !{!12}
+
+!0 = 

[PATCH] D88603: [WebAssembly] Add support for DWARF type units

2020-09-30 Thread Derek Schuff via Phabricator via cfe-commits
dschuff added inline comments.



Comment at: llvm/lib/MC/MCObjectFileInfo.cpp:962
+  case Triple::Wasm:
+return Ctx->getWasmSection(Name, SectionKind::getMetadata(), utostr(Hash),
+   ~0);

I may add a couple more tests to this, but I did want to ask @sbc100 about 
this, since I'm not 100% sure at the uniqueID field is for.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88603

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


[PATCH] D88370: Emit predefined macro for wavefront size for amdgcn

2020-09-30 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added inline comments.



Comment at: clang/lib/Driver/ToolChains/AMDGPU.cpp:394-395
+  // Get the last argument of -mwavefrontsize64 or -mno-wavefrontsize64.
+  for (auto WaveArg : Args.filtered_reverse(options::OPT_mwavefrontsize64,
+options::OPT_mno_wavefrontsize64)) 
{
+if (WaveArg->getOption().getID() == options::OPT_mwavefrontsize64) {

arsenm wrote:
> yaxunl wrote:
> > arsenm wrote:
> > > Why isn't this using hasFlag?
> > > e.g. like
> > > 
> > > ```
> > > DriverArgs.hasFlag(options::OPT_fcuda_flush_denormals_to_zero,
> > >options::OPT_fno_cuda_flush_denormals_to_zero,
> > >getDefaultDenormsAreZeroForTarget(Kind)))
> > > ```
> > hasFlag always return true or false, but here we have 3 cases : no arg, 
> > last arg is wave64, last arg is no-wave64.
> hasFlag considers all of these. The features only really need to add 
> +wavefrontsze64 or not based on true or false, the rest is just noise
I have a simpler solution. will update


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

https://reviews.llvm.org/D88370

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


[PATCH] D88265: Fix comma with half vectors.

2020-09-30 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added a comment.

In D88265#2303841 , @arames wrote:

> In D88265#2302653 , @fhahn wrote:
>
>> Could you adjust the commit message to be a bit more descriptive, e.g 
>> something like `[Sema] Support Comma operator for fp16 vectors.`
>
> Done!

Oh I think you'd need to edit the revision on Phabricator (top right on this 
page, `edit revision`). But if you are fine with it I can commit the patch for 
you with the adjusted commit title.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88265

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


[PATCH] D88265: [Sema] Support Comma operator for fp16 vectors.

2020-09-30 Thread Florian Hahn via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG700e63293eea: [Sema] Support Comma operator for fp16 
vectors. (authored by arames, committed by fhahn).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88265

Files:
  clang/lib/Sema/SemaExpr.cpp
  clang/test/Sema/fp16vec-sema.c


Index: clang/test/Sema/fp16vec-sema.c
===
--- clang/test/Sema/fp16vec-sema.c
+++ clang/test/Sema/fp16vec-sema.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify %s
 
 typedef __fp16 half4 __attribute__ ((vector_size (8)));
 typedef float float4 __attribute__ ((vector_size (16)));
@@ -28,6 +28,8 @@
   sv0 = hv0 >= hv1;
   sv0 = hv0 || hv1; // expected-error{{logical expression with vector types 
'half4' (vector of 4 '__fp16' values) and 'half4' is only supported in C++}}
   sv0 = hv0 && hv1; // expected-error{{logical expression with vector types 
'half4' (vector of 4 '__fp16' values) and 'half4' is only supported in C++}}
+  hv0, 1;
+  1, hv0;
 
   // Implicit conversion between half vectors and float vectors are not 
allowed.
   hv0 = fv0; // expected-error{{assigning to}}
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -13940,9 +13940,10 @@
   // float vectors and truncating the result back to half vector. For now, we 
do
   // this only when HalfArgsAndReturn is set (that is, when the target is arm 
or
   // arm64).
-  assert(isVector(RHS.get()->getType(), Context.HalfTy) ==
- isVector(LHS.get()->getType(), Context.HalfTy) &&
- "both sides are half vectors or neither sides are");
+  assert(
+  (Opc == BO_Comma || isVector(RHS.get()->getType(), Context.HalfTy) ==
+  isVector(LHS.get()->getType(), Context.HalfTy)) 
&&
+  "both sides are half vectors or neither sides are");
   ConvertHalfVec =
   needsConversionOfHalfVec(ConvertHalfVec, Context, LHS.get(), RHS.get());
 


Index: clang/test/Sema/fp16vec-sema.c
===
--- clang/test/Sema/fp16vec-sema.c
+++ clang/test/Sema/fp16vec-sema.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify %s
 
 typedef __fp16 half4 __attribute__ ((vector_size (8)));
 typedef float float4 __attribute__ ((vector_size (16)));
@@ -28,6 +28,8 @@
   sv0 = hv0 >= hv1;
   sv0 = hv0 || hv1; // expected-error{{logical expression with vector types 'half4' (vector of 4 '__fp16' values) and 'half4' is only supported in C++}}
   sv0 = hv0 && hv1; // expected-error{{logical expression with vector types 'half4' (vector of 4 '__fp16' values) and 'half4' is only supported in C++}}
+  hv0, 1;
+  1, hv0;
 
   // Implicit conversion between half vectors and float vectors are not allowed.
   hv0 = fv0; // expected-error{{assigning to}}
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -13940,9 +13940,10 @@
   // float vectors and truncating the result back to half vector. For now, we do
   // this only when HalfArgsAndReturn is set (that is, when the target is arm or
   // arm64).
-  assert(isVector(RHS.get()->getType(), Context.HalfTy) ==
- isVector(LHS.get()->getType(), Context.HalfTy) &&
- "both sides are half vectors or neither sides are");
+  assert(
+  (Opc == BO_Comma || isVector(RHS.get()->getType(), Context.HalfTy) ==
+  isVector(LHS.get()->getType(), Context.HalfTy)) &&
+  "both sides are half vectors or neither sides are");
   ConvertHalfVec =
   needsConversionOfHalfVec(ConvertHalfVec, Context, LHS.get(), RHS.get());
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] bdc8529 - Revert "[OpenMP] Add Error Handling for Conflicting Pointer Sizes for Target Offload"

2020-09-30 Thread via cfe-commits

Author: Joseph Huber
Date: 2020-09-30T15:08:22-04:00
New Revision: bdc85292fb0f2a3965c8c65f9461d285b04841ed

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

LOG: Revert "[OpenMP] Add Error Handling for Conflicting Pointer Sizes for 
Target Offload"

Failing tests on Arm due to the tests automatically populating
incomatible pointer width architectures. Reverting until the tests are
updated. Failing tests:

OpenMP/distribute_parallel_for_num_threads_codegen.cpp
OpenMP/distribute_parallel_for_if_codegen.cpp
OpenMP/distribute_parallel_for_simd_if_codegen.cpp
OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp
OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp
OpenMP/teams_distribute_parallel_for_if_codegen.cpp
OpenMP/teams_distribute_parallel_for_simd_if_codegen.cpp

This reverts commit 9d2378b59150f6f1cb5c9cf42ea06b0bb57029a1.

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp

Removed: 
clang/test/OpenMP/target_incompatible_architecture_messages.cpp



diff  --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td 
b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 29bc19e5a84e..3bf1bb19b7ae 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -253,7 +253,6 @@ def err_drv_optimization_remark_format : Error<
   "unknown remark serializer format: '%0'">;
 def err_drv_no_neon_modifier : Error<"[no]neon is not accepted as modifier, 
please use [no]simd instead">;
 def err_drv_invalid_omp_target : Error<"OpenMP target is invalid: '%0'">;
-def err_drv_incompatible_omp_arch : Error<"OpenMP target architecture '%0' 
pointer size is incompatible with host '%1'">;
 def err_drv_omp_host_ir_file_not_found : Error<
   "The provided host compiler IR file '%0' is required to generate code for 
OpenMP target regions but cannot be found.">;
 def err_drv_omp_host_target_not_supported : Error<

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index bbdf0e3be7ae..b402f53cc765 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -3206,14 +3206,6 @@ static void ParseLangArgs(LangOptions , ArgList 
, InputKind IK,
 TT.getArch() == llvm::Triple::x86 ||
 TT.getArch() == llvm::Triple::x86_64))
 Diags.Report(diag::err_drv_invalid_omp_target) << A->getValue(i);
-  else if ((T.isArch64Bit() && TT.isArch32Bit()) ||
-   (T.isArch64Bit() && TT.isArch16Bit()) ||
-   (T.isArch32Bit() && TT.isArch64Bit()) ||
-   (T.isArch32Bit() && TT.isArch16Bit()) ||
-   (T.isArch16Bit() && TT.isArch32Bit()) ||
-   (T.isArch16Bit() && TT.isArch64Bit()))
-Diags.Report(diag::err_drv_incompatible_omp_arch)
-<< A->getValue(i) << T.str();
   else
 Opts.OMPTargetTriples.push_back(TT);
 }

diff  --git 
a/clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp 
b/clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
index 031c7b6c778e..aefe00f1cadf 100644
--- a/clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
+++ b/clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
@@ -1,8 +1,8 @@
 // RUN: %clang_cc1 -x c++ -O1 -disable-llvm-optzns -verify -fopenmp 
-internal-isystem %S/../Headers/Inputs/include -internal-isystem 
%S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h 
-triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda 
-emit-llvm-bc %s -o %t-ppc-host.bc
 // RUN: %clang_cc1 -x c++ -O1 -disable-llvm-optzns -verify -fopenmp 
-internal-isystem %S/../Headers/Inputs/include -internal-isystem 
%S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h 
-triple nvptx64-unknown-unknown -aux-triple powerpc64le-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 -x c++ -O1 -disable-llvm-optzns -verify -fopenmp 
-internal-isystem %S/../Headers/Inputs/include -internal-isystem 
%S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h 
-triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc 
%s -o %t-x86-host.bc
-// RUN: %clang_cc1 -x c++ -O1 -disable-llvm-optzns -verify -fopenmp 
-internal-isystem %S/../Headers/Inputs/include -internal-isystem 
%S/../../lib/Headers/openmp_wrappers -include 

[PATCH] D88370: Emit predefined macro for wavefront size for amdgcn

2020-09-30 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 295312.
yaxunl added a comment.

simpler code for handling multiple wave64 options


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

https://reviews.llvm.org/D88370

Files:
  clang/lib/Basic/Targets/AMDGPU.cpp
  clang/lib/Basic/Targets/AMDGPU.h
  clang/lib/Driver/ToolChains/AMDGPU.cpp
  clang/test/Driver/amdgpu-features.c
  clang/test/Driver/amdgpu-macros.cl
  clang/test/Driver/hip-macros.hip
  clang/test/Driver/hip-toolchain-features.hip

Index: clang/test/Driver/hip-toolchain-features.hip
===
--- clang/test/Driver/hip-toolchain-features.hip
+++ clang/test/Driver/hip-toolchain-features.hip
@@ -42,3 +42,12 @@
 // DUP-SAME: "-target-feature" "-wavefrontsize64"
 // DUP-SAME: "-target-feature" "+cumode"
 // DUP: {{.*}}lld{{.*}} "-plugin-opt=-mattr=-wavefrontsize16,+wavefrontsize32,-wavefrontsize64,+cumode"
+
+// RUN: %clang -### -target x86_64-linux-gnu -fgpu-rdc -nogpulib \
+// RUN:   --cuda-gpu-arch=gfx1010 %s \
+// RUN:   -mno-wavefrontsize64 -mwavefrontsize64 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=WAVE64
+// WAVE64: {{.*}}clang{{.*}} "-target-feature" "-wavefrontsize16"
+// WAVE64-SAME: "-target-feature" "-wavefrontsize32"
+// WAVE64-SAME: "-target-feature" "+wavefrontsize64"
+// WAVE64: {{.*}}lld{{.*}} "-plugin-opt=-mattr=-wavefrontsize16,-wavefrontsize32,+wavefrontsize64"
Index: clang/test/Driver/hip-macros.hip
===
--- /dev/null
+++ clang/test/Driver/hip-macros.hip
@@ -0,0 +1,20 @@
+// RUN: %clang -E -dM --offload-arch=gfx906 -mwavefrontsize64 \
+// RUN:   --cuda-device-only -nogpuinc -nogpulib \
+// RUN:   %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
+// RUN: %clang -E -dM --offload-arch=gfx1010 -mwavefrontsize64 \
+// RUN:   --cuda-device-only -nogpuinc -nogpulib \
+// RUN:   %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
+// RUN: %clang -E -dM --offload-arch=gfx906 -mwavefrontsize64 \
+// RUN:   --cuda-device-only -nogpuinc -nogpulib \
+// RUN:   -mno-wavefrontsize64 %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
+// RUN: %clang -E -dM --offload-arch=gfx1010 -mwavefrontsize64 \
+// RUN:   --cuda-device-only -nogpuinc -nogpulib \
+// RUN:   -mno-wavefrontsize64 %s 2>&1 | FileCheck --check-prefixes=WAVE32 %s
+// RUN: %clang -E -dM --offload-arch=gfx906 -mno-wavefrontsize64 \
+// RUN:   --cuda-device-only -nogpuinc -nogpulib \
+// RUN:   -mwavefrontsize64 %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
+// RUN: %clang -E -dM --offload-arch=gfx1010 -mno-wavefrontsize64 \
+// RUN:   --cuda-device-only -nogpuinc -nogpulib \
+// RUN:   -mwavefrontsize64 %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
+// WAVE64-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// WAVE32-DAG: #define __AMDGCN_WAVEFRONT_SIZE 32
Index: clang/test/Driver/amdgpu-macros.cl
===
--- clang/test/Driver/amdgpu-macros.cl
+++ clang/test/Driver/amdgpu-macros.cl
@@ -346,4 +346,42 @@
 // GFX1011-DAG: #define __amdgcn_processor__ "gfx1011"
 // GFX1012-DAG: #define __amdgcn_processor__ "gfx1012"
 // GFX1030-DAG: #define __amdgcn_processor__ "gfx1030"
-// GFX1031-DAG: #define __amdgcn_processor__ "gfx1031"
\ No newline at end of file
+// GFX1031-DAG: #define __amdgcn_processor__ "gfx1031"
+
+// GFX600-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX601-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX700-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX701-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX702-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX703-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX704-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX801-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX802-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX803-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX810-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX900-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX902-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX904-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX906-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX908-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX909-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
+// GFX1010-DAG: #define __AMDGCN_WAVEFRONT_SIZE 32
+// GFX1011-DAG: #define __AMDGCN_WAVEFRONT_SIZE 32
+// GFX1012-DAG: #define __AMDGCN_WAVEFRONT_SIZE 32
+// GFX1030-DAG: #define __AMDGCN_WAVEFRONT_SIZE 32
+// GFX1031-DAG: #define __AMDGCN_WAVEFRONT_SIZE 32
+
+// RUN: %clang -E -dM -target amdgcn -mcpu=gfx906 -mwavefrontsize64 \
+// RUN:   %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
+// RUN: %clang -E -dM -target amdgcn -mcpu=gfx1010 -mwavefrontsize64 \
+// RUN:   %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
+// RUN: %clang -E -dM -target amdgcn -mcpu=gfx906 -mwavefrontsize64 \
+// RUN:   -mno-wavefrontsize64 %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
+// RUN: %clang -E -dM -target amdgcn -mcpu=gfx1010 -mwavefrontsize64 \
+// RUN:   -mno-wavefrontsize64 

[PATCH] D86743: [analyzer] Ignore VLASizeChecker case that could cause crash

2020-09-30 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment.

@vabridgers Please try to apply D69726  and 
check whether it solves this crash!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86743

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


[PATCH] D88430: [OpenMP] Replace OpenMP RTL Functions With OMPIRBuilder and OMPKinds.def

2020-09-30 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 updated this revision to Diff 295343.
jhuber6 added a comment.

Forgot to add one of the test changes from D88594 
 as it makes this one fail too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88430

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.h
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/test/Transforms/OpenMP/add_attributes.ll

Index: llvm/test/Transforms/OpenMP/add_attributes.ll
===
--- llvm/test/Transforms/OpenMP/add_attributes.ll
+++ llvm/test/Transforms/OpenMP/add_attributes.ll
@@ -888,313 +888,313 @@
 ; CHECK: declare dso_local i32 @omp_pause_resource_all(i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare dso_local i32 @omp_get_supported_active_levels() #0
+; CHECK-NEXT: declare dso_local i32 @omp_get_supported_active_levels()
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_barrier(%struct.ident_t*, i32) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare void @__kmpc_barrier(%struct.ident_t*, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_cancel(%struct.ident_t*, i32, i32) #0
+; CHECK-NEXT: declare i32 @__kmpc_cancel(%struct.ident_t*, i32, i32)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_cancel_barrier(%struct.ident_t*, i32) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare i32 @__kmpc_cancel_barrier(%struct.ident_t*, i32)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_flush(%struct.ident_t*) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare void @__kmpc_flush(%struct.ident_t*)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_global_thread_num(%struct.ident_t*) #0
+; CHECK-NEXT: declare i32 @__kmpc_global_thread_num(%struct.ident_t*)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_fork_call(%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) #0
+; CHECK-NEXT: declare void @__kmpc_fork_call(%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_omp_taskwait(%struct.ident_t*, i32) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare i32 @__kmpc_omp_taskwait(%struct.ident_t*, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_omp_taskyield(%struct.ident_t*, i32, i32) #0
+; CHECK-NEXT: declare i32 @__kmpc_omp_taskyield(%struct.ident_t*, i32, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_push_num_threads(%struct.ident_t*, i32, i32) #0
+; CHECK-NEXT: declare void @__kmpc_push_num_threads(%struct.ident_t*, i32, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_push_proc_bind(%struct.ident_t*, i32, i32) #0
+; CHECK-NEXT: declare void @__kmpc_push_proc_bind(%struct.ident_t*, i32, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_serialized_parallel(%struct.ident_t*, i32) #0
+; CHECK-NEXT: declare void @__kmpc_serialized_parallel(%struct.ident_t*, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_end_serialized_parallel(%struct.ident_t*, i32) #0
+; CHECK-NEXT: declare void @__kmpc_end_serialized_parallel(%struct.ident_t*, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_master(%struct.ident_t*, i32) #0
+; CHECK-NEXT: declare i32 @__kmpc_master(%struct.ident_t*, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_end_master(%struct.ident_t*, i32) #0
+; CHECK-NEXT: declare void @__kmpc_end_master(%struct.ident_t*, i32)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_critical(%struct.ident_t*, i32, [8 x i32]*) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare void @__kmpc_critical(%struct.ident_t*, i32, [8 x i32]*)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_critical_with_hint(%struct.ident_t*, i32, [8 x i32]*, i32) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare void @__kmpc_critical_with_hint(%struct.ident_t*, i32, [8 x i32]*, i32)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_end_critical(%struct.ident_t*, i32, [8 x i32]*) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare void @__kmpc_end_critical(%struct.ident_t*, i32, [8 x i32]*)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_begin(%struct.ident_t*, i32) #0
+; CHECK-NEXT: declare void @__kmpc_begin(%struct.ident_t*, i32)
 
 

[clang] 187686b - [CodeGen] add test for NAN creation; NFC

2020-09-30 Thread Sanjay Patel via cfe-commits

Author: Sanjay Patel
Date: 2020-09-30T13:22:12-04:00
New Revision: 187686bea3878c0bf2b150d784e7eab223434e25

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

LOG: [CodeGen] add test for NAN creation; NFC

This goes with the APFloat change proposed in
D88238.
This is copied from the MIPS-specific test in
builtin-nan-legacy.c to verify that the normal
behavior is correct on other targets without the
complication of an inverted quiet bit.

Added: 
clang/test/CodeGen/builtin-nan-exception.c

Modified: 


Removed: 




diff  --git a/clang/test/CodeGen/builtin-nan-exception.c 
b/clang/test/CodeGen/builtin-nan-exception.c
new file mode 100644
index ..2acf0c4390ec
--- /dev/null
+++ b/clang/test/CodeGen/builtin-nan-exception.c
@@ -0,0 +1,23 @@
+// RUN: %clang -target aarch64 -emit-llvm -S %s -o - | FileCheck %s
+// RUN: %clang -target lanai -emit-llvm -S %s -o - | FileCheck %s
+// RUN: %clang -target riscv64 -emit-llvm -S %s -o - | FileCheck %s
+// RUN: %clang -target x86_64 -emit-llvm -S %s -o - | FileCheck %s
+
+// Run a variety of targets to ensure there's no target-based 
diff erence.
+
+// The builtin always produces a 64-bit (double).
+// An SNaN with no payload is formed by setting the bit after the
+// the quiet bit (MSB of the significand).
+
+// CHECK: float 0x7FF8, float 0x7FF4
+// CHECK: double 0x7FF8, double 0x7FF4
+
+float f[] = {
+  __builtin_nan(""),
+  __builtin_nans(""),
+};
+
+double d[] = {
+  __builtin_nan(""),
+  __builtin_nans(""),
+};



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


[clang] 700e632 - [Sema] Support Comma operator for fp16 vectors.

2020-09-30 Thread Florian Hahn via cfe-commits

Author: Alexandre Rames
Date: 2020-09-30T18:23:09+01:00
New Revision: 700e63293eea4a23440f300b1e9125ca2e80c6e9

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

LOG: [Sema] Support Comma operator for fp16 vectors.

The current half vector was enforcing an assert expecting
 "(LHS is half vector) == (RHS is half vector)"
for comma.

Reviewed By: ahatanak, fhahn

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

Added: 


Modified: 
clang/lib/Sema/SemaExpr.cpp
clang/test/Sema/fp16vec-sema.c

Removed: 




diff  --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index a7c076657fb5..22840dd3dfe3 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -13940,9 +13940,10 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation 
OpLoc,
   // float vectors and truncating the result back to half vector. For now, we 
do
   // this only when HalfArgsAndReturn is set (that is, when the target is arm 
or
   // arm64).
-  assert(isVector(RHS.get()->getType(), Context.HalfTy) ==
- isVector(LHS.get()->getType(), Context.HalfTy) &&
- "both sides are half vectors or neither sides are");
+  assert(
+  (Opc == BO_Comma || isVector(RHS.get()->getType(), Context.HalfTy) ==
+  isVector(LHS.get()->getType(), Context.HalfTy)) 
&&
+  "both sides are half vectors or neither sides are");
   ConvertHalfVec =
   needsConversionOfHalfVec(ConvertHalfVec, Context, LHS.get(), RHS.get());
 

diff  --git a/clang/test/Sema/fp16vec-sema.c b/clang/test/Sema/fp16vec-sema.c
index aefb5f86a14b..f61ad4c91e89 100644
--- a/clang/test/Sema/fp16vec-sema.c
+++ b/clang/test/Sema/fp16vec-sema.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify %s
 
 typedef __fp16 half4 __attribute__ ((vector_size (8)));
 typedef float float4 __attribute__ ((vector_size (16)));
@@ -28,6 +28,8 @@ void testFP16Vec(int c) {
   sv0 = hv0 >= hv1;
   sv0 = hv0 || hv1; // expected-error{{logical expression with vector types 
'half4' (vector of 4 '__fp16' values) and 'half4' is only supported in C++}}
   sv0 = hv0 && hv1; // expected-error{{logical expression with vector types 
'half4' (vector of 4 '__fp16' values) and 'half4' is only supported in C++}}
+  hv0, 1;
+  1, hv0;
 
   // Implicit conversion between half vectors and float vectors are not 
allowed.
   hv0 = fv0; // expected-error{{assigning to}}



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


[clang] 90eaedd - [OpenMP] Replace OpenMP RTL Functions With OMPIRBuilder and OMPKinds.def

2020-09-30 Thread Joseph Huber via cfe-commits

Author: Joseph Huber
Date: 2020-09-30T14:00:01-04:00
New Revision: 90eaedda9b8ef46e2c0c1b8bce33e98a3adbb68c

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

LOG: [OpenMP] Replace OpenMP RTL Functions With OMPIRBuilder and OMPKinds.def

Summary:
Replace the OpenMP Runtime Library functions used in CGOpenMPRuntimeGPU
for OpenMP device code generation with ones in OMPKinds.def and use
OMPIRBuilder for generating runtime calls. This allows us to consolidate
more OpenMP code generation into the OMPIRBuilder. This patch also
invalidates specifying target architectures with conflicting pointer
sizes.

Reviewers: jdoerfert

Subscribers: aaron.ballman cfe-commits guansong llvm-commits sstefan1 yaxunl

Tags: #OpenMP #Clang #LLVM

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

Added: 


Modified: 
clang/lib/CodeGen/CGOpenMPRuntime.h
clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/test/OpenMP/nvptx_parallel_codegen.cpp
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
llvm/test/Transforms/OpenMP/add_attributes.ll

Removed: 




diff  --git a/clang/lib/CodeGen/CGOpenMPRuntime.h 
b/clang/lib/CodeGen/CGOpenMPRuntime.h
index 41fa9f5345aa..e39c2e11390e 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.h
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.h
@@ -306,6 +306,9 @@ class CGOpenMPRuntime {
   CodeGenModule 
   StringRef FirstSeparator, Separator;
 
+  /// An OpenMP-IR-Builder instance.
+  llvm::OpenMPIRBuilder OMPBuilder;
+
   /// Constructor allowing to redefine the name separator for the variables.
   explicit CGOpenMPRuntime(CodeGenModule , StringRef FirstSeparator,
StringRef Separator);
@@ -386,8 +389,6 @@ class CGOpenMPRuntime {
   llvm::Value *getCriticalRegionLock(StringRef CriticalName);
 
 private:
-  /// An OpenMP-IR-Builder instance.
-  llvm::OpenMPIRBuilder OMPBuilder;
 
   /// Map for SourceLocation and OpenMP runtime library debug locations.
   typedef llvm::DenseMap OpenMPDebugLocMapTy;

diff  --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
index d9ef6c2a1078..dbd24d33cc37 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -28,96 +28,6 @@ using namespace CodeGen;
 using namespace llvm::omp;
 
 namespace {
-enum OpenMPRTLFunctionNVPTX {
-  /// Call to void __kmpc_kernel_init(kmp_int32 thread_limit,
-  /// int16_t RequiresOMPRuntime);
-  OMPRTL_NVPTX__kmpc_kernel_init,
-  /// Call to void __kmpc_kernel_deinit(int16_t IsOMPRuntimeInitialized);
-  OMPRTL_NVPTX__kmpc_kernel_deinit,
-  /// Call to void __kmpc_spmd_kernel_init(kmp_int32 thread_limit,
-  /// int16_t RequiresOMPRuntime, int16_t RequiresDataSharing);
-  OMPRTL_NVPTX__kmpc_spmd_kernel_init,
-  /// Call to void __kmpc_spmd_kernel_deinit_v2(int16_t RequiresOMPRuntime);
-  OMPRTL_NVPTX__kmpc_spmd_kernel_deinit_v2,
-  /// Call to void __kmpc_kernel_prepare_parallel(void
-  /// *outlined_function);
-  OMPRTL_NVPTX__kmpc_kernel_prepare_parallel,
-  /// Call to bool __kmpc_kernel_parallel(void **outlined_function);
-  OMPRTL_NVPTX__kmpc_kernel_parallel,
-  /// Call to void __kmpc_kernel_end_parallel();
-  OMPRTL_NVPTX__kmpc_kernel_end_parallel,
-  /// Call to void __kmpc_serialized_parallel(ident_t *loc, kmp_int32
-  /// global_tid);
-  OMPRTL_NVPTX__kmpc_serialized_parallel,
-  /// Call to void __kmpc_end_serialized_parallel(ident_t *loc, kmp_int32
-  /// global_tid);
-  OMPRTL_NVPTX__kmpc_end_serialized_parallel,
-  /// Call to int32_t __kmpc_shuffle_int32(int32_t element,
-  /// int16_t lane_offset, int16_t warp_size);
-  OMPRTL_NVPTX__kmpc_shuffle_int32,
-  /// Call to int64_t __kmpc_shuffle_int64(int64_t element,
-  /// int16_t lane_offset, int16_t warp_size);
-  OMPRTL_NVPTX__kmpc_shuffle_int64,
-  /// Call to __kmpc_nvptx_parallel_reduce_nowait_v2(ident_t *loc, kmp_int32
-  /// global_tid, kmp_int32 num_vars, size_t reduce_size, void* reduce_data,
-  /// void (*kmp_ShuffleReductFctPtr)(void *rhsData, int16_t lane_id, int16_t
-  /// lane_offset, int16_t shortCircuit),
-  /// void (*kmp_InterWarpCopyFctPtr)(void* src, int32_t warp_num));
-  OMPRTL_NVPTX__kmpc_nvptx_parallel_reduce_nowait_v2,
-  /// Call to __kmpc_nvptx_teams_reduce_nowait_v2(ident_t *loc, kmp_int32
-  /// global_tid, void *global_buffer, int32_t num_of_records, void*
-  /// reduce_data,
-  /// void (*kmp_ShuffleReductFctPtr)(void *rhsData, int16_t lane_id, int16_t
-  /// lane_offset, int16_t shortCircuit),
-  /// void (*kmp_InterWarpCopyFctPtr)(void* src, int32_t warp_num), void
-  /// (*kmp_ListToGlobalCpyFctPtr)(void *buffer, int idx, void *reduce_data),
-  /// void (*kmp_GlobalToListCpyFctPtr)(void *buffer, int idx,
-  /// void *reduce_data), void 

[clang] 81921eb - [CodeGen] improve coverage for float (32-bit) type of NAN; NFC

2020-09-30 Thread Sanjay Patel via cfe-commits

Author: Sanjay Patel
Date: 2020-09-30T15:10:25-04:00
New Revision: 81921ebc430536ae5718da70a54328c790c8ae19

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

LOG: [CodeGen] improve coverage for float (32-bit) type of NAN; NFC

Goes with D88238

Added: 


Modified: 
clang/test/CodeGen/builtin-nan-exception.c

Removed: 




diff  --git a/clang/test/CodeGen/builtin-nan-exception.c 
b/clang/test/CodeGen/builtin-nan-exception.c
index 2acf0c4390ec..a0de25e52ebe 100644
--- a/clang/test/CodeGen/builtin-nan-exception.c
+++ b/clang/test/CodeGen/builtin-nan-exception.c
@@ -5,18 +5,28 @@
 
 // Run a variety of targets to ensure there's no target-based 
diff erence.
 
-// The builtin always produces a 64-bit (double).
 // An SNaN with no payload is formed by setting the bit after the
 // the quiet bit (MSB of the significand).
 
 // CHECK: float 0x7FF8, float 0x7FF4
-// CHECK: double 0x7FF8, double 0x7FF4
 
 float f[] = {
+  __builtin_nanf(""),
+  __builtin_nansf(""),
+};
+
+
+// Doubles are created and converted to floats.
+
+// CHECK: float 0x7FF8, float 0x7FF4
+
+float converted_to_float[] = {
   __builtin_nan(""),
   __builtin_nans(""),
 };
 
+// CHECK: double 0x7FF8, double 0x7FF4
+
 double d[] = {
   __builtin_nan(""),
   __builtin_nans(""),



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


[PATCH] D88138: [NPM] Add target specific hook to add passes for New Pass Manager

2020-09-30 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

In D88138#2304243 , @quic_aankit wrote:

> @aeubanks Thanks for the review. Can you also commit the patch on my behalf?

Committed in ce5379f0f0675592fd10a522009fd5b1561ca72b 
.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88138

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


[PATCH] D88265: Fix comma with half vectors.

2020-09-30 Thread Alexandre Rames via Phabricator via cfe-commits
arames added a comment.

In D88265#2302653 , @fhahn wrote:

> Could you adjust the commit message to be a bit more descriptive, e.g 
> something like `[Sema] Support Comma operator for fp16 vectors.`

Done!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88265

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


[PATCH] D88265: Fix comma with half vectors.

2020-09-30 Thread Alexandre Rames via Phabricator via cfe-commits
arames updated this revision to Diff 295316.
arames added a comment.

Update commit message.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88265

Files:
  clang/lib/Sema/SemaExpr.cpp
  clang/test/Sema/fp16vec-sema.c


Index: clang/test/Sema/fp16vec-sema.c
===
--- clang/test/Sema/fp16vec-sema.c
+++ clang/test/Sema/fp16vec-sema.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify %s
 
 typedef __fp16 half4 __attribute__ ((vector_size (8)));
 typedef float float4 __attribute__ ((vector_size (16)));
@@ -28,6 +28,8 @@
   sv0 = hv0 >= hv1;
   sv0 = hv0 || hv1; // expected-error{{logical expression with vector types 
'half4' (vector of 4 '__fp16' values) and 'half4' is only supported in C++}}
   sv0 = hv0 && hv1; // expected-error{{logical expression with vector types 
'half4' (vector of 4 '__fp16' values) and 'half4' is only supported in C++}}
+  hv0, 1;
+  1, hv0;
 
   // Implicit conversion between half vectors and float vectors are not 
allowed.
   hv0 = fv0; // expected-error{{assigning to}}
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -13933,9 +13933,10 @@
   // float vectors and truncating the result back to half vector. For now, we 
do
   // this only when HalfArgsAndReturn is set (that is, when the target is arm 
or
   // arm64).
-  assert(isVector(RHS.get()->getType(), Context.HalfTy) ==
- isVector(LHS.get()->getType(), Context.HalfTy) &&
- "both sides are half vectors or neither sides are");
+  assert(
+  (Opc == BO_Comma || isVector(RHS.get()->getType(), Context.HalfTy) ==
+  isVector(LHS.get()->getType(), Context.HalfTy)) 
&&
+  "both sides are half vectors or neither sides are");
   ConvertHalfVec =
   needsConversionOfHalfVec(ConvertHalfVec, Context, LHS.get(), RHS.get());
 


Index: clang/test/Sema/fp16vec-sema.c
===
--- clang/test/Sema/fp16vec-sema.c
+++ clang/test/Sema/fp16vec-sema.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify %s
 
 typedef __fp16 half4 __attribute__ ((vector_size (8)));
 typedef float float4 __attribute__ ((vector_size (16)));
@@ -28,6 +28,8 @@
   sv0 = hv0 >= hv1;
   sv0 = hv0 || hv1; // expected-error{{logical expression with vector types 'half4' (vector of 4 '__fp16' values) and 'half4' is only supported in C++}}
   sv0 = hv0 && hv1; // expected-error{{logical expression with vector types 'half4' (vector of 4 '__fp16' values) and 'half4' is only supported in C++}}
+  hv0, 1;
+  1, hv0;
 
   // Implicit conversion between half vectors and float vectors are not allowed.
   hv0 = fv0; // expected-error{{assigning to}}
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -13933,9 +13933,10 @@
   // float vectors and truncating the result back to half vector. For now, we do
   // this only when HalfArgsAndReturn is set (that is, when the target is arm or
   // arm64).
-  assert(isVector(RHS.get()->getType(), Context.HalfTy) ==
- isVector(LHS.get()->getType(), Context.HalfTy) &&
- "both sides are half vectors or neither sides are");
+  assert(
+  (Opc == BO_Comma || isVector(RHS.get()->getType(), Context.HalfTy) ==
+  isVector(LHS.get()->getType(), Context.HalfTy)) &&
+  "both sides are half vectors or neither sides are");
   ConvertHalfVec =
   needsConversionOfHalfVec(ConvertHalfVec, Context, LHS.get(), RHS.get());
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D88557: [HIP] Add option --gpu-instrument-lib=

2020-09-30 Thread Artem Belevich via Phabricator via cfe-commits
tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.

Perhaps we should start thinking of shipping some of that bitcode along with 
clang. 
Then the instrumentation library could be linked with automatically by the 
driver when `-finstrument` is specified.
We already need bitcode for the math library for both NVPTX and AMDGPU and will 
likely need more for other things that depend on things that are standard on 
the host.


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

https://reviews.llvm.org/D88557

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


[PATCH] D86743: [analyzer] Ignore VLASizeChecker case that could cause crash

2020-09-30 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware requested changes to this revision.
baloghadamsoftware added a comment.
This revision now requires changes to proceed.

In D86743#2303922 , @NoQ wrote:

> One slightly redeeming thing about this crash is that it's assertion-only. 
> When built without assertions clang doesn't crash and this patch doesn't 
> really change its behavior (adding transition to a null state is equivalent 
> to adding no transitions at all). This means that the assertion did its job 
> and notified us of the serious issue but simply removing the assertion 
> doesn't bring *that* much benefit and we can probably afford to wait for a 
> more solid fix.

Yes, that is right. `CheckerContext::addTransition()` accepts `nullptr`, thus 
with assertions disabled it does exactly what this patch does. Thus I think 
that this patch could be abandoned now, and if the bug is not exactly the same 
as 28450  then a new bug report 
should be filed in //BugZilla//. And maybe the review on D69726 
 could be continued if that is part of the 
proper solution you suggested.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86743

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


[PATCH] D88557: [HIP] Add option --gpu-instrument-lib=

2020-09-30 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

In D88557#2303891 , @tra wrote:

> Perhaps we should start thinking of shipping some of that bitcode along with 
> clang. 
> Then the instrumentation library could be linked with automatically by the 
> driver when `-finstrument` is specified.
> We already need bitcode for the math library for both NVPTX and AMDGPU and 
> will likely need more for other things that depend on things that are 
> standard on the host.

Right


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

https://reviews.llvm.org/D88557

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


[PATCH] D88265: [Sema] Support Comma operator for fp16 vectors.

2020-09-30 Thread Alexandre Rames via Phabricator via cfe-commits
arames added a comment.



> Oh I think you'd need to edit the revision on Phabricator (top right on this 
> page, `edit revision`). But if you are fine with it I can commit the patch 
> for you with the adjusted commit title.

Done !
Thanks for your help !


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88265

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


[PATCH] D88594: [OpenMP] Add Error Handling for Conflicting Pointer Sizes for Target Offload

2020-09-30 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert accepted this revision.
jdoerfert 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/D88594/new/

https://reviews.llvm.org/D88594

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


[clang] 9d2378b - [OpenMP] Add Error Handling for Conflicting Pointer Sizes for Target Offload

2020-09-30 Thread via cfe-commits

Author: Joseph Huber
Date: 2020-09-30T13:58:24-04:00
New Revision: 9d2378b59150f6f1cb5c9cf42ea06b0bb57029a1

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

LOG: [OpenMP] Add Error Handling for Conflicting Pointer Sizes for Target 
Offload

Summary:
This patch adds an error to Clang that detects if OpenMP offloading is used
between two architectures with incompatible pointer sizes. This ensures that
the data mapping can be done correctly and solves an issue in code generation
generating the wrong size pointer.

Reviewer: jdoerfert

Subscribers:

Tags: #OpenMP #Clang

Differential Revision:

Added: 
clang/test/OpenMP/target_incompatible_architecture_messages.cpp

Modified: 
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td 
b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 3bf1bb19b7ae..29bc19e5a84e 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -253,6 +253,7 @@ def err_drv_optimization_remark_format : Error<
   "unknown remark serializer format: '%0'">;
 def err_drv_no_neon_modifier : Error<"[no]neon is not accepted as modifier, 
please use [no]simd instead">;
 def err_drv_invalid_omp_target : Error<"OpenMP target is invalid: '%0'">;
+def err_drv_incompatible_omp_arch : Error<"OpenMP target architecture '%0' 
pointer size is incompatible with host '%1'">;
 def err_drv_omp_host_ir_file_not_found : Error<
   "The provided host compiler IR file '%0' is required to generate code for 
OpenMP target regions but cannot be found.">;
 def err_drv_omp_host_target_not_supported : Error<

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index b402f53cc765..bbdf0e3be7ae 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -3206,6 +3206,14 @@ static void ParseLangArgs(LangOptions , ArgList 
, InputKind IK,
 TT.getArch() == llvm::Triple::x86 ||
 TT.getArch() == llvm::Triple::x86_64))
 Diags.Report(diag::err_drv_invalid_omp_target) << A->getValue(i);
+  else if ((T.isArch64Bit() && TT.isArch32Bit()) ||
+   (T.isArch64Bit() && TT.isArch16Bit()) ||
+   (T.isArch32Bit() && TT.isArch64Bit()) ||
+   (T.isArch32Bit() && TT.isArch16Bit()) ||
+   (T.isArch16Bit() && TT.isArch32Bit()) ||
+   (T.isArch16Bit() && TT.isArch64Bit()))
+Diags.Report(diag::err_drv_incompatible_omp_arch)
+<< A->getValue(i) << T.str();
   else
 Opts.OMPTargetTriples.push_back(TT);
 }

diff  --git 
a/clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp 
b/clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
index aefe00f1cadf..031c7b6c778e 100644
--- a/clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
+++ b/clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
@@ -1,8 +1,8 @@
 // RUN: %clang_cc1 -x c++ -O1 -disable-llvm-optzns -verify -fopenmp 
-internal-isystem %S/../Headers/Inputs/include -internal-isystem 
%S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h 
-triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda 
-emit-llvm-bc %s -o %t-ppc-host.bc
 // RUN: %clang_cc1 -x c++ -O1 -disable-llvm-optzns -verify -fopenmp 
-internal-isystem %S/../Headers/Inputs/include -internal-isystem 
%S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h 
-triple nvptx64-unknown-unknown -aux-triple powerpc64le-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 -x c++ -O1 -disable-llvm-optzns -verify -fopenmp 
-internal-isystem %S/../Headers/Inputs/include -internal-isystem 
%S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h 
-triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc 
%s -o %t-x86-host.bc
-// RUN: %clang_cc1 -x c++ -O1 -disable-llvm-optzns -verify -fopenmp 
-internal-isystem %S/../Headers/Inputs/include -internal-isystem 
%S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h 
-triple nvptx-unknown-unknown -aux-triple powerpc64le-unknown-unknown 
-fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device 
-fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s
-// RUN: %clang_cc1 -x c++ -O1 -disable-llvm-optzns -verify -fopenmp 
-internal-isystem 

[PATCH] D86671: [clang-tidy] Add new case type to check variables with Hungarian notation

2020-09-30 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment.

Not strictly relevant here, but this does open up the idea of enforcing the 
style where an enum constant is prefixed by the initials of the enum name.




Comment at: 
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-hungarian-notation.cpp:25
+// RUN: {key: readability-identifier-naming.FunctionCase   , value: 
CamelCase },   \
+// RUN: {key: readability-identifier-naming.ClassCase  , value: 
szHungarianNotation }, \
+// RUN: {key: readability-identifier-naming.TypedefCase, value: 
szHungarianNotation }, \

Class names shouldn't use hungarian notation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86671

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


[PATCH] D88477: [analyzer] Overwrite cast type in getBinding only if that was null originally

2020-09-30 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment.

I'm getting lost :D

In D88477#2304230 , @NoQ wrote:

> And I believe that this part is already incorrect. Like, regardless of how we 
> do the dereference (the implicit lvalue-to-rvalue cast), or *whether* we do 
> it at all (nobody guarantees we'll ever do that!), the part of the static 
> analyzer that computes the lvalue `**b` has to work correctly. As of now it 
> computes an lvalue of incorrect type (currently it's `unsigned char` but it 
> has to be `char *`).

Are you implying that when we evaluate the assignment to the lvalue (line 
`#1`), we should have cast the stored value to the static type before binding 
in the `RegionStore`?

Doesn't it contradict with your previous statement:

In D77062#2298748 , @NoQ wrote:

> The contract of RegionStore with respect to type punning is that it stores 
> the value //as written//, even if its type doesn't match the storage type, 
> but then it casts the value to the correct type upon reading by invoking 
> `CastRetrievedVal()` on it. That's where the fix should probably be.



---

Or after evaluating the first dereference - but before evaluating the second - 
should we cast the lvalue to `char**` and only then do the LValueToRValue 
conversion?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88477

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


[clang] ae4c400 - [NFC] Fix spacing in clang/test/Driver/aix-ld.c

2020-09-30 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-09-30T17:01:32-04:00
New Revision: ae4c400e02fc3f7cff11cc332e6b107353b3e6a2

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

LOG: [NFC] Fix spacing in clang/test/Driver/aix-ld.c

Fix one line with mismatch in indentation after afc277b0ed0d.

Added: 


Modified: 
clang/test/Driver/aix-ld.c

Removed: 




diff  --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index 7ccbeff3b8b6..89959d851b93 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/clang/test/Driver/aix-ld.c
@@ -403,7 +403,7 @@
 // CHECK-LD32-NOSTDLIBXX-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOSTDLIBXX-LCXX-NOT: "-lc++"
 // CHECK-LD32-NOSTDLIBXX-LCXX: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
-// CHECK-LD32-NOSTDLIBXX-LCXX:"-lm"
+// CHECK-LD32-NOSTDLIBXX-LCXX: "-lm"
 // CHECK-LD32-NOSTDLIBXX-LCXX: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. -nostdlib++.



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


[PATCH] D69726: [analyzer] DynamicSize: Store the dynamic size

2020-09-30 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

Thank you for reminding me of this patch. I still think it's a pretty important 
patch and i'm interested in getting it landed.




Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:1388
- ->castAs()
- ->StripCasts()
- ->castAs();

What happened to this `StripCasts()`? I don't see it in the after-code and I 
vaguely remember having to be very careful with it.


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

https://reviews.llvm.org/D69726

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


[PATCH] D86743: [analyzer] Ignore VLASizeChecker case that could cause crash

2020-09-30 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment.

In D86743#2303910 , @NoQ wrote:

>> The last comment for that bug is D69726 , 
>> but the bug is not closed to it seems to me that D69726 
>>  does not solve it, just takes a single 
>> step towards the solution.
>
> It might as well be that the patch isn't, well, committed.

Oh! I mislooked that. I saw `DynamicSize.cpp` already in the repository, but 
that is a prerequisite, not that one. Sorry!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86743

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


[PATCH] D88430: [OpenMP] Replace OpenMP RTL Functions With OMPIRBuilder and OMPKinds.def

2020-09-30 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 updated this revision to Diff 295342.
jhuber6 added a comment.

Moving the Clang error checks into D88594 .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88430

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.h
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/test/Transforms/OpenMP/add_attributes.ll

Index: llvm/test/Transforms/OpenMP/add_attributes.ll
===
--- llvm/test/Transforms/OpenMP/add_attributes.ll
+++ llvm/test/Transforms/OpenMP/add_attributes.ll
@@ -888,313 +888,313 @@
 ; CHECK: declare dso_local i32 @omp_pause_resource_all(i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare dso_local i32 @omp_get_supported_active_levels() #0
+; CHECK-NEXT: declare dso_local i32 @omp_get_supported_active_levels()
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_barrier(%struct.ident_t*, i32) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare void @__kmpc_barrier(%struct.ident_t*, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_cancel(%struct.ident_t*, i32, i32) #0
+; CHECK-NEXT: declare i32 @__kmpc_cancel(%struct.ident_t*, i32, i32)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_cancel_barrier(%struct.ident_t*, i32) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare i32 @__kmpc_cancel_barrier(%struct.ident_t*, i32)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_flush(%struct.ident_t*) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare void @__kmpc_flush(%struct.ident_t*)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_global_thread_num(%struct.ident_t*) #0
+; CHECK-NEXT: declare i32 @__kmpc_global_thread_num(%struct.ident_t*)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_fork_call(%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) #0
+; CHECK-NEXT: declare void @__kmpc_fork_call(%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_omp_taskwait(%struct.ident_t*, i32) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare i32 @__kmpc_omp_taskwait(%struct.ident_t*, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_omp_taskyield(%struct.ident_t*, i32, i32) #0
+; CHECK-NEXT: declare i32 @__kmpc_omp_taskyield(%struct.ident_t*, i32, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_push_num_threads(%struct.ident_t*, i32, i32) #0
+; CHECK-NEXT: declare void @__kmpc_push_num_threads(%struct.ident_t*, i32, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_push_proc_bind(%struct.ident_t*, i32, i32) #0
+; CHECK-NEXT: declare void @__kmpc_push_proc_bind(%struct.ident_t*, i32, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_serialized_parallel(%struct.ident_t*, i32) #0
+; CHECK-NEXT: declare void @__kmpc_serialized_parallel(%struct.ident_t*, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_end_serialized_parallel(%struct.ident_t*, i32) #0
+; CHECK-NEXT: declare void @__kmpc_end_serialized_parallel(%struct.ident_t*, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_master(%struct.ident_t*, i32) #0
+; CHECK-NEXT: declare i32 @__kmpc_master(%struct.ident_t*, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_end_master(%struct.ident_t*, i32) #0
+; CHECK-NEXT: declare void @__kmpc_end_master(%struct.ident_t*, i32)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_critical(%struct.ident_t*, i32, [8 x i32]*) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare void @__kmpc_critical(%struct.ident_t*, i32, [8 x i32]*)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_critical_with_hint(%struct.ident_t*, i32, [8 x i32]*, i32) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare void @__kmpc_critical_with_hint(%struct.ident_t*, i32, [8 x i32]*, i32)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_end_critical(%struct.ident_t*, i32, [8 x i32]*) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare void @__kmpc_end_critical(%struct.ident_t*, i32, [8 x i32]*)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_begin(%struct.ident_t*, i32) #0
+; CHECK-NEXT: declare void @__kmpc_begin(%struct.ident_t*, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_end(%struct.ident_t*) #0
+; CHECK-NEXT: 

[PATCH] D88430: [OpenMP] Replace OpenMP RTL Functions With OMPIRBuilder and OMPKinds.def

2020-09-30 Thread Joseph Huber via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG90eaedda9b8e: [OpenMP] Replace OpenMP RTL Functions With 
OMPIRBuilder and OMPKinds.def (authored by jhuber6).

Changed prior to commit:
  https://reviews.llvm.org/D88430?vs=295343=295353#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88430

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.h
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/test/Transforms/OpenMP/add_attributes.ll

Index: llvm/test/Transforms/OpenMP/add_attributes.ll
===
--- llvm/test/Transforms/OpenMP/add_attributes.ll
+++ llvm/test/Transforms/OpenMP/add_attributes.ll
@@ -888,313 +888,313 @@
 ; CHECK: declare dso_local i32 @omp_pause_resource_all(i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare dso_local i32 @omp_get_supported_active_levels() #0
+; CHECK-NEXT: declare dso_local i32 @omp_get_supported_active_levels()
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_barrier(%struct.ident_t*, i32) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare void @__kmpc_barrier(%struct.ident_t*, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_cancel(%struct.ident_t*, i32, i32) #0
+; CHECK-NEXT: declare i32 @__kmpc_cancel(%struct.ident_t*, i32, i32)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_cancel_barrier(%struct.ident_t*, i32) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare i32 @__kmpc_cancel_barrier(%struct.ident_t*, i32)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_flush(%struct.ident_t*) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare void @__kmpc_flush(%struct.ident_t*)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_global_thread_num(%struct.ident_t*) #0
+; CHECK-NEXT: declare i32 @__kmpc_global_thread_num(%struct.ident_t*)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_fork_call(%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) #0
+; CHECK-NEXT: declare void @__kmpc_fork_call(%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_omp_taskwait(%struct.ident_t*, i32) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare i32 @__kmpc_omp_taskwait(%struct.ident_t*, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_omp_taskyield(%struct.ident_t*, i32, i32) #0
+; CHECK-NEXT: declare i32 @__kmpc_omp_taskyield(%struct.ident_t*, i32, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_push_num_threads(%struct.ident_t*, i32, i32) #0
+; CHECK-NEXT: declare void @__kmpc_push_num_threads(%struct.ident_t*, i32, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_push_proc_bind(%struct.ident_t*, i32, i32) #0
+; CHECK-NEXT: declare void @__kmpc_push_proc_bind(%struct.ident_t*, i32, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_serialized_parallel(%struct.ident_t*, i32) #0
+; CHECK-NEXT: declare void @__kmpc_serialized_parallel(%struct.ident_t*, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_end_serialized_parallel(%struct.ident_t*, i32) #0
+; CHECK-NEXT: declare void @__kmpc_end_serialized_parallel(%struct.ident_t*, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare i32 @__kmpc_master(%struct.ident_t*, i32) #0
+; CHECK-NEXT: declare i32 @__kmpc_master(%struct.ident_t*, i32)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_end_master(%struct.ident_t*, i32) #0
+; CHECK-NEXT: declare void @__kmpc_end_master(%struct.ident_t*, i32)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_critical(%struct.ident_t*, i32, [8 x i32]*) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare void @__kmpc_critical(%struct.ident_t*, i32, [8 x i32]*)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_critical_with_hint(%struct.ident_t*, i32, [8 x i32]*, i32) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare void @__kmpc_critical_with_hint(%struct.ident_t*, i32, [8 x i32]*, i32)
 
-; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_end_critical(%struct.ident_t*, i32, [8 x i32]*) #0
+; CHECK: ; Function Attrs: convergent nounwind
+; CHECK-NEXT: declare void @__kmpc_end_critical(%struct.ident_t*, i32, [8 x i32]*)
 
 ; CHECK: ; Function Attrs: nounwind
-; CHECK-NEXT: declare void @__kmpc_begin(%struct.ident_t*, i32) #0
+; CHECK-NEXT: declare void 

[PATCH] D88500: [AIX][Clang][Driver] Link libm in c++ mode

2020-09-30 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGafc277b0ed0d: [AIX][Clang][Driver] Link libm in c++ mode 
(authored by daltenty).

Changed prior to commit:
  https://reviews.llvm.org/D88500?vs=295111=295355#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88500

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -20,6 +20,7 @@
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-NOT: "-lm"
 // CHECK-LD32: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
@@ -41,6 +42,7 @@
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-NOT: "-lm"
 // CHECK-LD64: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
@@ -64,6 +66,7 @@
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD-NOT: "-lm"
 // CHECK-LD32-PTHREAD: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
@@ -87,6 +90,7 @@
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD-NOT: "-lm"
 // CHECK-LD64-PTHREAD: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
@@ -109,6 +113,7 @@
 // CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-PROF-NOT: "-lm"
 // CHECK-LD32-PROF: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. Enable g-profiling.
@@ -131,6 +136,7 @@
 // CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-GPROF-NOT: "-lm"
 // CHECK-LD64-GPROF: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Static linking.
@@ -153,6 +159,7 @@
 // CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-STATIC-NOT: "-lm"
 // CHECK-LD32-STATIC: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Library search path.
@@ -176,6 +183,7 @@
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-LIBP-NOT: "-lc++"
 // CHECK-LD32-LIBP: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-LIBP-NOT: "-lm"
 // CHECK-LD32-LIBP: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. nostdlib.
@@ -200,6 +208,7 @@
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
+// CHECK-LD32-NO-STD-LIB-NOT: "-lm"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. nodefaultlibs.
@@ -224,6 +233,7 @@
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc++"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
+// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lm"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
@@ -247,6 +257,7 @@
 // CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
 // CHECK-LD32-CXX-ARG-ORDER: "-lc++"
 // CHECK-LD32-CXX-ARG-ORDER: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-CXX-ARG-ORDER: "-lm"
 // CHECK-LD32-CXX-ARG-ORDER: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. lc++ and lc order.
@@ -266,6 +277,7 @@
 // CHECK-LD32-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-CXX-ARG-LCXX: "-lc++"
 // CHECK-LD32-CXX-ARG-LCXX: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-CXX-ARG-LCXX: "-lm"
 // CHECK-LD32-CXX-ARG-LCXX: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. lc++ and lc order.
@@ -285,6 +297,7 @@
 // CHECK-LD64-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-CXX-ARG-LCXX: "-lc++"
 // CHECK-LD64-CXX-ARG-LCXX: 

[clang] afc277b - [AIX][Clang][Driver] Link libm in c++ mode

2020-09-30 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2020-09-30T14:02:17-04:00
New Revision: afc277b0ed0dcd9fbbde6015bbdf289349fb2104

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

LOG: [AIX][Clang][Driver] Link libm in c++ mode

since that is the normal behaviour of other compilers on the platform.

Reviewed By: hubert.reinterpretcast

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/AIX.cpp
clang/test/Driver/aix-ld.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
index b56ddf55cb30..351b34e8bf90 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -162,6 +162,9 @@ void aix::Linker::ConstructJob(Compilation , const 
JobAction ,
 if (Args.hasArg(options::OPT_pthreads, options::OPT_pthread))
   CmdArgs.push_back("-lpthreads");
 
+if (D.CCCIsCXX())
+  CmdArgs.push_back("-lm");
+
 CmdArgs.push_back("-lc");
   }
 

diff  --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index 224e355aac13..7ccbeff3b8b6 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/clang/test/Driver/aix-ld.c
@@ -20,6 +20,7 @@
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-NOT: "-lm"
 // CHECK-LD32: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
@@ -41,6 +42,7 @@
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-NOT: "-lm"
 // CHECK-LD64: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
@@ -64,6 +66,7 @@
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD-NOT: "-lm"
 // CHECK-LD32-PTHREAD: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
@@ -87,6 +90,7 @@
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD-NOT: "-lm"
 // CHECK-LD64-PTHREAD: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
@@ -109,6 +113,7 @@
 // CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-PROF-NOT: "-lm"
 // CHECK-LD32-PROF: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. Enable g-profiling.
@@ -131,6 +136,7 @@
 // CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-GPROF-NOT: "-lm"
 // CHECK-LD64-GPROF: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Static linking.
@@ -153,6 +159,7 @@
 // CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-STATIC-NOT: "-lm"
 // CHECK-LD32-STATIC: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Library search path.
@@ -176,6 +183,7 @@
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-LIBP-NOT: "-lc++"
 // CHECK-LD32-LIBP: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-LIBP-NOT: "-lm"
 // CHECK-LD32-LIBP: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. nostdlib.
@@ -200,6 +208,7 @@
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
 // CHECK-LD32-NO-STD-LIB-NOT: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
+// CHECK-LD32-NO-STD-LIB-NOT: "-lm"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. nodefaultlibs.
@@ -224,6 +233,7 @@
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc++"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
+// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lm"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
@@ -247,6 +257,7 @@
 // CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
 // CHECK-LD32-CXX-ARG-ORDER: "-lc++"
 // CHECK-LD32-CXX-ARG-ORDER: 

[PATCH] D86743: [analyzer] Ignore VLASizeChecker case that could cause crash

2020-09-30 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

> The last comment for that bug is D69726 , 
> but the bug is not closed to it seems to me that D69726 
>  does not solve it, just takes a single step 
> towards the solution.

It might as well be that the patch isn't, well, committed.

> However, this one is a core checker, and not even alpha.

Yup, that's pretty bad.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86743

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


[PATCH] D88594: [OpenMP] Add Error Handling for Conflicting Pointer Sizes for Target Offload

2020-09-30 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 created this revision.
jhuber6 added a reviewer: jdoerfert.
jhuber6 added projects: OpenMP, clang.
Herald added subscribers: cfe-commits, guansong, yaxunl.
jhuber6 requested review of this revision.
Herald added a subscriber: sstefan1.

This patch adds an error to Clang that detects if OpenMP offloading is used 
between two architectures with incompatible pointer sizes. This ensures that 
the data mapping can be done correctly and solves an issue in code generation 
generating the wrong size pointer.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88594

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/target_incompatible_architecture_messages.cpp


Index: clang/test/OpenMP/target_incompatible_architecture_messages.cpp
===
--- /dev/null
+++ clang/test/OpenMP/target_incompatible_architecture_messages.cpp
@@ -0,0 +1,14 @@
+// RUN: not %clang_cc1 -x c++ -fopenmp -triple powerpc64le-unknown-unknown 
-fopenmp-targets=nvptx-nvidia-cuda -o - %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -x c++ -fopenmp -triple i386-unknown-unknown 
-fopenmp-targets=nvptx64-nvidia-cuda -o - %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -x c++ -fopenmp -triple x86_64-unknown-unknown 
-fopenmp-targets=nvptx-nvidia-cuda -o - %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -x c++ -fopenmp -triple x86_64-unknown-unknown 
-fopenmp-targets=i386-pc-linux-gnu -o - %s 2>&1 | FileCheck %s
+// CHECK: error: OpenMP target architecture '{{.+}}' pointer size is 
incompatible with host '{{.+}}'
+#ifndef HEADER
+#define HEADER
+
+void test() {
+#pragma omp target
+  {}
+}
+
+#endif
Index: 
clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
===
--- clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
+++ clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
@@ -1,8 +1,8 @@
 // RUN: %clang_cc1 -x c++ -O1 -disable-llvm-optzns -verify -fopenmp 
-internal-isystem %S/../Headers/Inputs/include -internal-isystem 
%S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h 
-triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda 
-emit-llvm-bc %s -o %t-ppc-host.bc
 // RUN: %clang_cc1 -x c++ -O1 -disable-llvm-optzns -verify -fopenmp 
-internal-isystem %S/../Headers/Inputs/include -internal-isystem 
%S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h 
-triple nvptx64-unknown-unknown -aux-triple powerpc64le-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 -x c++ -O1 -disable-llvm-optzns -verify -fopenmp 
-internal-isystem %S/../Headers/Inputs/include -internal-isystem 
%S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h 
-triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc 
%s -o %t-x86-host.bc
-// RUN: %clang_cc1 -x c++ -O1 -disable-llvm-optzns -verify -fopenmp 
-internal-isystem %S/../Headers/Inputs/include -internal-isystem 
%S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h 
-triple nvptx-unknown-unknown -aux-triple powerpc64le-unknown-unknown 
-fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device 
-fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s
-// RUN: %clang_cc1 -x c++ -O1 -disable-llvm-optzns -verify -fopenmp 
-internal-isystem %S/../Headers/Inputs/include -internal-isystem 
%S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h 
-fexceptions -fcxx-exceptions -aux-triple powerpc64le-unknown-unknown -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 - | FileCheck %s
+// RUN: %clang_cc1 -x c++ -O1 -disable-llvm-optzns -verify -fopenmp 
-internal-isystem %S/../Headers/Inputs/include -internal-isystem 
%S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h 
-triple nvptx64-unknown-unknown -aux-triple powerpc64le-unknown-unknown 
-fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device 
-fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s
+// RUN: %clang_cc1 -x c++ -O1 -disable-llvm-optzns -verify -fopenmp 
-internal-isystem %S/../Headers/Inputs/include -internal-isystem 
%S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h 
-fexceptions -fcxx-exceptions -aux-triple powerpc64le-unknown-unknown -triple 
nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s 
-fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s
 // expected-no-diagnostics
 #ifndef HEADER
 

[PATCH] D88265: [Sema] Support Comma operator for fp16 vectors.

2020-09-30 Thread Florian Hahn via Phabricator via cfe-commits
fhahn accepted this revision.
fhahn added a comment.

LGTM, thanks. I'll commit this in a minute.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88265

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


[clang] 892df30 - Fix interaction of `constinit` and `weak`.

2020-09-30 Thread Richard Smith via cfe-commits

Author: Richard Smith
Date: 2020-09-30T10:49:50-07:00
New Revision: 892df30a7f344b6cb9995710efbc94bb25cfb95b

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

LOG: Fix interaction of `constinit` and `weak`.

We previously took a shortcut and said that weak variables never have
constant initializers (because those initializers are never correct to
use outside the variable). We now say that weak variables can have
constant initializers, but are never usable in constant expressions.

Added: 
clang/test/SemaCXX/cxx20-constinit.cpp

Modified: 
clang/lib/AST/Decl.cpp
clang/lib/AST/ExprConstant.cpp
clang/lib/Sema/SemaDeclCXX.cpp

Removed: 




diff  --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index c96450b8a377..a6c7f30528eb 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -2287,6 +2287,10 @@ bool 
VarDecl::mightBeUsableInConstantExpressions(ASTContext ) const {
   if (isa(this))
 return false;
 
+  // The values of weak variables are never usable in constant expressions.
+  if (isWeak())
+return false;
+
   // In C++11, any variable of reference type can be used in a constant
   // expression if it is initialized by a constant expression.
   if (Lang.CPlusPlus11 && getType()->isReferenceType())
@@ -2414,10 +2418,6 @@ bool VarDecl::isInitICE() const {
 }
 
 bool VarDecl::checkInitIsICE() const {
-  // Initializers of weak variables are never ICEs.
-  if (isWeak())
-return false;
-
   EvaluatedStmt *Eval = ensureEvaluatedStmt();
   if (Eval->CheckedICE)
 // We have already checked whether this subexpression is an

diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 3bc649b96990..b17eed2dc823 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -14816,7 +14816,7 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext 
) {
 const VarDecl *VD;
 // Look for a declaration of this variable that has an initializer, and
 // check whether it is an ICE.
-if (Dcl->getAnyInitializer(VD) && VD->checkInitIsICE())
+if (Dcl->getAnyInitializer(VD) && !VD->isWeak() && 
VD->checkInitIsICE())
   return NoDiag();
 else
   return ICEDiag(IK_NotICE, cast(E)->getLocation());

diff  --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 2d2b80573a69..1275fc0c95b5 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -2,7 +2,7 @@ QualType 
Sema::CheckComparisonCategoryType(ComparisonCategoryType Kind,
 // might be foobar, including it failing to be a constant expression.
 // TODO Handle more ways the lookup or result can be invalid.
 if (!VD->isStaticDataMember() || !VD->isConstexpr() || !VD->hasInit() ||
-!VD->checkInitIsICE())
+VD->isWeak() || !VD->checkInitIsICE())
   return UnsupportedSTLError(USS_InvalidMember, MemName, VD);
 
 // Attempt to evaluate the var decl as a constant expression and extract

diff  --git a/clang/test/SemaCXX/cxx20-constinit.cpp 
b/clang/test/SemaCXX/cxx20-constinit.cpp
new file mode 100644
index ..a572b9128907
--- /dev/null
+++ b/clang/test/SemaCXX/cxx20-constinit.cpp
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 %s -std=c++20 -verify
+// expected-no-diagnostics
+
+constinit int a __attribute__((weak)) = 0;



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


  1   2   >