[PATCH] D82485: Add tests for sequences of callbacks that RecursiveASTVisitor produces

2020-06-25 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr updated this revision to Diff 273464.
gribozavr added a comment.

Added calls to default implementations.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82485

Files:
  clang/unittests/Tooling/CMakeLists.txt
  clang/unittests/Tooling/RecursiveASTVisitorTests/Callbacks.cpp

Index: clang/unittests/Tooling/RecursiveASTVisitorTests/Callbacks.cpp
===
--- /dev/null
+++ clang/unittests/Tooling/RecursiveASTVisitorTests/Callbacks.cpp
@@ -0,0 +1,910 @@
+//===--- clang/unittests/Tooling/RecursiveASTVisitorTests/Callbacks.cpp ---===//
+//
+// 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 "TestVisitor.h"
+
+using namespace clang;
+
+namespace {
+
+enum class ShouldTraversePostOrder : bool {
+  No = false,
+  Yes = true,
+};
+
+/// Base class for tests for RecursiveASTVisitor tests that validate the
+/// sequence of calls to user-defined callbacks like Traverse*(), WalkUp*(),
+/// Visit*().
+template 
+class RecordingVisitorBase : public TestVisitor {
+  ShouldTraversePostOrder ShouldTraversePostOrderValue;
+
+public:
+  RecordingVisitorBase(ShouldTraversePostOrder ShouldTraversePostOrderValue)
+  : ShouldTraversePostOrderValue(ShouldTraversePostOrderValue) {}
+
+  bool shouldTraversePostOrder() const {
+return static_cast(ShouldTraversePostOrderValue);
+  }
+
+  // Callbacks received during traversal.
+  std::string CallbackLog;
+  unsigned CallbackLogIndent = 0;
+
+  std::string stmtToString(Stmt *S) {
+StringRef ClassName = S->getStmtClassName();
+if (IntegerLiteral *IL = dyn_cast(S)) {
+  return (ClassName + "(" + IL->getValue().toString(10, false) + ")").str();
+}
+if (BinaryOperator *BO = dyn_cast(S)) {
+  return (ClassName + "(" + BinaryOperator::getOpcodeStr(BO->getOpcode()) +
+  ")")
+  .str();
+}
+if (CallExpr *CE = dyn_cast(S)) {
+  if (FunctionDecl *Callee = CE->getDirectCallee()) {
+if (Callee->getIdentifier()) {
+  return (ClassName + "(" + Callee->getName() + ")").str();
+}
+  }
+}
+if (DeclRefExpr *DRE = dyn_cast(S)) {
+  if (NamedDecl *ND = DRE->getFoundDecl()) {
+if (ND->getIdentifier()) {
+  return (ClassName + "(" + ND->getName() + ")").str();
+}
+  }
+}
+return ClassName.str();
+  }
+
+  /// Record the fact that the user-defined callback member function
+  /// \p CallbackName was called with the argument \p S.
+  void recordCallback(StringRef CallbackName, Stmt *S) {
+for (unsigned i = 0; i != CallbackLogIndent; ++i) {
+  CallbackLog += "  ";
+}
+CallbackLog += (CallbackName + " " + stmtToString(S) + "\n").str();
+  }
+
+  template 
+  void recordDefaultImplementation(StringRef CallbackName,
+   CallDefault CallDefaultFn) {
+++CallbackLogIndent;
+CallDefaultFn();
+--CallbackLogIndent;
+  }
+};
+
+template 
+::testing::AssertionResult visitorCallbackLogEqual(VisitorTy Visitor,
+   StringRef Code,
+   StringRef ExpectedLog) {
+  Visitor.runOver(Code);
+  // EXPECT_EQ shows the diff between the two strings if they are different.
+  EXPECT_EQ(ExpectedLog.trim().str(),
+StringRef(Visitor.CallbackLog).trim().str());
+  if (ExpectedLog.trim() != StringRef(Visitor.CallbackLog).trim()) {
+return ::testing::AssertionFailure();
+  }
+  return ::testing::AssertionSuccess();
+}
+
+} // namespace
+
+TEST(RecursiveASTVisitor, StmtCallbacks_TraverseLeaf) {
+  class RecordingVisitor : public RecordingVisitorBase {
+  public:
+RecordingVisitor(ShouldTraversePostOrder ShouldTraversePostOrderValue)
+: RecordingVisitorBase(ShouldTraversePostOrderValue) {}
+
+bool TraverseIntegerLiteral(IntegerLiteral *IL) {
+  recordCallback(__func__, IL);
+  recordDefaultImplementation(__func__, [&, this]() {
+RecordingVisitorBase::TraverseIntegerLiteral(IL);
+  });
+  return true;
+}
+
+bool WalkUpFromStmt(Stmt *S) {
+  recordCallback(__func__, S);
+  recordDefaultImplementation(
+  __func__, [&, this]() { RecordingVisitorBase::WalkUpFromStmt(S); });
+  return true;
+}
+  };
+
+  StringRef Code = R"cpp(
+void add(int, int);
+void test() {
+  1;
+  2 + 3;
+  add(4, 5);
+}
+)cpp";
+
+  EXPECT_TRUE(visitorCallbackLogEqual(
+  RecordingVisitor(ShouldTraversePostOrder::No), Code,
+  R"txt(
+WalkUpFromStmt CompoundStmt
+TraverseIntegerLiteral IntegerLiteral(1)
+  WalkUpFromStmt IntegerLiteral(1)
+WalkUpFromStmt BinaryOperator(+)

[PATCH] D82477: [lldb-vscode] Add Support for Module Event

2020-06-25 Thread Greg Clayton via Phabricator via cfe-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

We need to add a test for the symbols added target notification. See my 
previous comment on stripping a.out to a.out.stripped and then using 
"a.out.stripped" as the main executable.




Comment at: lldb/test/API/tools/lldb-vscode/module/main.cpp:2-9
+int multiply(int x, int y) {
+  return x * y; // breakpoint 1
+}
+
+int main(int argc, char const *argv[]) {
+  int result = multiply(argc, 20);
+  return result < 0;

We can probably simplify this to just be:

```
int main(int argc, char const *argv[]) {
  return 0; // breakpoint 1
}
```



Comment at: lldb/tools/lldb-vscode/JSONUtils.cpp:337-340
+std::string(module.GetFileSpec().GetFilename()));
+  std::string module_path = std::string(module.GetFileSpec().GetDirectory()) +
+"/" +
+std::string(module.GetFileSpec().GetFilename());

Let LLDB take care of the directory delimiter. Otherwise this will be bad on 
windows:
```
char module_path[PATH_MAX];
module.GetFileSpec().GetPath(module_path, sizeof(module_path));
```




Comment at: lldb/tools/lldb-vscode/JSONUtils.cpp:344-346
+std::string symbol_path =
+std::string(module.GetSymbolFileSpec().GetDirectory()) + "/" +
+std::string(module.GetSymbolFileSpec().GetFilename());

Let LLDB take care of the directory delimiter. Otherwise this will be bad on 
windows:

```
char symbol_path[PATH_MAX];
module.GetSymbolFileSpec().GetPath(module_path, sizeof(symbol_path));
```




Comment at: lldb/tools/lldb-vscode/JSONUtils.cpp:349-350
+  }
+  std::string loaded_addr = std::to_string(
+  module.GetObjectFileHeaderAddress().GetLoadAddress(g_vsc.target));
+  object.try_emplace("addressRange", loaded_addr);

We need to make sure the address returned is valid and we want the string value 
to be in hex. Are we sure std::to_string() will create a hex number? If not we 
can use sprintf:

```
uint64_t load_addr = 
module.GetObjectFileHeaderAddress().GetLoadAddress(g_vsc.target);
if (load_addr != LLDB_INVALID_ADDRESS) {
  char load_addr_str[64];
  snprintf(load_addr_str, sizeof(load_addr_str), "0x%016" PRIx64, load_addr);
  object.try_emplace("addressRange", load_addr_str);
}
```



Comment at: lldb/tools/lldb-vscode/JSONUtils.h:241
 
+/// Converts Module Event to a Visual Studio Code "Module"
+///

Might be better with text like:

```
/// Converts a LLDB module to a VS Code DAP module for use in "modules" events.
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82477



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


[PATCH] D81282: [builtins] Move more float128-related helpers to GENERIC_TF_SOURCES list

2020-06-25 Thread Anatoly Trosinenko via Phabricator via cfe-commits
atrosinenko marked an inline comment as done.
atrosinenko added inline comments.



Comment at: compiler-rt/lib/builtins/CMakeLists.txt:142
   powisf2.c
   powitf2.c
   subdf3.c

efriedma wrote:
> Missed powitf?
Fixed, thank you.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81282



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


[PATCH] D82085: [TRE] allow TRE for non-capturing calls.

2020-06-25 Thread Alexey Lapshin via Phabricator via cfe-commits
avl updated this revision to Diff 273457.
avl added a comment.

removed early check for TRE candidates from canTRE().


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82085

Files:
  llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
  llvm/test/Transforms/TailCallElim/basic.ll
  llvm/test/Transforms/TailCallElim/tre-noncapturing-alloca-calls.ll

Index: llvm/test/Transforms/TailCallElim/tre-noncapturing-alloca-calls.ll
===
--- /dev/null
+++ llvm/test/Transforms/TailCallElim/tre-noncapturing-alloca-calls.ll
@@ -0,0 +1,69 @@
+; RUN: opt < %s -tailcallelim -verify-dom-info -S | FileCheck %s
+
+; IR for that test was generated from the following C++ source:
+;
+;int count;
+;__attribute__((noinline)) void globalIncrement(const int* param) { count += *param; }
+;
+;void test(int recurseCount)
+;{
+;if (recurseCount == 0) return;
+;int temp = 10;
+;globalIncrement();
+;test(recurseCount - 1);
+;}
+;
+
+@count = dso_local local_unnamed_addr global i32 0, align 4
+
+; Function Attrs: nofree noinline norecurse nounwind uwtable
+define dso_local void @_Z15globalIncrementPKi(i32* nocapture readonly %param) local_unnamed_addr #0 {
+entry:
+  %0 = load i32, i32* %param, align 4
+  %1 = load i32, i32* @count, align 4
+  %add = add nsw i32 %1, %0
+  store i32 %add, i32* @count, align 4
+  ret void
+}
+
+; Test that TRE could be done for recursive tail routine containing
+; call to function receiving a pointer to local stack. 
+
+; CHECK: void @_Z4testi
+; CHECK: br label %tailrecurse
+; CHECK: tailrecurse:
+; CHECK-NOT: call void @_Z4testi
+; CHECK: br label %tailrecurse
+; CHECK-NOT: call void @_Z4testi
+; CHECK: ret
+
+; Function Attrs: nounwind uwtable
+define dso_local void @_Z4testi(i32 %recurseCount) local_unnamed_addr #1 {
+entry:
+  %temp = alloca i32, align 4
+  %cmp = icmp eq i32 %recurseCount, 0
+  br i1 %cmp, label %return, label %if.end
+
+if.end:   ; preds = %entry
+  %0 = bitcast i32* %temp to i8*
+  call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %0) #6
+  store i32 10, i32* %temp, align 4
+  call void @_Z15globalIncrementPKi(i32* nonnull %temp)
+  %sub = add nsw i32 %recurseCount, -1
+  call void @_Z4testi(i32 %sub)
+  call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %0) #6
+  br label %return
+
+return:   ; preds = %entry, %if.end
+  ret void
+}
+
+; Function Attrs: argmemonly nounwind willreturn
+declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #2
+
+; Function Attrs: argmemonly nounwind willreturn
+declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #2
+
+attributes #0 = { nofree noinline norecurse nounwind uwtable }
+attributes #1 = { nounwind uwtable }
+attributes #2 = { argmemonly nounwind willreturn }
Index: llvm/test/Transforms/TailCallElim/basic.ll
===
--- llvm/test/Transforms/TailCallElim/basic.ll
+++ llvm/test/Transforms/TailCallElim/basic.ll
@@ -19,8 +19,8 @@
 	%A = alloca i32		;  [#uses=2]
 	store i32 5, i32* %A
 	call void @use(i32* %A)
-; CHECK: tail call i32 @test1
-	%X = tail call i32 @test1()		;  [#uses=1]
+; CHECK: call i32 @test1
+	%X = call i32 @test1()		;  [#uses=1]
 	ret i32 %X
 }
 
Index: llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
===
--- llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
+++ llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
@@ -185,11 +185,9 @@
 };
 }
 
-static bool markTails(Function , bool ,
-  OptimizationRemarkEmitter *ORE) {
+static bool markTails(Function , OptimizationRemarkEmitter *ORE) {
   if (F.callsFunctionThatReturnsTwice())
 return false;
-  AllCallsAreTailCalls = true;
 
   // The local stack holds all alloca instructions and all byval arguments.
   AllocaDerivedValueTracker Tracker;
@@ -272,11 +270,8 @@
 }
   }
 
-  if (!IsNoTail && Escaped == UNESCAPED && !Tracker.AllocaUsers.count(CI)) {
+  if (!IsNoTail && Escaped == UNESCAPED && !Tracker.AllocaUsers.count(CI))
 DeferredTails.push_back(CI);
-  } else {
-AllCallsAreTailCalls = false;
-  }
 }
 
 for (auto *SuccBB : make_range(succ_begin(BB), succ_end(BB))) {
@@ -313,8 +308,6 @@
   LLVM_DEBUG(dbgs() << "Marked as tail call candidate: " << *CI << "\n");
   CI->setTailCall();
   Modified = true;
-} else {
-  AllCallsAreTailCalls = false;
 }
   }
 
@@ -326,6 +319,14 @@
 /// instructions between the call and this instruction are movable.
 ///
 static bool canMoveAboveCall(Instruction *I, CallInst *CI, AliasAnalysis *AA) {
+  if (isa(I))
+return true;
+
+  if (const IntrinsicInst *II = dyn_cast(I))
+if (II->getIntrinsicID() == Intrinsic::lifetime_end ||
+

[PATCH] D81282: [builtins] Move more float128-related helpers to GENERIC_TF_SOURCES list

2020-06-25 Thread Anatoly Trosinenko via Phabricator via cfe-commits
atrosinenko updated this revision to Diff 273452.
atrosinenko added a comment.

Move missed `powitf2.c` source as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81282

Files:
  compiler-rt/lib/builtins/CMakeLists.txt


Index: compiler-rt/lib/builtins/CMakeLists.txt
===
--- compiler-rt/lib/builtins/CMakeLists.txt
+++ compiler-rt/lib/builtins/CMakeLists.txt
@@ -46,7 +46,6 @@
   absvti2.c
   adddf3.c
   addsf3.c
-  addtf3.c
   addvdi3.c
   addvsi3.c
   addvti3.c
@@ -75,9 +74,7 @@
   divsc3.c
   divsf3.c
   divsi3.c
-  divtc3.c
   divti3.c
-  divtf3.c
   extendsfdf2.c
   extendhfsf2.c
   ffsdi2.c
@@ -123,7 +120,6 @@
   mulsc3.c
   mulsf3.c
   multi3.c
-  multf3.c
   mulvdi3.c
   mulvsi3.c
   mulvti3.c
@@ -143,13 +139,11 @@
   popcountti2.c
   powidf2.c
   powisf2.c
-  powitf2.c
   subdf3.c
   subsf3.c
   subvdi3.c
   subvsi3.c
   subvti3.c
-  subtf3.c
   trampoline_setup.c
   truncdfhf2.c
   truncdfsf2.c
@@ -168,7 +162,10 @@
 )
 
 set(GENERIC_TF_SOURCES
+  addtf3.c
   comparetf2.c
+  divtc3.c
+  divtf3.c
   extenddftf2.c
   extendsftf2.c
   fixtfdi.c
@@ -184,6 +181,9 @@
   floatunsitf.c
   floatuntitf.c
   multc3.c
+  multf3.c
+  powitf2.c
+  subtf3.c
   trunctfdf2.c
   trunctfsf2.c
 )


Index: compiler-rt/lib/builtins/CMakeLists.txt
===
--- compiler-rt/lib/builtins/CMakeLists.txt
+++ compiler-rt/lib/builtins/CMakeLists.txt
@@ -46,7 +46,6 @@
   absvti2.c
   adddf3.c
   addsf3.c
-  addtf3.c
   addvdi3.c
   addvsi3.c
   addvti3.c
@@ -75,9 +74,7 @@
   divsc3.c
   divsf3.c
   divsi3.c
-  divtc3.c
   divti3.c
-  divtf3.c
   extendsfdf2.c
   extendhfsf2.c
   ffsdi2.c
@@ -123,7 +120,6 @@
   mulsc3.c
   mulsf3.c
   multi3.c
-  multf3.c
   mulvdi3.c
   mulvsi3.c
   mulvti3.c
@@ -143,13 +139,11 @@
   popcountti2.c
   powidf2.c
   powisf2.c
-  powitf2.c
   subdf3.c
   subsf3.c
   subvdi3.c
   subvsi3.c
   subvti3.c
-  subtf3.c
   trampoline_setup.c
   truncdfhf2.c
   truncdfsf2.c
@@ -168,7 +162,10 @@
 )
 
 set(GENERIC_TF_SOURCES
+  addtf3.c
   comparetf2.c
+  divtc3.c
+  divtf3.c
   extenddftf2.c
   extendsftf2.c
   fixtfdi.c
@@ -184,6 +181,9 @@
   floatunsitf.c
   floatuntitf.c
   multc3.c
+  multf3.c
+  powitf2.c
+  subtf3.c
   trunctfdf2.c
   trunctfsf2.c
 )
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82332: [Coroutines] Handle dependent promise types for final_suspend non-throw check

2020-06-25 Thread Brian Gesiak via Phabricator via cfe-commits
modocache accepted this revision.
modocache added a comment.
This revision is now accepted and ready to land.

Thanks, this looks good to me!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82332



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


[PATCH] D82586: [HIP] Improve check patterns to avoid test failures in case string "opt", etc. happens to be in the command path.

2020-06-25 Thread Hiroshi Yamauchi via Phabricator via cfe-commits
yamauchi created this revision.
yamauchi added reviewers: arsenm, yaxunl.
Herald added subscribers: cfe-commits, wdng.
Herald added a project: clang.

Similarly to D82046 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82586

Files:
  clang/test/Driver/hip-link-save-temps.hip


Index: clang/test/Driver/hip-link-save-temps.hip
===
--- clang/test/Driver/hip-link-save-temps.hip
+++ clang/test/Driver/hip-link-save-temps.hip
@@ -38,9 +38,9 @@
 
 // CHECK: "{{.*clang-offload-bundler.*}}" {{.*}} 
"-outputs=obj1-host-x86_64-unknown-linux-gnu.o,obj1-hip-amdgcn-amd-amdhsa-gfx900.o,obj1-hip-amdgcn-amd-amdhsa-gfx906.o"
 "-unbundle"
 // CHECK: "{{.*clang-offload-bundler.*}}" {{.*}} 
"-outputs=obj2-host-x86_64-unknown-linux-gnu.o,obj2-hip-amdgcn-amd-amdhsa-gfx900.o,obj2-hip-amdgcn-amd-amdhsa-gfx906.o"
 "-unbundle"
-// CHECK-NOT: llvm-link
-// CHECK-NOT: opt
-// CHECK-NOT: llc
+// CHECK-NOT: {{".*/llvm-link"}}
+// CHECK-NOT: {{".*/opt"}}
+// CHECK-NOT: {{".*/llc"}}
 // CHECK: "{{.*lld.*}}" {{.*}} "-mllvm" "-amdgpu-internalize-symbols"
 // CHECK-SAME: "-o" "a.out-hip-amdgcn-amd-amdhsa-gfx900" 
"obj1-hip-amdgcn-amd-amdhsa-gfx900.o" "obj2-hip-amdgcn-amd-amdhsa-gfx900.o"
 // CHECK: "{{.*lld.*}}" {{.*}} "-mllvm" "-amdgpu-internalize-symbols"


Index: clang/test/Driver/hip-link-save-temps.hip
===
--- clang/test/Driver/hip-link-save-temps.hip
+++ clang/test/Driver/hip-link-save-temps.hip
@@ -38,9 +38,9 @@
 
 // CHECK: "{{.*clang-offload-bundler.*}}" {{.*}} "-outputs=obj1-host-x86_64-unknown-linux-gnu.o,obj1-hip-amdgcn-amd-amdhsa-gfx900.o,obj1-hip-amdgcn-amd-amdhsa-gfx906.o" "-unbundle"
 // CHECK: "{{.*clang-offload-bundler.*}}" {{.*}} "-outputs=obj2-host-x86_64-unknown-linux-gnu.o,obj2-hip-amdgcn-amd-amdhsa-gfx900.o,obj2-hip-amdgcn-amd-amdhsa-gfx906.o" "-unbundle"
-// CHECK-NOT: llvm-link
-// CHECK-NOT: opt
-// CHECK-NOT: llc
+// CHECK-NOT: {{".*/llvm-link"}}
+// CHECK-NOT: {{".*/opt"}}
+// CHECK-NOT: {{".*/llc"}}
 // CHECK: "{{.*lld.*}}" {{.*}} "-mllvm" "-amdgpu-internalize-symbols"
 // CHECK-SAME: "-o" "a.out-hip-amdgcn-amd-amdhsa-gfx900" "obj1-hip-amdgcn-amd-amdhsa-gfx900.o" "obj2-hip-amdgcn-amd-amdhsa-gfx900.o"
 // CHECK: "{{.*lld.*}}" {{.*}} "-mllvm" "-amdgpu-internalize-symbols"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] c61ef1f - [Sema][CodeComplete][ObjC] Don't split the first selector fragment

2020-06-25 Thread David Goldman via cfe-commits

Author: David Goldman
Date: 2020-06-25T13:58:27-04:00
New Revision: c61ef1f25c7fe774e68d20beb956a3b12a353b95

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

LOG: [Sema][CodeComplete][ObjC] Don't split the first selector fragment

Summary:
Standardize the formatting of selector fragments to include the ':',
e.g. for `- (void)foobar:(int)foobar;`, report `{foobar:}` instead of
`{foobar}{:}`. This was normally the case except for a couple of places
where it was split.

This also improves integration with clangd since it relies upon the `:`
to identify ObjC selectors.

NOTE: It is possible to have selector fragments that are just `:` with
no text, we now handle this properly for the first fragment.

Reviewers: sammccall, doug.gregor

Subscribers: ilya-biryukov, dexonsmith, arphaman, kadircet, usaxena95, 
cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/lib/Sema/SemaCodeComplete.cpp
clang/test/Index/complete-method-decls.m
clang/test/Index/complete-parameterized-classes.m

Removed: 




diff  --git a/clang/lib/Sema/SemaCodeComplete.cpp 
b/clang/lib/Sema/SemaCodeComplete.cpp
index 5539aef917d0..913c43886b4e 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -8133,8 +8133,8 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl 
*Property,
 Builder.AddChunk(CodeCompletionString::CK_RightParen);
   }
 
-  Builder.AddTypedTextChunk(Allocator.CopyString(SelectorId->getName()));
-  Builder.AddTypedTextChunk(":");
+  Builder.AddTypedTextChunk(
+  Allocator.CopyString(SelectorId->getName() + ":"));
   AddObjCPassingTypeChunk(Property->getType(), /*Quals=*/0, Context, 
Policy,
   Builder);
   Builder.AddTextChunk(Key);
@@ -8722,39 +8722,43 @@ void Sema::CodeCompleteObjCMethodDecl(Scope *S, 
Optional IsInstanceMethod,
 
 Selector Sel = Method->getSelector();
 
-// Add the first part of the selector to the pattern.
-Builder.AddTypedTextChunk(
-Builder.getAllocator().CopyString(Sel.getNameForSlot(0)));
-
-// Add parameters to the pattern.
-unsigned I = 0;
-for (ObjCMethodDecl::param_iterator P = Method->param_begin(),
-PEnd = Method->param_end();
- P != PEnd; (void)++P, ++I) {
-  // Add the part of the selector name.
-  if (I == 0)
-Builder.AddTypedTextChunk(":");
-  else if (I < Sel.getNumArgs()) {
-Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);
-Builder.AddTypedTextChunk(
-Builder.getAllocator().CopyString(Sel.getNameForSlot(I) + ":"));
-  } else
-break;
-
-  // Add the parameter type.
-  QualType ParamType;
-  if ((*P)->getObjCDeclQualifier() & Decl::OBJC_TQ_CSNullability)
-ParamType = (*P)->getType();
-  else
-ParamType = (*P)->getOriginalType();
-  ParamType = ParamType.substObjCTypeArgs(
-  Context, {}, ObjCSubstitutionContext::Parameter);
-  AttributedType::stripOuterNullability(ParamType);
-  AddObjCPassingTypeChunk(ParamType, (*P)->getObjCDeclQualifier(), Context,
-  Policy, Builder);
+if (Sel.isUnarySelector()) {
+  // Unary selectors have no arguments.
+  Builder.AddTypedTextChunk(
+  Builder.getAllocator().CopyString(Sel.getNameForSlot(0)));
+} else {
+  // Add all parameters to the pattern.
+  unsigned I = 0;
+  for (ObjCMethodDecl::param_iterator P = Method->param_begin(),
+  PEnd = Method->param_end();
+   P != PEnd; (void)++P, ++I) {
+// Add the part of the selector name.
+if (I == 0)
+  Builder.AddTypedTextChunk(
+  Builder.getAllocator().CopyString(Sel.getNameForSlot(I) + ":"));
+else if (I < Sel.getNumArgs()) {
+  Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);
+  Builder.AddTypedTextChunk(
+  Builder.getAllocator().CopyString(Sel.getNameForSlot(I) + ":"));
+} else
+  break;
 
-  if (IdentifierInfo *Id = (*P)->getIdentifier())
-Builder.AddTextChunk(Builder.getAllocator().CopyString(Id->getName()));
+// Add the parameter type.
+QualType ParamType;
+if ((*P)->getObjCDeclQualifier() & Decl::OBJC_TQ_CSNullability)
+  ParamType = (*P)->getType();
+else
+  ParamType = (*P)->getOriginalType();
+ParamType = ParamType.substObjCTypeArgs(
+Context, {}, ObjCSubstitutionContext::Parameter);
+AttributedType::stripOuterNullability(ParamType);
+AddObjCPassingTypeChunk(ParamType, 

[PATCH] D82585: [analyzer][NFC] Move the data structures from CheckerRegistry to the Core library

2020-06-25 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus created this revision.
Szelethus added reviewers: NoQ, xazax.hun, dcoughlin, vsavchenko, martong, 
balazske, baloghadamsoftware.
Szelethus added a project: clang.
Herald added subscribers: cfe-commits, ASDenysPetrov, steakhal, Charusso, 
gamesh411, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, mgrang, rnkovacs, 
szepet, whisperity, mgorny.

If you were around the analyzer for a while now, you must've seen a lot of 
patches that awkwardly puts code from one library to the other:

- D75360  moves the constructors of 
CheckerManager, which lies in the Core library, to the Frontend library. Most 
the patch itself was a struggle along the library lines.
- D78126  had to be reverted because 
dependency information would be utilized in the Core library, but the actual 
data lied in the frontend. D78126#inline-751477 
 touches on this issue as well.

This stems from the often mentioned problem: the Frontend library depends on 
Core and Checkers, Checkers depends on Core. The checker registry functions 
(`registerMallocChecker`, etc) lie in the Checkers library in order to keep 
each checker its own module. What this implies is that checker registration 
cannot take place in the Core, but the Core might still want to use the data 
that results from it (which checker/package is enabled, dependencies, etc).

D54436  was the patch that initiated this. 
Back in the days when CheckerRegistry was super dumb and buggy, it implemented 
a non-documented solution to this problem by keeping the data in the Core, and 
leaving the logic in the Frontend. At the time when the patch landed, the 
merger to the Frontend made sense, because the data hadn't been utilized 
anywhere, and the whole workaround without any documentation made little sense 
to me.

So, lets put the data back where it belongs, in the Core library.

Side note: I can't help but cringe at the fact how ridiculously awkward the 
library lines are. I feel like I'm thinking too much inside the box, but I 
guess this is just the price of keeping the checkers so modularized.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82585

Files:
  clang/include/clang/StaticAnalyzer/Core/CheckerManager.h
  clang/include/clang/StaticAnalyzer/Core/CheckerRegistryData.h
  clang/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h
  clang/lib/StaticAnalyzer/Core/CMakeLists.txt
  clang/lib/StaticAnalyzer/Core/CheckerRegistryData.cpp
  clang/lib/StaticAnalyzer/Frontend/AnalyzerHelpFlags.cpp
  clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
  clang/lib/StaticAnalyzer/Frontend/CreateCheckerManager.cpp
  clang/unittests/StaticAnalyzer/CallEventTest.cpp
  clang/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp

Index: clang/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp
===
--- clang/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp
+++ clang/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp
@@ -100,8 +100,9 @@
 llvm::raw_svector_ostream OS(Buf);
 C.getAnalysisManager()
 .getCheckerManager()
-->getCheckerRegistry()
-.printEnabledCheckerList(OS);
+->getCheckerRegistryData()
+.printEnabledCheckerList(C.getAnalysisManager().getAnalyzerOptions(),
+ OS);
 // Strip a newline off.
 auto R =
 std::make_unique(*BT, OS.str().drop_back(1), N);
Index: clang/unittests/StaticAnalyzer/CallEventTest.cpp
===
--- clang/unittests/StaticAnalyzer/CallEventTest.cpp
+++ clang/unittests/StaticAnalyzer/CallEventTest.cpp
@@ -10,6 +10,7 @@
 #include "CheckerRegistration.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Frontend/CompilerInstance.h"
+#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h"
Index: clang/lib/StaticAnalyzer/Frontend/CreateCheckerManager.cpp
===
--- clang/lib/StaticAnalyzer/Frontend/CreateCheckerManager.cpp
+++ clang/lib/StaticAnalyzer/Frontend/CreateCheckerManager.cpp
@@ -23,11 +23,11 @@
 ArrayRef> checkerRegistrationFns)
 : Context(), LangOpts(Context.getLangOpts()), AOptions(AOptions),
   PP(), Diags(Context.getDiagnostics()),
-  Registry(
-  std::make_unique(plugins, Context.getDiagnostics(),
-AOptions, checkerRegistrationFns)) {
-  Registry->initializeRegistry(*this);
-  Registry->initializeManager(*this);
+  RegistryData(std::make_unique()) {
+  CheckerRegistry Registry(*RegistryData, plugins, Context.getDiagnostics(),
+

[clang] 3661595 - [Coroutines] Special handle __builtin_coro_resume for final_suspend nothrow check

2020-06-25 Thread Xun Li via cfe-commits

Author: Xun Li
Date: 2020-06-25T10:49:50-07:00
New Revision: 366159566df3a980d3e34f3ec9609e77cdb4df8b

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

LOG: [Coroutines] Special handle __builtin_coro_resume for final_suspend 
nothrow check

Summary:
In https://reviews.llvm.org/D82029 we added the conformance check that the 
expression co_await promise.final_suspend() should not potentially throw.
As part of this expression, in cases when the await_suspend() method of the 
final suspend awaiter returns a handle, __builtin_coro_resume could be called 
on the handle to immediately resume that coroutine.
__builtin_coro_resume is not declared with noexcept and it shouldn't. We need 
to special check this case here.

Reviewers: modocache, lewissbaker, junparser

Reviewed By: lewissbaker

Subscribers: modocache, cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/lib/Sema/SemaCoroutine.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaCoroutine.cpp 
b/clang/lib/Sema/SemaCoroutine.cpp
index c8ca247aae83..6262f4b117d3 100644
--- a/clang/lib/Sema/SemaCoroutine.cpp
+++ b/clang/lib/Sema/SemaCoroutine.cpp
@@ -614,6 +614,17 @@ static void checkNoThrow(Sema , const Stmt *E,
 // In the case of dtor, the call to dtor is implicit and hence we should
 // pass nullptr to canCalleeThrow.
 if (Sema::canCalleeThrow(S, IsDtor ? nullptr : cast(E), D)) {
+  if (const auto *FD = dyn_cast(D)) {
+// co_await promise.final_suspend() could end up calling
+// __builtin_coro_resume for symmetric transfer if await_suspend()
+// returns a handle. In that case, even __builtin_coro_resume is not
+// declared as noexcept and may throw, it does not throw _into_ the
+// coroutine that just suspended, but rather throws back out from
+// whoever called coroutine_handle::resume(), hence we claim that
+// logically it does not throw.
+if (FD->getBuiltinID() == Builtin::BI__builtin_coro_resume)
+  return;
+  }
   if (ThrowingDecls.empty()) {
 // First time seeing an error, emit the error message.
 S.Diag(cast(S.CurContext)->getLocation(),



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


[PATCH] D82579: [NFC] Extract unifyTargetFeatures

2020-06-25 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:93
+StringRef Name = Features[I];
+assert(Name[0] == '-' || Name[0] == '+');
+LastOpt[Name.drop_front(1)] = I;

I don't think assert should be used for something that may be specified to the 
user on command line.




Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:97
+
+  for (unsigned I = 0, N = Features.size(); I < N; ++I) {
+// If this feature was overridden, ignore it.

Would it be simpler to just iterate over features backwards and skip the 
features we've already seen?




Comment at: clang/lib/Driver/ToolChains/CommonArgs.h:120
+/// If there are multiple +xxx or -xxx features, keep the last one.
+void unifyTargetFeatures(std::vector );
+

Returning a new `std::vector` would make it more convenient to use 
and there's less complexity -- no need for the caller to create a temporary 
vector and the function itself can just return the temporary vector it collects 
the items in.

```
for (auto Feature : unifyTargetFeatures(Features)) {
  ...
}
```


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

https://reviews.llvm.org/D82579



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


[PATCH] D82498: [SourceManager] don't check invalid param of getLocalSLocEntry()

2020-06-25 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers updated this revision to Diff 273449.
nickdesaulniers added a comment.

- drop `Invalid` param from getLocalSLocEntry


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82498

Files:
  clang/include/clang/Basic/SourceManager.h
  clang/lib/Basic/SourceManager.cpp


Index: clang/lib/Basic/SourceManager.cpp
===
--- clang/lib/Basic/SourceManager.cpp
+++ clang/lib/Basic/SourceManager.cpp
@@ -882,11 +882,8 @@
   unsigned LessIndex = 0;
   NumProbes = 0;
   while (true) {
-bool Invalid = false;
 unsigned MiddleIndex = (GreaterIndex-LessIndex)/2+LessIndex;
-unsigned MidOffset = getLocalSLocEntry(MiddleIndex, ).getOffset();
-if (Invalid)
-  return FileID::get(0);
+unsigned MidOffset = getLocalSLocEntry(MiddleIndex).getOffset();
 
 ++NumProbes;
 
@@ -1694,11 +1691,7 @@
   // The location we're looking for isn't in the main file; look
   // through all of the local source locations.
   for (unsigned I = 0, N = local_sloc_entry_size(); I != N; ++I) {
-bool Invalid = false;
-const SLocEntry  = getLocalSLocEntry(I, );
-if (Invalid)
-  return FileID();
-
+const SLocEntry  = getLocalSLocEntry(I);
 if (SLoc.isFile() && SLoc.getFile().getContentCache() &&
 SLoc.getFile().getContentCache()->OrigEntry == SourceFile)
   return FileID::get(I);
Index: clang/include/clang/Basic/SourceManager.h
===
--- clang/include/clang/Basic/SourceManager.h
+++ clang/include/clang/Basic/SourceManager.h
@@ -1645,8 +1645,7 @@
   unsigned local_sloc_entry_size() const { return LocalSLocEntryTable.size(); }
 
   /// Get a local SLocEntry. This is exposed for indexing.
-  const SrcMgr::SLocEntry (unsigned Index,
- bool *Invalid = nullptr) const {
+  const SrcMgr::SLocEntry (unsigned Index) const {
 assert(Index < LocalSLocEntryTable.size() && "Invalid index");
 return LocalSLocEntryTable[Index];
   }
@@ -1739,12 +1738,13 @@
   const SrcMgr::SLocEntry (unsigned Index, bool *Invalid) const;
 
   /// Get the entry with the given unwrapped FileID.
+  /// Invalid will not be modified for Local IDs.
   const SrcMgr::SLocEntry (int ID,
 bool *Invalid = nullptr) const {
 assert(ID != -1 && "Using FileID sentinel value");
 if (ID < 0)
   return getLoadedSLocEntryByID(ID, Invalid);
-return getLocalSLocEntry(static_cast(ID), Invalid);
+return getLocalSLocEntry(static_cast(ID));
   }
 
   const SrcMgr::SLocEntry &


Index: clang/lib/Basic/SourceManager.cpp
===
--- clang/lib/Basic/SourceManager.cpp
+++ clang/lib/Basic/SourceManager.cpp
@@ -882,11 +882,8 @@
   unsigned LessIndex = 0;
   NumProbes = 0;
   while (true) {
-bool Invalid = false;
 unsigned MiddleIndex = (GreaterIndex-LessIndex)/2+LessIndex;
-unsigned MidOffset = getLocalSLocEntry(MiddleIndex, ).getOffset();
-if (Invalid)
-  return FileID::get(0);
+unsigned MidOffset = getLocalSLocEntry(MiddleIndex).getOffset();
 
 ++NumProbes;
 
@@ -1694,11 +1691,7 @@
   // The location we're looking for isn't in the main file; look
   // through all of the local source locations.
   for (unsigned I = 0, N = local_sloc_entry_size(); I != N; ++I) {
-bool Invalid = false;
-const SLocEntry  = getLocalSLocEntry(I, );
-if (Invalid)
-  return FileID();
-
+const SLocEntry  = getLocalSLocEntry(I);
 if (SLoc.isFile() && SLoc.getFile().getContentCache() &&
 SLoc.getFile().getContentCache()->OrigEntry == SourceFile)
   return FileID::get(I);
Index: clang/include/clang/Basic/SourceManager.h
===
--- clang/include/clang/Basic/SourceManager.h
+++ clang/include/clang/Basic/SourceManager.h
@@ -1645,8 +1645,7 @@
   unsigned local_sloc_entry_size() const { return LocalSLocEntryTable.size(); }
 
   /// Get a local SLocEntry. This is exposed for indexing.
-  const SrcMgr::SLocEntry (unsigned Index,
- bool *Invalid = nullptr) const {
+  const SrcMgr::SLocEntry (unsigned Index) const {
 assert(Index < LocalSLocEntryTable.size() && "Invalid index");
 return LocalSLocEntryTable[Index];
   }
@@ -1739,12 +1738,13 @@
   const SrcMgr::SLocEntry (unsigned Index, bool *Invalid) const;
 
   /// Get the entry with the given unwrapped FileID.
+  /// Invalid will not be modified for Local IDs.
   const SrcMgr::SLocEntry (int ID,
 bool *Invalid = nullptr) const {
 assert(ID != -1 && "Using FileID sentinel value");
 if (ID < 0)
   return getLoadedSLocEntryByID(ID, Invalid);
-return getLocalSLocEntry(static_cast(ID), Invalid);
+return 

[PATCH] D82582: [SVE] Remove calls to VectorType::getNumElements from clang

2020-06-25 Thread Christopher Tetreault via Phabricator via cfe-commits
ctetreau created this revision.
Herald added subscribers: cfe-commits, psnobl, rkruppe, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: clang.
ctetreau added a child revision: D78127: [SVE] Mark 
VectorType::getNumElements() deprecated.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82582

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/SwiftCallingConv.cpp

Index: clang/lib/CodeGen/SwiftCallingConv.cpp
===
--- clang/lib/CodeGen/SwiftCallingConv.cpp
+++ clang/lib/CodeGen/SwiftCallingConv.cpp
@@ -320,9 +320,12 @@
   // If we have a vector type, split it.
   if (auto vecTy = dyn_cast_or_null(type)) {
 auto eltTy = vecTy->getElementType();
-CharUnits eltSize = (end - begin) / vecTy->getNumElements();
+CharUnits eltSize =
+(end - begin) / cast(vecTy)->getNumElements();
 assert(eltSize == getTypeStoreSize(CGM, eltTy));
-for (unsigned i = 0, e = vecTy->getNumElements(); i != e; ++i) {
+for (unsigned i = 0,
+  e = cast(vecTy)->getNumElements();
+ i != e; ++i) {
   addEntry(eltTy, begin, begin + eltSize);
   begin += eltSize;
 }
@@ -674,8 +677,9 @@
 
 bool swiftcall::isLegalVectorType(CodeGenModule , CharUnits vectorSize,
   llvm::VectorType *vectorTy) {
-  return isLegalVectorType(CGM, vectorSize, vectorTy->getElementType(),
-   vectorTy->getNumElements());
+  return isLegalVectorType(
+  CGM, vectorSize, vectorTy->getElementType(),
+  cast(vectorTy)->getNumElements());
 }
 
 bool swiftcall::isLegalVectorType(CodeGenModule , CharUnits vectorSize,
@@ -688,7 +692,7 @@
 std::pair
 swiftcall::splitLegalVectorType(CodeGenModule , CharUnits vectorSize,
 llvm::VectorType *vectorTy) {
-  auto numElts = vectorTy->getNumElements();
+  auto numElts = cast(vectorTy)->getNumElements();
   auto eltTy = vectorTy->getElementType();
 
   // Try to split the vector type in half.
@@ -710,7 +714,7 @@
   }
 
   // Try to split the vector into legal subvectors.
-  auto numElts = origVectorTy->getNumElements();
+  auto numElts = cast(origVectorTy)->getNumElements();
   auto eltTy = origVectorTy->getElementType();
   assert(numElts != 1);
 
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -1323,7 +1323,7 @@
"Splatted expr doesn't match with vector element type?");
 
 // Splat the element across to all elements
-unsigned NumElements = cast(DstTy)->getNumElements();
+unsigned NumElements = cast(DstTy)->getNumElements();
 return Builder.CreateVectorSplat(NumElements, Src, "splat");
   }
 
@@ -1630,7 +1630,7 @@
 Value *RHS = CGF.EmitScalarExpr(E->getExpr(1));
 Value *Mask;
 
-llvm::VectorType *LTy = cast(LHS->getType());
+auto *LTy = cast(LHS->getType());
 unsigned LHSElts = LTy->getNumElements();
 
 Mask = RHS;
@@ -1648,10 +1648,12 @@
 //   n = extract mask i
 //   x = extract val n
 //   newv = insert newv, x, i
-auto *RTy = llvm::FixedVectorType::get(LTy->getElementType(),
-   MTy->getNumElements());
+auto *RTy = llvm::FixedVectorType::get(
+LTy->getElementType(),
+cast(MTy)->getNumElements());
 Value* NewV = llvm::UndefValue::get(RTy);
-for (unsigned i = 0, e = MTy->getNumElements(); i != e; ++i) {
+for (unsigned i = 0, e = cast(MTy)->getNumElements();
+ i != e; ++i) {
   Value *IIndx = llvm::ConstantInt::get(CGF.SizeTy, i);
   Value *Indx = Builder.CreateExtractElement(Mask, IIndx, "shuf_idx");
 
@@ -1840,7 +1842,7 @@
 return Visit(E->getInit(0));
   }
 
-  unsigned ResElts = VType->getNumElements();
+  unsigned ResElts = cast(VType)->getNumElements();
 
   // Loop over initializers collecting the Value for each, and remembering
   // whether the source was swizzle (ExtVectorElementExpr).  This will allow
@@ -1864,7 +1866,8 @@
   if (isa(IE)) {
 llvm::ExtractElementInst *EI = cast(Init);
 
-if (EI->getVectorOperandType()->getNumElements() == ResElts) {
+if (cast(EI->getVectorOperandType())
+->getNumElements() == ResElts) {
   llvm::ConstantInt *C = cast(EI->getIndexOperand());
   Value *LHS = nullptr, *RHS = nullptr;
   if (CurIdx == 0) {
@@ -1902,7 +1905,7 @@
   continue;
 }
 
-unsigned InitElts = VVT->getNumElements();
+unsigned InitElts = cast(VVT)->getNumElements();
 
 // If the initializer is an ExtVecEltExpr (a swizzle), and the swizzle's
 // input is the same width as the vector being constructed, generate an
@@ -1911,7 +1914,7 @@
 if (isa(IE)) {
   

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

2020-06-25 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan accepted this revision.
leonardchan 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/D73186/new/

https://reviews.llvm.org/D73186



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


[PATCH] D82085: [TRE] allow TRE for non-capturing calls.

2020-06-25 Thread Alexey Lapshin via Phabricator via cfe-commits
avl marked an inline comment as done.
avl added inline comments.



Comment at: llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:838
+if (isValidTRECandidate(CI))
+  HasValidCandidates = true;
+  }

laytonio wrote:
> avl wrote:
> > laytonio wrote:
> > > Is there any reason to find and validate candidates now only to have to 
> > > redo it when we actually perform the eliminations? If so, is there any 
> > > reason this needs to follow a different code path than findTRECandidate? 
> > > findTRECandidate is doing the same checks, except for canMoveAboveCall 
> > > and canTransformAccumulatorRecursion, which should probably be refactored 
> > > into findTRECandidate from eliminateCall anyway. If not then all of this 
> > > code goes away and we're left with the same canTRE as in trunk.
> > We are enumerating all instructions here, so we could understand if there 
> > are not TRE candidates and stop earlier. That is the reason for doing it 
> > here.
> > 
> > I agree that findTRECandidate should be refactored to have the same checks 
> > as here. 
> > 
> > What do you think is better to do:
> > 
> > - leave early check for TRE candidates in canTRE or remove it
> > - refactor findTRECandidate or leave it as is
> > 
> > ?
> Yes we are iterating all the instructions here but, unless I am missing 
> something, we would literally just be doing the checks twice for no reason. 
> Look at it this way, best case scenario we have to check all possible 
> candidates once, find none and we're done. Worst case, we check all possible 
> candidates once, find one and have to check all possible candidates a second 
> time. Where as if we remove the early checks we only ever have to check the 
> candidates once. So we wouldn't really be stopping any earlier.
> 
> As for refactoring findTRECandidate, I do think that should be done and we 
> should strive to move all the failure conditions out of eliminateCall in 
> order to avoid having to fold a return only to find out we didn't need to. 
> But, I think that is out of the scope of this change, and if we do decide to 
> keep the early checks here then we should say that findTRECandidate does a 
> good enough job to consider this function as having valid candidates.
>Yes we are iterating all the instructions here but, unless I am missing 
>something, we would literally just be doing the checks twice for no reason. 
>Look at it this way, best case scenario we have to check all possible 
>candidates once, find none and we're done. Worst case, we check all possible 
>candidates once, find one and have to check all possible candidates a second 
>time. Where as if we remove the early checks we only ever have to check the 
>candidates once. So we wouldn't really be stopping any earlier.

yes. we would do check twice if there are TRE candidates. my idea was that 
number of cases when TRE is applicable less then when TRE is not applicable. 
Thus we would do double instruction navigation more often than double check for 
candidates. But, I did not measure real impact. Thus, let`s return old logic 
here as you suggested.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82085



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


[PATCH] D82506: [HIP] Add missing options for lto

2020-06-25 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.

LGTM.


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

https://reviews.llvm.org/D82506



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


[PATCH] D82415: [Coroutines] Special handle __builtin_coro_resume for final_suspend nothrow check

2020-06-25 Thread Lewis Baker via Phabricator via cfe-commits
lewissbaker accepted this revision.
lewissbaker added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: clang/lib/Sema/SemaCoroutine.cpp:621
+// returns a handle. In that case, even __builtin_coro_resume is not
+// declared as noexcept, we claim that logically it does not throw.
+if (FD->getBuiltinID() == Builtin::BI__builtin_coro_resume)

... it does not throw _into_ the coroutine that just suspended, but rather 
throws back out from whoever called coroutine_handle::resume().


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82415



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


[PATCH] D81678: Introduce frozen attribute at call sites for stricter poison analysis

2020-06-25 Thread Gui Andrade via Phabricator via cfe-commits
guiand marked an inline comment as done.
guiand added inline comments.



Comment at: clang/lib/CodeGen/CGCall.cpp:2082
+  const Type *RetTyPtr = RetTy.getTypePtr();
+  if (!RetTy->isVoidType() && !RetTyPtr->isRecordType() &&
+  RetAI.getKind() != ABIArgInfo::Indirect) {

rsmith wrote:
> Other types that we should think about from a padding perspective:
> 
>  * `nullptr_t` (which has the same size and alignment as `void*` but is all 
> padding)
>  * 80-bit `long double` and `_Complex long double` (I don't know whether we 
> guarantee to initialize the 6 padding bytes)
>  * member pointers might contain padding under some ABI rules -- under the MS 
> ABI, you get a struct containing N pointers followed by M ints, which could 
> have 4 bytes of tail padding on 64-bit targets
>  * vector types with tail padding (eg, a vector of 3 `char`s is sometimes 
> passed as an `i32` with one byte `undef`)
>  * matrix types (presumably the same concerns as for vector types apply here)
>  * maybe Obj-C object types?
>  * `_ExtInt` types (eg, returning an `_ExtInt(65)` initialized to 0 produces 
> an `{i64, i64}` containing 7 bytes of `undef`)
> 
> It would be safer to list exactly those types for which we know this 
> assumption is correct rather than assuming that it's correct by default -- I 
> think more than half of the `Type` subclasses for concrete canonical types 
> can have undef bits in their IR representation.
This is a good point, and I think there was some nuance that I had previously 
included in determining this for records (since removed) that I didn't think to 
include in CGCall.cpp.

I think one particular check, `llvm::DataLayout::typeSizeEqualsStoreSize`, 
handles a lot of these cases:
- `long double`
- oddly-sized vectors
- `_ExtInt` types

I don't know if the `matrix` type has internal padding (like structs) but if 
not it would cover that as well.  
I believe that the struct with padding wouldn't be an issue as we're excluding 
record types here.  
And I'd have to take a closer look at `nullptr_t` to see how it behaves here.

~~~

But if I'd like to build an exhaustive list of types I think will work 
correctly with a check like this:
- scalars
- floating point numbers
- pointers

I think I'd need also need an inner `typeSizeEqualsStoreSize` check on the base 
type of vectors/complex numbers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81678



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


[PATCH] D82360: Add StringLiteral to SyntaxTree

2020-06-25 Thread Eduardo Caldas via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG466e8b7ea6e1: Add StringLiteral to SyntaxTree (authored by 
eduucaldas).

Changed prior to commit:
  https://reviews.llvm.org/D82360?vs=273346=273438#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82360

Files:
  clang/include/clang/Tooling/Syntax/Nodes.h
  clang/lib/Tooling/Syntax/BuildTree.cpp
  clang/lib/Tooling/Syntax/Nodes.cpp
  clang/unittests/Tooling/Syntax/TreeTest.cpp

Index: clang/unittests/Tooling/Syntax/TreeTest.cpp
===
--- clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -1399,6 +1399,109 @@
 )txt"));
 }
 
+TEST_P(SyntaxTreeTest, StringLiteral) {
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  "a\n\0\x20";
+  L"αβ";
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-StringLiteralExpression
+| | `-"a\n\0\x20"
+| `-;
+|-ExpressionStatement
+| |-StringLiteralExpression
+| | `-L"αβ"
+| `-;
+`-}
+)txt"));
+}
+
+TEST_P(SyntaxTreeTest, StringLiteralUtf) {
+  if (!GetParam().isCXX11OrLater()) {
+return;
+  }
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  u8"a\x1f\x05";
+  u"C++抽象構文木";
+  U"\n";
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-StringLiteralExpression
+| | `-u8"a\x1f\x05"
+| `-;
+|-ExpressionStatement
+| |-StringLiteralExpression
+| | `-u"C++抽象構文木"
+| `-;
+|-ExpressionStatement
+| |-StringLiteralExpression
+| | `-U"\n"
+| `-;
+`-}
+)txt"));
+}
+
+TEST_P(SyntaxTreeTest, StringLiteralRaw) {
+  if (!GetParam().isCXX11OrLater()) {
+return;
+  }
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  R"SyntaxTree(
+  Hello "Syntax" \"
+  )SyntaxTree";
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-StringLiteralExpression
+| | `-R"SyntaxTree(
+  Hello "Syntax" \"
+  )SyntaxTree"
+| `-;
+`-}
+)txt"));
+}
+
 TEST_P(SyntaxTreeTest, IntegerLiteral) {
   EXPECT_TRUE(treeDumpEqual(
   R"cpp(
@@ -2730,7 +2833,7 @@
 | |-BoolLiteralExpression
 | | `-true
 | |-,
-| |-UnknownExpression
+| |-StringLiteralExpression
 | | `-"message"
 | |-)
 | `-;
Index: clang/lib/Tooling/Syntax/Nodes.cpp
===
--- clang/lib/Tooling/Syntax/Nodes.cpp
+++ clang/lib/Tooling/Syntax/Nodes.cpp
@@ -26,6 +26,8 @@
 return OS << "BoolLiteralExpression";
   case NodeKind::CharacterLiteralExpression:
 return OS << "CharacterLiteralExpression";
+  case NodeKind::StringLiteralExpression:
+return OS << "StringLiteralExpression";
   case NodeKind::PrefixUnaryOperatorExpression:
 return OS << "PrefixUnaryOperatorExpression";
   case NodeKind::PostfixUnaryOperatorExpression:
@@ -214,6 +216,11 @@
   findChild(syntax::NodeRole::LiteralToken));
 }
 
+syntax::Leaf *syntax::StringLiteralExpression::literalToken() {
+  return llvm::cast_or_null(
+  findChild(syntax::NodeRole::LiteralToken));
+}
+
 syntax::Leaf *syntax::CxxNullPtrExpression::nullPtrKeyword() {
   return llvm::cast_or_null(
   findChild(syntax::NodeRole::LiteralToken));
Index: clang/lib/Tooling/Syntax/BuildTree.cpp
===
--- clang/lib/Tooling/Syntax/BuildTree.cpp
+++ clang/lib/Tooling/Syntax/BuildTree.cpp
@@ -667,6 +667,12 @@
  new (allocator()) syntax::CharacterLiteralExpression, S);
 return true;
   }
+  bool WalkUpFromStringLiteral(StringLiteral *S) {
+Builder.markChildToken(S->getBeginLoc(), syntax::NodeRole::LiteralToken);
+Builder.foldNode(Builder.getExprRange(S),
+ new (allocator()) syntax::StringLiteralExpression, S);
+return true;
+  }
 
   bool WalkUpFromCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *S) {
 Builder.markChildToken(S->getLocation(), syntax::NodeRole::LiteralToken);
Index: clang/include/clang/Tooling/Syntax/Nodes.h
===
--- clang/include/clang/Tooling/Syntax/Nodes.h
+++ clang/include/clang/Tooling/Syntax/Nodes.h
@@ -47,6 +47,7 @@
   IntegerLiteralExpression,
   BoolLiteralExpression,
   CharacterLiteralExpression,
+  StringLiteralExpression,
   IdExpression,
 
   // Statements.
@@ -287,6 +288,16 @@
   syntax::Leaf *literalToken();
 };
 

[PATCH] D82256: [analyzer] Enable constructor support in evalCall event

2020-06-25 Thread Nithin VR via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG37c1bf21d1da: [analyzer] Enable constructor support in 
evalCall event. (authored by vrnithinkumar, committed by Artem Dergachev 
adergac...@apple.com).

Changed prior to commit:
  https://reviews.llvm.org/D82256?vs=273162=273430#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82256

Files:
  clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
  clang/include/clang/StaticAnalyzer/Core/CheckerManager.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  clang/lib/StaticAnalyzer/Checkers/AnalysisOrderChecker.cpp
  clang/lib/StaticAnalyzer/Core/CallEvent.cpp
  clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
  clang/test/Analysis/analyzer-config.c
  clang/test/Analysis/cxxctr-evalcall-analysis-order.cpp
  clang/test/Analysis/new-ctor-conservative.cpp

Index: clang/test/Analysis/new-ctor-conservative.cpp
===
--- clang/test/Analysis/new-ctor-conservative.cpp
+++ clang/test/Analysis/new-ctor-conservative.cpp
@@ -27,6 +27,7 @@
   S *s = new S[10];
   // FIXME: Should be true once we inline array constructors.
   clang_analyzer_eval(s[0].x == 1); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(s[1].x == 1); // expected-warning{{UNKNOWN}}
 }
 
 struct NullS {
Index: clang/test/Analysis/cxxctr-evalcall-analysis-order.cpp
===
--- /dev/null
+++ clang/test/Analysis/cxxctr-evalcall-analysis-order.cpp
@@ -0,0 +1,33 @@
+// RUN: %clang_analyze_cc1 %s \
+// RUN:  -analyzer-checker=debug.AnalysisOrder \
+// RUN:  -analyzer-config debug.AnalysisOrder:EvalCall=true \
+// RUN:  -analyzer-config debug.AnalysisOrder:PreCall=true \
+// RUN:  -analyzer-config debug.AnalysisOrder:PostCall=true \
+// RUN:  2>&1 | FileCheck %s
+
+// This test ensures that eval::Call event will be triggered for constructors.
+
+class C {
+public:
+  C(){};
+  C(int x){};
+  C(int x, int y){};
+};
+
+void foo() {
+  C C0;
+  C C1(42);
+  C *C2 = new C{2, 3};
+}
+
+// CHECK:  PreCall (C::C) [CXXConstructorCall]
+// CHECK-NEXT:  EvalCall (C::C) {argno: 0} [CXXConstructorCall]
+// CHECK-NEXT:  PostCall (C::C) [CXXConstructorCall]
+// CHECK-NEXT:  PreCall (C::C) [CXXConstructorCall]
+// CHECK-NEXT:  EvalCall (C::C) {argno: 1} [CXXConstructorCall]
+// CHECK-NEXT:  PostCall (C::C) [CXXConstructorCall]
+// CHECK-NEXT:  PreCall (operator new) [CXXAllocatorCall]
+// CHECK-NEXT:  PostCall (operator new) [CXXAllocatorCall]
+// CHECK-NEXT:  PreCall (C::C) [CXXConstructorCall]
+// CHECK-NEXT:  EvalCall (C::C) {argno: 2} [CXXConstructorCall]
+// CHECK-NEXT:  PostCall (C::C) [CXXConstructorCall]
Index: clang/test/Analysis/analyzer-config.c
===
--- clang/test/Analysis/analyzer-config.c
+++ clang/test/Analysis/analyzer-config.c
@@ -50,6 +50,7 @@
 // CHECK-NEXT: debug.AnalysisOrder:Bind = false
 // CHECK-NEXT: debug.AnalysisOrder:EndAnalysis = false
 // CHECK-NEXT: debug.AnalysisOrder:EndFunction = false
+// CHECK-NEXT: debug.AnalysisOrder:EvalCall = false
 // CHECK-NEXT: debug.AnalysisOrder:LiveSymbols = false
 // CHECK-NEXT: debug.AnalysisOrder:NewAllocator = false
 // CHECK-NEXT: debug.AnalysisOrder:PointerEscape = false
Index: clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
===
--- clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
+++ clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
@@ -584,7 +584,7 @@
   // defaultEvalCall if all of them fail.
   ExplodedNodeSet dstCallEvaluated;
   getCheckerManager().runCheckersForEvalCall(dstCallEvaluated, dstPreVisit,
- Call, *this);
+ Call, *this, EvalCallOptions());
 
   // If there were other constructors called for object-type arguments
   // of this call, clean them up.
@@ -717,7 +717,7 @@
 ExprEngine::CallInlinePolicy
 ExprEngine::mayInlineCallKind(const CallEvent , const ExplodedNode *Pred,
   AnalyzerOptions ,
-  const ExprEngine::EvalCallOptions ) {
+  const EvalCallOptions ) {
   const LocationContext *CurLC = Pred->getLocationContext();
   const StackFrameContext *CallerSFC = CurLC->getStackFrame();
   switch (Call.getKind()) {
Index: clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
===
--- clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
+++ clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
@@ -615,7 +615,8 @@
   } else {
 for (ExplodedNodeSet::iterator I = DstPreCall.begin(), E = 

[PATCH] D82318: Add `FloatingLiteral` to SyntaxTree

2020-06-25 Thread Eduardo Caldas via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7b404b6d0031: Add `FloatingLiteral` to SyntaxTree (authored 
by eduucaldas).

Changed prior to commit:
  https://reviews.llvm.org/D82318?vs=273347=273437#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82318

Files:
  clang/include/clang/Tooling/Syntax/Nodes.h
  clang/lib/Tooling/Syntax/BuildTree.cpp
  clang/lib/Tooling/Syntax/Nodes.cpp
  clang/unittests/Tooling/Syntax/TreeTest.cpp

Index: clang/unittests/Tooling/Syntax/TreeTest.cpp
===
--- clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -53,6 +53,8 @@
 
   bool isC99OrLater() const { return Language == Lang_C99; }
 
+  bool isC() const { return Language == Lang_C89 || Language == Lang_C99; }
+
   bool isCXX() const {
 return Language == Lang_CXX03 || Language == Lang_CXX11 ||
Language == Lang_CXX14 || Language == Lang_CXX17 ||
@@ -69,10 +71,6 @@
Language == Lang_CXX20;
   }
 
-  bool hasBoolType() const {
-return Language == Lang_C89 || Language == Lang_C99;
-  }
-
   bool isCXX17OrLater() const {
 return Language == Lang_CXX17 || Language == Lang_CXX20;
   }
@@ -1207,14 +1205,66 @@
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, CxxNullPtrLiteral) {
+TEST_P(SyntaxTreeTest, IntegerLiteral) {
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  12;
+  12u;
+  12l;
+  12ul;
+  014;
+  0XC;
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-IntegerLiteralExpression
+| | `-12
+| `-;
+|-ExpressionStatement
+| |-IntegerLiteralExpression
+| | `-12u
+| `-;
+|-ExpressionStatement
+| |-IntegerLiteralExpression
+| | `-12l
+| `-;
+|-ExpressionStatement
+| |-IntegerLiteralExpression
+| | `-12ul
+| `-;
+|-ExpressionStatement
+| |-IntegerLiteralExpression
+| | `-014
+| `-;
+|-ExpressionStatement
+| |-IntegerLiteralExpression
+| | `-0XC
+| `-;
+`-}
+)txt"));
+}
+
+TEST_P(SyntaxTreeTest, IntegerLiteralLongLong) {
   if (!GetParam().isCXX11OrLater()) {
 return;
   }
   EXPECT_TRUE(treeDumpEqual(
   R"cpp(
 void test() {
-  nullptr;
+  12ll;
+  12ull;
 }
 )cpp",
   R"txt(
@@ -1229,8 +1279,70 @@
   `-CompoundStatement
 |-{
 |-ExpressionStatement
-| |-CxxNullPtrExpression
-| | `-nullptr
+| |-IntegerLiteralExpression
+| | `-12ll
+| `-;
+|-ExpressionStatement
+| |-IntegerLiteralExpression
+| | `-12ull
+| `-;
+`-}
+)txt"));
+}
+
+TEST_P(SyntaxTreeTest, IntegerLiteralBinary) {
+  if (!GetParam().isCXX14OrLater()) {
+return;
+  }
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  0b1100;
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-IntegerLiteralExpression
+| | `-0b1100
+| `-;
+`-}
+)txt"));
+}
+
+TEST_P(SyntaxTreeTest, IntegerLiteralWithDigitSeparators) {
+  if (!GetParam().isCXX14OrLater()) {
+return;
+  }
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  1'2'0ull;
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-IntegerLiteralExpression
+| | `-1'2'0ull
 | `-;
 `-}
 )txt"));
@@ -1365,15 +1477,58 @@
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, BoolLiteral) {
-  if (GetParam().hasBoolType()) {
+TEST_P(SyntaxTreeTest, FloatingLiteral) {
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  1e-2;
+  2.;
+  .2;
+  2.f;
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-FloatingLiteralExpression
+| | `-1e-2
+| `-;
+|-ExpressionStatement
+| |-FloatingLiteralExpression
+| | `-2.
+| `-;
+|-ExpressionStatement
+| |-FloatingLiteralExpression
+| | `-.2
+| `-;
+|-ExpressionStatement
+| |-FloatingLiteralExpression
+| | `-2.f
+| `-;
+`-}
+)txt"));
+}
+
+TEST_P(SyntaxTreeTest, FloatingLiteralHexadecimal) {
+  if (!GetParam().isCXX17OrLater()) {
 return;
   }
   EXPECT_TRUE(treeDumpEqual(
   R"cpp(
 void test() {
-  true;
-  false;
+  0xfp1;
+  0xf.p1;
+  0x.fp1;
+  0xf.fp1f;
 }
 )cpp",
   R"txt(
@@ -1388,12 +1543,20 @@
   `-CompoundStatement
 |-{
 |-ExpressionStatement
-

[PATCH] D82312: Add `CharLiteral` to SyntaxTree

2020-06-25 Thread Eduardo Caldas via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG221d7bbe49cc: Add `CharLiteral` to SyntaxTree (authored by 
eduucaldas).

Changed prior to commit:
  https://reviews.llvm.org/D82312?vs=273343=273436#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82312

Files:
  clang/include/clang/Tooling/Syntax/Nodes.h
  clang/lib/Tooling/Syntax/BuildTree.cpp
  clang/lib/Tooling/Syntax/Nodes.cpp
  clang/unittests/Tooling/Syntax/TreeTest.cpp

Index: clang/unittests/Tooling/Syntax/TreeTest.cpp
===
--- clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -73,6 +73,10 @@
 return Language == Lang_C89 || Language == Lang_C99;
   }
 
+  bool isCXX17OrLater() const {
+return Language == Lang_CXX17 || Language == Lang_CXX20;
+  }
+
   bool supportsCXXDynamicExceptionSpecification() const {
 return Language == Lang_CXX03 || Language == Lang_CXX11 ||
Language == Lang_CXX14;
@@ -1232,6 +1236,135 @@
 )txt"));
 }
 
+TEST_P(SyntaxTreeTest, CharacterLiteral) {
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  'a';
+  '\n';
+  '\x20';
+  '\0';
+  L'a';
+  L'α';
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-'a'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-'\n'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-'\x20'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-'\0'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-L'a'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-L'α'
+| `-;
+`-}
+)txt"));
+}
+
+TEST_P(SyntaxTreeTest, CharacterLiteralUtf) {
+  if (!GetParam().isCXX11OrLater()) {
+return;
+  }
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  u'a';
+  u'構';
+  U'a';
+  U'';
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-u'a'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-u'構'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-U'a'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-U''
+| `-;
+`-}
+)txt"));
+}
+
+TEST_P(SyntaxTreeTest, CharacterLiteralUtf8) {
+  if (!GetParam().isCXX17OrLater()) {
+return;
+  }
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  u8'a';
+  u8'\x7f';
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-u8'a'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-u8'\x7f'
+| `-;
+`-}
+)txt"));
+}
+
 TEST_P(SyntaxTreeTest, BoolLiteral) {
   if (GetParam().hasBoolType()) {
 return;
Index: clang/lib/Tooling/Syntax/Nodes.cpp
===
--- clang/lib/Tooling/Syntax/Nodes.cpp
+++ clang/lib/Tooling/Syntax/Nodes.cpp
@@ -24,6 +24,8 @@
 return OS << "IntegerLiteralExpression";
   case NodeKind::BoolLiteralExpression:
 return OS << "BoolLiteralExpression";
+  case NodeKind::CharacterLiteralExpression:
+return OS << "CharacterLiteralExpression";
   case NodeKind::PrefixUnaryOperatorExpression:
 return OS << "PrefixUnaryOperatorExpression";
   case NodeKind::PostfixUnaryOperatorExpression:
@@ -207,6 +209,11 @@
   findChild(syntax::NodeRole::LiteralToken));
 }
 
+syntax::Leaf *syntax::CharacterLiteralExpression::literalToken() {
+  return llvm::cast_or_null(
+  findChild(syntax::NodeRole::LiteralToken));
+}
+
 syntax::Leaf *syntax::CxxNullPtrExpression::nullPtrKeyword() {
   return llvm::cast_or_null(
   findChild(syntax::NodeRole::LiteralToken));
Index: clang/lib/Tooling/Syntax/BuildTree.cpp
===
--- clang/lib/Tooling/Syntax/BuildTree.cpp
+++ clang/lib/Tooling/Syntax/BuildTree.cpp
@@ -661,6 +661,13 @@
 return true;
   }
 
+  bool WalkUpFromCharacterLiteral(CharacterLiteral *S) {
+Builder.markChildToken(S->getLocation(), syntax::NodeRole::LiteralToken);
+Builder.foldNode(Builder.getExprRange(S),
+ new (allocator()) syntax::CharacterLiteralExpression, 

[PATCH] D82506: [HIP] Add missing options for lto

2020-06-25 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked an inline comment as done.
yaxunl added inline comments.



Comment at: clang/lib/Driver/ToolChains/HIP.cpp:76
+MAttrString.append(Args.MakeArgString(OneFeature));
+if (OneFeature != Features.back())
+  MAttrString.append(",");

tra wrote:
> I think StringRef will result in comparison by value. If we happen to have 
> duplicate features, we may end up skipping a comma.
> You need to either iterate ofer the pointers to elements of the Features, or 
> use a different method of figuring out if a comma is necessary.
> E.g. us a bool set at the end of the body.
> 
> 
> 
Fixed by using unifyTargetFeatures. This makes sure the features are unique.


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

https://reviews.llvm.org/D82506



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


[PATCH] D82497: [Clang][SourceManager] optimize getFileIDLocal()

2020-06-25 Thread Nick Desaulniers via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG408efffbe4a5: [Clang][SourceManager] optimize 
getFileIDLocal() (authored by nickdesaulniers).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82497

Files:
  clang/lib/Basic/SourceManager.cpp


Index: clang/lib/Basic/SourceManager.cpp
===
--- clang/lib/Basic/SourceManager.cpp
+++ clang/lib/Basic/SourceManager.cpp
@@ -898,9 +898,8 @@
 }
 
 // If the middle index contains the value, succeed and return.
-// FIXME: This could be made faster by using a function that's aware of
-// being in the local area.
-if (isOffsetInFileID(FileID::get(MiddleIndex), SLocOffset)) {
+if (MiddleIndex + 1 == LocalSLocEntryTable.size() ||
+SLocOffset < getLocalSLocEntry(MiddleIndex + 1).getOffset()) {
   FileID Res = FileID::get(MiddleIndex);
 
   // If this isn't a macro expansion, remember it.  We have good locality


Index: clang/lib/Basic/SourceManager.cpp
===
--- clang/lib/Basic/SourceManager.cpp
+++ clang/lib/Basic/SourceManager.cpp
@@ -898,9 +898,8 @@
 }
 
 // If the middle index contains the value, succeed and return.
-// FIXME: This could be made faster by using a function that's aware of
-// being in the local area.
-if (isOffsetInFileID(FileID::get(MiddleIndex), SLocOffset)) {
+if (MiddleIndex + 1 == LocalSLocEntryTable.size() ||
+SLocOffset < getLocalSLocEntry(MiddleIndex + 1).getOffset()) {
   FileID Res = FileID::get(MiddleIndex);
 
   // If this isn't a macro expansion, remember it.  We have good locality
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81938: [InferAddressSpaces] Handle the pair of `ptrtoint`/`inttoptr`.

2020-06-25 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added inline comments.



Comment at: clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu:66
+// COMMON-LABEL: define amdgpu_kernel void @_Z7kernel41S(%struct.S.coerce 
%s.coerce)
+// OPT: %0 = extractvalue %struct.S.coerce %s.coerce, 0
+// OPT: %1 = extractvalue %struct.S.coerce %s.coerce, 1

Probably should use filecheck variables to avoid depending on the numbers



Comment at: clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu:69
+// OPT: %2 = load i32, i32 addrspace(1)* %0, align 4
+// OPT: %inc = add nsw i32 %2, 1
+// OPT: store i32 %inc, i32 addrspace(1)* %0, align 4

I think relying on the name may fail in a release build, filecheck variable



Comment at: llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp:237-239
+ TTI->isNoopAddrSpaceCast(
+ P2I->getOperand(0)->getType()->getPointerAddressSpace(),
+ I2P->getType()->getPointerAddressSpace());

arsenm wrote:
> hliao wrote:
> > arsenm wrote:
> > > Can you also elaborate on why the isNoopAddrSpaceCast check is needed? 
> > > I'm not 100% sure it is in all contexts, so want to be sure to document 
> > > that
> > As we may convert a pair of ptr/int casts into an `addrspacecast` if both 
> > of them are no-op casts, if that's not a no-op `addrspacecast` under a 
> > specific target, we may introduce an invalid `addrspacecast` based on the 
> > current IR spec.
> > 
> I mean there needs to be comment explaining all of this
I think this is missing one of the key points I'm worried about for the IR 
semantics.

I believe if you were to invalidly reinterpret a pointer with another address 
space, it would be undefined to access the invalid pointer and thus you can use 
this to infer. In pure arithmetic cases, I'm not sure this would hold. This 
check is to avoid breaking cases where it may still be valid to do something 
with reinterpreted pointer bits other than access memory



Comment at: llvm/test/Transforms/InferAddressSpaces/noop-ptrint-pair.ll:2
+; RUN: opt -mtriple=amdgcn-amd-amdhsa -S -o - -infer-address-spaces %s | 
FileCheck -check-prefixes=COMMON,AMDGCN %s
+; RUN: opt -S -o - -infer-address-spaces %s | FileCheck 
-check-prefixes=COMMON,NOTTI %s
+

The pass early exits without TTI since there's no flat address space value, so 
this isn't really testing anything. We would have to add a flag for the flat 
value to bypass it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81938



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


[PATCH] D82579: [NFC] Extract unifyTargetFeatures

2020-06-25 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.
yaxunl added a reviewer: tra.
yaxunl added a child revision: D82506: [HIP] Add missing options for lto.

extract unifyTargetFeatures to be used by lld.


https://reviews.llvm.org/D82579

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  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
@@ -35,3 +35,13 @@
 
 // ALL3: {{.*}}clang{{.*}}"-target-feature" "+xnack" "-target-feature" "+sram-ecc"
 // NOALL3: {{.*}}clang{{.*}}"-target-feature" "-xnack" "-target-feature" "-sram-ecc"
+
+// RUN: %clang -### -target x86_64-linux-gnu -fgpu-rdc -nogpulib \
+// RUN:   --cuda-gpu-arch=gfx1010 %s \
+// 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"
Index: clang/lib/Driver/ToolChains/CommonArgs.h
===
--- clang/lib/Driver/ToolChains/CommonArgs.h
+++ clang/lib/Driver/ToolChains/CommonArgs.h
@@ -106,10 +106,19 @@
 std::string getCPUName(const llvm::opt::ArgList , const llvm::Triple ,
bool FromAs = false);
 
+/// Iterate \p Args and convert -mxxx to +xxx and -mno-xxx to -xxx and
+/// append it to \p Features.
+///
+/// Note: Since \p Features may contain default values before calling
+/// this function, or may be appended with entries to override arguments,
+/// entries in \p Features are not unique.
 void handleTargetFeaturesGroup(const llvm::opt::ArgList ,
std::vector ,
llvm::opt::OptSpecifier Group);
 
+/// If there are multiple +xxx or -xxx features, keep the last one.
+void unifyTargetFeatures(std::vector );
+
 /// Handles the -save-stats option and returns the filename to save statistics
 /// to.
 SmallString<128> getStatsFileName(const llvm::opt::ArgList ,
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -84,6 +84,30 @@
   }
 }
 
+void tools::unifyTargetFeatures(std::vector ) {
+  std::vector UnifiedFeatures;
+  // Find the last of each feature.
+  llvm::StringMap LastOpt;
+  for (unsigned I = 0, N = Features.size(); I < N; ++I) {
+StringRef Name = Features[I];
+assert(Name[0] == '-' || Name[0] == '+');
+LastOpt[Name.drop_front(1)] = I;
+  }
+
+  for (unsigned I = 0, N = Features.size(); I < N; ++I) {
+// If this feature was overridden, ignore it.
+StringRef Name = Features[I];
+llvm::StringMap::iterator LastI = LastOpt.find(Name.drop_front(1));
+assert(LastI != LastOpt.end());
+unsigned Last = LastI->second;
+if (Last != I)
+  continue;
+
+UnifiedFeatures.push_back(Name);
+  }
+  Features = std::move(UnifiedFeatures);
+}
+
 void tools::addDirectoryList(const ArgList , ArgStringList ,
  const char *ArgName, const char *EnvVar) {
   const char *DirList = ::getenv(EnvVar);
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -374,25 +374,10 @@
 ve::getVETargetFeatures(D, Args, Features);
   }
 
-  // Find the last of each feature.
-  llvm::StringMap LastOpt;
-  for (unsigned I = 0, N = Features.size(); I < N; ++I) {
-StringRef Name = Features[I];
-assert(Name[0] == '-' || Name[0] == '+');
-LastOpt[Name.drop_front(1)] = I;
-  }
-
-  for (unsigned I = 0, N = Features.size(); I < N; ++I) {
-// If this feature was overridden, ignore it.
-StringRef Name = Features[I];
-llvm::StringMap::iterator LastI = LastOpt.find(Name.drop_front(1));
-assert(LastI != LastOpt.end());
-unsigned Last = LastI->second;
-if (Last != I)
-  continue;
-
+  unifyTargetFeatures(Features);
+  for (auto Feature : Features) {
 CmdArgs.push_back(IsAux ? "-aux-target-feature" : "-target-feature");
-CmdArgs.push_back(Name.data());
+CmdArgs.push_back(Feature.data());
   }
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79972: [OpenMP5.0] map item can be non-contiguous for target update

2020-06-25 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:7849-7851
+if ( != &*Components.begin()) {
+  ElementType = ElementType->getPointeeOrArrayElementType();
+}

No need for braces here



Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:8956
+Info.PointersArray, 0, I);
+Address PAddr(P, C.getTypeAlignInChars(C.VoidPtrTy));
+CGF.Builder.CreateStore(DAddr.getPointer(), PAddr);

`C.getTypeAlignInChars(C.VoidPtrTy)`->`CGF.getPointerAlign()`



Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:10330-10333
+// Fill up non-contiguous information.
+Info.Offsets = std::move((Offsets));
+Info.Counts = std::move((Counts));
+Info.Strides = std::move((Strides));

Better just to pass `Info.Offsets`, `Info.Counts` and `Info.Strides` as 
arguments to `generateAllInfo()` function and do not create local copies at all.



Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:10583-10586
+// Fill up non-contiguous information.
+Info.Offsets = std::move((Offsets));
+Info.Counts = std::move((Counts));
+Info.Strides = std::move((Strides));

Same, pass the fields as arguments instead.



Comment at: clang/lib/Serialization/ASTReader.cpp:12515
 auto *AssociatedDecl = Record.readDeclAs();
-Components.push_back(OMPClauseMappableExprCommon::MappableComponent(
-AssociatedExpr, AssociatedDecl));
+Components.emplace_back(OMPClauseMappableExprCommon::MappableComponent(
+AssociatedExprPr, AssociatedDecl, /*IsNonContiguous=*/false));

Still calling an extra constructor here, just `.emplace_back(AssociatedExprPr, 
AssociatedDecl, /*IsNonContiguous=*/false);`



Comment at: clang/lib/Serialization/ASTReader.cpp:12633-12634
 auto *AssociatedDecl = Record.readDeclAs();
-Components.push_back(OMPClauseMappableExprCommon::MappableComponent(
-AssociatedExpr, AssociatedDecl));
+Components.emplace_back(OMPClauseMappableExprCommon::MappableComponent(
+AssociatedExprPr, AssociatedDecl, IsNonContiguous));
   }

Just `Components.emplace_back(AssociatedExprPr, AssociatedDecl, 
IsNonContiguous);`



Comment at: clang/lib/Serialization/ASTReader.cpp:12684
 auto *AssociatedDecl = Record.readDeclAs();
-Components.push_back(OMPClauseMappableExprCommon::MappableComponent(
-AssociatedExpr, AssociatedDecl));
+Components.emplace_back(OMPClauseMappableExprCommon::MappableComponent(
+AssociatedExprPr, AssociatedDecl, IsNonContiguous));

`.emplace_back(AssociatedExprPr, AssociatedDecl, IsNonContiguous);`



Comment at: clang/lib/Serialization/ASTReader.cpp:12734
 auto *AssociatedDecl = Record.readDeclAs();
-Components.push_back(OMPClauseMappableExprCommon::MappableComponent(
-AssociatedExpr, AssociatedDecl));
+Components.emplace_back(OMPClauseMappableExprCommon::MappableComponent(
+AssociatedExprPr, AssociatedDecl, /*IsNonContiguous=*/false));

.`emplace_back(AssociatedExprPr, AssociatedDecl, /*IsNonContiguous=*/false);`



Comment at: clang/lib/Serialization/ASTReader.cpp:12776-12777
 auto *AssociatedDecl = Record.readDeclAs();
-Components.push_back(OMPClauseMappableExprCommon::MappableComponent(
-AssociatedExpr, AssociatedDecl));
+Components.emplace_back(OMPClauseMappableExprCommon::MappableComponent(
+AssociatedExpr, AssociatedDecl, /*IsNonContiguous*/ false));
   }

`.emplace_back(AssociatedExpr, AssociatedDecl, /*IsNonContiguous*/ false);`



Comment at: clang/lib/Serialization/ASTReader.cpp:12819-12820
 auto *AssociatedDecl = Record.readDeclAs();
-Components.push_back(OMPClauseMappableExprCommon::MappableComponent(
-AssociatedExpr, AssociatedDecl));
+Components.emplace_back(OMPClauseMappableExprCommon::MappableComponent(
+AssociatedExpr, AssociatedDecl, /*IsNonContiguous=*/false));
   }

`.emplace_back(AssociatedExpr, AssociatedDecl, /*IsNonContiguous=*/false));`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79972



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


[PATCH] D82502: [PowerPC][Power10] Implement Load VSX Vector and Sign Extend and Zero Extend

2020-06-25 Thread Albion Fung via Phabricator via cfe-commits
Conanap updated this revision to Diff 273421.
Conanap marked 9 inline comments as done.
Conanap added a comment.

Fixed return signature for the open coded functions in altivec.h


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82502

Files:
  clang/lib/Headers/altivec.h
  clang/test/CodeGen/builtins-ppc-p10vector.c
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.h
  llvm/lib/Target/PowerPC/PPCInstrPrefix.td
  llvm/test/CodeGen/PowerPC/p10-vsx-builtins.ll
  llvm/test/MC/Disassembler/PowerPC/p10insts.txt
  llvm/test/MC/PowerPC/p10.s

Index: llvm/test/MC/PowerPC/p10.s
===
--- llvm/test/MC/PowerPC/p10.s
+++ llvm/test/MC/PowerPC/p10.s
@@ -33,3 +33,15 @@
 # CHECK-BE: vclrrb 1, 4, 3# encoding: [0x10,0x24,0x19,0xcd]
 # CHECK-LE: vclrrb 1, 4, 3# encoding: [0xcd,0x19,0x24,0x10]
 vclrrb 1, 4, 3
+# CHECK-BE: lxvrbx 32, 1, 2   # encoding: [0x7c,0x01,0x10,0x1b]
+# CHECK-LE: lxvrbx 32, 1, 2   # encoding: [0x1b,0x10,0x01,0x7c]
+lxvrbx 32, 1, 2
+# CHECK-BE: lxvrhx 33, 1, 2   # encoding: [0x7c,0x21,0x10,0x5b]
+# CHECK-LE: lxvrhx 33, 1, 2   # encoding: [0x5b,0x10,0x21,0x7c]
+lxvrhx 33, 1, 2
+# CHECK-BE: lxvrdx 34, 1, 2   # encoding: [0x7c,0x41,0x10,0xdb]
+# CHECK-LE: lxvrdx 34, 1, 2   # encoding: [0xdb,0x10,0x41,0x7c]
+lxvrdx 34, 1, 2
+# CHECK-BE: lxvrwx 35, 1, 2   # encoding: [0x7c,0x61,0x10,0x9b]
+# CHECK-LE: lxvrwx 35, 1, 2   # encoding: [0x9b,0x10,0x61,0x7c]
+lxvrwx 35, 1, 2
Index: llvm/test/MC/Disassembler/PowerPC/p10insts.txt
===
--- llvm/test/MC/Disassembler/PowerPC/p10insts.txt
+++ llvm/test/MC/Disassembler/PowerPC/p10insts.txt
@@ -30,3 +30,15 @@
 
 # CHECK: vclrrb 1, 4, 3
 0x10 0x24 0x19 0xcd
+
+# CHECK: lxvrbx 32, 1, 2
+0x7c 0x01 0x10 0x1b
+
+# CHECK: lxvrhx 33, 1, 2
+0x7c 0x21 0x10 0x5b
+
+# CHECK: lxvrdx 34, 1, 2
+0x7c 0x41 0x10 0xdb
+
+# CHECK: lxvrwx 35, 1, 2
+0x7c 0x61 0x10 0x9b
Index: llvm/test/CodeGen/PowerPC/p10-vsx-builtins.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/p10-vsx-builtins.ll
@@ -0,0 +1,71 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; These test cases tests that zero extending loads utilize the Load VSX Vector Rightmost
+
+; (lxvr[b|h|w|d]) instructions in Power10.
+; 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: lxvrbx
+; Function Attrs: norecurse nounwind readonly
+define dso_local <1 x i128> @vec_xl_zext(i64 %__offset, i8* nocapture readonly %__pointer) local_unnamed_addr #0 {
+; CHECK-LABEL: vec_xl_zext:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:lxvrbx v2, r4, r3
+; CHECK-NEXT:blr
+entry:
+  %add.ptr = getelementptr inbounds i8, i8* %__pointer, i64 %__offset
+  %0 = load i8, i8* %add.ptr, align 1
+  %conv = zext i8 %0 to i128
+  %splat.splatinsert = insertelement <1 x i128> undef, i128 %conv, i32 0
+  ret <1 x i128> %splat.splatinsert
+}
+
+; CHECK: lxvrhx
+; Function Attrs: norecurse nounwind readonly
+define dso_local <1 x i128> @vec_xl_zext_short(i64 %__offset, i16* nocapture readonly %__pointer) local_unnamed_addr #0 {
+; CHECK-LABEL: vec_xl_zext_short:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:sldi r3, r3, 1
+; CHECK-NEXT:lxvrhx v2, r4, r3
+; CHECK-NEXT:blr
+entry:
+  %add.ptr = getelementptr inbounds i16, i16* %__pointer, i64 %__offset
+  %0 = load i16, i16* %add.ptr, align 2
+  %conv = zext i16 %0 to i128
+  %splat.splatinsert = insertelement <1 x i128> undef, i128 %conv, i32 0
+  ret <1 x i128> %splat.splatinsert
+}
+
+; CHECK: lxvrwx
+; Function Attrs: norecurse nounwind readonly
+define dso_local <1 x i128> @vec_xl_zext_word(i64 %__offset, i32* nocapture readonly %__pointer) local_unnamed_addr #0 {
+; CHECK-LABEL: vec_xl_zext_word:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:sldi r3, r3, 2
+; CHECK-NEXT:lxvrwx v2, r4, r3
+; CHECK-NEXT:blr
+entry:
+  %add.ptr = getelementptr inbounds i32, i32* %__pointer, i64 %__offset
+  %0 = load i32, i32* %add.ptr, align 4
+  %conv = zext i32 %0 to i128
+  %splat.splatinsert = insertelement <1 x i128> undef, i128 %conv, i32 0
+  ret <1 x i128> %splat.splatinsert
+}
+
+; CHECK: lxvrdx
+; Function Attrs: norecurse nounwind readonly
+define dso_local <1 x i128> @vec_xl_zext_dw(i64 %__offset, i64* nocapture readonly %__pointer) local_unnamed_addr #0 {
+; CHECK-LABEL: vec_xl_zext_dw:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:sldi r3, r3, 3

[PATCH] D82506: [HIP] Add missing options for lto

2020-06-25 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 273424.
yaxunl marked an inline comment as done.
yaxunl added a comment.
Herald added subscribers: kerbowa, nhaehnle, jvesely.

Fix issue about -mattr. Also use generic LTO option translation and use 
-plugin-opt.


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

https://reviews.llvm.org/D82506

Files:
  clang/lib/Driver/ToolChains/AMDGPU.h
  clang/lib/Driver/ToolChains/HIP.cpp
  clang/test/Driver/hip-link-save-temps.hip
  clang/test/Driver/hip-save-temps.hip
  clang/test/Driver/hip-toolchain-features.hip
  clang/test/Driver/hip-toolchain-mllvm.hip
  clang/test/Driver/hip-toolchain-opt.hip
  clang/test/Driver/hip-toolchain-rdc-separate.hip
  clang/test/Driver/hip-toolchain-rdc.hip

Index: clang/test/Driver/hip-toolchain-rdc.hip
===
--- clang/test/Driver/hip-toolchain-rdc.hip
+++ clang/test/Driver/hip-toolchain-rdc.hip
@@ -53,7 +53,8 @@
 // CHECK-NOT: "*.llvm-link"
 // CHECK-NOT: ".*opt"
 // CHECK-NOT: ".*llc"
-// CHECK: {{".*lld.*"}} {{.*}} "-mllvm" "-amdgpu-internalize-symbols"
+// CHECK: {{".*lld.*"}} {{.*}} "-plugin-opt=-amdgpu-internalize-symbols"
+// CHECK-SAME: "-plugin-opt=mcpu=gfx803"
 // CHECK-SAME: "-o" "[[IMG_DEV1:.*.out]]" [[A_BC1]] [[B_BC1]]
 
 // generate image for device side path on gfx900
@@ -80,7 +81,8 @@
 // CHECK-NOT: "*.llvm-link"
 // CHECK-NOT: ".*opt"
 // CHECK-NOT: ".*llc"
-// CHECK: {{".*lld.*"}} {{.*}} "-mllvm" "-amdgpu-internalize-symbols"
+// CHECK: {{".*lld.*"}} {{.*}} "-plugin-opt=-amdgpu-internalize-symbols"
+// CHECK-SAME: "-plugin-opt=mcpu=gfx900"
 // CHECK-SAME: "-o" "[[IMG_DEV2:.*.out]]" [[A_BC2]] [[B_BC2]]
 
 // combine images generated into hip fat binary object
Index: clang/test/Driver/hip-toolchain-rdc-separate.hip
===
--- clang/test/Driver/hip-toolchain-rdc-separate.hip
+++ clang/test/Driver/hip-toolchain-rdc-separate.hip
@@ -107,13 +107,15 @@
 // LINK-NOT: "*.llvm-link"
 // LINK-NOT: ".*opt"
 // LINK-NOT: ".*llc"
-// LINK: {{".*lld.*"}} {{.*}} "-mllvm" "-amdgpu-internalize-symbols"
+// LINK: {{".*lld.*"}} {{.*}} "-plugin-opt=-amdgpu-internalize-symbols"
+// LINK: "-plugin-opt=mcpu=gfx803"
 // LINK-SAME: "-o" "[[IMG_DEV1:.*.out]]" "[[A_BC1]]" "[[B_BC1]]"
 
 // LINK-NOT: "*.llvm-link"
 // LINK-NOT: ".*opt"
 // LINK-NOT: ".*llc"
-// LINK: {{".*lld.*"}} {{.*}} "-mllvm" "-amdgpu-internalize-symbols"
+// LINK: {{".*lld.*"}} {{.*}} "-plugin-opt=-amdgpu-internalize-symbols"
+// LINK: "-plugin-opt=mcpu=gfx900"
 // LINK-SAME: "-o" "[[IMG_DEV2:.*.out]]" "[[A_BC2]]" "[[B_BC2]]"
 
 // LINK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
Index: clang/test/Driver/hip-toolchain-opt.hip
===
--- clang/test/Driver/hip-toolchain-opt.hip
+++ clang/test/Driver/hip-toolchain-opt.hip
@@ -72,6 +72,16 @@
 
 // ALL-NOT: "{{.*}}llc"
 
+// ALL: "{{.*}}lld{{.*}}" {{.*}} "-plugin-opt=mcpu=gfx900"
+// DEFAULT-NOT: "-plugin-opt=O{{.*}}"
+// O0-SAME: "-plugin-opt=O0"
+// O1-SAME: "-plugin-opt=O1"
+// O2-SAME: "-plugin-opt=O2"
+// O3-SAME: "-plugin-opt=O3"
+// Os-SAME: "-plugin-opt=O2"
+// Oz-SAME: "-plugin-opt=O2"
+// Og-SAME: "-plugin-opt=O1"
+
 // ALL: "{{.*}}clang{{.*}}" "-cc1" "-triple" "x86_64-unknown-linux-gnu"
 // DEFAULT-NOT: "-O{{.}}"
 // O0-SAME: "-O0"
Index: clang/test/Driver/hip-toolchain-mllvm.hip
===
--- clang/test/Driver/hip-toolchain-mllvm.hip
+++ clang/test/Driver/hip-toolchain-mllvm.hip
@@ -7,20 +7,25 @@
 // RUN:   -mllvm -amdgpu-function-calls=0 \
 // RUN:   %s 2>&1 | FileCheck %s
 
+// RUN: %clang -### -target x86_64-linux-gnu \
+// RUN:   --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
+// RUN:   -fgpu-rdc -mllvm -amdgpu-function-calls=0 \
+// RUN:   %s 2>&1 | FileCheck -check-prefixes=CHECK,RDC %s
+
 // CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
-// CHECK-SAME: "-emit-obj"
 // CHECK-SAME: {{.*}} "-target-cpu" "gfx803"
 // CHECK-SAME: {{.*}} "-mllvm" "-amdgpu-function-calls=0" {{.*}}
 
 // CHECK-NOT: {{".*opt"}}
 // CHECK-NOT: {{".*llc"}}
+// RDC: [[LLD:".*lld.*"]] {{.*}} "-plugin-opt=-amdgpu-function-calls=0"
 
 // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
-// CHECK-SAME: "-emit-obj"
 // CHECK-SAME: {{.*}} "-target-cpu" "gfx900"
 // CHECK-SAME: {{.*}} "-mllvm" "-amdgpu-function-calls=0" {{.*}}
 
 // CHECK-NOT: {{".*opt"}}
 // CHECK-NOT: {{".*llc"}}
+// RDC: [[LLD:".*lld.*"]] {{.*}} "-plugin-opt=-amdgpu-function-calls=0"
Index: clang/test/Driver/hip-toolchain-features.hip
===
--- clang/test/Driver/hip-toolchain-features.hip
+++ clang/test/Driver/hip-toolchain-features.hip
@@ -2,38 +2,45 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: amdgpu-registered-target

[PATCH] D81282: [builtins] Move more float128-related helpers to GENERIC_TF_SOURCES list

2020-06-25 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments.



Comment at: compiler-rt/lib/builtins/CMakeLists.txt:142
   powisf2.c
   powitf2.c
   subdf3.c

Missed powitf?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81282



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


[clang] 7b404b6 - Add `FloatingLiteral` to SyntaxTree

2020-06-25 Thread Eduardo Caldas via cfe-commits

Author: Eduardo Caldas
Date: 2020-06-25T17:05:08Z
New Revision: 7b404b6d003181e990f53d27866ee98d5151c4f3

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

LOG: Add `FloatingLiteral` to SyntaxTree

Subscribers: cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/include/clang/Tooling/Syntax/Nodes.h
clang/lib/Tooling/Syntax/BuildTree.cpp
clang/lib/Tooling/Syntax/Nodes.cpp
clang/unittests/Tooling/Syntax/TreeTest.cpp

Removed: 




diff  --git a/clang/include/clang/Tooling/Syntax/Nodes.h 
b/clang/include/clang/Tooling/Syntax/Nodes.h
index e50e80ec1fc3..9446d911c18e 100644
--- a/clang/include/clang/Tooling/Syntax/Nodes.h
+++ b/clang/include/clang/Tooling/Syntax/Nodes.h
@@ -43,11 +43,12 @@ enum class NodeKind : uint16_t {
   PrefixUnaryOperatorExpression,
   PostfixUnaryOperatorExpression,
   BinaryOperatorExpression,
-  CxxNullPtrExpression,
   IntegerLiteralExpression,
-  BoolLiteralExpression,
   CharacterLiteralExpression,
+  FloatingLiteralExpression,
   StringLiteralExpression,
+  BoolLiteralExpression,
+  CxxNullPtrExpression,
   IdExpression,
 
   // Statements.
@@ -247,14 +248,14 @@ class UnknownExpression final : public Expression {
   }
 };
 
-/// C++11 'nullptr' expression.
-class CxxNullPtrExpression final : public Expression {
+/// Expression for integer literals. C++ [lex.icon]
+class IntegerLiteralExpression final : public Expression {
 public:
-  CxxNullPtrExpression() : Expression(NodeKind::CxxNullPtrExpression) {}
+  IntegerLiteralExpression() : Expression(NodeKind::IntegerLiteralExpression) 
{}
   static bool classof(const Node *N) {
-return N->kind() == NodeKind::CxxNullPtrExpression;
+return N->kind() == NodeKind::IntegerLiteralExpression;
   }
-  syntax::Leaf *nullPtrKeyword();
+  syntax::Leaf *literalToken();
 };
 
 /// Expression for character literals. C++ [lex.ccon]
@@ -268,12 +269,23 @@ class CharacterLiteralExpression final : public 
Expression {
   syntax::Leaf *literalToken();
 };
 
-/// Expression for integer literals.
-class IntegerLiteralExpression final : public Expression {
+/// Expression for floating-point literals. C++ [lex.fcon]
+class FloatingLiteralExpression final : public Expression {
 public:
-  IntegerLiteralExpression() : Expression(NodeKind::IntegerLiteralExpression) 
{}
+  FloatingLiteralExpression()
+  : Expression(NodeKind::FloatingLiteralExpression) {}
   static bool classof(const Node *N) {
-return N->kind() == NodeKind::IntegerLiteralExpression;
+return N->kind() == NodeKind::FloatingLiteralExpression;
+  }
+  syntax::Leaf *literalToken();
+};
+
+/// Expression for string-literals. C++ [lex.string]
+class StringLiteralExpression final : public Expression {
+public:
+  StringLiteralExpression() : Expression(NodeKind::StringLiteralExpression) {}
+  static bool classof(const Node *N) {
+return N->kind() == NodeKind::StringLiteralExpression;
   }
   syntax::Leaf *literalToken();
 };
@@ -288,14 +300,14 @@ class BoolLiteralExpression final : public Expression {
   syntax::Leaf *literalToken();
 };
 
-/// Expression for string-literals. C++ [lex.string]
-class StringLiteralExpression final : public Expression {
+/// Expression for the `nullptr` literal. C++ [lex.nullptr]
+class CxxNullPtrExpression final : public Expression {
 public:
-  StringLiteralExpression() : Expression(NodeKind::StringLiteralExpression) {}
+  CxxNullPtrExpression() : Expression(NodeKind::CxxNullPtrExpression) {}
   static bool classof(const Node *N) {
-return N->kind() == NodeKind::StringLiteralExpression;
+return N->kind() == NodeKind::CxxNullPtrExpression;
   }
-  syntax::Leaf *literalToken();
+  syntax::Leaf *nullPtrKeyword();
 };
 
 /// An abstract class for prefix and postfix unary operators.

diff  --git a/clang/lib/Tooling/Syntax/BuildTree.cpp 
b/clang/lib/Tooling/Syntax/BuildTree.cpp
index bd2f372e057b..6f740b3ab146 100644
--- a/clang/lib/Tooling/Syntax/BuildTree.cpp
+++ b/clang/lib/Tooling/Syntax/BuildTree.cpp
@@ -654,19 +654,20 @@ class BuildTreeVisitor : public 
RecursiveASTVisitor {
 return true;
   }
 
-  bool WalkUpFromCXXBoolLiteralExpr(CXXBoolLiteralExpr *S) {
+  bool WalkUpFromCharacterLiteral(CharacterLiteral *S) {
 Builder.markChildToken(S->getLocation(), syntax::NodeRole::LiteralToken);
 Builder.foldNode(Builder.getExprRange(S),
- new (allocator()) syntax::BoolLiteralExpression, S);
+ new (allocator()) syntax::CharacterLiteralExpression, S);
 return true;
   }
 
-  bool WalkUpFromCharacterLiteral(CharacterLiteral *S) {
+  bool WalkUpFromFloatingLiteral(FloatingLiteral *S) {
 Builder.markChildToken(S->getLocation(), syntax::NodeRole::LiteralToken);
 

[clang] 466e8b7 - Add StringLiteral to SyntaxTree

2020-06-25 Thread Eduardo Caldas via cfe-commits

Author: Eduardo Caldas
Date: 2020-06-25T17:05:08Z
New Revision: 466e8b7ea6e162d48cac42ccda210bdeb11080e3

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

LOG: Add StringLiteral to SyntaxTree

Subscribers: cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/include/clang/Tooling/Syntax/Nodes.h
clang/lib/Tooling/Syntax/BuildTree.cpp
clang/lib/Tooling/Syntax/Nodes.cpp
clang/unittests/Tooling/Syntax/TreeTest.cpp

Removed: 




diff  --git a/clang/include/clang/Tooling/Syntax/Nodes.h 
b/clang/include/clang/Tooling/Syntax/Nodes.h
index 4310bc5dc81c..e50e80ec1fc3 100644
--- a/clang/include/clang/Tooling/Syntax/Nodes.h
+++ b/clang/include/clang/Tooling/Syntax/Nodes.h
@@ -47,6 +47,7 @@ enum class NodeKind : uint16_t {
   IntegerLiteralExpression,
   BoolLiteralExpression,
   CharacterLiteralExpression,
+  StringLiteralExpression,
   IdExpression,
 
   // Statements.
@@ -287,6 +288,16 @@ class BoolLiteralExpression final : public Expression {
   syntax::Leaf *literalToken();
 };
 
+/// Expression for string-literals. C++ [lex.string]
+class StringLiteralExpression final : public Expression {
+public:
+  StringLiteralExpression() : Expression(NodeKind::StringLiteralExpression) {}
+  static bool classof(const Node *N) {
+return N->kind() == NodeKind::StringLiteralExpression;
+  }
+  syntax::Leaf *literalToken();
+};
+
 /// An abstract class for prefix and postfix unary operators.
 class UnaryOperatorExpression : public Expression {
 public:

diff  --git a/clang/lib/Tooling/Syntax/BuildTree.cpp 
b/clang/lib/Tooling/Syntax/BuildTree.cpp
index 5912a54d1bee..bd2f372e057b 100644
--- a/clang/lib/Tooling/Syntax/BuildTree.cpp
+++ b/clang/lib/Tooling/Syntax/BuildTree.cpp
@@ -667,6 +667,12 @@ class BuildTreeVisitor : public 
RecursiveASTVisitor {
  new (allocator()) syntax::CharacterLiteralExpression, S);
 return true;
   }
+  bool WalkUpFromStringLiteral(StringLiteral *S) {
+Builder.markChildToken(S->getBeginLoc(), syntax::NodeRole::LiteralToken);
+Builder.foldNode(Builder.getExprRange(S),
+ new (allocator()) syntax::StringLiteralExpression, S);
+return true;
+  }
 
   bool WalkUpFromCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *S) {
 Builder.markChildToken(S->getLocation(), syntax::NodeRole::LiteralToken);

diff  --git a/clang/lib/Tooling/Syntax/Nodes.cpp 
b/clang/lib/Tooling/Syntax/Nodes.cpp
index e6e280e9cb13..290b1e6bafa1 100644
--- a/clang/lib/Tooling/Syntax/Nodes.cpp
+++ b/clang/lib/Tooling/Syntax/Nodes.cpp
@@ -26,6 +26,8 @@ llvm::raw_ostream ::operator<<(llvm::raw_ostream , 
NodeKind K) {
 return OS << "BoolLiteralExpression";
   case NodeKind::CharacterLiteralExpression:
 return OS << "CharacterLiteralExpression";
+  case NodeKind::StringLiteralExpression:
+return OS << "StringLiteralExpression";
   case NodeKind::PrefixUnaryOperatorExpression:
 return OS << "PrefixUnaryOperatorExpression";
   case NodeKind::PostfixUnaryOperatorExpression:
@@ -214,6 +216,11 @@ syntax::Leaf 
*syntax::CharacterLiteralExpression::literalToken() {
   findChild(syntax::NodeRole::LiteralToken));
 }
 
+syntax::Leaf *syntax::StringLiteralExpression::literalToken() {
+  return llvm::cast_or_null(
+  findChild(syntax::NodeRole::LiteralToken));
+}
+
 syntax::Leaf *syntax::CxxNullPtrExpression::nullPtrKeyword() {
   return llvm::cast_or_null(
   findChild(syntax::NodeRole::LiteralToken));

diff  --git a/clang/unittests/Tooling/Syntax/TreeTest.cpp 
b/clang/unittests/Tooling/Syntax/TreeTest.cpp
index 0a20950458d6..bc2a65b2dd07 100644
--- a/clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ b/clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -1399,6 +1399,109 @@ void test() {
 )txt"));
 }
 
+TEST_P(SyntaxTreeTest, StringLiteral) {
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  "a\n\0\x20";
+  L"αβ";
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-StringLiteralExpression
+| | `-"a\n\0\x20"
+| `-;
+|-ExpressionStatement
+| |-StringLiteralExpression
+| | `-L"αβ"
+| `-;
+`-}
+)txt"));
+}
+
+TEST_P(SyntaxTreeTest, StringLiteralUtf) {
+  if (!GetParam().isCXX11OrLater()) {
+return;
+  }
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  u8"a\x1f\x05";
+  u"C++抽象構文木";
+  U"\n";
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-StringLiteralExpression
+| | 

[clang] 221d7bb - Add `CharLiteral` to SyntaxTree

2020-06-25 Thread Eduardo Caldas via cfe-commits

Author: Eduardo Caldas
Date: 2020-06-25T17:05:08Z
New Revision: 221d7bbe49cceb0e408f0f46d9f8371e6c9fee2c

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

LOG: Add `CharLiteral` to SyntaxTree

Subscribers: cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/include/clang/Tooling/Syntax/Nodes.h
clang/lib/Tooling/Syntax/BuildTree.cpp
clang/lib/Tooling/Syntax/Nodes.cpp
clang/unittests/Tooling/Syntax/TreeTest.cpp

Removed: 




diff  --git a/clang/include/clang/Tooling/Syntax/Nodes.h 
b/clang/include/clang/Tooling/Syntax/Nodes.h
index 255a108133bc..4310bc5dc81c 100644
--- a/clang/include/clang/Tooling/Syntax/Nodes.h
+++ b/clang/include/clang/Tooling/Syntax/Nodes.h
@@ -46,6 +46,7 @@ enum class NodeKind : uint16_t {
   CxxNullPtrExpression,
   IntegerLiteralExpression,
   BoolLiteralExpression,
+  CharacterLiteralExpression,
   IdExpression,
 
   // Statements.
@@ -255,6 +256,17 @@ class CxxNullPtrExpression final : public Expression {
   syntax::Leaf *nullPtrKeyword();
 };
 
+/// Expression for character literals. C++ [lex.ccon]
+class CharacterLiteralExpression final : public Expression {
+public:
+  CharacterLiteralExpression()
+  : Expression(NodeKind::CharacterLiteralExpression) {}
+  static bool classof(const Node *N) {
+return N->kind() == NodeKind::CharacterLiteralExpression;
+  }
+  syntax::Leaf *literalToken();
+};
+
 /// Expression for integer literals.
 class IntegerLiteralExpression final : public Expression {
 public:

diff  --git a/clang/lib/Tooling/Syntax/BuildTree.cpp 
b/clang/lib/Tooling/Syntax/BuildTree.cpp
index 7ff603fbd33a..5912a54d1bee 100644
--- a/clang/lib/Tooling/Syntax/BuildTree.cpp
+++ b/clang/lib/Tooling/Syntax/BuildTree.cpp
@@ -661,6 +661,13 @@ class BuildTreeVisitor : public 
RecursiveASTVisitor {
 return true;
   }
 
+  bool WalkUpFromCharacterLiteral(CharacterLiteral *S) {
+Builder.markChildToken(S->getLocation(), syntax::NodeRole::LiteralToken);
+Builder.foldNode(Builder.getExprRange(S),
+ new (allocator()) syntax::CharacterLiteralExpression, S);
+return true;
+  }
+
   bool WalkUpFromCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *S) {
 Builder.markChildToken(S->getLocation(), syntax::NodeRole::LiteralToken);
 Builder.foldNode(Builder.getExprRange(S),

diff  --git a/clang/lib/Tooling/Syntax/Nodes.cpp 
b/clang/lib/Tooling/Syntax/Nodes.cpp
index 498721d3a371..e6e280e9cb13 100644
--- a/clang/lib/Tooling/Syntax/Nodes.cpp
+++ b/clang/lib/Tooling/Syntax/Nodes.cpp
@@ -24,6 +24,8 @@ llvm::raw_ostream ::operator<<(llvm::raw_ostream , 
NodeKind K) {
 return OS << "IntegerLiteralExpression";
   case NodeKind::BoolLiteralExpression:
 return OS << "BoolLiteralExpression";
+  case NodeKind::CharacterLiteralExpression:
+return OS << "CharacterLiteralExpression";
   case NodeKind::PrefixUnaryOperatorExpression:
 return OS << "PrefixUnaryOperatorExpression";
   case NodeKind::PostfixUnaryOperatorExpression:
@@ -207,6 +209,11 @@ syntax::Leaf 
*syntax::BoolLiteralExpression::literalToken() {
   findChild(syntax::NodeRole::LiteralToken));
 }
 
+syntax::Leaf *syntax::CharacterLiteralExpression::literalToken() {
+  return llvm::cast_or_null(
+  findChild(syntax::NodeRole::LiteralToken));
+}
+
 syntax::Leaf *syntax::CxxNullPtrExpression::nullPtrKeyword() {
   return llvm::cast_or_null(
   findChild(syntax::NodeRole::LiteralToken));

diff  --git a/clang/unittests/Tooling/Syntax/TreeTest.cpp 
b/clang/unittests/Tooling/Syntax/TreeTest.cpp
index d32ce6203913..0a20950458d6 100644
--- a/clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ b/clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -73,6 +73,10 @@ struct TestClangConfig {
 return Language == Lang_C89 || Language == Lang_C99;
   }
 
+  bool isCXX17OrLater() const {
+return Language == Lang_CXX17 || Language == Lang_CXX20;
+  }
+
   bool supportsCXXDynamicExceptionSpecification() const {
 return Language == Lang_CXX03 || Language == Lang_CXX11 ||
Language == Lang_CXX14;
@@ -1232,6 +1236,135 @@ void test() {
 )txt"));
 }
 
+TEST_P(SyntaxTreeTest, CharacterLiteral) {
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  'a';
+  '\n';
+  '\x20';
+  '\0';
+  L'a';
+  L'α';
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-'a'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-'\n'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-'\x20'
+| `-;
+|-ExpressionStatement

[clang] 408efff - [Clang][SourceManager] optimize getFileIDLocal()

2020-06-25 Thread Nick Desaulniers via cfe-commits

Author: Nick Desaulniers
Date: 2020-06-25T09:59:41-07:00
New Revision: 408efffbe4a52bae05f1677a47eb3ccfd5cdc1d3

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

LOG: [Clang][SourceManager] optimize getFileIDLocal()

Summary:
A recent Linux kernel commit exposed a performance cliff in Clang. Calls
to SourceManager::getFileIDLocal() when there's a cache miss against
LastFileIDLookup can be relatively expensive, as getFileIDLocal() tries
a few linear probes, then falls back to binary search.  The use of
SourceManager::isOffsetInFileID() is also relatively expensive (both
isOffsetInFileID and getFileIDLocal dominated a trace of the performance
cliff case).

As a FIXME notes (and as @kadircet helpfully noted in review of D80681),
there's a few optimizations we can do here since we've already
identified that an offset is local (as opposed to "loaded").

This patch was forked off of D80681, which additionally did this and
modified some caching behavior, as we expect this change to be less
controversial.

In terms of optimizations, we've already determined that the SLocOffset
parameter to SourceManager::getFileIDLocal() is local in the caller
SourceManager::getFileIDSlow(). Also, there's an early continue in the
binary search loop in getFileIDLocal() that are duplicated in
isOffsetInFileID() as pointed out by @kadircet.

Take advantage of these to optimize the binary search patch, and remove
the FIXME.

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: cfe-commits, kadircet, srhines

Tags: #clang

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

Added: 


Modified: 
clang/lib/Basic/SourceManager.cpp

Removed: 




diff  --git a/clang/lib/Basic/SourceManager.cpp 
b/clang/lib/Basic/SourceManager.cpp
index 6e4c8e8052bd..63518bf8b79a 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -898,9 +898,8 @@ FileID SourceManager::getFileIDLocal(unsigned SLocOffset) 
const {
 }
 
 // If the middle index contains the value, succeed and return.
-// FIXME: This could be made faster by using a function that's aware of
-// being in the local area.
-if (isOffsetInFileID(FileID::get(MiddleIndex), SLocOffset)) {
+if (MiddleIndex + 1 == LocalSLocEntryTable.size() ||
+SLocOffset < getLocalSLocEntry(MiddleIndex + 1).getOffset()) {
   FileID Res = FileID::get(MiddleIndex);
 
   // If this isn't a macro expansion, remember it.  We have good locality



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


[clang] f79a66b - Ensure that default value for -triple is correctly normalizedvalues

2020-06-25 Thread Daniel Grumberg via cfe-commits

Author: Daniel Grumberg
Date: 2020-06-25T17:49:59+01:00
New Revision: f79a66ba69628db471d559f0f182f476bf49ac90

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

LOG: Ensure that default value for -triple is correctly normalizedvalues

This fixes the build failure at 
http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64/builds/240/steps/test-check-clang/logs/FAIL%3A%20Clang-Unit%3A%3ACC1CommandLineGenerationTest.CanGenerateCC1CommandLineSeparateRequiredAbsent

Added: 


Modified: 
clang/include/clang/Driver/CC1Options.td

Removed: 




diff  --git a/clang/include/clang/Driver/CC1Options.td 
b/clang/include/clang/Driver/CC1Options.td
index bc1fd0b58d3e..8729512454c3 100644
--- a/clang/include/clang/Driver/CC1Options.td
+++ b/clang/include/clang/Driver/CC1Options.td
@@ -24,7 +24,7 @@ def target_feature : Separate<["-"], "target-feature">,
   HelpText<"Target specific attributes">;
 def triple : Separate<["-"], "triple">,
   HelpText<"Specify target triple (e.g. i686-apple-darwin9)">,
-  MarshallingInfoString<"TargetOpts->Triple", 
"llvm::sys::getDefaultTargetTriple()", "std::string">,
+  MarshallingInfoString<"TargetOpts->Triple", 
"llvm::Triple::normalize(llvm::sys::getDefaultTargetTriple())", "std::string">,
   AlwaysEmit, Normalizer<"normalizeTriple">, DenormalizeString;
 def target_abi : Separate<["-"], "target-abi">,
   HelpText<"Target a particular ABI type">;



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


[clang] 37c1bf2 - [analyzer] Enable constructor support in evalCall event.

2020-06-25 Thread Artem Dergachev via cfe-commits

Author: Nithin Vadukkumchery Rajendrakumar
Date: 2020-06-25T09:47:13-07:00
New Revision: 37c1bf21d1da85c164638efc32e8c7cfbf713ac5

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

LOG: [analyzer] Enable constructor support in evalCall event.

Pass EvalCallOptions via runCheckersForEvalCall into defaultEvalCall.
Update the AnalysisOrderChecker to support evalCall for testing.

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

Added: 
clang/test/Analysis/cxxctr-evalcall-analysis-order.cpp

Modified: 
clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
clang/include/clang/StaticAnalyzer/Core/CheckerManager.h
clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
clang/lib/StaticAnalyzer/Checkers/AnalysisOrderChecker.cpp
clang/lib/StaticAnalyzer/Core/CallEvent.cpp
clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
clang/test/Analysis/analyzer-config.c
clang/test/Analysis/new-ctor-conservative.cpp

Removed: 




diff  --git a/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td 
b/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
index 9de324506bf6..8430dc123598 100644
--- a/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
+++ b/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
@@ -1372,6 +1372,12 @@ def AnalysisOrderChecker : Checker<"AnalysisOrder">,
   "false",
   Released,
   Hide>,
+CmdLineOption,
 CmdLineOption, check::PreCall, check::PostCall,
   check::EndFunction, check::EndAnalysis, check::NewAllocator,
   check::Bind, check::PointerEscape, check::RegionChanges,
-  check::LiveSymbols> {
+  check::LiveSymbols, eval::Call> {
 
   bool isCallbackEnabled(const AnalyzerOptions ,
  StringRef CallbackName) const {
@@ -122,6 +122,19 @@ class AnalysisOrderChecker
   llvm::errs() << "PostStmt\n";
   }
 
+  bool evalCall(const CallEvent , CheckerContext ) const {
+if (isCallbackEnabled(C, "EvalCall")) {
+  llvm::errs() << "EvalCall";
+  if (const NamedDecl *ND = dyn_cast_or_null(Call.getDecl()))
+llvm::errs() << " (" << ND->getQualifiedNameAsString() << ')';
+  llvm::errs() << " {argno: " << Call.getNumArgs() << '}';
+  llvm::errs() << " [" << Call.getKindAsString() << ']';
+  llvm::errs() << '\n';
+  return true;
+}
+return false;
+  }
+
   void checkPreCall(const CallEvent , CheckerContext ) const {
 if (isCallbackEnabled(C, "PreCall")) {
   llvm::errs() << "PreCall";

diff  --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp 
b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
index b8d8d467341d..78d13ddfb773 100644
--- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -523,7 +523,7 @@ CallEvent::getReturnValueUnderConstruction() const {
   if (!CC)
 return None;
 
-  ExprEngine::EvalCallOptions CallOpts;
+  EvalCallOptions CallOpts;
   ExprEngine  = getState()->getStateManager().getOwningEngine();
   SVal RetVal =
 Engine.computeObjectUnderConstruction(getOriginExpr(), getState(),

diff  --git a/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp 
b/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
index 98504006030a..86cecf6524f0 100644
--- a/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
@@ -653,7 +653,8 @@ CheckerManager::runCheckersForEvalAssume(ProgramStateRef 
state,
 void CheckerManager::runCheckersForEvalCall(ExplodedNodeSet ,
 const ExplodedNodeSet ,
 const CallEvent ,
-ExprEngine ) {
+ExprEngine ,
+const EvalCallOptions ) {
   for (auto *const Pred : Src) {
 bool anyEvaluated = false;
 
@@ -665,10 +666,8 @@ void 
CheckerManager::runCheckersForEvalCall(ExplodedNodeSet ,
   // TODO: Support the situation when the call doesn't correspond
   // to any Expr.
   ProgramPoint L = ProgramPoint::getProgramPoint(
-  cast(Call.getOriginExpr()),
-  ProgramPoint::PostStmtKind,
-  Pred->getLocationContext(),
-  EvalCallChecker.Checker);
+  Call.getOriginExpr(), ProgramPoint::PostStmtKind,
+  Pred->getLocationContext(), EvalCallChecker.Checker);
   bool evaluated = false;
   { // CheckerContext generates transitions(populates checkDest) on
 // destruction, so introduce the scope to make sure it gets properly
@@ -690,7 +689,7 @@ void 

[PATCH] D82429: [sve][acle] Add some C intrinsics for brain float types.

2020-06-25 Thread Francesco Petrogalli via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
fpetrogalli marked an inline comment as done.
Closed by commit rG7200fa38a912: [sve][acle] Add some C intrinsics for brain 
float types. (authored by fpetrogalli).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82429

Files:
  clang/include/clang/Basic/arm_sve.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_cnt-bfloat.c
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_tbl-bfloat.c
  clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_tbl2-bfloat.c
  clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_tbx-bfloat.c
  llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
  llvm/test/CodeGen/AArch64/sve-intrinsics-counting-bits.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll
  llvm/test/CodeGen/AArch64/sve2-intrinsics-perm-tb.ll

Index: llvm/test/CodeGen/AArch64/sve2-intrinsics-perm-tb.ll
===
--- llvm/test/CodeGen/AArch64/sve2-intrinsics-perm-tb.ll
+++ llvm/test/CodeGen/AArch64/sve2-intrinsics-perm-tb.ll
@@ -122,6 +122,16 @@
   ret  %out
 }
 
+define  @ftbx_h_bf16( %a,  %b,  %c) #0 {
+; CHECK-LABEL: ftbx_h_bf16:
+; CHECK: tbx z0.h, z1.h, z2.h
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.tbx.nxv8bf16( %a,
+%b,
+%c)
+  ret  %out
+}
+
 define  @tbx_s( %a,  %b,  %c) {
 ; CHECK-LABEL: tbx_s:
 ; CHECK: tbx z0.s, z1.s, z2.s
@@ -179,3 +189,8 @@
 declare  @llvm.aarch64.sve.tbx.nxv8f16(, , )
 declare  @llvm.aarch64.sve.tbx.nxv4f32(, , )
 declare  @llvm.aarch64.sve.tbx.nxv2f64(, , )
+
+declare  @llvm.aarch64.sve.tbx.nxv8bf16(, , )
+
+; +bf16 is required for the bfloat version.
+attributes #0 = { "target-features"="+sve,+bf16" }
Index: llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll
===
--- llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll
+++ llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll
@@ -1027,6 +1027,15 @@
   ret  %out
 }
 
+define  @tbl_bf16( %a,  %b) #0 {
+; CHECK-LABEL: tbl_bf16:
+; CHECK: tbl z0.h, { z0.h }, z1.h
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.tbl.nxv8bf16( %a,
+%b)
+  ret  %out
+}
+
 define  @tbl_f32( %a,  %b) {
 ; CHECK-LABEL: tbl_f32:
 ; CHECK: tbl z0.s, { z0.s }, z1.s
@@ -1933,6 +1942,7 @@
 declare  @llvm.aarch64.sve.tbl.nxv4i32(, )
 declare  @llvm.aarch64.sve.tbl.nxv2i64(, )
 declare  @llvm.aarch64.sve.tbl.nxv8f16(, )
+declare  @llvm.aarch64.sve.tbl.nxv8bf16(, )
 declare  @llvm.aarch64.sve.tbl.nxv4f32(, )
 declare  @llvm.aarch64.sve.tbl.nxv2f64(, )
 
@@ -2027,3 +2037,6 @@
 declare  @llvm.aarch64.sve.zip2.nxv8f16(, )
 declare  @llvm.aarch64.sve.zip2.nxv4f32(, )
 declare  @llvm.aarch64.sve.zip2.nxv2f64(, )
+
+; +bf16 is required for the bfloat version.
+attributes #0 = { "target-features"="+sve,+bf16" }
Index: llvm/test/CodeGen/AArch64/sve-intrinsics-counting-bits.ll
===
--- llvm/test/CodeGen/AArch64/sve-intrinsics-counting-bits.ll
+++ llvm/test/CodeGen/AArch64/sve-intrinsics-counting-bits.ll
@@ -145,6 +145,16 @@
   ret  %out
 }
 
+define  @cnt_bf16( %a,  %pg,  %b) #0 {
+; CHECK-LABEL: cnt_bf16:
+; CHECK: cnt z0.h, p0/m, z1.h
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.cnt.nxv8bf16( %a,
+ %pg,
+ %b)
+  ret  %out
+}
+
 define  @cnt_f32( %a,  %pg,  %b) {
 ; CHECK-LABEL: cnt_f32:
 ; CHECK: cnt z0.s, p0/m, z1.s
@@ -180,5 +190,9 @@
 declare  @llvm.aarch64.sve.cnt.nxv4i32(, , )
 declare  @llvm.aarch64.sve.cnt.nxv2i64(, , )
 declare  @llvm.aarch64.sve.cnt.nxv8f16(, , )
+declare  @llvm.aarch64.sve.cnt.nxv8bf16(, , )
 declare  @llvm.aarch64.sve.cnt.nxv4f32(, , )
 declare  @llvm.aarch64.sve.cnt.nxv2f64(, , )
+
+; +bf16 is required for the bfloat version.
+attributes #0 = { "target-features"="+sve,+bf16" }
Index: llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
===
--- llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
+++ llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
@@ -284,6 +284,11 @@
   defm CLS_ZPmZ  : sve_int_un_pred_arit_1<   0b000, "cls",  int_aarch64_sve_cls>;
   defm CLZ_ZPmZ  : sve_int_un_pred_arit_1<   0b001, "clz",  int_aarch64_sve_clz>;
   defm CNT_ZPmZ  : sve_int_un_pred_arit_1<   0b010, "cnt",  int_aarch64_sve_cnt>;
+
+ let Predicates = [HasSVE, HasBF16] in {
+  def : SVE_3_Op_Pat(CNT_ZPmZ_H)>;
+ }
+
   defm CNOT_ZPmZ : sve_int_un_pred_arit_1<   0b011, "cnot", int_aarch64_sve_cnot>;
   defm NOT_ZPmZ  : sve_int_un_pred_arit_1<   0b110, "not",  

[PATCH] D81938: [InferAddressSpaces] Handle the pair of `ptrtoint`/`inttoptr`.

2020-06-25 Thread Michael Liao via Phabricator via cfe-commits
hliao added a comment.

ping for code review


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81938



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


[PATCH] D79972: [OpenMP5.0] map item can be non-contiguous for target update

2020-06-25 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen added a comment.

ping


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79972



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


[PATCH] D82578: [AArch64][SVE2] Guard while intrinsics on scalar bfloat feature macro

2020-06-25 Thread Cullen Rhodes via Phabricator via cfe-commits
c-rhodes created this revision.
c-rhodes added reviewers: sdesmalen, fpetrogalli, kmclaughlin.
Herald added subscribers: danielkiss, kristof.beyls, tschuett.
Herald added a reviewer: rengolin.
Herald added a reviewer: efriedma.
Herald added a project: clang.

`svwhilerw_bf16` and `svwhilewr_bf16` intrinsics use the scalar `bfloat16_t`
type which is predicated on `__ARM_FEATURE_BF16_SCALAR_ARITHMETIC`. This
patch changes the feature guard from `__ARM_FEATURE_SVE_BF16` to the
scalar bfloat feature macro.

The verify tests for `+bf16` are also removed in this patch. The purpose
of these checks was to match the SVE2 ACLE tests that look for an
implicit declaration warning if the feature isn't set. They worked when
the intrinsics were guarded on `__ARM_FEATURE_SVE_BF16` as the `bfloat16_t`
was guarded on a different macro, but with both the type and intrinsic
guarded on the same macro an earlier error is triggered in the ACLE
regarding the type and we don't get a warning as we do for SVE2.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82578

Files:
  clang/include/clang/Basic/arm_sve.td
  clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_whilerw-bfloat.c
  clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_whilewr-bfloat.c


Index: clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_whilewr-bfloat.c
===
--- clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_whilewr-bfloat.c
+++ clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_whilewr-bfloat.c
@@ -1,18 +1,7 @@
-// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 
-D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE_BF16 -triple 
aarch64-none-linux-gnu -target-feature +sve2 -target-feature +bf16 
-fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | 
FileCheck %s
-// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 
-D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE_BF16 
-DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 
-target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall 
-emit-llvm -o - %s | FileCheck %s
-
-// Test expected warnings for implicit declaration when +sve2 is missing
-// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC 
-D__ARM_FEATURE_SVE_BF16 -triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +bf16 -fallow-half-arguments-and-returns -fsyntax-only -verify 
-verify-ignore-unexpected=error %s
-// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC 
-D__ARM_FEATURE_SVE_BF16 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu 
-target-feature +sve -target-feature +bf16 -fallow-half-arguments-and-returns 
-fsyntax-only -verify=overload -verify-ignore-unexpected=error %s
-
-// Test expected warnings for implicit declaration when +bf16 is missing
-// NOTE: +bf16 doesn't currently imply __ARM_FEATURE_SVE_BF16, once the
-// implementation is complete it will, at which point -target-feature +bf16
-// should be removed.
-// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 
-D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -triple aarch64-none-linux-gnu 
-target-feature +sve2 -target-feature +bf16 -fallow-half-arguments-and-returns 
-fsyntax-only -verify -verify-ignore-unexpected=error %s
-
-// Test expected ambiguous call error for overloaded form when +bf16 is missing
-// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 
-D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sve2 -target-feature +bf16 
-fallow-half-arguments-and-returns -fsyntax-only -verify=overload-bf16 
-verify-ignore-unexpected=note %s
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 
-D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -triple aarch64-none-linux-gnu 
-target-feature +sve2 -target-feature +bf16 -fallow-half-arguments-and-returns 
-S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 
-D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sve2 -target-feature +bf16 
-fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | 
FileCheck %s
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC 
-triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 
-fallow-half-arguments-and-returns -fsyntax-only -verify 
-verify-ignore-unexpected=error %s
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC 
-DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +bf16 -fallow-half-arguments-and-returns -fsyntax-only 
-verify=overload -verify-ignore-unexpected=error %s
 
 #include 
 
@@ -29,8 +18,7 @@
   // CHECK: %[[INTRINSIC:.*]] = call  
@llvm.aarch64.sve.whilewr.h.nxv8i1.p0bf16(bfloat* %op1, bfloat* %op2)
   // CHECK: 

[PATCH] D82429: [sve][acle] Add some C intrinsics for brain float types.

2020-06-25 Thread Francesco Petrogalli via Phabricator via cfe-commits
fpetrogalli updated this revision to Diff 273411.
fpetrogalli added a comment.

Removed the run lines that didn't work, as described in 
https://reviews.llvm.org/D82429#inline-759371


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82429

Files:
  clang/include/clang/Basic/arm_sve.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_cnt-bfloat.c
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_tbl-bfloat.c
  clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_tbl2-bfloat.c
  clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_tbx-bfloat.c
  llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
  llvm/test/CodeGen/AArch64/sve-intrinsics-counting-bits.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll
  llvm/test/CodeGen/AArch64/sve2-intrinsics-perm-tb.ll

Index: llvm/test/CodeGen/AArch64/sve2-intrinsics-perm-tb.ll
===
--- llvm/test/CodeGen/AArch64/sve2-intrinsics-perm-tb.ll
+++ llvm/test/CodeGen/AArch64/sve2-intrinsics-perm-tb.ll
@@ -122,6 +122,16 @@
   ret  %out
 }
 
+define  @ftbx_h_bf16( %a,  %b,  %c) #0 {
+; CHECK-LABEL: ftbx_h_bf16:
+; CHECK: tbx z0.h, z1.h, z2.h
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.tbx.nxv8bf16( %a,
+%b,
+%c)
+  ret  %out
+}
+
 define  @tbx_s( %a,  %b,  %c) {
 ; CHECK-LABEL: tbx_s:
 ; CHECK: tbx z0.s, z1.s, z2.s
@@ -179,3 +189,8 @@
 declare  @llvm.aarch64.sve.tbx.nxv8f16(, , )
 declare  @llvm.aarch64.sve.tbx.nxv4f32(, , )
 declare  @llvm.aarch64.sve.tbx.nxv2f64(, , )
+
+declare  @llvm.aarch64.sve.tbx.nxv8bf16(, , )
+
+; +bf16 is required for the bfloat version.
+attributes #0 = { "target-features"="+sve,+bf16" }
Index: llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll
===
--- llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll
+++ llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll
@@ -1027,6 +1027,15 @@
   ret  %out
 }
 
+define  @tbl_bf16( %a,  %b) #0 {
+; CHECK-LABEL: tbl_bf16:
+; CHECK: tbl z0.h, { z0.h }, z1.h
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.tbl.nxv8bf16( %a,
+%b)
+  ret  %out
+}
+
 define  @tbl_f32( %a,  %b) {
 ; CHECK-LABEL: tbl_f32:
 ; CHECK: tbl z0.s, { z0.s }, z1.s
@@ -1933,6 +1942,7 @@
 declare  @llvm.aarch64.sve.tbl.nxv4i32(, )
 declare  @llvm.aarch64.sve.tbl.nxv2i64(, )
 declare  @llvm.aarch64.sve.tbl.nxv8f16(, )
+declare  @llvm.aarch64.sve.tbl.nxv8bf16(, )
 declare  @llvm.aarch64.sve.tbl.nxv4f32(, )
 declare  @llvm.aarch64.sve.tbl.nxv2f64(, )
 
@@ -2027,3 +2037,6 @@
 declare  @llvm.aarch64.sve.zip2.nxv8f16(, )
 declare  @llvm.aarch64.sve.zip2.nxv4f32(, )
 declare  @llvm.aarch64.sve.zip2.nxv2f64(, )
+
+; +bf16 is required for the bfloat version.
+attributes #0 = { "target-features"="+sve,+bf16" }
Index: llvm/test/CodeGen/AArch64/sve-intrinsics-counting-bits.ll
===
--- llvm/test/CodeGen/AArch64/sve-intrinsics-counting-bits.ll
+++ llvm/test/CodeGen/AArch64/sve-intrinsics-counting-bits.ll
@@ -145,6 +145,16 @@
   ret  %out
 }
 
+define  @cnt_bf16( %a,  %pg,  %b) #0 {
+; CHECK-LABEL: cnt_bf16:
+; CHECK: cnt z0.h, p0/m, z1.h
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.cnt.nxv8bf16( %a,
+ %pg,
+ %b)
+  ret  %out
+}
+
 define  @cnt_f32( %a,  %pg,  %b) {
 ; CHECK-LABEL: cnt_f32:
 ; CHECK: cnt z0.s, p0/m, z1.s
@@ -180,5 +190,9 @@
 declare  @llvm.aarch64.sve.cnt.nxv4i32(, , )
 declare  @llvm.aarch64.sve.cnt.nxv2i64(, , )
 declare  @llvm.aarch64.sve.cnt.nxv8f16(, , )
+declare  @llvm.aarch64.sve.cnt.nxv8bf16(, , )
 declare  @llvm.aarch64.sve.cnt.nxv4f32(, , )
 declare  @llvm.aarch64.sve.cnt.nxv2f64(, , )
+
+; +bf16 is required for the bfloat version.
+attributes #0 = { "target-features"="+sve,+bf16" }
Index: llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
===
--- llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
+++ llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
@@ -284,6 +284,11 @@
   defm CLS_ZPmZ  : sve_int_un_pred_arit_1<   0b000, "cls",  int_aarch64_sve_cls>;
   defm CLZ_ZPmZ  : sve_int_un_pred_arit_1<   0b001, "clz",  int_aarch64_sve_clz>;
   defm CNT_ZPmZ  : sve_int_un_pred_arit_1<   0b010, "cnt",  int_aarch64_sve_cnt>;
+
+ let Predicates = [HasSVE, HasBF16] in {
+  def : SVE_3_Op_Pat(CNT_ZPmZ_H)>;
+ }
+
   defm CNOT_ZPmZ : sve_int_un_pred_arit_1<   0b011, "cnot", int_aarch64_sve_cnot>;
   defm NOT_ZPmZ  : sve_int_un_pred_arit_1<   0b110, "not",  int_aarch64_sve_not>;
   defm FABS_ZPmZ : 

[PATCH] D82429: [sve][acle] Add some C intrinsics for brain float types.

2020-06-25 Thread Francesco Petrogalli via Phabricator via cfe-commits
fpetrogalli marked 2 inline comments as done.
fpetrogalli added inline comments.



Comment at: clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_tbl2-bfloat.c:7
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 
-D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -triple aarch64-none-linux-gnu 
-target-feature +sve2 -target-feature +bf16 -fallow-half-arguments-and-returns 
-fsyntax-only -verify -verify-ignore-unexpected=error 
-verify-ignore-unexpected=note %s
+// R UN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 
-D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sve2 -target-feature +bf16 
-fallow-half-arguments-and-returns -fsyntax-only -verify=overload-bf16 
-verify-ignore-unexpected=error -verify-ignore-unexpected=note %s
+

c-rhodes wrote:
> c-rhodes wrote:
> > fpetrogalli wrote:
> > > I could do with an extra pair of eyes here: I can't figure out why the 
> > > warning raised by this run is not detected by the `overload-bf16-warning` 
> > > below... (Same for the same line I have added in the test for tbx).
> > Ah, it works in the example I linked because `whilerw` / `whilewr` uses the 
> > scalar `bfloat16_t`, whereas this is using sizeless type which is 
> > predicated on `-D__ARM_FEATURE_SVE_BF16` so we get:
> > 
> > ```error: 'error' diagnostics seen but not expected:
> >   File 
> > /home/culrho01/llvm-project/clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_tbl2-bfloat.c
> >  Line 18: unknown type name 'svbfloat16_t'; did you mean 'svfloat16_t'?
> >   File 
> > /home/culrho01/llvm-project/clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_tbl2-bfloat.c
> >  Line 18: unknown type name 'svbfloat16x2_t'; did you mean 
> > 'svfloat16x2_t'?```
> > 
> > I'm not sure if/how we can test this for the overloaded form
> I'm not sure if what I suggested makes sense - trying to do what we've done 
> in the sve2 acle tests where we expect an implicit declaration warning for 
> overloaded/non-overloaded intrinsics if the sve2 feature isn't enabled. I 
> guess it's different for BF16 as the types are guarded on the feature macro 
> in the ACLE, for whatever reason we get the same warning for the 
> non-overloaded intrinsics but an error for the overloaded ones. I think we 
> can be pretty confident `+bf16` is required as the test will fail otherwise, 
> but it's tricky trying to isolate an error implying the macro is missing on 
> the intrinsic. FWIW we don't test this for SVE either, I think we can skip 
> this test for the overloaded form, may as well keep the non-overloaded one in 
> if it works.
Agree. I have removed the overload tests for the warning.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82429



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


[PATCH] D82575: [OpenMP] Additional OpenMP test without version string after upgrading to 5.0

2020-06-25 Thread Saiyedul Islam via Phabricator via cfe-commits
saiislam created this revision.
saiislam added reviewers: ABataev, jdoerfert, gregrodgers.
Herald added subscribers: cfe-commits, sstefan1, guansong, yaxunl.
Herald added a project: clang.
saiislam added a commit: rG2bfce22a924a: [OpenMP] Upgrade default version of 
OpenMP to 5.0.
saiislam removed a commit: rG2bfce22a924a: [OpenMP] Upgrade default version of 
OpenMP to 5.0.

[Work in progress, more tests to be updated]
Follow up of https://reviews.llvm.org/D81098 to ensure that updated
tests run without version string also. It will ensure that no test
silently fails during next OpenMP version bump.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82575

Files:
  clang/test/OpenMP/declare_target_codegen.cpp


Index: clang/test/OpenMP/declare_target_codegen.cpp
===
--- clang/test/OpenMP/declare_target_codegen.cpp
+++ clang/test/OpenMP/declare_target_codegen.cpp
@@ -3,21 +3,35 @@
 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -x c++ -triple 
powerpc64le-unknown-unknown -emit-llvm %s -fopenmp-is-device 
-fopenmp-host-ir-file-path %t-ppc-host.bc -emit-pch -o %t
 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -x c++ -triple 
powerpc64le-unknown-unknown -emit-llvm %s -fopenmp-is-device 
-fopenmp-host-ir-file-path %t-ppc-host.bc -include-pch %t -o - -DLOAD | 
FileCheck %s
 
-// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown 
-fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - 
-fopenmp-version=50 -DOMP5 | FileCheck %s --check-prefix HOST5
-// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown 
-fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm-bc %s -o %t-ppc-host.bc 
-fopenmp-version=50 -DOMP5
-// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown 
-emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - 
-fopenmp-version=50 -DOMP5 | FileCheck %s --check-prefix DEV5
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown 
-fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - 
-fopenmp-version=50 -DOMP5plus | FileCheck %s --check-prefix HOST5
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown 
-fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm-bc %s -o %t-ppc-host.bc 
-fopenmp-version=50 -DOMP5plus
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown 
-emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - 
-fopenmp-version=50 -DOMP5plus | FileCheck %s --check-prefix DEV5
 
-// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown 
-emit-llvm %s -o - -fopenmp-version=50 -DOMP5 | FileCheck %s --check-prefix 
KMPC-ONLY
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown 
-emit-llvm %s -o - -fopenmp-version=50 -DOMP5plus | FileCheck %s --check-prefix 
KMPC-ONLY
 
-// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple 
powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu 
-emit-llvm %s -o - -fopenmp-version=50 -DOMP5 | FileCheck %s --check-prefix 
SIMD-ONLY
-// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple 
powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu 
-emit-llvm-bc %s -o %t-ppc-host.bc -fopenmp-version=50 -DOMP5
-// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple 
powerpc64le-unknown-unknown -emit-llvm %s -fopenmp-is-device 
-fopenmp-host-ir-file-path %t-ppc-host.bc -o - -fopenmp-version=50 -DOMP5 | 
FileCheck %s --check-prefix SIMD-ONLY
+// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple 
powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu 
-emit-llvm %s -o - -fopenmp-version=50 -DOMP5plus | FileCheck %s --check-prefix 
SIMD-ONLY
+// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple 
powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu 
-emit-llvm-bc %s -o %t-ppc-host.bc -fopenmp-version=50 -DOMP5plus
+// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple 
powerpc64le-unknown-unknown -emit-llvm %s -fopenmp-is-device 
-fopenmp-host-ir-file-path %t-ppc-host.bc -o - -fopenmp-version=50 -DOMP5plus | 
FileCheck %s --check-prefix SIMD-ONLY
 
 // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple 
powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu 
-emit-llvm-bc %s -o %t-ppc-host.bc -fopenmp-version=45
 // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple 
powerpc64le-unknown-unknown -emit-llvm %s -fopenmp-is-device 
-fopenmp-host-ir-file-path %t-ppc-host.bc -o - -fopenmp-version=45 | FileCheck 
%s --check-prefix SIMD-ONLY
 // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple 
powerpc64le-unknown-unknown -emit-llvm %s -fopenmp-is-device 
-fopenmp-host-ir-file-path %t-ppc-host.bc -emit-pch -o %t -fopenmp-version=45
 // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple 
powerpc64le-unknown-unknown -emit-llvm %s 

[PATCH] D70603: Change while to do-while

2020-06-25 Thread Seija Kijin via Phabricator via cfe-commits
pi1024e added a comment.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70603



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


[PATCH] D82576: [PowerPC][Power10] Implement low-order Vector Modulus Builtins, and add Vector Multiply/Divide/Modulus Builtins Tests

2020-06-25 Thread Amy Kwan via Phabricator via cfe-commits
amyk created this revision.
amyk added reviewers: power-llvm-team, PowerPC, Conanap, saghir, nemanjai, lei.
amyk added projects: LLVM, clang, PowerPC.
Herald added a subscriber: shchenz.

This patch aims to add the following function prototypes:

  vector signed int vec_mod (vector signed int a, vector signed int b);
  vector unsigned int vec_mod (vector unsigned int a, vector unsigned int b);
  vector signed long long vec_mod (vector signed long long a, vector signed 
long long b);
  vector unsigned long long vec_mod (vector unsigned long long a, vector 
unsigned long long b);

Along with adding the front-end tests for `vec_mul`, `vec_div` and `vec_mod` 
for `v4i32` and `v2i64`. 
The `vec_mul` and `vec_div` functions have already been previously implemented, 
but these functions
can use the Power10 instructions introduced in D82510 
.

Depends on D82510 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82576

Files:
  clang/lib/Headers/altivec.h
  clang/test/CodeGen/builtins-ppc-p10vector.c

Index: clang/test/CodeGen/builtins-ppc-p10vector.c
===
--- clang/test/CodeGen/builtins-ppc-p10vector.c
+++ clang/test/CodeGen/builtins-ppc-p10vector.c
@@ -8,10 +8,72 @@
 vector signed char vsca;
 vector unsigned char vuca;
 vector unsigned short vusa;
-vector unsigned int vuia;
+vector signed int vsia, vsib;
+vector unsigned int vuia, vuib;
+vector signed long long vslla, vsllb;
 vector unsigned long long vulla, vullb;
 unsigned int uia;
 
+vector signed long long test_vec_mul_sll(void) {
+  // CHECK: mul <2 x i64>
+  // CHECK-NEXT: ret <2 x i64>
+  return vec_mul(vslla, vsllb);
+}
+
+vector unsigned long long test_vec_mul_ull(void) {
+  // CHECK: mul <2 x i64>
+  // CHECK-NEXT: ret <2 x i64>
+  return vec_mul(vulla, vullb);
+}
+
+vector signed int test_vec_div_si(void) {
+  // CHECK: sdiv <4 x i32>
+  // CHECK-NEXT: ret <4 x i32>
+  return vec_div(vsia, vsib);
+}
+
+vector unsigned int test_vec_div_ui(void) {
+  // CHECK: udiv <4 x i32>
+  // CHECK-NEXT: ret <4 x i32>
+  return vec_div(vuia, vuib);
+}
+
+vector signed long long test_vec_div_sll(void) {
+  // CHECK: sdiv <2 x i64>
+  // CHECK-NEXT: ret <2 x i64>
+  return vec_div(vslla, vsllb);
+}
+
+vector unsigned long long test_vec_div_ull(void) {
+  // CHECK: udiv <2 x i64>
+  // CHECK-NEXT: ret <2 x i64>
+  return vec_div(vulla, vullb);
+}
+
+vector signed int test_vec_mod_si(void) {
+  // CHECK: srem <4 x i32>
+  // CHECK-NEXT: ret <4 x i32>
+  return vec_mod(vsia, vsib);
+}
+
+vector unsigned int test_vec_mod_ui(void) {
+  // CHECK: urem <4 x i32>
+  // CHECK-NEXT: ret <4 x i32>
+  return vec_mod(vuia, vuib);
+}
+
+vector signed long long test_vec_mod_sll(void) {
+  // CHECK: srem <2 x i64>
+  // CHECK-NEXT: ret <2 x i64>
+  return vec_mod(vslla, vsllb);
+}
+
+vector unsigned long long test_vec_mod_ull(void) {
+  // CHECK: urem <2 x i64>
+  // CHECK-NEXT: ret <2 x i64>
+  return vec_mod(vulla, vullb);
+}
+
 vector unsigned long long test_vpdepd(void) {
   // CHECK: @llvm.ppc.altivec.vpdepd(<2 x i64>
   // CHECK-NEXT: ret <2 x i64>
Index: clang/lib/Headers/altivec.h
===
--- clang/lib/Headers/altivec.h
+++ clang/lib/Headers/altivec.h
@@ -16845,6 +16845,28 @@
   return __builtin_altivec_vctzdm(__a, __b);
 }
 
+/* vec_mod */
+
+static __inline__ vector signed int __ATTRS_o_ai
+vec_mod(vector signed int __a, vector signed int __b) {
+  return __a % __b;
+}
+
+static __inline__ vector unsigned int __ATTRS_o_ai
+vec_mod(vector unsigned int __a, vector unsigned int __b) {
+  return __a % __b;
+}
+
+static __inline__ vector signed long long __ATTRS_o_ai
+vec_mod(vector signed long long __a, vector signed long long __b) {
+  return __a % __b;
+}
+
+static __inline__ vector unsigned long long __ATTRS_o_ai
+vec_mod(vector unsigned long long __a, vector unsigned long long __b) {
+  return __a % __b;
+}
+
 #endif /* __POWER10_VECTOR__ */
 
 #undef __ATTRS_o_ai
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82391: [AArch64][SVE] Add bfloat16 support to svext intrinsic

2020-06-25 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen added inline comments.



Comment at: llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td:1479
+  let Predicates = [IsLE, HasBF16] in {
+def : Pat<(nxv16i8 (bitconvert (nxv8bf16 ZPR:$src))), (nxv16i8 ZPR:$src)>;
+

These patterns are missing tests in llvm/test/CodeGen/AArch64/sve-bitcast.ll


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

https://reviews.llvm.org/D82391



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


[PATCH] D81825: [Clang] Add support for -Wno-inline-namespace-reopened-noninline

2020-06-25 Thread Andrey Bokhanko via Phabricator via cfe-commits
andreybokhanko added a comment.

Fix committed in 
https://reviews.llvm.org/rG16501782c8d849bc1812d527dc8466574700663d. Thanks for 
working on this!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81825



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


[clang] 7200fa3 - [sve][acle] Add some C intrinsics for brain float types.

2020-06-25 Thread Francesco Petrogalli via cfe-commits

Author: Francesco Petrogalli
Date: 2020-06-25T16:31:01Z
New Revision: 7200fa38a912d0d9ec407ccdd7c4d924979da160

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

LOG: [sve][acle] Add some C intrinsics for brain float types.

Summary:
The following intrinsics has been added:

svuint16_t svcnt[_bf16]_m(svuint16_t inactive, svbool_t pg, svbfloat16_t op)
svuint16_t svcnt[_bf16]_x(svbool_t pg, svbfloat16_t op)
svuint16_t svcnt[_bf16]_z(svbool_t pg, svbfloat16_t op)

svbfloat16_t svtbl[_bf16](svbfloat16_t data, svuint16_t indices)

svbfloat16_t svtbl2[_bf16](svbfloat16x2_t data, svuint16_t indices)

svbfloat16_t svtbx[_bf16](svbfloat16_t fallback, svbfloat16_t data, svuint16_t 
indices)

Reviewers: c-rhodes, kmclaughlin, efriedma, sdesmalen, ctetreau

Subscribers: tschuett, hiraditya, rkruppe, psnobl, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

Added: 
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_cnt-bfloat.c
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_tbl-bfloat.c
clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_tbl2-bfloat.c
clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_tbx-bfloat.c

Modified: 
clang/include/clang/Basic/arm_sve.td
clang/lib/CodeGen/CGBuiltin.cpp
llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
llvm/test/CodeGen/AArch64/sve-intrinsics-counting-bits.ll
llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll
llvm/test/CodeGen/AArch64/sve2-intrinsics-perm-tb.ll

Removed: 




diff  --git a/clang/include/clang/Basic/arm_sve.td 
b/clang/include/clang/Basic/arm_sve.td
index 3fb86fcdc1ff..59adbeaf645f 100644
--- a/clang/include/clang/Basic/arm_sve.td
+++ b/clang/include/clang/Basic/arm_sve.td
@@ -928,6 +928,10 @@ defm SVCLS : SInstCLS<"svcls", "csil",
"aarch64_sve_cls">;
 defm SVCLZ : SInstCLS<"svclz", "csilUcUsUiUl","aarch64_sve_clz">;
 defm SVCNT : SInstCLS<"svcnt", "csilUcUsUiUlhfd", "aarch64_sve_cnt">;
 
+let ArchGuard = "defined(__ARM_FEATURE_SVE_BF16)" in {
+  defm SVCNT_BF16 : SInstCLS<"svcnt", "b", "aarch64_sve_cnt">;
+}
+
 

 // Conversion
 
@@ -1177,6 +1181,11 @@ def SVREV: SInst<"svrev[_{d}]",   "dd",   
"csilUcUsUiUlhfd", MergeNo
 def SVSEL: SInst<"svsel[_{d}]",   "dPdd", "csilUcUsUiUlhfd", 
MergeNone, "aarch64_sve_sel">;
 def SVSPLICE : SInst<"svsplice[_{d}]","dPdd", "csilUcUsUiUlhfd", 
MergeNone, "aarch64_sve_splice">;
 def SVTBL: SInst<"svtbl[_{d}]",   "ddu",  "csilUcUsUiUlhfd", 
MergeNone, "aarch64_sve_tbl">;
+
+let ArchGuard = "defined(__ARM_FEATURE_SVE_BF16)" in {
+  def SVTBL_BF16 : SInst<"svtbl[_{d}]",   "ddu",  "b",   
MergeNone, "aarch64_sve_tbl">;
+}
+
 def SVTRN1   : SInst<"svtrn1[_{d}]",  "ddd",  "csilUcUsUiUlhfd", 
MergeNone, "aarch64_sve_trn1">;
 def SVTRN2   : SInst<"svtrn2[_{d}]",  "ddd",  "csilUcUsUiUlhfd", 
MergeNone, "aarch64_sve_trn2">;
 def SVUNPKHI_S   : SInst<"svunpkhi[_{d}]","dh",   "sil", 
MergeNone, "aarch64_sve_sunpkhi">;
@@ -1974,6 +1983,11 @@ def SVTBL2 : SInst<"svtbl2[_{d}]", "d2u",  
"csilUcUsUiUlhfd", MergeNone>;
 def SVTBX  : SInst<"svtbx[_{d}]",  "dddu", "csilUcUsUiUlhfd", MergeNone, 
"aarch64_sve_tbx">;
 }
 
+let ArchGuard = "defined(__ARM_FEATURE_SVE2) && 
defined(__ARM_FEATURE_SVE_BF16)" in {
+def SVTBL2_BF16 : SInst<"svtbl2[_{d}]", "d2u",  "b", MergeNone>;
+def SVTBX_BF16  : SInst<"svtbx[_{d}]",  "dddu", "b", MergeNone, 
"aarch64_sve_tbx">;
+}
+
 

 // SVE2 - Optional
 

diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index c43877e117eb..2eef4f284271 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -8465,6 +8465,7 @@ Value 
*CodeGenFunction::EmitAArch64SVEBuiltinExpr(unsigned BuiltinID,
   case SVE::BI__builtin_sve_svtbl2_u64:
   case SVE::BI__builtin_sve_svtbl2_s64:
   case SVE::BI__builtin_sve_svtbl2_f16:
+  case SVE::BI__builtin_sve_svtbl2_bf16:
   case SVE::BI__builtin_sve_svtbl2_f32:
   case SVE::BI__builtin_sve_svtbl2_f64: {
 SVETypeFlags TF(Builtin->TypeModifier);

diff  --git a/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_cnt-bfloat.c 
b/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_cnt-bfloat.c
new file mode 100644
index ..45174ff9ef51
--- /dev/null
+++ b/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_cnt-bfloat.c
@@ -0,0 +1,44 @@
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE_BF16 
-D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -triple aarch64-none-linux-gnu 
-target-feature +sve -target-feature 

[clang] 772f482 - Change while to do-while

2020-06-25 Thread Fangrui Song via cfe-commits

Author: Seija Kijin
Date: 2020-06-25T09:30:30-07:00
New Revision: 772f4826465de80d8c7f11b2fb35b92f9fe58f45

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

LOG: Change while to do-while

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

Added: 


Modified: 
clang/lib/Analysis/ReachableCode.cpp

Removed: 




diff  --git a/clang/lib/Analysis/ReachableCode.cpp 
b/clang/lib/Analysis/ReachableCode.cpp
index 369879ad65f5..221d137dadb8 100644
--- a/clang/lib/Analysis/ReachableCode.cpp
+++ b/clang/lib/Analysis/ReachableCode.cpp
@@ -138,10 +138,10 @@ static bool isDeadReturn(const CFGBlock *B, const Stmt 
*S) {
 static SourceLocation getTopMostMacro(SourceLocation Loc, SourceManager ) {
   assert(Loc.isMacroID());
   SourceLocation Last;
-  while (Loc.isMacroID()) {
+  do {
 Last = Loc;
 Loc = SM.getImmediateMacroCallerLoc(Loc);
-  }
+  } while (Loc.isMacroID());
   return Last;
 }
 



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


[libunwind] c55051e - [libunwind] Allow specifying custom Lit config files

2020-06-25 Thread Louis Dionne via cfe-commits

Author: Louis Dionne
Date: 2020-06-25T12:15:15-04:00
New Revision: c55051eea5d3cd57abfd9727f519b670517704d9

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

LOG: [libunwind] Allow specifying custom Lit config files

This is the libunwind counterpart of 0c66af970c80.

Added: 
libunwind/test/lit.cfg.py

Modified: 
libunwind/CMakeLists.txt
libunwind/test/CMakeLists.txt
libunwind/test/lit.site.cfg.in

Removed: 
libunwind/test/lit.cfg



diff  --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index d3f791e17f10..7065112627a2 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -154,6 +154,8 @@ set(LIBUNWIND_TEST_LINKER_FLAGS "" CACHE STRING
 "Additional linker flags for test programs.")
 set(LIBUNWIND_TEST_COMPILER_FLAGS "" CACHE STRING
 "Additional compiler flags for test programs.")
+set(LIBUNWIND_TEST_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/test/lit.site.cfg.in" 
CACHE STRING
+"The Lit testing configuration to use when running the tests.")
 
 if (NOT LIBUNWIND_ENABLE_SHARED AND NOT LIBUNWIND_ENABLE_STATIC)
   message(FATAL_ERROR "libunwind must be built as either a shared or static 
library.")

diff  --git a/libunwind/test/CMakeLists.txt b/libunwind/test/CMakeLists.txt
index 26e7842b7a1f..794a59f58f84 100644
--- a/libunwind/test/CMakeLists.txt
+++ b/libunwind/test/CMakeLists.txt
@@ -25,12 +25,11 @@ set(LIBUNWIND_EXECUTOR "${Python3_EXECUTABLE} 
${LIBUNWIND_LIBCXX_PATH}/utils/run
 "Executor to use when running tests.")
 
 set(AUTO_GEN_COMMENT "## Autogenerated by libunwind configuration.\n# Do not 
edit!")
-configure_file(
-  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
+configure_lit_site_cfg(
+  "${LIBUNWIND_TEST_CONFIG}"
   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
-  @ONLY)
+  MAIN_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py")
 
 add_lit_testsuite(check-unwind "Running libunwind tests"
   ${CMAKE_CURRENT_BINARY_DIR}
-  DEPENDS ${LIBUNWIND_TEST_DEPS}
-  )
+  DEPENDS ${LIBUNWIND_TEST_DEPS})

diff  --git a/libunwind/test/lit.cfg b/libunwind/test/lit.cfg
deleted file mode 100644
index 7f74bd6e4afb..
--- a/libunwind/test/lit.cfg
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
-
-# Configuration file for the 'lit' test runner.
-
-
-import os
-import site
-
-site.addsitedir(os.path.dirname(__file__))
-
-
-# Tell pylint that we know config and lit_config exist somewhere.
-if 'PYLINT_IMPORT' in os.environ:
-config = object()
-lit_config = object()
-
-# name: The name of this test suite.
-config.name = 'libunwind'
-
-# suffixes: A list of file extensions to treat as test files.
-config.suffixes = ['.cpp', '.s']
-
-# test_source_root: The root path where tests are located.
-config.test_source_root = os.path.dirname(__file__)
-
-# Infer the libcxx_test_source_root for configuration import.
-# If libcxx_source_root isn't specified in the config, assume that the libcxx
-# and libunwind source directories are sibling directories.
-libcxx_src_root = getattr(config, 'libcxx_src_root', None)
-if not libcxx_src_root:
-libcxx_src_root = os.path.join(config.test_source_root, '../../libcxx')
-libcxx_test_src_root = os.path.join(libcxx_src_root, 'utils')
-if os.path.isfile(os.path.join(libcxx_test_src_root, 'libcxx', '__init__.py')):
-site.addsitedir(libcxx_test_src_root)
-else:
-lit_config.fatal('Could not find libcxx test directory for test imports'
- ' in: %s' % libcxx_test_src_root)
-
-# Infer the test_exec_root from the libcxx_object root.
-obj_root = getattr(config, 'libunwind_obj_root', None)
-
-# Check that the test exec root is known.
-if obj_root is None:
-import libcxx.test.config
-libcxx.test.config.loadSiteConfig(
-lit_config, config, 'libunwind_site_config', 'LIBUNWIND_SITE_CONFIG')
-obj_root = getattr(config, 'libunwind_obj_root', None)
-if obj_root is None:
-import tempfile
-obj_root = tempfile.mkdtemp(prefix='libunwind-testsuite-')
-lit_config.warning('Creating temporary directory for object root: %s' %
-   obj_root)
-
-config.test_exec_root = os.path.join(obj_root, 'test')
-
-cfg_variant = getattr(config, 'configuration_variant', 'libunwind')
-if cfg_variant:
-lit_config.note('Using configuration variant: %s' % cfg_variant)
-
-# Load the Configuration class from the module name .test.config.
-config_module_name = '.'.join([cfg_variant, 'test', 'config'])
-config_module = __import__(config_module_name, fromlist=['Configuration'])
-
-configuration = config_module.Configuration(lit_config, config)
-configuration.configure()
-configuration.print_config_info()
-if lit_config.params.get('use_old_format', False):
-lit_config.note("Using the old libc++ testing 

[PATCH] D82310: Add `BoolLiteralExpression` to SyntaxTree

2020-06-25 Thread Eduardo Caldas via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7f7f8564808b: Add `BoolLiteralExpression` to SyntaxTree 
(authored by eduucaldas).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82310

Files:
  clang/include/clang/Tooling/Syntax/Nodes.h
  clang/lib/Tooling/Syntax/BuildTree.cpp
  clang/lib/Tooling/Syntax/Nodes.cpp
  clang/unittests/Tooling/Syntax/TreeTest.cpp

Index: clang/unittests/Tooling/Syntax/TreeTest.cpp
===
--- clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -69,6 +69,10 @@
Language == Lang_CXX20;
   }
 
+  bool hasBoolType() const {
+return Language == Lang_C89 || Language == Lang_C99;
+  }
+
   bool supportsCXXDynamicExceptionSpecification() const {
 return Language == Lang_CXX03 || Language == Lang_CXX11 ||
Language == Lang_CXX14;
@@ -1228,6 +1232,40 @@
 )txt"));
 }
 
+TEST_P(SyntaxTreeTest, BoolLiteral) {
+  if (GetParam().hasBoolType()) {
+return;
+  }
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  true;
+  false;
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-BoolLiteralExpression
+| | `-true
+| `-;
+|-ExpressionStatement
+| |-BoolLiteralExpression
+| | `-false
+| `-;
+`-}
+)txt"));
+}
+
 TEST_P(SyntaxTreeTest, IntegerLiteral) {
   EXPECT_TRUE(treeDumpEqual(
   R"cpp(
@@ -1691,18 +1729,18 @@
 |-{
 |-ExpressionStatement
 | |-BinaryOperatorExpression
-| | |-UnknownExpression
+| | |-BoolLiteralExpression
 | | | `-true
 | | |-||
-| | `-UnknownExpression
+| | `-BoolLiteralExpression
 | |   `-false
 | `-;
 |-ExpressionStatement
 | |-BinaryOperatorExpression
-| | |-UnknownExpression
+| | |-BoolLiteralExpression
 | | | `-true
 | | |-or
-| | `-UnknownExpression
+| | `-BoolLiteralExpression
 | |   `-false
 | `-;
 |-ExpressionStatement
@@ -2556,7 +2594,7 @@
 |-StaticAssertDeclaration
 | |-static_assert
 | |-(
-| |-UnknownExpression
+| |-BoolLiteralExpression
 | | `-true
 | |-,
 | |-UnknownExpression
@@ -2566,7 +2604,7 @@
 `-StaticAssertDeclaration
   |-static_assert
   |-(
-  |-UnknownExpression
+  |-BoolLiteralExpression
   | `-true
   |-)
   `-;
@@ -3186,7 +3224,7 @@
   |   |-)
   |   |-noexcept
   |   |-(
-  |   |-UnknownExpression
+  |   |-BoolLiteralExpression
   |   | `-true
   |   `-)
   `-;
Index: clang/lib/Tooling/Syntax/Nodes.cpp
===
--- clang/lib/Tooling/Syntax/Nodes.cpp
+++ clang/lib/Tooling/Syntax/Nodes.cpp
@@ -22,6 +22,8 @@
 return OS << "CxxNullPtrExpression";
   case NodeKind::IntegerLiteralExpression:
 return OS << "IntegerLiteralExpression";
+  case NodeKind::BoolLiteralExpression:
+return OS << "BoolLiteralExpression";
   case NodeKind::PrefixUnaryOperatorExpression:
 return OS << "PrefixUnaryOperatorExpression";
   case NodeKind::PostfixUnaryOperatorExpression:
@@ -200,6 +202,11 @@
   findChild(syntax::NodeRole::LiteralToken));
 }
 
+syntax::Leaf *syntax::BoolLiteralExpression::literalToken() {
+  return llvm::cast_or_null(
+  findChild(syntax::NodeRole::LiteralToken));
+}
+
 syntax::Leaf *syntax::CxxNullPtrExpression::nullPtrKeyword() {
   return llvm::cast_or_null(
   findChild(syntax::NodeRole::LiteralToken));
Index: clang/lib/Tooling/Syntax/BuildTree.cpp
===
--- clang/lib/Tooling/Syntax/BuildTree.cpp
+++ clang/lib/Tooling/Syntax/BuildTree.cpp
@@ -654,6 +654,13 @@
 return true;
   }
 
+  bool WalkUpFromCXXBoolLiteralExpr(CXXBoolLiteralExpr *S) {
+Builder.markChildToken(S->getLocation(), syntax::NodeRole::LiteralToken);
+Builder.foldNode(Builder.getExprRange(S),
+ new (allocator()) syntax::BoolLiteralExpression, S);
+return true;
+  }
+
   bool WalkUpFromCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *S) {
 Builder.markChildToken(S->getLocation(), syntax::NodeRole::LiteralToken);
 Builder.foldNode(Builder.getExprRange(S),
Index: clang/include/clang/Tooling/Syntax/Nodes.h
===
--- clang/include/clang/Tooling/Syntax/Nodes.h
+++ clang/include/clang/Tooling/Syntax/Nodes.h
@@ -45,6 +45,7 @@
   BinaryOperatorExpression,
   CxxNullPtrExpression,
   IntegerLiteralExpression,
+  BoolLiteralExpression,
   IdExpression,
 
   // Statements.
@@ -264,6 +265,16 @@
   syntax::Leaf *literalToken();
 };
 
+/// Expression for boolean literals. C++ [lex.bool]
+class BoolLiteralExpression final : public Expression {
+public:
+  BoolLiteralExpression() : 

[PATCH] D77062: [analyzer] Improved zero assumption in CStringChecke::assumeZero

2020-06-25 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment.

@NoQ gentle ping.


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

https://reviews.llvm.org/D77062



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


[PATCH] D81825: [Clang] Add support for -Wno-inline-namespace-reopened-noninline

2020-06-25 Thread Andrey Bokhanko via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG16501782c8d8: [Clang] Add support for 
-Wno-inline-namespace-reopened-noninline (authored by Elvina, committed by 
andreybokhanko).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81825

Files:
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/test/Misc/warning-flags.c
  clang/test/SemaCXX/warn-inline-namespace-reopened-noninline-disable.cpp


Index: clang/test/SemaCXX/warn-inline-namespace-reopened-noninline-disable.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/warn-inline-namespace-reopened-noninline-disable.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -Wall -verify -std=c++11 %s
+// RUN: %clang_cc1 -fsyntax-only -Wall 
-Wno-inline-namespace-reopened-noninline -DSILENCE -verify -std=c++11 %s
+
+namespace X {
+  #ifndef SILENCE
+inline namespace {} // expected-note {{previous definition}}
+namespace {} // expected-warning {{inline namespace reopened as a 
non-inline namespace}}
+  #else
+// expected-no-diagnostics
+inline namespace {}
+namespace {}
+  #endif
+}
Index: clang/test/Misc/warning-flags.c
===
--- clang/test/Misc/warning-flags.c
+++ clang/test/Misc/warning-flags.c
@@ -18,7 +18,7 @@
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (69):
+CHECK: Warnings without flags (68):
 
 CHECK-NEXT:   ext_expected_semi_decl_list
 CHECK-NEXT:   ext_explicit_specialization_storage_class
@@ -58,7 +58,6 @@
 CHECK-NEXT:   warn_ignoring_ftabstop_value
 CHECK-NEXT:   warn_implements_nscopying
 CHECK-NEXT:   warn_incompatible_qualified_id
-CHECK-NEXT:   warn_inline_namespace_reopened_noninline
 CHECK-NEXT:   warn_invalid_asm_cast_lvalue
 CHECK-NEXT:   warn_maynot_respond
 CHECK-NEXT:   warn_method_param_redefinition
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -1414,7 +1414,8 @@
   DefaultIgnore, InGroup;
 
 def warn_inline_namespace_reopened_noninline : Warning<
-  "inline namespace reopened as a non-inline namespace">;
+  "inline namespace reopened as a non-inline namespace">,
+  InGroup;
 def err_inline_namespace_mismatch : Error<
   "non-inline namespace cannot be reopened as inline">;
 
Index: clang/include/clang/Basic/DiagnosticGroups.td
===
--- clang/include/clang/Basic/DiagnosticGroups.td
+++ clang/include/clang/Basic/DiagnosticGroups.td
@@ -382,6 +382,8 @@
 def PrivateModule : DiagGroup<"private-module">;
 
 def CXX11InlineNamespace : DiagGroup<"c++11-inline-namespace">;
+def InlineNamespaceReopenedNoninline
+: DiagGroup<"inline-namespace-reopened-noninline">;
 def InvalidNoreturn : DiagGroup<"invalid-noreturn">;
 def InvalidSourceEncoding : DiagGroup<"invalid-source-encoding">;
 def KNRPromotedParameter : DiagGroup<"knr-promoted-parameter">;


Index: clang/test/SemaCXX/warn-inline-namespace-reopened-noninline-disable.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/warn-inline-namespace-reopened-noninline-disable.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -Wall -verify -std=c++11 %s
+// RUN: %clang_cc1 -fsyntax-only -Wall -Wno-inline-namespace-reopened-noninline -DSILENCE -verify -std=c++11 %s
+
+namespace X {
+  #ifndef SILENCE
+inline namespace {} // expected-note {{previous definition}}
+namespace {} // expected-warning {{inline namespace reopened as a non-inline namespace}}
+  #else
+// expected-no-diagnostics
+inline namespace {}
+namespace {}
+  #endif
+}
Index: clang/test/Misc/warning-flags.c
===
--- clang/test/Misc/warning-flags.c
+++ clang/test/Misc/warning-flags.c
@@ -18,7 +18,7 @@
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (69):
+CHECK: Warnings without flags (68):
 
 CHECK-NEXT:   ext_expected_semi_decl_list
 CHECK-NEXT:   ext_explicit_specialization_storage_class
@@ -58,7 +58,6 @@
 CHECK-NEXT:   warn_ignoring_ftabstop_value
 CHECK-NEXT:   warn_implements_nscopying
 CHECK-NEXT:   warn_incompatible_qualified_id
-CHECK-NEXT:   warn_inline_namespace_reopened_noninline
 CHECK-NEXT:   warn_invalid_asm_cast_lvalue
 CHECK-NEXT:   warn_maynot_respond
 CHECK-NEXT:   warn_method_param_redefinition
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ 

[PATCH] D82020: PowerPC-specific builtin constrained FP enablement

2020-06-25 Thread Kevin P. Neal via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG15edd7aaa714: [FPEnv] PowerPC-specific builtin constrained 
FP enablement (authored by ajwock, committed by kpn).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82020

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/builtins-ppc-fpconstrained.c

Index: clang/test/CodeGen/builtins-ppc-fpconstrained.c
===
--- /dev/null
+++ clang/test/CodeGen/builtins-ppc-fpconstrained.c
@@ -0,0 +1,159 @@
+// REQUIRES: powerpc-registered-target
+// RUN: %clang_cc1 -triple powerpc64le-gnu-linux -target-feature +vsx \
+// RUN: -emit-llvm %s -o - | FileCheck --check-prefix=CHECK-UNCONSTRAINED %s
+// RUN: %clang_cc1 -triple powerpc64le-gnu-linux -target-feature +vsx \
+// RUN:  -ffp-exception-behavior=strict -emit-llvm %s -o - | FileCheck \
+// RUN: --check-prefix=CHECK-CONSTRAINED -vv %s
+// RUN: %clang_cc1 -triple powerpc64le-gnu-linux -target-feature +vsx \
+// RUN: -fallow-half-arguments-and-returns -S -o - %s | \
+// RUN: FileCheck --check-prefix=CHECK-ASM --check-prefix=NOT-FIXME-CHECK  %s
+// RUN: %clang_cc1 -triple powerpc64le-gnu-linux -target-feature +vsx \
+// RUN: -fallow-half-arguments-and-returns -S -ffp-exception-behavior=strict \
+// RUN: -o - %s | FileCheck --check-prefix=CHECK-ASM \
+// RUN: --check-prefix=FIXME-CHECK  %s
+
+typedef __attribute__((vector_size(4 * sizeof(float float vec_float;
+typedef __attribute__((vector_size(2 * sizeof(double double vec_double;
+
+volatile vec_double vd;
+volatile vec_float vf;
+
+void test_float(void) {
+  vf = __builtin_vsx_xvsqrtsp(vf);
+  // CHECK-LABEL: try-xvsqrtsp
+  // CHECK-UNCONSTRAINED: @llvm.sqrt.v4f32(<4 x float> %{{.*}})
+  // CHECK-CONSTRAINED: @llvm.experimental.constrained.sqrt.v4f32(<4 x float> %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
+  // CHECK-ASM: xvsqrtsp
+
+  vd = __builtin_vsx_xvsqrtdp(vd);
+  // CHECK-LABEL: try-xvsqrtdp
+  // CHECK-UNCONSTRAINED: @llvm.sqrt.v2f64(<2 x double> %{{.*}})
+  // CHECK-CONSTRAINED: @llvm.experimental.constrained.sqrt.v2f64(<2 x double> %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
+  // CHECK-ASM: xvsqrtdp
+
+  vf = __builtin_vsx_xvrspim(vf);
+  // CHECK-LABEL: try-xvrspim
+  // CHECK-UNCONSTRAINED: @llvm.floor.v4f32(<4 x float> %{{.*}})
+  // CHECK-CONSTRAINED: @llvm.experimental.constrained.floor.v4f32(<4 x float> %{{.*}}, metadata !"fpexcept.strict")
+  // CHECK-ASM: xvrspim
+
+  vd = __builtin_vsx_xvrdpim(vd);
+  // CHECK-LABEL: try-xvrdpim
+  // CHECK-UNCONSTRAINED: @llvm.floor.v2f64(<2 x double> %{{.*}})
+  // CHECK-CONSTRAINED: @llvm.experimental.constrained.floor.v2f64(<2 x double> %{{.*}}, metadata !"fpexcept.strict")
+  // CHECK-ASM: xvrdpim
+
+  vf = __builtin_vsx_xvrspi(vf);
+  // CHECK-LABEL: try-xvrspi
+  // CHECK-UNCONSTRAINED: @llvm.round.v4f32(<4 x float> %{{.*}})
+  // CHECK-CONSTRAINED: @llvm.experimental.constrained.round.v4f32(<4 x float> %{{.*}}, metadata !"fpexcept.strict")
+  // CHECK-ASM: xvrspi
+
+  vd = __builtin_vsx_xvrdpi(vd);
+  // CHECK-LABEL: try-xvrdpi
+  // CHECK-UNCONSTRAINED: @llvm.round.v2f64(<2 x double> %{{.*}})
+  // CHECK-CONSTRAINED: @llvm.experimental.constrained.round.v2f64(<2 x double> %{{.*}}, metadata !"fpexcept.strict")
+  // CHECK-ASM: xvrdpi
+
+  vf = __builtin_vsx_xvrspic(vf);
+  // CHECK-LABEL: try-xvrspic
+  // CHECK-UNCONSTRAINED: @llvm.nearbyint.v4f32(<4 x float> %{{.*}})
+  // CHECK-CONSTRAINED: @llvm.experimental.constrained.nearbyint.v4f32(<4 x float> %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
+  // CHECK-ASM: xvrspic
+
+  vd = __builtin_vsx_xvrdpic(vd);
+  // CHECK-LABEL: try-xvrdpic
+  // CHECK-UNCONSTRAINED: @llvm.nearbyint.v2f64(<2 x double> %{{.*}})
+  // CHECK-CONSTRAINED: @llvm.experimental.constrained.nearbyint.v2f64(<2 x double> %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
+  // CHECK-ASM: xvrdpic
+
+  vf = __builtin_vsx_xvrspip(vf);
+  // CHECK-LABEL: try-xvrspip
+  // CHECK-UNCONSTRAINED: @llvm.ceil.v4f32(<4 x float> %{{.*}})
+  // CHECK-CONSTRAINED: @llvm.experimental.constrained.ceil.v4f32(<4 x float> %{{.*}}, metadata !"fpexcept.strict")
+  // CHECK-ASM: xvrspip
+
+  vd = __builtin_vsx_xvrdpip(vd);
+  // CHECK-LABEL: try-xvrdpip
+  // CHECK-UNCONSTRAINED: @llvm.ceil.v2f64(<2 x double> %{{.*}})
+  // CHECK-CONSTRAINED: @llvm.experimental.constrained.ceil.v2f64(<2 x double> %{{.*}}, metadata !"fpexcept.strict")
+  // CHECK-ASM: xvrdpip
+
+  vf = __builtin_vsx_xvrspiz(vf);
+  // CHECK-LABEL: try-xvrspiz
+  // CHECK-UNCONSTRAINED: @llvm.trunc.v4f32(<4 x float> %{{.*}})
+  // CHECK-CONSTRAINED: @llvm.experimental.constrained.trunc.v4f32(<4 x float> %{{.*}}, metadata !"fpexcept.strict")
+  // CHECK-ASM: xvrspiz
+
+  vd = __builtin_vsx_xvrdpiz(vd);
+  // CHECK-LABEL: try-xvrdpiz
+  // CHECK-UNCONSTRAINED: 

[PATCH] D82501: [sve][acle] Add reinterpret intrinsics for brain float.

2020-06-25 Thread Francesco Petrogalli via Phabricator via cfe-commits
fpetrogalli updated this revision to Diff 273399.
fpetrogalli marked an inline comment as done.
fpetrogalli added a comment.

@david-arm, at the end I decided to add the `ASM-NOT` test, it was easy and 
came for free.

Also, I have moved the IR tests in the file with all other bitcasts, using a 
funcion attribute to enable the bf16 feature only for those functions that deal 
with bfloats.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82501

Files:
  clang/utils/TableGen/SveEmitter.cpp
  llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
  llvm/test/CodeGen/AArch64/sve-bitcast-bfloat.ll
  llvm/test/CodeGen/AArch64/sve-bitcast.ll

Index: llvm/test/CodeGen/AArch64/sve-bitcast.ll
===
--- llvm/test/CodeGen/AArch64/sve-bitcast.ll
+++ llvm/test/CodeGen/AArch64/sve-bitcast.ll
@@ -340,3 +340,118 @@
   %bc = bitcast  %v to 
   ret  %bc
 }
+
+define  @bitcast_bfloat_to_i8( %v) #0 {
+; CHECK-LABEL: bitcast_bfloat_to_i8:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_bfloat_to_i16( %v) #0 {
+; CHECK-LABEL: bitcast_bfloat_to_i16:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_bfloat_to_i32( %v) #0 {
+; CHECK-LABEL: bitcast_bfloat_to_i32:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_bfloat_to_i64( %v) #0 {
+; CHECK-LABEL: bitcast_bfloat_to_i64:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_bfloat_to_half( %v) #0 {
+; CHECK-LABEL: bitcast_bfloat_to_half:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_bfloat_to_float( %v) #0 {
+; CHECK-LABEL: bitcast_bfloat_to_float:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_bfloat_to_double( %v) #0 {
+; CHECK-LABEL: bitcast_bfloat_to_double:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_i8_to_bfloat( %v) #0 {
+; CHECK-LABEL: bitcast_i8_to_bfloat:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_i16_to_bfloat( %v) #0 {
+; CHECK-LABEL: bitcast_i16_to_bfloat:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_i32_to_bfloat( %v) #0 {
+; CHECK-LABEL: bitcast_i32_to_bfloat:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_i64_to_bfloat( %v) #0 {
+; CHECK-LABEL: bitcast_i64_to_bfloat:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_half_to_bfloat( %v) #0 {
+; CHECK-LABEL: bitcast_half_to_bfloat:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_float_to_bfloat( %v) #0 {
+; CHECK-LABEL: bitcast_float_to_bfloat:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_double_to_bfloat( %v) #0 {
+; CHECK-LABEL: bitcast_double_to_bfloat:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+; +bf16 is required for the bfloat version.
+attributes #0 = { "target-features"="+sve,+bf16" }
Index: llvm/test/CodeGen/AArch64/sve-bitcast-bfloat.ll
===
--- /dev/null
+++ llvm/test/CodeGen/AArch64/sve-bitcast-bfloat.ll
@@ -0,0 +1,119 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve,+bf16 < %s 2>%t | FileCheck %s
+; RUN: not --crash llc -mtriple=aarch64_be -mattr=+sve,+bf16 < %s
+; RUN: FileCheck --check-prefix=WARN --allow-empty %s <%t
+
+; WARN-NOT: warning
+
+define  @bitcast_bfloat_to_i8( %v) {
+; CHECK-LABEL: bitcast_bfloat_to_i8:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_bfloat_to_i16( %v) {
+; CHECK-LABEL: bitcast_bfloat_to_i16:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_bfloat_to_i32( %v) {
+; CHECK-LABEL: bitcast_bfloat_to_i32:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_bfloat_to_i64( %v) {
+; CHECK-LABEL: bitcast_bfloat_to_i64:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_bfloat_to_half( %v) {
+; CHECK-LABEL: bitcast_bfloat_to_half:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = bitcast  %v to 
+  ret  %bc
+}
+
+define  @bitcast_bfloat_to_float( %v) {
+; CHECK-LABEL: bitcast_bfloat_to_float:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ret
+  %bc = 

[PATCH] D82502: [PowerPC][Power10] Implement Load VSX Vector and Sign Extend and Zero Extend

2020-06-25 Thread Albion Fung via Phabricator via cfe-commits
Conanap updated this revision to Diff 273393.
Conanap added a comment.

Addressed Amy's comments regarding documentation of the changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82502

Files:
  clang/lib/Headers/altivec.h
  clang/test/CodeGen/builtins-ppc-p10vector.c
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.h
  llvm/lib/Target/PowerPC/PPCInstrPrefix.td
  llvm/test/CodeGen/PowerPC/p10-vsx-builtins.ll
  llvm/test/MC/Disassembler/PowerPC/p10insts.txt
  llvm/test/MC/PowerPC/p10.s

Index: llvm/test/MC/PowerPC/p10.s
===
--- llvm/test/MC/PowerPC/p10.s
+++ llvm/test/MC/PowerPC/p10.s
@@ -33,3 +33,15 @@
 # CHECK-BE: vclrrb 1, 4, 3# encoding: [0x10,0x24,0x19,0xcd]
 # CHECK-LE: vclrrb 1, 4, 3# encoding: [0xcd,0x19,0x24,0x10]
 vclrrb 1, 4, 3
+# CHECK-BE: lxvrbx 32, 1, 2   # encoding: [0x7c,0x01,0x10,0x1b]
+# CHECK-LE: lxvrbx 32, 1, 2   # encoding: [0x1b,0x10,0x01,0x7c]
+lxvrbx 32, 1, 2
+# CHECK-BE: lxvrhx 33, 1, 2   # encoding: [0x7c,0x21,0x10,0x5b]
+# CHECK-LE: lxvrhx 33, 1, 2   # encoding: [0x5b,0x10,0x21,0x7c]
+lxvrhx 33, 1, 2
+# CHECK-BE: lxvrdx 34, 1, 2   # encoding: [0x7c,0x41,0x10,0xdb]
+# CHECK-LE: lxvrdx 34, 1, 2   # encoding: [0xdb,0x10,0x41,0x7c]
+lxvrdx 34, 1, 2
+# CHECK-BE: lxvrwx 35, 1, 2   # encoding: [0x7c,0x61,0x10,0x9b]
+# CHECK-LE: lxvrwx 35, 1, 2   # encoding: [0x9b,0x10,0x61,0x7c]
+lxvrwx 35, 1, 2
Index: llvm/test/MC/Disassembler/PowerPC/p10insts.txt
===
--- llvm/test/MC/Disassembler/PowerPC/p10insts.txt
+++ llvm/test/MC/Disassembler/PowerPC/p10insts.txt
@@ -30,3 +30,15 @@
 
 # CHECK: vclrrb 1, 4, 3
 0x10 0x24 0x19 0xcd
+
+# CHECK: lxvrbx 32, 1, 2
+0x7c 0x01 0x10 0x1b
+
+# CHECK: lxvrhx 33, 1, 2
+0x7c 0x21 0x10 0x5b
+
+# CHECK: lxvrdx 34, 1, 2
+0x7c 0x41 0x10 0xdb
+
+# CHECK: lxvrwx 35, 1, 2
+0x7c 0x61 0x10 0x9b
Index: llvm/test/CodeGen/PowerPC/p10-vsx-builtins.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/p10-vsx-builtins.ll
@@ -0,0 +1,71 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; These test cases tests that zero extending loads utilize the Load VSX Vector Rightmost
+
+; (lxvr[b|h|w|d]) instructions in Power10.
+; 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: lxvrbx
+; Function Attrs: norecurse nounwind readonly
+define dso_local <1 x i128> @vec_xl_zext(i64 %__offset, i8* nocapture readonly %__pointer) local_unnamed_addr #0 {
+; CHECK-LABEL: vec_xl_zext:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:lxvrbx v2, r4, r3
+; CHECK-NEXT:blr
+entry:
+  %add.ptr = getelementptr inbounds i8, i8* %__pointer, i64 %__offset
+  %0 = load i8, i8* %add.ptr, align 1
+  %conv = zext i8 %0 to i128
+  %splat.splatinsert = insertelement <1 x i128> undef, i128 %conv, i32 0
+  ret <1 x i128> %splat.splatinsert
+}
+
+; CHECK: lxvrhx
+; Function Attrs: norecurse nounwind readonly
+define dso_local <1 x i128> @vec_xl_zext_short(i64 %__offset, i16* nocapture readonly %__pointer) local_unnamed_addr #0 {
+; CHECK-LABEL: vec_xl_zext_short:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:sldi r3, r3, 1
+; CHECK-NEXT:lxvrhx v2, r4, r3
+; CHECK-NEXT:blr
+entry:
+  %add.ptr = getelementptr inbounds i16, i16* %__pointer, i64 %__offset
+  %0 = load i16, i16* %add.ptr, align 2
+  %conv = zext i16 %0 to i128
+  %splat.splatinsert = insertelement <1 x i128> undef, i128 %conv, i32 0
+  ret <1 x i128> %splat.splatinsert
+}
+
+; CHECK: lxvrwx
+; Function Attrs: norecurse nounwind readonly
+define dso_local <1 x i128> @vec_xl_zext_word(i64 %__offset, i32* nocapture readonly %__pointer) local_unnamed_addr #0 {
+; CHECK-LABEL: vec_xl_zext_word:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:sldi r3, r3, 2
+; CHECK-NEXT:lxvrwx v2, r4, r3
+; CHECK-NEXT:blr
+entry:
+  %add.ptr = getelementptr inbounds i32, i32* %__pointer, i64 %__offset
+  %0 = load i32, i32* %add.ptr, align 4
+  %conv = zext i32 %0 to i128
+  %splat.splatinsert = insertelement <1 x i128> undef, i128 %conv, i32 0
+  ret <1 x i128> %splat.splatinsert
+}
+
+; CHECK: lxvrdx
+; Function Attrs: norecurse nounwind readonly
+define dso_local <1 x i128> @vec_xl_zext_dw(i64 %__offset, i64* nocapture readonly %__pointer) local_unnamed_addr #0 {
+; CHECK-LABEL: vec_xl_zext_dw:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:sldi r3, r3, 3
+; CHECK-NEXT:lxvrdx v2, r4, r3
+; 

[PATCH] D82085: [TRE] allow TRE for non-capturing calls.

2020-06-25 Thread Layton Kifer via Phabricator via cfe-commits
laytonio added inline comments.



Comment at: llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:838
+if (isValidTRECandidate(CI))
+  HasValidCandidates = true;
+  }

avl wrote:
> laytonio wrote:
> > Is there any reason to find and validate candidates now only to have to 
> > redo it when we actually perform the eliminations? If so, is there any 
> > reason this needs to follow a different code path than findTRECandidate? 
> > findTRECandidate is doing the same checks, except for canMoveAboveCall and 
> > canTransformAccumulatorRecursion, which should probably be refactored into 
> > findTRECandidate from eliminateCall anyway. If not then all of this code 
> > goes away and we're left with the same canTRE as in trunk.
> We are enumerating all instructions here, so we could understand if there are 
> not TRE candidates and stop earlier. That is the reason for doing it here.
> 
> I agree that findTRECandidate should be refactored to have the same checks as 
> here. 
> 
> What do you think is better to do:
> 
> - leave early check for TRE candidates in canTRE or remove it
> - refactor findTRECandidate or leave it as is
> 
> ?
Yes we are iterating all the instructions here but, unless I am missing 
something, we would literally just be doing the checks twice for no reason. 
Look at it this way, best case scenario we have to check all possible 
candidates once, find none and we're done. Worst case, we check all possible 
candidates once, find one and have to check all possible candidates a second 
time. Where as if we remove the early checks we only ever have to check the 
candidates once. So we wouldn't really be stopping any earlier.

As for refactoring findTRECandidate, I do think that should be done and we 
should strive to move all the failure conditions out of eliminateCall in order 
to avoid having to fold a return only to find out we didn't need to. But, I 
think that is out of the scope of this change, and if we do decide to keep the 
early checks here then we should say that findTRECandidate does a good enough 
job to consider this function as having valid candidates.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82085



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


[PATCH] D82568: [clang][CrossTU] Invalidate parent map after get cross TU definition.

2020-06-25 Thread Balázs Kéri via Phabricator via cfe-commits
balazske created this revision.
Herald added subscribers: cfe-commits, martong, gamesh411, Szelethus, dkrupp.
Herald added a project: clang.
balazske added reviewers: gamesh411, martong.
Herald added a subscriber: rnkovacs.

Parent map of ASTContext is built once. If this happens and later
the TU is modified by getCrossTUDefinition the parent map does not
contain the newly imported objects and has to be re-created.

Invalidation of the parent map is added to the CrossTranslationUnitContext.
It could be added to ASTImporter as well but for now this task remains the
responsibility of the user of ASTImporter. Reason for this is mostly that
ASTImporter calls itself recursively.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82568

Files:
  clang/lib/CrossTU/CrossTranslationUnit.cpp
  clang/unittests/CrossTU/CrossTranslationUnitTest.cpp


Index: clang/unittests/CrossTU/CrossTranslationUnitTest.cpp
===
--- clang/unittests/CrossTU/CrossTranslationUnitTest.cpp
+++ clang/unittests/CrossTU/CrossTranslationUnitTest.cpp
@@ -8,6 +8,7 @@
 
 #include "clang/CrossTU/CrossTranslationUnit.h"
 #include "clang/AST/ASTConsumer.h"
+#include "clang/AST/ParentMapContext.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendAction.h"
 #include "clang/Tooling/Tooling.h"
@@ -44,6 +45,10 @@
 assert(FD && FD->getName() == "f");
 bool OrigFDHasBody = FD->hasBody();
 
+const DynTypedNodeList ParentsBeforeImport =
+Ctx.getParentMapContext().getParents(*FD);
+ASSERT_FALSE(ParentsBeforeImport.empty());
+
 // Prepare the index file and the AST file.
 int ASTFD;
 llvm::SmallString<256> ASTFileName;
@@ -105,10 +110,29 @@
 EXPECT_EQ(OrigSLoc, FDWithDefinition->getLocation());
   }
 }
+
+// Check parent map.
+const DynTypedNodeList ParentsAfterImport =
+Ctx.getParentMapContext().getParents(*FD);
+const DynTypedNodeList ParentsOfImported =
+Ctx.getParentMapContext().getParents(*NewFD);
+EXPECT_TRUE(
+checkParentListsEq(ParentsBeforeImport, ParentsAfterImport));
+EXPECT_FALSE(ParentsOfImported.empty());
   }
 }
   }
 
+  static bool checkParentListsEq(const DynTypedNodeList ,
+ const DynTypedNodeList ) {
+if (L1.size() != L2.size())
+  return false;
+for (unsigned int I = 0; I < L1.size(); ++I)
+  if (L1[I] != L2[I])
+return false;
+return true;
+  }
+
 private:
   CrossTranslationUnitContext CTU;
   bool *Success;
Index: clang/lib/CrossTU/CrossTranslationUnit.cpp
===
--- clang/lib/CrossTU/CrossTranslationUnit.cpp
+++ clang/lib/CrossTU/CrossTranslationUnit.cpp
@@ -12,6 +12,7 @@
 #include "clang/CrossTU/CrossTranslationUnit.h"
 #include "clang/AST/ASTImporter.h"
 #include "clang/AST/Decl.h"
+#include "clang/AST/ParentMapContext.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/CrossTU/CrossTUDiagnostic.h"
 #include "clang/Frontend/ASTUnit.h"
@@ -718,6 +719,9 @@
   assert(hasBodyOrInit(ToDecl) && "Imported Decl should have body or init.");
   ++NumGetCTUSuccess;
 
+  // Parent map is invalidated after changing the AST.
+  ToDecl->getASTContext().getParentMapContext().clear();
+
   return ToDecl;
 }
 


Index: clang/unittests/CrossTU/CrossTranslationUnitTest.cpp
===
--- clang/unittests/CrossTU/CrossTranslationUnitTest.cpp
+++ clang/unittests/CrossTU/CrossTranslationUnitTest.cpp
@@ -8,6 +8,7 @@
 
 #include "clang/CrossTU/CrossTranslationUnit.h"
 #include "clang/AST/ASTConsumer.h"
+#include "clang/AST/ParentMapContext.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendAction.h"
 #include "clang/Tooling/Tooling.h"
@@ -44,6 +45,10 @@
 assert(FD && FD->getName() == "f");
 bool OrigFDHasBody = FD->hasBody();
 
+const DynTypedNodeList ParentsBeforeImport =
+Ctx.getParentMapContext().getParents(*FD);
+ASSERT_FALSE(ParentsBeforeImport.empty());
+
 // Prepare the index file and the AST file.
 int ASTFD;
 llvm::SmallString<256> ASTFileName;
@@ -105,10 +110,29 @@
 EXPECT_EQ(OrigSLoc, FDWithDefinition->getLocation());
   }
 }
+
+// Check parent map.
+const DynTypedNodeList ParentsAfterImport =
+Ctx.getParentMapContext().getParents(*FD);
+const DynTypedNodeList ParentsOfImported =
+Ctx.getParentMapContext().getParents(*NewFD);
+EXPECT_TRUE(
+checkParentListsEq(ParentsBeforeImport, ParentsAfterImport));
+EXPECT_FALSE(ParentsOfImported.empty());
   }
 }
   }
 
+  static bool checkParentListsEq(const DynTypedNodeList ,
+ const DynTypedNodeList ) {
+if (L1.size() != L2.size())
+  return false;
+for 

[PATCH] D82429: [sve][acle] Add some C intrinsics for brain float types.

2020-06-25 Thread Cullen Rhodes via Phabricator via cfe-commits
c-rhodes accepted this revision.
c-rhodes added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_tbl2-bfloat.c:7
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 
-D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -triple aarch64-none-linux-gnu 
-target-feature +sve2 -target-feature +bf16 -fallow-half-arguments-and-returns 
-fsyntax-only -verify -verify-ignore-unexpected=error 
-verify-ignore-unexpected=note %s
+// R UN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 
-D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sve2 -target-feature +bf16 
-fallow-half-arguments-and-returns -fsyntax-only -verify=overload-bf16 
-verify-ignore-unexpected=error -verify-ignore-unexpected=note %s
+

c-rhodes wrote:
> fpetrogalli wrote:
> > I could do with an extra pair of eyes here: I can't figure out why the 
> > warning raised by this run is not detected by the `overload-bf16-warning` 
> > below... (Same for the same line I have added in the test for tbx).
> Ah, it works in the example I linked because `whilerw` / `whilewr` uses the 
> scalar `bfloat16_t`, whereas this is using sizeless type which is predicated 
> on `-D__ARM_FEATURE_SVE_BF16` so we get:
> 
> ```error: 'error' diagnostics seen but not expected:
>   File 
> /home/culrho01/llvm-project/clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_tbl2-bfloat.c
>  Line 18: unknown type name 'svbfloat16_t'; did you mean 'svfloat16_t'?
>   File 
> /home/culrho01/llvm-project/clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_tbl2-bfloat.c
>  Line 18: unknown type name 'svbfloat16x2_t'; did you mean 'svfloat16x2_t'?```
> 
> I'm not sure if/how we can test this for the overloaded form
I'm not sure if what I suggested makes sense - trying to do what we've done in 
the sve2 acle tests where we expect an implicit declaration warning for 
overloaded/non-overloaded intrinsics if the sve2 feature isn't enabled. I guess 
it's different for BF16 as the types are guarded on the feature macro in the 
ACLE, for whatever reason we get the same warning for the non-overloaded 
intrinsics but an error for the overloaded ones. I think we can be pretty 
confident `+bf16` is required as the test will fail otherwise, but it's tricky 
trying to isolate an error implying the macro is missing on the intrinsic. FWIW 
we don't test this for SVE either, I think we can skip this test for the 
overloaded form, may as well keep the non-overloaded one in if it works.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82429



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


[PATCH] D82535: [CodeComplete] Add code completion for using alias.

2020-06-25 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!

Will land this one too. In the meantime feel free to apply for commit access, 
as explained in 
https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access (IIRC, you 
already have a couple patches, if not you can also point at these after I land)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82535



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


[PATCH] D70603: Change while to do-while

2020-06-25 Thread Seija Kijin via Phabricator via cfe-commits
pi1024e added a comment.

How do I do that, if I may ask? Sorry for the rude tone.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70603



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


[PATCH] D82386: [clangd] Config: Fragments and parsing from YAML

2020-06-25 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet marked 5 inline comments as done.
kadircet added a comment.

LGTM with couple of nits.

Regarding clang-format, I was mostly confused by `template  class 
Located {` being on a single line, but apparently that's the style :D




Comment at: clang-tools-extra/clangd/ConfigFragment.h:61
+  /// BufferName is used for the SourceMgr and diagnostics.
+  static std::vector parseYAML(llvm::StringRef YAML,
+ llvm::StringRef BufferName,

sammccall wrote:
> kadircet wrote:
> > what about `fromYAML` and returning `vector` ?
> > what about fromYAML
> 
> I can live with it if you like, but I prefer parse:
>  - Fragment::fromYAML reads funny as it returns multiple fragments in general
>  - parse describes the action more clearly and so hints toward thinking about 
> error handling etc
> 
> > returning vector ?
> why? the resulting vector is slower (has to copy instead of move on 
> reallocation).
> It prevents us from moving from the fragment when we compile it (which we do 
> in some places)
> I can live with it if you like, but I prefer parse:

I was mainly unhappy about it because `parse` doesn't reflect the construction 
bit of the process, but it is clear from the signature and you are right about 
returning multiple fragments contradicting with the idea of `from`. I am more 
inclined towards `from` but I am fine with `parse` too if it feels more natural 
to you.

> why? the resulting vector is slower (has to copy instead of move on 
> reallocation).

It was to signal the fact that these correspond to some `immutable` input 
received, but I giving up on move semantics sounds like a nasty consequence. So 
let's keep it that way (unless you want to hide the members and provide only 
const accessors, which is some plumbing for a simple struct like this and might 
hinder readability)



Comment at: clang-tools-extra/clangd/ConfigFragment.h:73
+/// Only valid if SourceManager is set.
+llvm::SMLoc Location;
+  };

sammccall wrote:
> kadircet wrote:
> > what is the use of this ?
> There may be multiple fragments in a file.
> 
> When tracking how fragments are used in the logs, there should be enough 
> information to identify the particular fragment, without having to guess.
>  - during parsing, we can log in some source-specific way
>  - in the Fragment form, we can log this location to identify the fragment
>  - during compilation, we log this location and the pointer address of the 
> new CompiledFragment
>  - subsequently we can just log the CompiledFragment address
right, I was thinking that we already have location information available for 
the start of the fragment during parsing and wasn't sure how useful it would be 
in later on stages as we know the exact location of the relevant entries (keys, 
scalars etc.) for logging.

I wasn't against the idea of storing it, just wanted to learn if it has any 
significant importance for the upcoming stages. thanks for the info!



Comment at: clang-tools-extra/clangd/ConfigFragment.h:75
+  };
+  SourceInfo Source;
+

sammccall wrote:
> kadircet wrote:
> > why not make this const ? i don't think it makes sense to modify these 
> > after creation.
> const members are a pain, as they prevent moving the object (and vectors of 
> them are doing copies, etc). For that reason I generally don't find "I don't 
> semantically need to modify this" a good enough reason to mark a member const.
> 
> Adding a constructor muddles the idea of a dumb struct and presents an 
> inconsistent API - the other fields *also* don't really change during the 
> lifetime (parseYAML() is basically a big constructor)
this was in parallel with the idea of returning `vector`. so 
agreed.



Comment at: clang-tools-extra/clangd/ConfigFragment.h:77
+
+  struct ConditionFragment {
+std::vector> PathMatch;

sammccall wrote:
> kadircet wrote:
> > comments?
> Whoops, done. There's an argument to be made that we shouldn't maintain docs 
> in two places, and the user docs should be canonical.
> Something to think about later, maybe we can generate them.
> 
> I'm always unsure whether to put the doc for "blocks" like this on the struct 
> or the field...
I suppose it makes sense to put the part starting with `  /// Conditions based 
on a file's path use the following form:` above the field rather than the 
struct, especially if we are planning to generate docs.

also:
s/ConfigFragment/Fragment/



Comment at: clang-tools-extra/clangd/ConfigFragment.h:81
+/// The condition will evaluate to false.
+bool UnrecognizedCondition;
+  };

sammccall wrote:
> kadircet wrote:
> > `HasUnrecognizedCondition` ?
> > 
> > also default init to `true` maybe?
> Renamed. I guess you meant `false` here? (an empty condition should not have 
> this set)
I was actually suggesting `true` to make sure this is 

[clang] 1650178 - [Clang] Add support for -Wno-inline-namespace-reopened-noninline

2020-06-25 Thread Andrey Bokhanko via cfe-commits

Author: Elvina Yakubova
Date: 2020-06-25T18:48:50+03:00
New Revision: 16501782c8d849bc1812d527dc8466574700663d

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

LOG: [Clang] Add support for -Wno-inline-namespace-reopened-noninline

This patch adds the option for disabling 
warn_inline_namespace_reopened_noninline
warning described here: https://bugs.llvm.org/show_bug.cgi?id=46106

Patch by Elvina Yakubova

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

Added: 
clang/test/SemaCXX/warn-inline-namespace-reopened-noninline-disable.cpp

Modified: 
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/test/Misc/warning-flags.c

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticGroups.td 
b/clang/include/clang/Basic/DiagnosticGroups.td
index 23f530dd4e1f..37e0b77e79ed 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -382,6 +382,8 @@ def IncompleteModule : DiagGroup<"incomplete-module",
 def PrivateModule : DiagGroup<"private-module">;
 
 def CXX11InlineNamespace : DiagGroup<"c++11-inline-namespace">;
+def InlineNamespaceReopenedNoninline
+: DiagGroup<"inline-namespace-reopened-noninline">;
 def InvalidNoreturn : DiagGroup<"invalid-noreturn">;
 def InvalidSourceEncoding : DiagGroup<"invalid-source-encoding">;
 def KNRPromotedParameter : DiagGroup<"knr-promoted-parameter">;

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 9067c45adc77..70b43f5abc4b 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -1414,7 +1414,8 @@ def warn_cxx14_compat_inline_variable : Warning<
   DefaultIgnore, InGroup;
 
 def warn_inline_namespace_reopened_noninline : Warning<
-  "inline namespace reopened as a non-inline namespace">;
+  "inline namespace reopened as a non-inline namespace">,
+  InGroup;
 def err_inline_namespace_mismatch : Error<
   "non-inline namespace cannot be reopened as inline">;
 

diff  --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c
index 841c748b8025..e4f9069b88c8 100644
--- a/clang/test/Misc/warning-flags.c
+++ b/clang/test/Misc/warning-flags.c
@@ -18,7 +18,7 @@ This test serves two purposes:
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (69):
+CHECK: Warnings without flags (68):
 
 CHECK-NEXT:   ext_expected_semi_decl_list
 CHECK-NEXT:   ext_explicit_specialization_storage_class
@@ -58,7 +58,6 @@ CHECK-NEXT:   warn_fe_macro_contains_embedded_newline
 CHECK-NEXT:   warn_ignoring_ftabstop_value
 CHECK-NEXT:   warn_implements_nscopying
 CHECK-NEXT:   warn_incompatible_qualified_id
-CHECK-NEXT:   warn_inline_namespace_reopened_noninline
 CHECK-NEXT:   warn_invalid_asm_cast_lvalue
 CHECK-NEXT:   warn_maynot_respond
 CHECK-NEXT:   warn_method_param_redefinition

diff  --git 
a/clang/test/SemaCXX/warn-inline-namespace-reopened-noninline-disable.cpp 
b/clang/test/SemaCXX/warn-inline-namespace-reopened-noninline-disable.cpp
new file mode 100644
index ..3cc683006c41
--- /dev/null
+++ b/clang/test/SemaCXX/warn-inline-namespace-reopened-noninline-disable.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -Wall -verify -std=c++11 %s
+// RUN: %clang_cc1 -fsyntax-only -Wall 
-Wno-inline-namespace-reopened-noninline -DSILENCE -verify -std=c++11 %s
+
+namespace X {
+  #ifndef SILENCE
+inline namespace {} // expected-note {{previous definition}}
+namespace {} // expected-warning {{inline namespace reopened as a 
non-inline namespace}}
+  #else
+// expected-no-diagnostics
+inline namespace {}
+namespace {}
+  #endif
+}



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


[clang] 15edd7a - [FPEnv] PowerPC-specific builtin constrained FP enablement

2020-06-25 Thread Kevin P. Neal via cfe-commits

Author: Andrew Wock
Date: 2020-06-25T11:42:58-04:00
New Revision: 15edd7aaa7142e5db2a6cf9b81e4514967431824

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

LOG: [FPEnv] PowerPC-specific builtin constrained FP enablement

This change enables PowerPC compiler builtins to generate constrained
floating point operations when clang is indicated to do so.

A couple of possibly unexpected backend divergences between constrained
floating point and regular behavior are highlighted under the test tag
FIXME-CHECK. This may be something for those on the PPC backend to look
at.

Patch by: Drew Wock 

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

Added: 
clang/test/CodeGen/builtins-ppc-fpconstrained.c

Modified: 
clang/lib/CodeGen/CGBuiltin.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 89ab1a3c2cb0..c43877e117eb 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -14235,9 +14235,14 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned 
BuiltinID,
   case PPC::BI__builtin_vsx_xvsqrtdp: {
 llvm::Type *ResultType = ConvertType(E->getType());
 Value *X = EmitScalarExpr(E->getArg(0));
-ID = Intrinsic::sqrt;
-llvm::Function *F = CGM.getIntrinsic(ID, ResultType);
-return Builder.CreateCall(F, X);
+if (Builder.getIsFPConstrained()) {
+  llvm::Function *F = CGM.getIntrinsic(
+  Intrinsic::experimental_constrained_sqrt, ResultType);
+  return Builder.CreateConstrainedFPCall(F, X);
+} else {
+  llvm::Function *F = CGM.getIntrinsic(Intrinsic::sqrt, ResultType);
+  return Builder.CreateCall(F, X);
+}
   }
   // Count leading zeros
   case PPC::BI__builtin_altivec_vclzb:
@@ -14294,21 +14299,32 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned 
BuiltinID,
 Value *X = EmitScalarExpr(E->getArg(0));
 if (BuiltinID == PPC::BI__builtin_vsx_xvrdpim ||
 BuiltinID == PPC::BI__builtin_vsx_xvrspim)
-  ID = Intrinsic::floor;
+  ID = Builder.getIsFPConstrained()
+   ? Intrinsic::experimental_constrained_floor
+   : Intrinsic::floor;
 else if (BuiltinID == PPC::BI__builtin_vsx_xvrdpi ||
  BuiltinID == PPC::BI__builtin_vsx_xvrspi)
-  ID = Intrinsic::round;
+  ID = Builder.getIsFPConstrained()
+   ? Intrinsic::experimental_constrained_round
+   : Intrinsic::round;
 else if (BuiltinID == PPC::BI__builtin_vsx_xvrdpic ||
  BuiltinID == PPC::BI__builtin_vsx_xvrspic)
-  ID = Intrinsic::nearbyint;
+  ID = Builder.getIsFPConstrained()
+   ? Intrinsic::experimental_constrained_nearbyint
+   : Intrinsic::nearbyint;
 else if (BuiltinID == PPC::BI__builtin_vsx_xvrdpip ||
  BuiltinID == PPC::BI__builtin_vsx_xvrspip)
-  ID = Intrinsic::ceil;
+  ID = Builder.getIsFPConstrained()
+   ? Intrinsic::experimental_constrained_ceil
+   : Intrinsic::ceil;
 else if (BuiltinID == PPC::BI__builtin_vsx_xvrdpiz ||
  BuiltinID == PPC::BI__builtin_vsx_xvrspiz)
-  ID = Intrinsic::trunc;
+  ID = Builder.getIsFPConstrained()
+   ? Intrinsic::experimental_constrained_trunc
+   : Intrinsic::trunc;
 llvm::Function *F = CGM.getIntrinsic(ID, ResultType);
-return Builder.CreateCall(F, X);
+return Builder.getIsFPConstrained() ? Builder.CreateConstrainedFPCall(F, X)
+: Builder.CreateCall(F, X);
   }
 
   // Absolute value
@@ -14333,21 +14349,43 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned 
BuiltinID,
 Value *X = EmitScalarExpr(E->getArg(0));
 Value *Y = EmitScalarExpr(E->getArg(1));
 Value *Z = EmitScalarExpr(E->getArg(2));
-llvm::Function *F = CGM.getIntrinsic(Intrinsic::fma, ResultType);
+llvm::Function *F;
+if (Builder.getIsFPConstrained())
+  F = CGM.getIntrinsic(Intrinsic::experimental_constrained_fma, 
ResultType);
+else
+  F = CGM.getIntrinsic(Intrinsic::fma, ResultType);
 switch (BuiltinID) {
   case PPC::BI__builtin_vsx_xvmaddadp:
   case PPC::BI__builtin_vsx_xvmaddasp:
-return Builder.CreateCall(F, {X, Y, Z});
+if (Builder.getIsFPConstrained())
+  return Builder.CreateConstrainedFPCall(F, {X, Y, Z});
+else
+  return Builder.CreateCall(F, {X, Y, Z});
   case PPC::BI__builtin_vsx_xvnmaddadp:
   case PPC::BI__builtin_vsx_xvnmaddasp:
-return Builder.CreateFNeg(Builder.CreateCall(F, {X, Y, Z}), "neg");
+if (Builder.getIsFPConstrained())
+  return Builder.CreateFNeg(
+  Builder.CreateConstrainedFPCall(F, {X, Y, Z}), "neg");
+else
+  return 

[clang] 7f7f856 - Add `BoolLiteralExpression` to SyntaxTree

2020-06-25 Thread Eduardo Caldas via cfe-commits

Author: Eduardo Caldas
Date: 2020-06-25T15:37:53Z
New Revision: 7f7f8564808b51aa62744edf75c07c0df102056a

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

LOG: Add `BoolLiteralExpression` to SyntaxTree

Subscribers: cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/include/clang/Tooling/Syntax/Nodes.h
clang/lib/Tooling/Syntax/BuildTree.cpp
clang/lib/Tooling/Syntax/Nodes.cpp
clang/unittests/Tooling/Syntax/TreeTest.cpp

Removed: 




diff  --git a/clang/include/clang/Tooling/Syntax/Nodes.h 
b/clang/include/clang/Tooling/Syntax/Nodes.h
index 139ac9aa8eca..255a108133bc 100644
--- a/clang/include/clang/Tooling/Syntax/Nodes.h
+++ b/clang/include/clang/Tooling/Syntax/Nodes.h
@@ -45,6 +45,7 @@ enum class NodeKind : uint16_t {
   BinaryOperatorExpression,
   CxxNullPtrExpression,
   IntegerLiteralExpression,
+  BoolLiteralExpression,
   IdExpression,
 
   // Statements.
@@ -264,6 +265,16 @@ class IntegerLiteralExpression final : public Expression {
   syntax::Leaf *literalToken();
 };
 
+/// Expression for boolean literals. C++ [lex.bool]
+class BoolLiteralExpression final : public Expression {
+public:
+  BoolLiteralExpression() : Expression(NodeKind::BoolLiteralExpression) {}
+  static bool classof(const Node *N) {
+return N->kind() == NodeKind::BoolLiteralExpression;
+  }
+  syntax::Leaf *literalToken();
+};
+
 /// An abstract class for prefix and postfix unary operators.
 class UnaryOperatorExpression : public Expression {
 public:

diff  --git a/clang/lib/Tooling/Syntax/BuildTree.cpp 
b/clang/lib/Tooling/Syntax/BuildTree.cpp
index 3ee66aabfb6d..7ff603fbd33a 100644
--- a/clang/lib/Tooling/Syntax/BuildTree.cpp
+++ b/clang/lib/Tooling/Syntax/BuildTree.cpp
@@ -654,6 +654,13 @@ class BuildTreeVisitor : public 
RecursiveASTVisitor {
 return true;
   }
 
+  bool WalkUpFromCXXBoolLiteralExpr(CXXBoolLiteralExpr *S) {
+Builder.markChildToken(S->getLocation(), syntax::NodeRole::LiteralToken);
+Builder.foldNode(Builder.getExprRange(S),
+ new (allocator()) syntax::BoolLiteralExpression, S);
+return true;
+  }
+
   bool WalkUpFromCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *S) {
 Builder.markChildToken(S->getLocation(), syntax::NodeRole::LiteralToken);
 Builder.foldNode(Builder.getExprRange(S),

diff  --git a/clang/lib/Tooling/Syntax/Nodes.cpp 
b/clang/lib/Tooling/Syntax/Nodes.cpp
index 623391a7d844..498721d3a371 100644
--- a/clang/lib/Tooling/Syntax/Nodes.cpp
+++ b/clang/lib/Tooling/Syntax/Nodes.cpp
@@ -22,6 +22,8 @@ llvm::raw_ostream ::operator<<(llvm::raw_ostream , 
NodeKind K) {
 return OS << "CxxNullPtrExpression";
   case NodeKind::IntegerLiteralExpression:
 return OS << "IntegerLiteralExpression";
+  case NodeKind::BoolLiteralExpression:
+return OS << "BoolLiteralExpression";
   case NodeKind::PrefixUnaryOperatorExpression:
 return OS << "PrefixUnaryOperatorExpression";
   case NodeKind::PostfixUnaryOperatorExpression:
@@ -200,6 +202,11 @@ syntax::Leaf 
*syntax::IntegerLiteralExpression::literalToken() {
   findChild(syntax::NodeRole::LiteralToken));
 }
 
+syntax::Leaf *syntax::BoolLiteralExpression::literalToken() {
+  return llvm::cast_or_null(
+  findChild(syntax::NodeRole::LiteralToken));
+}
+
 syntax::Leaf *syntax::CxxNullPtrExpression::nullPtrKeyword() {
   return llvm::cast_or_null(
   findChild(syntax::NodeRole::LiteralToken));

diff  --git a/clang/unittests/Tooling/Syntax/TreeTest.cpp 
b/clang/unittests/Tooling/Syntax/TreeTest.cpp
index 5f48ef129988..d32ce6203913 100644
--- a/clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ b/clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -69,6 +69,10 @@ struct TestClangConfig {
Language == Lang_CXX20;
   }
 
+  bool hasBoolType() const {
+return Language == Lang_C89 || Language == Lang_C99;
+  }
+
   bool supportsCXXDynamicExceptionSpecification() const {
 return Language == Lang_CXX03 || Language == Lang_CXX11 ||
Language == Lang_CXX14;
@@ -1228,6 +1232,40 @@ void test() {
 )txt"));
 }
 
+TEST_P(SyntaxTreeTest, BoolLiteral) {
+  if (GetParam().hasBoolType()) {
+return;
+  }
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  true;
+  false;
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-BoolLiteralExpression
+| | `-true
+| `-;
+|-ExpressionStatement
+| |-BoolLiteralExpression
+| | `-false
+| `-;
+`-}
+)txt"));
+}
+
 TEST_P(SyntaxTreeTest, IntegerLiteral) {
   EXPECT_TRUE(treeDumpEqual(
   R"cpp(
@@ -1691,18 +1729,18 @@ void test(int a) {
 

[PATCH] D70603: Change while to do-while

2020-06-25 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D70603#2114361 , @pi1024e wrote:

> @MaskRay it's been months yet this hasn't landed yet. Why?


It is usually assumed that the patch author pushes this commit. In this case, 
it seems that you don't have commit access. You'll need to provide 'Name 
' and I can push it for you.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70603



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


[PATCH] D82085: [TRE] allow TRE for non-capturing calls.

2020-06-25 Thread Alexey Lapshin via Phabricator via cfe-commits
avl marked an inline comment as done.
avl added inline comments.



Comment at: llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:838
+if (isValidTRECandidate(CI))
+  HasValidCandidates = true;
+  }

laytonio wrote:
> Is there any reason to find and validate candidates now only to have to redo 
> it when we actually perform the eliminations? If so, is there any reason this 
> needs to follow a different code path than findTRECandidate? findTRECandidate 
> is doing the same checks, except for canMoveAboveCall and 
> canTransformAccumulatorRecursion, which should probably be refactored into 
> findTRECandidate from eliminateCall anyway. If not then all of this code goes 
> away and we're left with the same canTRE as in trunk.
We are enumerating all instructions here, so we could understand if there are 
not TRE candidates and stop earlier. That is the reason for doing it here.

I agree that findTRECandidate should be refactored to have the same checks as 
here. 

What do you think is better to do:

- leave early check for TRE candidates in canTRE or remove it
- refactor findTRECandidate or leave it as is

?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82085



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


[PATCH] D82505: [lldb-vscode] Add Support for Module Event

2020-06-25 Thread Yifan Shen via Phabricator via cfe-commits
aelitashen abandoned this revision.
aelitashen added a comment.

Mistakenly created two diffs on same commit, See D82477 
 for the original diff.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82505



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


[PATCH] D82391: [AArch64][SVE] Add bfloat16 support to svext intrinsic

2020-06-25 Thread Francesco Petrogalli via Phabricator via cfe-commits
fpetrogalli accepted this revision.
fpetrogalli added a comment.
This revision is now accepted and ready to land.

LGTM, thank you!


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

https://reviews.llvm.org/D82391



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


[PATCH] D82477: [lldb-vscode] Add Support for Module Event

2020-06-25 Thread Yifan Shen via Phabricator via cfe-commits
aelitashen updated this revision to Diff 273378.
aelitashen added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Formatting the codes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82477

Files:
  clang/tools/clang-format/git-clang-format
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/test/API/tools/lldb-vscode/module/Makefile
  lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
  lldb/test/API/tools/lldb-vscode/module/main.cpp
  lldb/tools/lldb-vscode/JSONUtils.cpp
  lldb/tools/lldb-vscode/JSONUtils.h
  lldb/tools/lldb-vscode/VSCode.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp

Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Option/Arg.h"
@@ -433,6 +434,30 @@
 g_vsc.SendJSON(llvm::json::Value(std::move(bp_event)));
   }
 }
+  } else if (lldb::SBTarget::EventIsTargetEvent(event)) {
+if (event_mask & lldb::SBTarget::eBroadcastBitModulesLoaded ||
+event_mask & lldb::SBTarget::eBroadcastBitModulesUnloaded ||
+event_mask & lldb::SBTarget::eBroadcastBitSymbolsLoaded) {
+  int num_modules = lldb::SBTarget::GetNumModulesFromEvent(event);
+  for (int i = 0; i < num_modules; i++) {
+auto module = lldb::SBTarget::GetModuleAtIndexFromEvent(i, event);
+auto module_event = CreateEventObject("module");
+llvm::json::Value module_value = CreateModule(module);
+llvm::json::Object body;
+if (event_mask & lldb::SBTarget::eBroadcastBitModulesLoaded) {
+  body.try_emplace("reason", "new");
+} else if (event_mask &
+lldb::SBTarget::eBroadcastBitModulesUnloaded) {
+  body.try_emplace("reason", "removed");
+} else if (event_mask &
+lldb::SBTarget::eBroadcastBitSymbolsLoaded) {
+  body.try_emplace("reason", "changed");
+}
+body.try_emplace("module", module_value);
+module_event.try_emplace("body", std::move(body));
+g_vsc.SendJSON(llvm::json::Value(std::move(module_event)));
+  }
+}
   } else if (event.BroadcasterMatchesRef(g_vsc.broadcaster)) {
 if (event_mask & eBroadcastBitStopEventThread) {
   done = true;
Index: lldb/tools/lldb-vscode/VSCode.cpp
===
--- lldb/tools/lldb-vscode/VSCode.cpp
+++ lldb/tools/lldb-vscode/VSCode.cpp
@@ -354,6 +354,11 @@
 lldb::SBTarget::eBroadcastBitBreakpointChanged);
 listener.StartListeningForEvents(this->broadcaster,
  eBroadcastBitStopEventThread);
+listener.StartListeningForEvents(
+  this->target.GetBroadcaster(),
+  lldb::SBTarget::eBroadcastBitModulesLoaded |
+  lldb::SBTarget::eBroadcastBitModulesUnloaded |
+  lldb::SBTarget::eBroadcastBitSymbolsLoaded);
   }
 }
 
Index: lldb/tools/lldb-vscode/JSONUtils.h
===
--- lldb/tools/lldb-vscode/JSONUtils.h
+++ lldb/tools/lldb-vscode/JSONUtils.h
@@ -13,6 +13,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/JSON.h"
 #include "VSCodeForward.h"
+#include "lldb/API/SBModule.h"
 
 namespace lldb_vscode {
 
@@ -237,6 +238,16 @@
  llvm::Optional request_path = llvm::None,
  llvm::Optional request_line = llvm::None);
 
+/// Converts Module Event to a Visual Studio Code "Module"
+///
+/// \param[in] module
+/// A LLDB module object to convert into a JSON value
+///
+/// \return
+/// A "Module" JSON object with that follows the formal JSON
+/// definition outlined by Microsoft.
+llvm::json::Value CreateModule(lldb::SBModule );
+
 /// Create a "Event" JSON object using \a event_name as the event name
 ///
 /// \param[in] event_name
Index: lldb/tools/lldb-vscode/JSONUtils.cpp
===
--- lldb/tools/lldb-vscode/JSONUtils.cpp
+++ lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -327,6 +327,31 @@
   return llvm::json::Value(std::move(object));
 }
 
+llvm::json::Value CreateModule(lldb::SBModule ) {
+  llvm::json::Object object;
+  if (!module.IsValid())
+return llvm::json::Value(std::move(object));
+  object.try_emplace("id", std::string(module.GetUUIDString()));
+  object.try_emplace(
+"name",
+std::string(module.GetFileSpec().GetFilename()));
+  std::string module_path = std::string(module.GetFileSpec().GetDirectory()) +
+"/" +
+

[PATCH] D69987: [RISCV] Assemble/Disassemble v-ext instructions.

2020-06-25 Thread Evandro Menezes via Phabricator via cfe-commits
evandro added inline comments.



Comment at: llvm/lib/Target/RISCV/RISCVInstrFormats.td:56
+def NoConstraint : RISCVVConstraint<0>;
+def WidenV   : RISCVVConstraint<1>;
+def WidenW   : RISCVVConstraint<2>;

HsiangKai wrote:
> evandro wrote:
> > HsiangKai wrote:
> > > evandro wrote:
> > > > Methinks that these constraints `WidenV`, `WidenW`, `WidenCvt`, should 
> > > > be split up by their components.  IOW, into `Widen`, `Wide` (input), 
> > > > `Cvt`.  This way, it's easier to test for specific constraints.
> > > Do you mean
> > > 
> > > WidenV = Widen;
> > > WidenW = Widen | WideInput;
> > > WidenCvt = Widen | Cvt;
> > Yes.
> Got it. I will improve it based on v0.9 implementation.
Please, address this comment before committing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69987



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


[PATCH] D82563: [Sema][NFC] Remove Redundant Condition

2020-06-25 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware created this revision.
baloghadamsoftware added reviewers: sammccall, rsmith.
baloghadamsoftware added a project: clang.
Herald added subscribers: martong, gamesh411, Szelethus, dkrupp, rnkovacs.

Condition `TypeQuals` is checked both in an outer and in an inner `if` 
statement in static function `ConvertDeclSpecToType()` in file `SemaType.cpp`. 
This patch removes the redundant inner check.

The issue was found using `clang-tidy` check under review 
`misc-redundant-condition`. See https://reviews.llvm.org/D81272.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82563

Files:
  clang/lib/Sema/SemaType.cpp


Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -1759,7 +1759,7 @@
 //   The effect of a cv-qualifier-seq in a function declarator is not the
 //   same as adding cv-qualification on top of the function type. In the
 //   latter case, the cv-qualifiers are ignored.
-if (TypeQuals && Result->isFunctionType()) {
+if (Result->isFunctionType()) {
   diagnoseAndRemoveTypeQualifiers(
   S, DS, TypeQuals, Result, DeclSpec::TQ_const | DeclSpec::TQ_volatile,
   S.getLangOpts().CPlusPlus


Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -1759,7 +1759,7 @@
 //   The effect of a cv-qualifier-seq in a function declarator is not the
 //   same as adding cv-qualification on top of the function type. In the
 //   latter case, the cv-qualifiers are ignored.
-if (TypeQuals && Result->isFunctionType()) {
+if (Result->isFunctionType()) {
   diagnoseAndRemoveTypeQualifiers(
   S, DS, TypeQuals, Result, DeclSpec::TQ_const | DeclSpec::TQ_volatile,
   S.getLangOpts().CPlusPlus
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82562: Implement AVX ABI Warning/error

2020-06-25 Thread Erich Keane via Phabricator via cfe-commits
erichkeane created this revision.
erichkeane added reviewers: craig.topper, echristo.

The x86-64 "avx" feature changes how >128 bit vector types are passed,
instead of being passed in separate 128 bit registers, they can be
passed in 256 bit registers.

"avx512f" does the same thing, except it switches from 256 bit registers
to 512 bit registers.

The result of both of these is an ABI incompatibility between functions
compiled with and without these features.

This patch implements a warning/error pair upon an attempt to call a
function that would run afoul of this. First, if a function is called
that would have its ABI changed, we issue a warning.

Second, if said call is made in a situation where the caller and callee
are known to have different calling conventions (such as the case of
'target'), we instead issue an error.


Repository:
  rC Clang

https://reviews.llvm.org/D82562

Files:
  clang/include/clang/Basic/DiagnosticFrontendKinds.td
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/CodeGen/TargetInfo.h
  clang/test/CodeGen/target-avx-abi-diag.c
  clang/test/CodeGen/target-builtin-error-3.c
  clang/test/CodeGen/target-builtin-noerror.c

Index: clang/test/CodeGen/target-builtin-noerror.c
===
--- clang/test/CodeGen/target-builtin-noerror.c
+++ clang/test/CodeGen/target-builtin-noerror.c
@@ -6,15 +6,15 @@
 
 // No warnings.
 extern __m256i a;
-int __attribute__((target("avx"))) bar(__m256i a) {
+int __attribute__((target("avx"))) bar() {
   return _mm256_extract_epi32(a, 3);
 }
 
 int baz() {
-  return bar(a);
+  return bar();
 }
 
-int __attribute__((target("avx"))) qq_avx(__m256i a) {
+int __attribute__((target("avx"))) qq_avx() {
   return _mm256_extract_epi32(a, 3);
 }
 
@@ -25,7 +25,7 @@
 extern __m256i a;
 int qq() {
   if (__builtin_cpu_supports("avx"))
-return qq_avx(a);
+return qq_avx();
   else
 return qq_noavx();
 }
Index: clang/test/CodeGen/target-builtin-error-3.c
===
--- clang/test/CodeGen/target-builtin-error-3.c
+++ clang/test/CodeGen/target-builtin-error-3.c
@@ -18,11 +18,12 @@
   return __extension__ ({ __m256 __a = (a); (__m128i)__builtin_ia32_vcvtps2ph256((__v8sf)__a, (0x00)); }); // expected-error {{'__builtin_ia32_vcvtps2ph256' needs target feature f16c}}
 }
 static inline half16 __attribute__((__overloadable__)) convert_half( float16 a ) {
-  half16 r; 
-  r.lo = convert_half( a.lo); 
+  half16 r;
+  r.lo = convert_half(a.lo);
   return r;
 }
 void avx_test( uint16_t *destData, float16 argbF)
 {
-   ((half16U*)destData)[0] = convert_half(argbF);
+  // expected-warning@+1{{AVX vector argument of type 'float16' (vector of 16 'float' values) without 'avx512f' enabled changes the ABI}}
+  ((half16U *)destData)[0] = convert_half(argbF);
 }
Index: clang/test/CodeGen/target-avx-abi-diag.c
===
--- /dev/null
+++ clang/test/CodeGen/target-avx-abi-diag.c
@@ -0,0 +1,50 @@
+// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -verify=no256,no512 -o - -S
+// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -target-feature +avx -verify=no512 -o - -S
+// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -target-feature +avx512f -verify=both -o - -S
+
+// both-no-diagnostics
+
+typedef short avx512fType __attribute__((vector_size(64)));
+typedef short avx256Type __attribute__((vector_size(32)));
+
+__attribute__((target("avx"))) void takesAvx256(avx256Type t);
+__attribute__((target("avx512f"))) void takesAvx512(avx512fType t);
+void takesAvx256_no_target(avx256Type t);
+void takesAvx512_no_target(avx512fType t);
+
+void variadic(int i, ...);
+__attribute__((target("avx512f"))) void variadic_err(int i, ...);
+
+// If neither side has an attribute, warn.
+void call_warn(void) {
+  avx256Type t1;
+  takesAvx256_no_target(t1); // no256-warning {{AVX vector argument of type 'avx256Type' (vector of 16 'short' values) without 'avx' enabled changes the ABI}}
+
+  avx512fType t2;
+  takesAvx512_no_target(t2); // no512-warning {{AVX vector argument of type 'avx512fType' (vector of 32 'short' values) without 'avx512f' enabled changes the ABI}}
+
+  variadic(1, t1); // no256-warning {{AVX vector argument of type 'avx256Type' (vector of 16 'short' values) without 'avx' enabled changes the ABI}}
+  variadic(3, t2); // no512-warning {{AVX vector argument of type 'avx512fType' (vector of 32 'short' values) without 'avx512f' enabled changes the ABI}}
+}
+
+// If only 1 side has an attribute, error.
+void call_errors(void) {
+  avx256Type t1;
+  takesAvx256(t1); // no256-error {{AVX vector argument of type 'avx256Type' (vector of 16 'short' values) without 'avx' enabled changes the ABI}}
+  avx512fType t2;
+  takesAvx512(t2); // no512-error {{AVX vector argument of type 'avx512fType' (vector of 32 'short' values) without 'avx512f' enabled changes the ABI}}
+
+  variadic_err(1, t1); // no256-error 

[PATCH] D82561: [analyzer][CrossTU] Lower CTUImportThreshold default value

2020-06-25 Thread Endre Fülöp via Phabricator via cfe-commits
gamesh411 created this revision.
gamesh411 added reviewers: martong, balazske.
Herald added subscribers: cfe-commits, ASDenysPetrov, steakhal, Charusso, 
dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, 
baloghadamsoftware, xazax.hun, whisperity.
Herald added a reviewer: Szelethus.
Herald added a project: clang.
gamesh411 updated this revision to Diff 273372.
gamesh411 added a comment.

update test value


The default value of 100 makes the analysis slow. Projects of considerable
size can take more time to finish than it is practical. The new default
setting of 8 is based on the analysis of LLVM itself. With the old default
value of 100 the analysis time was over a magnitude slower. Thresholding the
load of ASTUnits is to be extended in the future with a more fine-tuneable
solution that accomodates to the specifics of the project analyzed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82561

Files:
  clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
  clang/test/Analysis/analyzer-config.c


Index: clang/test/Analysis/analyzer-config.c
===
--- clang/test/Analysis/analyzer-config.c
+++ clang/test/Analysis/analyzer-config.c
@@ -41,7 +41,7 @@
 // CHECK-NEXT: cplusplus.Move:WarnOn = KnownsAndLocals
 // CHECK-NEXT: crosscheck-with-z3 = false
 // CHECK-NEXT: ctu-dir = ""
-// CHECK-NEXT: ctu-import-threshold = 100
+// CHECK-NEXT: ctu-import-threshold = 8
 // CHECK-NEXT: ctu-index-name = externalDefMap.txt
 // CHECK-NEXT: ctu-invocation-list = invocations.yaml
 // CHECK-NEXT: deadcode.DeadStores:ShowFixIts = false
Index: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
===
--- clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
+++ clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
@@ -324,7 +324,7 @@
 "Lowering this threshold can alleviate the memory burder of "
 "analysis with many interdependent definitions located in "
 "various translation units.",
-100u)
+8u)
 
 ANALYZER_OPTION(
 unsigned, AlwaysInlineSize, "ipa-always-inline-size",


Index: clang/test/Analysis/analyzer-config.c
===
--- clang/test/Analysis/analyzer-config.c
+++ clang/test/Analysis/analyzer-config.c
@@ -41,7 +41,7 @@
 // CHECK-NEXT: cplusplus.Move:WarnOn = KnownsAndLocals
 // CHECK-NEXT: crosscheck-with-z3 = false
 // CHECK-NEXT: ctu-dir = ""
-// CHECK-NEXT: ctu-import-threshold = 100
+// CHECK-NEXT: ctu-import-threshold = 8
 // CHECK-NEXT: ctu-index-name = externalDefMap.txt
 // CHECK-NEXT: ctu-invocation-list = invocations.yaml
 // CHECK-NEXT: deadcode.DeadStores:ShowFixIts = false
Index: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
===
--- clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
+++ clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
@@ -324,7 +324,7 @@
 "Lowering this threshold can alleviate the memory burder of "
 "analysis with many interdependent definitions located in "
 "various translation units.",
-100u)
+8u)
 
 ANALYZER_OPTION(
 unsigned, AlwaysInlineSize, "ipa-always-inline-size",
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70603: Change while to do-while

2020-06-25 Thread Seija Kijin via Phabricator via cfe-commits
pi1024e added a comment.

@MaskRay it's been months yet this hasn't landed yet. Why?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70603



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


[PATCH] D82561: [analyzer][CrossTU] Lower CTUImportThreshold default value

2020-06-25 Thread Endre Fülöp via Phabricator via cfe-commits
gamesh411 updated this revision to Diff 273372.
gamesh411 added a comment.

update test value


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82561

Files:
  clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
  clang/test/Analysis/analyzer-config.c


Index: clang/test/Analysis/analyzer-config.c
===
--- clang/test/Analysis/analyzer-config.c
+++ clang/test/Analysis/analyzer-config.c
@@ -41,7 +41,7 @@
 // CHECK-NEXT: cplusplus.Move:WarnOn = KnownsAndLocals
 // CHECK-NEXT: crosscheck-with-z3 = false
 // CHECK-NEXT: ctu-dir = ""
-// CHECK-NEXT: ctu-import-threshold = 100
+// CHECK-NEXT: ctu-import-threshold = 8
 // CHECK-NEXT: ctu-index-name = externalDefMap.txt
 // CHECK-NEXT: ctu-invocation-list = invocations.yaml
 // CHECK-NEXT: deadcode.DeadStores:ShowFixIts = false
Index: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
===
--- clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
+++ clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
@@ -324,7 +324,7 @@
 "Lowering this threshold can alleviate the memory burder of "
 "analysis with many interdependent definitions located in "
 "various translation units.",
-100u)
+8u)
 
 ANALYZER_OPTION(
 unsigned, AlwaysInlineSize, "ipa-always-inline-size",


Index: clang/test/Analysis/analyzer-config.c
===
--- clang/test/Analysis/analyzer-config.c
+++ clang/test/Analysis/analyzer-config.c
@@ -41,7 +41,7 @@
 // CHECK-NEXT: cplusplus.Move:WarnOn = KnownsAndLocals
 // CHECK-NEXT: crosscheck-with-z3 = false
 // CHECK-NEXT: ctu-dir = ""
-// CHECK-NEXT: ctu-import-threshold = 100
+// CHECK-NEXT: ctu-import-threshold = 8
 // CHECK-NEXT: ctu-index-name = externalDefMap.txt
 // CHECK-NEXT: ctu-invocation-list = invocations.yaml
 // CHECK-NEXT: deadcode.DeadStores:ShowFixIts = false
Index: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
===
--- clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
+++ clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
@@ -324,7 +324,7 @@
 "Lowering this threshold can alleviate the memory burder of "
 "analysis with many interdependent definitions located in "
 "various translation units.",
-100u)
+8u)
 
 ANALYZER_OPTION(
 unsigned, AlwaysInlineSize, "ipa-always-inline-size",
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D82225: [libTooling] Delete deprecated `Stencil` combinators.

2020-06-25 Thread Fāng-ruì Sòng via cfe-commits
On Thu, Jun 25, 2020 at 5:53 AM Yitzhak Mandelbaum  wrote:
>
> Thanks for alerting me. Why is it important to strip out this information? 
> Also, might this be something we can change on the arcanist side (to not add 
> to the commit message) rather than strip out on the git end?

Mostly to keep commit descriptions tidy. In a paper of git log output,
large volume of unneeded Phabricator tags dilutes useful information.
It is said that hacking on the Phabricator side can prevent pushing
some tags, but it may also lose convenience because currently one can
edit Reviewers: and Subscribers:.

> On Wed, Jun 24, 2020 at 3:28 PM Fangrui Song via Phabricator 
>  wrote:
>>
>> MaskRay added a comment.
>>
>> Hi, your git commit contains extra Phabricator tags. You can drop 
>> `Reviewers:` `Subscribers:` `Tags:` and the text `Summary:` from the git 
>> commit with the following script:
>>
>>   arcfilter () {
>>   arc amend
>>   git log -1 --pretty=%B | awk '/Reviewers:|Subscribers:/{p=1} 
>> /Reviewed By:|Differential Revision:/{p=0} !p && !/^Summary:$/ 
>> {sub(/^Summary: /,"");print}' | git commit --amend --date=now -F -
>>   }
>>
>> `Reviewed By: ` is considered important by some people. Please keep the tag. 
>> (I have updated my script to use `--date=now` (setting author date to 
>> committer date))
>>
>> `https://reviews.llvm.org/D80978` contains a git pre-push hook to automate 
>> this.
>>
>>
>> Repository:
>>   rG LLVM Github Monorepo
>>
>> CHANGES SINCE LAST ACTION
>>   https://reviews.llvm.org/D82225/new/
>>
>> https://reviews.llvm.org/D82225
>>
>>
>>


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


[PATCH] D82391: [AArch64][SVE] Add bfloat16 support to svext intrinsic

2020-06-25 Thread Cullen Rhodes via Phabricator via cfe-commits
c-rhodes updated this revision to Diff 273365.
c-rhodes added a comment.

Changes:

- Guard patterns on `+bf16`.


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

https://reviews.llvm.org/D82391

Files:
  clang/include/clang/Basic/arm_sve.td
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ext-bfloat.c
  llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
  llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll


Index: llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll
===
--- llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll
+++ llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll
@@ -516,6 +516,16 @@
   ret  %out
 }
 
+define  @ext_bf16( %a,  %b) #0 {
+; CHECK-LABEL: ext_bf16:
+; CHECK: ext z0.b, z0.b, z1.b, #6
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.ext.nxv8bf16( %a,
+%b,
+   i32 3)
+  ret  %out
+}
+
 define  @ext_f16( %a,  %b) {
 ; CHECK-LABEL: ext_f16:
 ; CHECK: ext z0.b, z0.b, z1.b, #6
@@ -1876,6 +1886,7 @@
 declare  @llvm.aarch64.sve.ext.nxv8i16(, 
, i32)
 declare  @llvm.aarch64.sve.ext.nxv4i32(, 
, i32)
 declare  @llvm.aarch64.sve.ext.nxv2i64(, 
, i32)
+declare  @llvm.aarch64.sve.ext.nxv8bf16(, , i32)
 declare  @llvm.aarch64.sve.ext.nxv8f16(, 
, i32)
 declare  @llvm.aarch64.sve.ext.nxv4f32(, , i32)
 declare  @llvm.aarch64.sve.ext.nxv2f64(, , i32)
Index: llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
===
--- llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
+++ llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
@@ -1454,7 +1454,6 @@
 
 def : Pat<(nxv8f16 (bitconvert (nxv16i8 ZPR:$src))), (nxv8f16 ZPR:$src)>;
 def : Pat<(nxv8f16 (bitconvert (nxv8i16 ZPR:$src))), (nxv8f16 ZPR:$src)>;
-def : Pat<(nxv8bf16 (bitconvert (nxv8i16 ZPR:$src))), (nxv8bf16 ZPR:$src)>;
 def : Pat<(nxv8f16 (bitconvert (nxv4i32 ZPR:$src))), (nxv8f16 ZPR:$src)>;
 def : Pat<(nxv8f16 (bitconvert (nxv2i64 ZPR:$src))), (nxv8f16 ZPR:$src)>;
 def : Pat<(nxv8f16 (bitconvert (nxv4f32 ZPR:$src))), (nxv8f16 ZPR:$src)>;
@@ -1473,6 +1472,14 @@
 def : Pat<(nxv2f64 (bitconvert (nxv2i64 ZPR:$src))), (nxv2f64 ZPR:$src)>;
 def : Pat<(nxv2f64 (bitconvert (nxv8f16 ZPR:$src))), (nxv2f64 ZPR:$src)>;
 def : Pat<(nxv2f64 (bitconvert (nxv4f32 ZPR:$src))), (nxv2f64 ZPR:$src)>;
+
+  }
+
+  let Predicates = [IsLE, HasBF16] in {
+def : Pat<(nxv16i8 (bitconvert (nxv8bf16 ZPR:$src))), (nxv16i8 ZPR:$src)>;
+
+def : Pat<(nxv8bf16 (bitconvert (nxv16i8 ZPR:$src))), (nxv8bf16 ZPR:$src)>;
+def : Pat<(nxv8bf16 (bitconvert (nxv8i16 ZPR:$src))), (nxv8bf16 ZPR:$src)>;
   }
 
   def : Pat<(nxv16i1 (reinterpret_cast (nxv16i1 PPR:$src))), (COPY_TO_REGCLASS 
PPR:$src, PPR)>;
Index: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ext-bfloat.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ext-bfloat.c
@@ -0,0 +1,26 @@
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC 
-D__ARM_FEATURE_SVE_BF16 -triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall 
-emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC 
-D__ARM_FEATURE_SVE_BF16 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu 
-target-feature +sve -target-feature +bf16 -fallow-half-arguments-and-returns 
-S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC 
-D__ARM_FEATURE_SVE_BF16 -triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall 
-o - %s >/dev/null 2>%t
+// RUN: FileCheck --check-prefix=ASM --allow-empty %s <%t
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC 
-triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 
-fallow-half-arguments-and-returns -fsyntax-only -verify 
-verify-ignore-unexpected=error -verify-ignore-unexpected=note %s
+
+// If this check fails please read test/CodeGen/aarch64-sve-intrinsics/README 
for instructions on how to resolve it.
+// ASM-NOT: warning
+#include 
+
+#ifdef SVE_OVERLOADED_FORMS
+// A simple used,unused... macro, long enough to represent any SVE builtin.
+#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
+#else
+#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
+#endif
+
+svbfloat16_t test_svext_bf16(svbfloat16_t op1, svbfloat16_t op2)
+{
+  // CHECK-LABEL: test_svext_bf16
+  // CHECK: %[[INTRINSIC:.*]] = call  
@llvm.aarch64.sve.ext.nxv8bf16( %op1,  %op2, i32 127)
+  // CHECK: ret  %[[INTRINSIC]]
+  // expected-warning@+1 {{implicit 

[PATCH] D82501: [sve][acle] Add reinterpret intrinsics for brain float.

2020-06-25 Thread Francesco Petrogalli via Phabricator via cfe-commits
fpetrogalli marked 2 inline comments as done.
fpetrogalli added inline comments.



Comment at: 
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret-bfloat.c:5
+
+#include 
+

david-arm wrote:
> Hi @fpetrogalli, in the same way that you asked @kmclaughlin if she could add 
> the ASM-NOT check line in her patch, are you able to do that here? You'd need 
> to add an additional RUN line though to compile to assembly. Don't worry if 
> it's not possible though!
It is possible, but my understanding is that we anyway decided to do this work 
as a separate patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82501



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


[PATCH] D82448: [AArch64][SVE] Add bfloat16 support to store intrinsics

2020-06-25 Thread Francesco Petrogalli via Phabricator via cfe-commits
fpetrogalli accepted this revision.
fpetrogalli added a comment.
This revision is now accepted and ready to land.

LGTM, thank you!




Comment at: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_st1-bfloat.c:4
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC 
-triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 
-fallow-half-arguments-and-returns -fsyntax-only -verify 
-verify-ignore-unexpected=error -verify-ignore-unexpected=note %s
+
+#include 

kmclaughlin wrote:
> fpetrogalli wrote:
> > Nit: is it worth adding the `ASM-NOT: warning` check that is used in other 
> > tests? Of course, only if it doesn't fail, for in such case we would have 
> > to address the problem in a separate patch.
> > 
> > (Same for all the new C tests added in this patch).
> Adding the check doesn't fail, but I will add these checks to the load & 
> store tests in a separate patch
Yep - thanks for confirming.


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

https://reviews.llvm.org/D82448



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


[PATCH] D70603: Change while to do-while

2020-06-25 Thread Seija Kijin via Phabricator via cfe-commits
pi1024e added a comment.

Any updates?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70603



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


[PATCH] D69987: [RISCV] Assemble/Disassemble v-ext instructions.

2020-06-25 Thread Hsiangkai Wang via Phabricator via cfe-commits
HsiangKai marked an inline comment as done.
HsiangKai added inline comments.



Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoV.td:9
+///
+/// This file describes the RISC-V instructions from the standard 'V',
+/// Vector instruction set extension.

asb wrote:
> Please add similar language as in RISCVInstrInfoB.td to indicate the version 
> being described and explain this version is experimental and hasn't been 
> ratified.
Got it. I will add more comments similar to RISCVInstrInfoB.td before landing 
the patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69987



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


[PATCH] D69987: [RISCV] Assemble/Disassemble v-ext instructions.

2020-06-25 Thread Hsiangkai Wang via Phabricator via cfe-commits
HsiangKai marked an inline comment as done.
HsiangKai added inline comments.



Comment at: llvm/lib/Target/RISCV/RISCVInstrFormats.td:56
+def NoConstraint : RISCVVConstraint<0>;
+def WidenV   : RISCVVConstraint<1>;
+def WidenW   : RISCVVConstraint<2>;

evandro wrote:
> HsiangKai wrote:
> > evandro wrote:
> > > Methinks that these constraints `WidenV`, `WidenW`, `WidenCvt`, should be 
> > > split up by their components.  IOW, into `Widen`, `Wide` (input), `Cvt`.  
> > > This way, it's easier to test for specific constraints.
> > Do you mean
> > 
> > WidenV = Widen;
> > WidenW = Widen | WideInput;
> > WidenCvt = Widen | Cvt;
> Yes.
Got it. I will improve it based on v0.9 implementation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69987



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


[PATCH] D82318: Add `FloatingLiteral` to SyntaxTree

2020-06-25 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas updated this revision to Diff 273347.
eduucaldas marked an inline comment as done.
eduucaldas added a comment.

Fix indenting


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82318

Files:
  clang/include/clang/Tooling/Syntax/Nodes.h
  clang/lib/Tooling/Syntax/BuildTree.cpp
  clang/lib/Tooling/Syntax/Nodes.cpp
  clang/unittests/Tooling/Syntax/TreeTest.cpp

Index: clang/unittests/Tooling/Syntax/TreeTest.cpp
===
--- clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -69,6 +69,10 @@
Language == Lang_CXX20;
   }
 
+  bool isCXX17OrLater() const {
+return Language == Lang_CXX17 || Language == Lang_CXX20;
+  }
+
   bool supportsCXXDynamicExceptionSpecification() const {
 return Language == Lang_CXX03 || Language == Lang_CXX11 ||
Language == Lang_CXX14;
@@ -1228,6 +1232,91 @@
 )txt"));
 }
 
+TEST_P(SyntaxTreeTest, FloatingLiteral) {
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  1e-2;
+  2.;
+  .2;
+  2.f;
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-FloatingLiteralExpression
+| | `-1e-2
+| `-;
+|-ExpressionStatement
+| |-FloatingLiteralExpression
+| | `-2.
+| `-;
+|-ExpressionStatement
+| |-FloatingLiteralExpression
+| | `-.2
+| `-;
+|-ExpressionStatement
+| |-FloatingLiteralExpression
+| | `-2.f
+| `-;
+`-}
+)txt"));
+}
+
+TEST_P(SyntaxTreeTest, FloatingLiteralHexadecimal) {
+  if (!GetParam().isCXX17OrLater()) {
+return;
+  }
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  0xfp1;
+  0xf.p1;
+  0x.fp1;
+  0xf.fp1f;
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-FloatingLiteralExpression
+| | `-0xfp1
+| `-;
+|-ExpressionStatement
+| |-FloatingLiteralExpression
+| | `-0xf.p1
+| `-;
+|-ExpressionStatement
+| |-FloatingLiteralExpression
+| | `-0x.fp1
+| `-;
+|-ExpressionStatement
+| |-FloatingLiteralExpression
+| | `-0xf.fp1f
+| `-;
+`-}
+)txt"));
+}
+
 TEST_P(SyntaxTreeTest, IntegerLiteral) {
   EXPECT_TRUE(treeDumpEqual(
   R"cpp(
Index: clang/lib/Tooling/Syntax/Nodes.cpp
===
--- clang/lib/Tooling/Syntax/Nodes.cpp
+++ clang/lib/Tooling/Syntax/Nodes.cpp
@@ -22,6 +22,8 @@
 return OS << "CxxNullPtrExpression";
   case NodeKind::IntegerLiteralExpression:
 return OS << "IntegerLiteralExpression";
+  case NodeKind::FloatingLiteralExpression:
+return OS << "FloatingLiteralExpression";
   case NodeKind::PrefixUnaryOperatorExpression:
 return OS << "PrefixUnaryOperatorExpression";
   case NodeKind::PostfixUnaryOperatorExpression:
@@ -195,6 +197,11 @@
   findChild(syntax::NodeRole::IdExpression_id));
 }
 
+syntax::Leaf *syntax::FloatingLiteralExpression::literalToken() {
+  return llvm::cast_or_null(
+  findChild(syntax::NodeRole::LiteralToken));
+}
+
 syntax::Leaf *syntax::IntegerLiteralExpression::literalToken() {
   return llvm::cast_or_null(
   findChild(syntax::NodeRole::LiteralToken));
Index: clang/lib/Tooling/Syntax/BuildTree.cpp
===
--- clang/lib/Tooling/Syntax/BuildTree.cpp
+++ clang/lib/Tooling/Syntax/BuildTree.cpp
@@ -654,6 +654,13 @@
 return true;
   }
 
+  bool WalkUpFromFloatingLiteral(FloatingLiteral *S) {
+Builder.markChildToken(S->getLocation(), syntax::NodeRole::LiteralToken);
+Builder.foldNode(Builder.getExprRange(S),
+ new (allocator()) syntax::FloatingLiteralExpression, S);
+return true;
+  }
+
   bool WalkUpFromCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *S) {
 Builder.markChildToken(S->getLocation(), syntax::NodeRole::LiteralToken);
 Builder.foldNode(Builder.getExprRange(S),
Index: clang/include/clang/Tooling/Syntax/Nodes.h
===
--- clang/include/clang/Tooling/Syntax/Nodes.h
+++ clang/include/clang/Tooling/Syntax/Nodes.h
@@ -45,6 +45,7 @@
   BinaryOperatorExpression,
   CxxNullPtrExpression,
   IntegerLiteralExpression,
+  FloatingLiteralExpression,
   IdExpression,
 
   // Statements.
@@ -254,6 +255,17 @@
   syntax::Leaf *nullPtrKeyword();
 };
 
+/// Expression for floating-point literals. C++ [lex.fcon]
+class FloatingLiteralExpression final : public Expression {
+public:
+  FloatingLiteralExpression()
+  : Expression(NodeKind::FloatingLiteralExpression) {}
+  static bool classof(const 

[PATCH] D82360: Add StringLiteral to SyntaxTree

2020-06-25 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas updated this revision to Diff 273346.
eduucaldas added a comment.

Add unicode tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82360

Files:
  clang/include/clang/Tooling/Syntax/Nodes.h
  clang/lib/Tooling/Syntax/BuildTree.cpp
  clang/lib/Tooling/Syntax/Nodes.cpp
  clang/unittests/Tooling/Syntax/TreeTest.cpp

Index: clang/unittests/Tooling/Syntax/TreeTest.cpp
===
--- clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -1228,6 +1228,109 @@
 )txt"));
 }
 
+TEST_P(SyntaxTreeTest, StringLiteral) {
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  "a\n\0\x20";
+  L"αβ";
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-StringLiteralExpression
+| | `-"a\n\0\x20"
+| `-;
+|-ExpressionStatement
+| |-StringLiteralExpression
+| | `-L"αβ"
+| `-;
+`-}
+)txt"));
+}
+
+TEST_P(SyntaxTreeTest, StringLiteralUtf) {
+  if (!GetParam().isCXX11OrLater()) {
+return;
+  }
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  u8"a\x1f\x05";
+  u"C++抽象構文木";
+  U"\n";
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-StringLiteralExpression
+| | `-u8"a\x1f\x05"
+| `-;
+|-ExpressionStatement
+| |-StringLiteralExpression
+| | `-u"C++抽象構文木"
+| `-;
+|-ExpressionStatement
+| |-StringLiteralExpression
+| | `-U"\n"
+| `-;
+`-}
+)txt"));
+}
+
+TEST_P(SyntaxTreeTest, StringLiteralRaw) {
+  if (!GetParam().isCXX11OrLater()) {
+return;
+  }
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  R"SyntaxTree(
+  Hello "Syntax" \"
+  )SyntaxTree";
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-StringLiteralExpression
+| | `-R"SyntaxTree(
+  Hello "Syntax" \"
+  )SyntaxTree"
+| `-;
+`-}
+)txt"));
+}
+
 TEST_P(SyntaxTreeTest, IntegerLiteral) {
   EXPECT_TRUE(treeDumpEqual(
   R"cpp(
@@ -2559,7 +2662,7 @@
 | |-UnknownExpression
 | | `-true
 | |-,
-| |-UnknownExpression
+| |-StringLiteralExpression
 | | `-"message"
 | |-)
 | `-;
Index: clang/lib/Tooling/Syntax/Nodes.cpp
===
--- clang/lib/Tooling/Syntax/Nodes.cpp
+++ clang/lib/Tooling/Syntax/Nodes.cpp
@@ -22,6 +22,8 @@
 return OS << "CxxNullPtrExpression";
   case NodeKind::IntegerLiteralExpression:
 return OS << "IntegerLiteralExpression";
+  case NodeKind::StringLiteralExpression:
+return OS << "StringLiteralExpression";
   case NodeKind::PrefixUnaryOperatorExpression:
 return OS << "PrefixUnaryOperatorExpression";
   case NodeKind::PostfixUnaryOperatorExpression:
@@ -200,6 +202,11 @@
   findChild(syntax::NodeRole::LiteralToken));
 }
 
+syntax::Leaf *syntax::StringLiteralExpression::literalToken() {
+  return llvm::cast_or_null(
+  findChild(syntax::NodeRole::LiteralToken));
+}
+
 syntax::Leaf *syntax::CxxNullPtrExpression::nullPtrKeyword() {
   return llvm::cast_or_null(
   findChild(syntax::NodeRole::LiteralToken));
Index: clang/lib/Tooling/Syntax/BuildTree.cpp
===
--- clang/lib/Tooling/Syntax/BuildTree.cpp
+++ clang/lib/Tooling/Syntax/BuildTree.cpp
@@ -654,6 +654,13 @@
 return true;
   }
 
+  bool WalkUpFromStringLiteral(StringLiteral *S) {
+Builder.markChildToken(S->getBeginLoc(), syntax::NodeRole::LiteralToken);
+Builder.foldNode(Builder.getExprRange(S),
+ new (allocator()) syntax::StringLiteralExpression, S);
+return true;
+  }
+
   bool WalkUpFromCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *S) {
 Builder.markChildToken(S->getLocation(), syntax::NodeRole::LiteralToken);
 Builder.foldNode(Builder.getExprRange(S),
Index: clang/include/clang/Tooling/Syntax/Nodes.h
===
--- clang/include/clang/Tooling/Syntax/Nodes.h
+++ clang/include/clang/Tooling/Syntax/Nodes.h
@@ -45,6 +45,7 @@
   BinaryOperatorExpression,
   CxxNullPtrExpression,
   IntegerLiteralExpression,
+  StringLiteralExpression,
   IdExpression,
 
   // Statements.
@@ -264,6 +265,16 @@
   syntax::Leaf *literalToken();
 };
 
+/// Expression for string-literals. C++ [lex.string]
+class StringLiteralExpression final : public Expression {
+public:
+  StringLiteralExpression() : 

[PATCH] D82548: [CodeComplete] add code completion for `delete` and `default` specifier.

2020-06-25 Thread liu hui via Phabricator via cfe-commits
lh123 created this revision.
lh123 added a reviewer: kadircet.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
lh123 added a parent revision: D82535: [CodeComplete] Add code completion for 
using alias..

add code completion for `delete` and `default` specifier.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82548

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Sema/SemaCodeComplete.cpp
  clang/test/CodeCompletion/delete-default-specifier.cpp

Index: clang/test/CodeCompletion/delete-default-specifier.cpp
===
--- /dev/null
+++ clang/test/CodeCompletion/delete-default-specifier.cpp
@@ -0,0 +1,24 @@
+struct A {
+  A() = default;
+  // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:2:9 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+  // CHECK-CC1: COMPLETION: default
+  // CHECK-CC1-NEXT: COMPLETION: delete
+  A(const A &);
+};
+
+A::A(const A &) = default;
+// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:9:19 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: COMPLETION: default
+// CHECK-CC2-NEXT: COMPLETION: delete
+
+struct B {
+  void test() = delete;
+  // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:15:17 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
+  // CHECK-CC3: COMPLETION: default
+  // CHECK-CC3-NEXT: COMPLETION: delete
+};
+
+void test() = delete;
+// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:21:15 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
+// CHECK-CC4: COMPLETION: default
+// CHECK-CC4-NEXT: COMPLETION: delete
Index: clang/lib/Sema/SemaCodeComplete.cpp
===
--- clang/lib/Sema/SemaCodeComplete.cpp
+++ clang/lib/Sema/SemaCodeComplete.cpp
@@ -6261,6 +6261,25 @@
 Results.data(), Results.size());
 }
 
+void Sema::CodeCompleteFunctionDeleteAndDefaultSpecifier() {
+  if (!LangOpts.CPlusPlus11) {
+return;
+  }
+  ResultBuilder Results(*this, CodeCompleter->getAllocator(),
+CodeCompleter->getCodeCompletionTUInfo(),
+CodeCompletionContext::CCC_Other);
+  Results.EnterNewScope();
+  // FIXME(liuhui): Ideally, we should only provide `default` completion for
+  // special functions.
+  Results.AddResult("default");
+  // FIXME(liuhui): Ideally, we should only provide `delete` completion for the
+  // first function declaration.
+  Results.AddResult("delete");
+  Results.ExitScope();
+  HandleCodeCompleteResults(this, CodeCompleter, Results.getCompletionContext(),
+Results.data(), Results.size());
+}
+
 /// Macro that optionally prepends an "@" to the string literal passed in via
 /// Keyword, depending on whether NeedAt is true or false.
 #define OBJC_AT_KEYWORD_NAME(NeedAt, Keyword) ((NeedAt) ? "@" Keyword : Keyword)
Index: clang/lib/Parse/ParseDeclCXX.cpp
===
--- clang/lib/Parse/ParseDeclCXX.cpp
+++ clang/lib/Parse/ParseDeclCXX.cpp
@@ -2714,6 +2714,11 @@
   DefinitionKind = FDK_Defaulted;
 else if (KW.is(tok::kw_delete))
   DefinitionKind = FDK_Deleted;
+else if (KW.is(tok::code_completion)) {
+  Actions.CodeCompleteFunctionDeleteAndDefaultSpecifier();
+  cutOffParsing();
+  return nullptr;
+}
   }
 }
 DeclaratorInfo.setFunctionDefinitionKind(DefinitionKind);
Index: clang/lib/Parse/ParseDecl.cpp
===
--- clang/lib/Parse/ParseDecl.cpp
+++ clang/lib/Parse/ParseDecl.cpp
@@ -2046,46 +2046,52 @@
   }
 
   // Check to see if we have a function *definition* which must have a body.
-  if (D.isFunctionDeclarator() &&
-  // Look at the next token to make sure that this isn't a function
-  // declaration.  We have to check this because __attribute__ might be the
-  // start of a function definition in GCC-extended K C.
-  !isDeclarationAfterDeclarator()) {
-
-// Function definitions are only allowed at file scope and in C++ classes.
-// The C++ inline method definition case is handled elsewhere, so we only
-// need to handle the file scope definition case.
-if (Context == DeclaratorContext::FileContext) {
-  if (isStartOfFunctionDefinition(D)) {
-if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef) {
-  Diag(Tok, diag::err_function_declared_typedef);
-
-  // Recover by treating the 'typedef' as spurious.
-  DS.ClearStorageClassSpecs();
-}
+  if (D.isFunctionDeclarator()) {
+if (Tok.is(tok::equal) && NextToken().is(tok::code_completion)) {
+  

[PATCH] D82312: Add `CharLiteral` to SyntaxTree

2020-06-25 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas updated this revision to Diff 273343.
eduucaldas marked 3 inline comments as done.
eduucaldas added a comment.

Add tests for unicode characters


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82312

Files:
  clang/include/clang/Tooling/Syntax/Nodes.h
  clang/lib/Tooling/Syntax/BuildTree.cpp
  clang/lib/Tooling/Syntax/Nodes.cpp
  clang/unittests/Tooling/Syntax/TreeTest.cpp

Index: clang/unittests/Tooling/Syntax/TreeTest.cpp
===
--- clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -69,6 +69,10 @@
Language == Lang_CXX20;
   }
 
+  bool isCXX17OrLater() const {
+return Language == Lang_CXX17 || Language == Lang_CXX20;
+  }
+
   bool supportsCXXDynamicExceptionSpecification() const {
 return Language == Lang_CXX03 || Language == Lang_CXX11 ||
Language == Lang_CXX14;
@@ -1228,6 +1232,135 @@
 )txt"));
 }
 
+TEST_P(SyntaxTreeTest, CharacterLiteral) {
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  'a';
+  '\n';
+  '\x20';
+  '\0';
+  L'a';
+  L'α';
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-'a'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-'\n'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-'\x20'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-'\0'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-L'a'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-L'α'
+| `-;
+`-}
+)txt"));
+}
+
+TEST_P(SyntaxTreeTest, CharacterLiteralUtf) {
+  if (!GetParam().isCXX11OrLater()) {
+return;
+  }
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  u'a';
+  u'構';
+  U'a';
+  U'';
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-u'a'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-u'構'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-U'a'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-U''
+| `-;
+`-}
+)txt"));
+}
+
+TEST_P(SyntaxTreeTest, CharacterLiteralUtf8) {
+  if (!GetParam().isCXX17OrLater()) {
+return;
+  }
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+void test() {
+  u8'a';
+  u8'\x7f';
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-u8'a'
+| `-;
+|-ExpressionStatement
+| |-CharacterLiteralExpression
+| | `-u8'\x7f'
+| `-;
+`-}
+)txt"));
+}
+
 TEST_P(SyntaxTreeTest, IntegerLiteral) {
   EXPECT_TRUE(treeDumpEqual(
   R"cpp(
Index: clang/lib/Tooling/Syntax/Nodes.cpp
===
--- clang/lib/Tooling/Syntax/Nodes.cpp
+++ clang/lib/Tooling/Syntax/Nodes.cpp
@@ -22,6 +22,8 @@
 return OS << "CxxNullPtrExpression";
   case NodeKind::IntegerLiteralExpression:
 return OS << "IntegerLiteralExpression";
+  case NodeKind::CharacterLiteralExpression:
+return OS << "CharacterLiteralExpression";
   case NodeKind::PrefixUnaryOperatorExpression:
 return OS << "PrefixUnaryOperatorExpression";
   case NodeKind::PostfixUnaryOperatorExpression:
@@ -200,6 +202,11 @@
   findChild(syntax::NodeRole::LiteralToken));
 }
 
+syntax::Leaf *syntax::CharacterLiteralExpression::literalToken() {
+  return llvm::cast_or_null(
+  findChild(syntax::NodeRole::LiteralToken));
+}
+
 syntax::Leaf *syntax::CxxNullPtrExpression::nullPtrKeyword() {
   return llvm::cast_or_null(
   findChild(syntax::NodeRole::LiteralToken));
Index: clang/lib/Tooling/Syntax/BuildTree.cpp
===
--- clang/lib/Tooling/Syntax/BuildTree.cpp
+++ clang/lib/Tooling/Syntax/BuildTree.cpp
@@ -654,6 +654,13 @@
 return true;
   }
 
+  bool WalkUpFromCharacterLiteral(CharacterLiteral *S) {
+Builder.markChildToken(S->getLocation(), syntax::NodeRole::LiteralToken);
+Builder.foldNode(Builder.getExprRange(S),
+ new (allocator()) syntax::CharacterLiteralExpression, S);
+return true;
+  }
+
   bool WalkUpFromCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *S) {
 

[PATCH] D82226: Add Metadata to Transformer tooling

2020-06-25 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel added a comment.

Looks good! Only real question is one of design -- should we consider the 
(deeper) change of templating the various types rather than using dynamic 
typing?  For that matter, the decision doesn't even have to be the same for 
both AtomicChange and the Transformer types. Transformer could be templated 
while AtomicChange uses any.

I'm inclined towards what you have, but that may just be laziness on part 
(since this requires minimal changes).  I'm curious to hear what Dmitri thinks.




Comment at: clang/include/clang/Tooling/Refactoring/AtomicChange.h:144
   tooling::Replacements Replaces;
+  llvm::Any Metadata;
 };

Please add a field comment. Something like what you have in the revision 
description would be good.



Comment at: clang/lib/Tooling/Refactoring/AtomicChange.cpp:210
+: AtomicChange(SM, KeyPosition) {
+  Metadata = std::move(M);
+}

I assume that  
```
: AtomicChange(SM, KeyPosition), Metadata(std::move(M)) {}
```
didn't work?



Comment at: clang/unittests/Tooling/RefactoringTest.cpp:1299
 
+struct SomeMetadata {
+  int Data;

any reason not to use int directly as the type carried in the metadata?



Comment at: clang/unittests/Tooling/TransformerTest.cpp:460
+  auto Factory = newFrontendActionFactory();
+  EXPECT_TRUE(runToolOnCodeWithArgs(
+  Factory->create(), Input, std::vector(), "input.cc",

Why expect vs assert?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82226



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


[PATCH] D82547: [Debugify] Expose debugify (original mode) as CC1 option

2020-06-25 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro created this revision.
djtodoro added reviewers: vsk, aprantl, dblaikie, probinson.
djtodoro added projects: debug-info, LLVM.
Herald added a project: clang.
Herald added subscribers: llvm-commits, cfe-commits.
djtodoro added a parent revision: D82546: [Debugify][OriginalMode] Export the 
report into JSON file.

In order to test the preservation of the original Debug Info metadata in your 
projects, a front end option could be very useful, since users usually report 
that a concrete entity (e.g. variable `x`, or function `fn2()`) is missing 
debug info. The [0] is an example of running the utility on GDB Project.

[0] https://djolertrk.github.io/di-checker-html-report-example/


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82547

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/CC1Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/DebugInfo/debugify-each-original.c
  llvm/docs/HowToUpdateDebugInfo.rst

Index: llvm/docs/HowToUpdateDebugInfo.rst
===
--- llvm/docs/HowToUpdateDebugInfo.rst
+++ llvm/docs/HowToUpdateDebugInfo.rst
@@ -317,6 +317,16 @@
 
   $ llvm-debugify-original.py sample.json sample.html
 
+The `original` mode can be invoked from front-end level as follows:
+
+.. code-block:: bash
+
+  # Test each pass.
+  $ clang -Xclang -fenable-debugify-each-original -g -O2 sample.c
+
+  # Test each pass and export the issues report into the JSON file.
+  $ clang -Xclang -fenable-debugify-each-original -Xclang -fenable-debugify-original-export=sample.json -g -O2 sample.c
+
 Using ``debugify``
 ^^
 
Index: clang/test/DebugInfo/debugify-each-original.c
===
--- /dev/null
+++ clang/test/DebugInfo/debugify-each-original.c
@@ -0,0 +1,57 @@
+// RUN: %clang -g -Xclang -fenable-debugify-each-original -emit-llvm -S \
+// RUN: -O1 -o - %s 2>&1 | FileCheck %s
+
+int main()
+{
+  int x = 1;
+  int y = 2;
+  return x + y;
+}
+
+// CHECK: Force set function attributes: PASS
+// CHECK-NEXT: Infer set function attributes: PASS
+// CHECK-NEXT: Interprocedural Sparse Conditional Constant Propagation: PASS
+// CHECK-NEXT: Called Value Propagation: PASS
+// CHECK-NEXT: Global Variable Optimizer: PASS
+// CHECK-NEXT: Promote Memory to Register: PASS
+// CHECK-NEXT: Dead Argument Elimination: PASS
+// CHECK-NEXT: Combine redundant instructions: PASS
+// CHECK-NEXT: Simplify the CFG: PASS
+// CHECK-NEXT: Globals Alias Analysis: PASS
+// CHECK-NEXT: SROA: PASS
+// CHECK-NEXT: Early CSE w/ MemorySSA: PASS
+// CHECK-NEXT: Simplify the CFG: PASS
+// CHECK-NEXT: Combine redundant instructions: PASS
+// CHECK-NEXT: Conditionally eliminate dead library calls: PASS
+// CHECK-NEXT: PGOMemOPSize: PASS
+// CHECK-NEXT: Simplify the CFG: PASS
+// CHECK-NEXT: Reassociate expressions: PASS
+// CHECK-NEXT: Simplify the CFG: PASS
+// CHECK-NEXT: Combine redundant instructions: PASS
+// CHECK-NEXT: MemCpy Optimization: PASS
+// CHECK-NEXT: Sparse Conditional Constant Propagation: PASS
+// CHECK-NEXT: Bit-Tracking Dead Code Elimination: PASS
+// CHECK-NEXT: Combine redundant instructions: PASS
+// CHECK-NEXT: Aggressive Dead Code Elimination: PASS
+// CHECK-NEXT: Simplify the CFG: PASS
+// CHECK-NEXT: Combine redundant instructions: PASS
+// CHECK-NEXT: A No-Op Barrier Pass: PASS
+// CHECK-NEXT: Deduce function attributes in RPO: PASS
+// CHECK-NEXT: Global Variable Optimizer: PASS
+// CHECK-NEXT: Dead Global Elimination: PASS
+// CHECK-NEXT: Globals Alias Analysis: PASS
+// CHECK-NEXT: Float to int: PASS
+// CHECK-NEXT: Lower constant intrinsics: PASS
+// CHECK-NEXT: Loop Distribution: PASS
+// CHECK-NEXT: Loop Vectorization: PASS
+// CHECK-NEXT: Loop Load Elimination: PASS
+// CHECK-NEXT: Combine redundant instructions: PASS
+// CHECK-NEXT: Simplify the CFG: PASS
+// CHECK-NEXT: Optimize scalar/vector ops: PASS
+// CHECK-NEXT: Combine redundant instructions: PASS
+// CHECK-NEXT: Warn about non-applied transformations: PASS
+// CHECK-NEXT: Alignment from assumptions: PASS
+// CHECK-NEXT: Strip Unused Function Prototypes: PASS
+// CHECK-NEXT: Remove redundant instructions: PASS
+// CHECK-NEXT: Hoist/decompose integer division and remainder: PASS
+// CHECK-NEXT: Simplify the CFG: PASS
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -791,6 +791,16 @@
   llvm::is_contained(DebugEntryValueArchs, T.getArch()))
 Opts.EmitCallSiteInfo = true;
 
+  Opts.EnableDebugifyEachOriginal =
+  Args.hasArg(OPT_fenable_debugify_each_original);
+  // Ignore the option if the -fenable-debugify-each-original wasn't enabled.
+  if (Opts.EnableDebugifyEachOriginal &&
+  

[PATCH] D82448: [AArch64][SVE] Add bfloat16 support to store intrinsics

2020-06-25 Thread Kerry McLaughlin via Phabricator via cfe-commits
kmclaughlin updated this revision to Diff 273331.
kmclaughlin added a comment.

- Added HasSVE to Predicates in AArch64SVEInstrInfo.td
- Removed unnecessary indentation changes in AArch64SVEInstrInfo.td
- Removed hasBF16 variable from performST1Combine/performSTNT1Combine


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

https://reviews.llvm.org/D82448

Files:
  clang/include/clang/Basic/arm_sve.td
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_st1-bfloat.c
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_stnt1-bfloat.c
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
  llvm/test/CodeGen/AArch64/sve-intrinsics-st1-addressing-mode-reg-imm.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-st1-addressing-mode-reg-reg.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-st1.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-stores.ll
  llvm/test/CodeGen/AArch64/sve-masked-ldst-nonext.ll
  llvm/test/CodeGen/AArch64/sve-pred-contiguous-ldst-addressing-mode-reg-imm.ll
  llvm/test/CodeGen/AArch64/sve-pred-contiguous-ldst-addressing-mode-reg-reg.ll
  
llvm/test/CodeGen/AArch64/sve-pred-non-temporal-ldst-addressing-mode-reg-imm.ll
  
llvm/test/CodeGen/AArch64/sve-pred-non-temporal-ldst-addressing-mode-reg-reg.ll

Index: llvm/test/CodeGen/AArch64/sve-pred-non-temporal-ldst-addressing-mode-reg-reg.ll
===
--- llvm/test/CodeGen/AArch64/sve-pred-non-temporal-ldst-addressing-mode-reg-reg.ll
+++ llvm/test/CodeGen/AArch64/sve-pred-non-temporal-ldst-addressing-mode-reg-reg.ll
@@ -94,6 +94,20 @@
   ret void
 }
 
+define void @test_masked_ldst_sv8bf16(bfloat* %base,  %mask, i64 %offset) nounwind #0 {
+; CHECK-LABEL: test_masked_ldst_sv8bf16:
+; CHECK-NEXT: ldnt1h { z[[DATA:[0-9]+]].h }, p0/z, [x0, x1, lsl #1]
+; CHECK-NEXT: stnt1h { z[[DATA]].h }, p0, [x0, x1, lsl #1]
+; CHECK-NEXT: ret
+  %gep = getelementptr bfloat, bfloat* %base, i64 %offset
+  %data = call  @llvm.aarch64.sve.ldnt1.nxv8bf16( %mask,
+  bfloat* %gep)
+  call void @llvm.aarch64.sve.stnt1.nxv8bf16( %data,
+  %mask,
+ bfloat* %gep)
+  ret void
+}
+
 ; 16-lane non-temporal load/stores.
 
 define void @test_masked_ldst_sv16i8(i8* %base,  %mask, i64 %offset) nounwind {
@@ -121,6 +135,7 @@
 ; 8-element non-temporal loads.
 declare  @llvm.aarch64.sve.ldnt1.nxv8i16(, i16*)
 declare  @llvm.aarch64.sve.ldnt1.nxv8f16(, half*)
+declare  @llvm.aarch64.sve.ldnt1.nxv8bf16(, bfloat*)
 
 ; 16-element non-temporal loads.
 declare  @llvm.aarch64.sve.ldnt1.nxv16i8(, i8*)
@@ -128,14 +143,18 @@
 ; 2-element non-temporal stores.
 declare void @llvm.aarch64.sve.stnt1.nxv2i64(, , i64*)
 declare void @llvm.aarch64.sve.stnt1.nxv2f64(, , double*)
-  
-; 4-element non-temporal stores.
+
+; 4-element non-temporal stores.
 declare void @llvm.aarch64.sve.stnt1.nxv4i32(, , i32*)
 declare void @llvm.aarch64.sve.stnt1.nxv4f32(, , float*)
-  
-; 8-element non-temporal stores.
+
+; 8-element non-temporal stores.
 declare void @llvm.aarch64.sve.stnt1.nxv8i16(, , i16*)
 declare void @llvm.aarch64.sve.stnt1.nxv8f16(, , half*)
+declare void @llvm.aarch64.sve.stnt1.nxv8bf16(, , bfloat*)
 
 ; 16-element non-temporal stores.
 declare void @llvm.aarch64.sve.stnt1.nxv16i8(, , i8*)
+
+; +bf16 is required for the bfloat version.
+attributes #0 = { "target-features"="+sve,+bf16" }
Index: llvm/test/CodeGen/AArch64/sve-pred-non-temporal-ldst-addressing-mode-reg-imm.ll
===
--- llvm/test/CodeGen/AArch64/sve-pred-non-temporal-ldst-addressing-mode-reg-imm.ll
+++ llvm/test/CodeGen/AArch64/sve-pred-non-temporal-ldst-addressing-mode-reg-imm.ll
@@ -139,6 +139,23 @@
   ret void
 }
 
+define void @test_masked_ldst_sv8bf16( * %base,  %mask) nounwind #0 {
+; CHECK-LABEL: test_masked_ldst_sv8bf16:
+; CHECK-NEXT: ldnt1h { z[[DATA:[0-9]+]].h }, p0/z, [x0, #-1, mul vl]
+; CHECK-NEXT: stnt1h { z[[DATA]].h }, p0, [x0, #2, mul vl]
+; CHECK-NEXT: ret
+  %base_load = getelementptr , * %base, i64 -1
+  %base_load_bc = bitcast * %base_load to bfloat*
+  %data = call  @llvm.aarch64.sve.ldnt1.nxv8bf16( %mask,
+  bfloat* %base_load_bc)
+  %base_store = getelementptr ,  * %base, i64 2
+  %base_store_bc = bitcast * %base_store to bfloat*
+  call void @llvm.aarch64.sve.stnt1.nxv8bf16( %data,
+  %mask,
+ bfloat* %base_store_bc)
+  ret void
+}
+
 ; 16-lane non-temporal load/stores.
 
 define void @test_masked_ldst_sv16i8( * %base,  

[PATCH] D82448: [AArch64][SVE] Add bfloat16 support to store intrinsics

2020-06-25 Thread Kerry McLaughlin via Phabricator via cfe-commits
kmclaughlin marked 4 inline comments as done.
kmclaughlin added a comment.

Thanks for reviewing this again, @fpetrogalli!




Comment at: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_st1-bfloat.c:4
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC 
-triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 
-fallow-half-arguments-and-returns -fsyntax-only -verify 
-verify-ignore-unexpected=error -verify-ignore-unexpected=note %s
+
+#include 

fpetrogalli wrote:
> Nit: is it worth adding the `ASM-NOT: warning` check that is used in other 
> tests? Of course, only if it doesn't fail, for in such case we would have to 
> address the problem in a separate patch.
> 
> (Same for all the new C tests added in this patch).
Adding the check doesn't fail, but I will add these checks to the load & store 
tests in a separate patch


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

https://reviews.llvm.org/D82448



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


[PATCH] D82486: RecursiveASTVisitor: don't call WalkUp unnecessarily in post-order traversal

2020-06-25 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel added inline comments.



Comment at: clang/include/clang/AST/RecursiveASTVisitor.h:335
+  template  struct is_same_method_impl {
+static bool isSameMethod(...) { return false; }
+  };

Why use var-args rather than spelling out the type arguments like you have on 
lines 339-341 or, simpler, line 351?



Comment at: clang/include/clang/AST/RecursiveASTVisitor.h:339
+  template <> struct is_same_method_impl {
+template (S))); break;
+if (isSameMethod(::Traverse##CLASS,
\
+ ::Traverse##CLASS)) { 
\

Do you explain this logic somewhere? Or do you feel it will be obvious to the 
reader? (I don't have a good intuition about this class to judge).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82486



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


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

2020-06-25 Thread Bevin Hansson via Phabricator via cfe-commits
ebevhan added a comment.

The last patchset contains the comment about rounding, so I think I will 
consider this accepted.

As a final addendum to the discussion on rounding and overflow... The last 
Appendix to the E-C TR does actually say:

  2.   In the first edition requires that overflow handling is done before 
rounding; for the second edition the order is changed: rounding should be done 
first, followed by overflow handling. Note that this change does not affect any 
result when the overflow mode is saturation. 

The wording in the main text could be a bit clearer about it being explicit, 
though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73186



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


[PATCH] D82445: [analyzer][solver] Track symbol equivalence

2020-06-25 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:537
+  // true for equality and false for disequality.
+  bool IsEquality = true;
+

vsavchenko wrote:
> NoQ wrote:
> > Do i understand correctly that this isn't used yet and it's for the later 
> > patches?
> Not exactly, it is used in two symmetric cases:
>   # We assumed a condition and we try to understand if what we assumed is an 
> equality operation
>   # We try understand something about a symbol and we want to understand if 
> it is an equality operation
> 
> So, in the first case, the branch covering `IsEquality == false` does nothing 
> and is designed for the later patches.
> 
> The second case, however, does work right now.  If we see an equality 
> operation where operands are known to be a part of the same class, we can 
> tell for sure the result of the comparison.  This way `a == b` is `true` and 
> `a != b` is `false`.  You can find this logic in `getRangeForEqualities`.
Ok, makes sense!



Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1603-1604
 ProgramStateRef
 RangeConstraintManager::removeDeadBindings(ProgramStateRef State,
SymbolReaper ) {
+  ClassMembersTy ClassMembersMap = State->get();

vsavchenko wrote:
> NoQ wrote:
> > Ok, this turned out to be much scarier than i expected. At least, can we 
> > somehow assert that our data structures remain internally consistent after 
> > these operations? I.e., things like "a symbol points to an equivalence 
> > class iff it belongs to the set of members of that class", etc.
> Assertion like this might cost us double of what we have in this function 
> right now.
Sounds pretty amazing and worth every microsecond.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82445



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


[PATCH] D82518: [openmp] Use Directive_enumSize instead of OMPD_unknown position

2020-06-25 Thread Valentin Clement via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5b9ce07a761f: [openmp] Use Directive_enumSize instead of 
OMPD_unknown position (authored by clementval).

Changed prior to commit:
  https://reviews.llvm.org/D82518?vs=273216=273327#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82518

Files:
  clang/lib/Basic/OpenMPKinds.cpp
  clang/lib/Parse/ParseOpenMP.cpp


Index: clang/lib/Parse/ParseOpenMP.cpp
===
--- clang/lib/Parse/ParseOpenMP.cpp
+++ clang/lib/Parse/ParseOpenMP.cpp
@@ -194,8 +194,9 @@
   DKind = F[I][2];
 }
   }
-  return DKind < OMPD_unknown ? static_cast(DKind)
-  : OMPD_unknown;
+  return unsigned(DKind) < llvm::omp::Directive_enumSize
+ ? static_cast(DKind)
+ : OMPD_unknown;
 }
 
 static DeclarationName parseOpenMPReductionId(Parser ) {
Index: clang/lib/Basic/OpenMPKinds.cpp
===
--- clang/lib/Basic/OpenMPKinds.cpp
+++ clang/lib/Basic/OpenMPKinds.cpp
@@ -580,7 +580,7 @@
 void clang::getOpenMPCaptureRegions(
 SmallVectorImpl ,
 OpenMPDirectiveKind DKind) {
-  assert(DKind <= OMPD_unknown);
+  assert(unsigned(DKind) < llvm::omp::Directive_enumSize);
   switch (DKind) {
   case OMPD_parallel:
   case OMPD_parallel_for:


Index: clang/lib/Parse/ParseOpenMP.cpp
===
--- clang/lib/Parse/ParseOpenMP.cpp
+++ clang/lib/Parse/ParseOpenMP.cpp
@@ -194,8 +194,9 @@
   DKind = F[I][2];
 }
   }
-  return DKind < OMPD_unknown ? static_cast(DKind)
-  : OMPD_unknown;
+  return unsigned(DKind) < llvm::omp::Directive_enumSize
+ ? static_cast(DKind)
+ : OMPD_unknown;
 }
 
 static DeclarationName parseOpenMPReductionId(Parser ) {
Index: clang/lib/Basic/OpenMPKinds.cpp
===
--- clang/lib/Basic/OpenMPKinds.cpp
+++ clang/lib/Basic/OpenMPKinds.cpp
@@ -580,7 +580,7 @@
 void clang::getOpenMPCaptureRegions(
 SmallVectorImpl ,
 OpenMPDirectiveKind DKind) {
-  assert(DKind <= OMPD_unknown);
+  assert(unsigned(DKind) < llvm::omp::Directive_enumSize);
   switch (DKind) {
   case OMPD_parallel:
   case OMPD_parallel_for:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82518: [openmp] Use Directive_enumSize instead of OMPD_unknown position

2020-06-25 Thread Valentin Clement via Phabricator via cfe-commits
clementval marked 2 inline comments as done.
clementval added inline comments.



Comment at: clang/lib/Basic/OpenMPKinds.cpp:583
 OpenMPDirectiveKind DKind) {
-  assert(DKind <= OMPD_unknown);
+  assert(unsigned(DKind) <= llvm::omp::Directive_enumSize);
   switch (DKind) {

jdoerfert wrote:
> `<`, right?
You are right.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82518



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


[PATCH] D82535: [CodeComplete] Add code completion for using alias.

2020-06-25 Thread liu hui via Phabricator via cfe-commits
lh123 updated this revision to Diff 273321.
lh123 marked 3 inline comments as done.
lh123 added a comment.

Address comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82535

Files:
  clang/lib/Sema/SemaCodeComplete.cpp
  clang/test/CodeCompletion/ordinary-name-cxx11.cpp
  clang/test/CodeCompletion/ordinary-name.cpp

Index: clang/test/CodeCompletion/ordinary-name.cpp
===
--- clang/test/CodeCompletion/ordinary-name.cpp
+++ clang/test/CodeCompletion/ordinary-name.cpp
@@ -59,6 +59,7 @@
   // CHECK-CC1-NEXT: COMPLETION: Pattern : typeof(<#type#>)
   // CHECK-CC1-NEXT: COMPLETION: union
   // CHECK-CC1-NEXT: COMPLETION: unsigned
+  // CHECK-CC1-NOT: COMPLETION: Pattern : using <#name#> = <#type#>;
   // CHECK-CC1-NEXT: COMPLETION: Pattern : using namespace <#identifier#>;
   // CHECK-CC1-NEXT: COMPLETION: void
   // CHECK-CC1-NEXT: COMPLETION: volatile
@@ -103,6 +104,7 @@
   // CHECK-CC2-NEXT: COMPLETION: union
   // CHECK-CC2-NEXT: COMPLETION: unsigned
   // CHECK-CC2-NEXT: COMPLETION: Pattern : using <#qualifier#>::<#name#>;
+  // CHECK-CC2-NOT: COMPLETION: Pattern : using <#name#> = <#type#>;
   // CHECK-CC2-NEXT: COMPLETION: Pattern : using namespace <#identifier#>;
   // CHECK-CC2-NEXT: COMPLETION: void
   // CHECK-CC2-NEXT: COMPLETION: volatile
@@ -140,6 +142,7 @@
   // CHECK-CC3-NEXT: COMPLETION: union
   // CHECK-CC3-NEXT: COMPLETION: unsigned
   // CHECK-CC3-NEXT: COMPLETION: Pattern : using <#qualifier#>::<#name#>;
+  // CHECK-CC3-NOT: COMPLETION: Pattern : using <#name#> = <#type#>;
   // CHECK-CC3-NEXT: COMPLETION: virtual
   // CHECK-CC3-NEXT: COMPLETION: void
   // CHECK-CC3-NEXT: COMPLETION: volatile
@@ -232,6 +235,7 @@
   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : typeof(<#type#>)
   // CHECK-NO-RTTI-NEXT: COMPLETION: union
   // CHECK-NO-RTTI-NEXT: COMPLETION: unsigned
+  // CHECK-NO-RTTI-NOT: COMPLETION: Pattern : using <#name#> = <#type#>;
   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : using namespace <#identifier#>;
   // CHECK-NO-RTTI-NEXT: COMPLETION: void
   // CHECK-NO-RTTI-NEXT: COMPLETION: volatile
Index: clang/test/CodeCompletion/ordinary-name-cxx11.cpp
===
--- clang/test/CodeCompletion/ordinary-name-cxx11.cpp
+++ clang/test/CodeCompletion/ordinary-name-cxx11.cpp
@@ -62,6 +62,7 @@
   // CHECK-CC1-NEXT: COMPLETION: Pattern : typeof(<#type#>)
   // CHECK-CC1-NEXT: COMPLETION: union
   // CHECK-CC1-NEXT: COMPLETION: unsigned
+  // CHECK-CC1-NEXT: COMPLETION: Pattern : using <#name#> = <#type#>;
   // CHECK-CC1-NEXT: COMPLETION: Pattern : using namespace <#identifier#>;
   // CHECK-CC1-NEXT: COMPLETION: void
   // CHECK-CC1-NEXT: COMPLETION: volatile
@@ -113,6 +114,7 @@
   // CHECK-CC2-NEXT: COMPLETION: union
   // CHECK-CC2-NEXT: COMPLETION: unsigned
   // CHECK-CC2-NEXT: COMPLETION: Pattern : using <#qualifier#>::<#name#>;
+  // CHECK-CC2-NEXT: COMPLETION: Pattern : using <#name#> = <#type#>;
   // CHECK-CC2-NEXT: COMPLETION: Pattern : using namespace <#identifier#>;
   // CHECK-CC2-NEXT: COMPLETION: void
   // CHECK-CC2-NEXT: COMPLETION: volatile
@@ -156,6 +158,7 @@
   // CHECK-CC3-NEXT: COMPLETION: union
   // CHECK-CC3-NEXT: COMPLETION: unsigned
   // CHECK-CC3-NEXT: COMPLETION: Pattern : using <#qualifier#>::<#name#>
+  // CHECK-CC3-NEXT: COMPLETION: Pattern : using <#name#> = <#type#>;
   // CHECK-CC3-NEXT: COMPLETION: virtual
   // CHECK-CC3-NEXT: COMPLETION: void
   // CHECK-CC3-NEXT: COMPLETION: volatile
@@ -264,6 +267,7 @@
   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : typeof(<#type#>)
   // CHECK-NO-RTTI-NEXT: COMPLETION: union
   // CHECK-NO-RTTI-NEXT: COMPLETION: unsigned
+  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : using <#name#> = <#type#>;
   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : using namespace <#identifier#>;
   // CHECK-NO-RTTI-NEXT: COMPLETION: void
   // CHECK-NO-RTTI-NEXT: COMPLETION: volatile
Index: clang/lib/Sema/SemaCodeComplete.cpp
===
--- clang/lib/Sema/SemaCodeComplete.cpp
+++ clang/lib/Sema/SemaCodeComplete.cpp
@@ -1816,6 +1816,18 @@
   Results.AddResult(CodeCompletionResult(Builder.TakeString()));
 }
 
+// using name = type
+static void AddUsingAliasResult(CodeCompletionBuilder ,
+ResultBuilder ) {
+  Builder.AddTypedTextChunk("using");
+  Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);
+  Builder.AddPlaceholderChunk("name");
+  Builder.AddChunk(CodeCompletionString::CK_Equal);
+  Builder.AddPlaceholderChunk("type");
+  Builder.AddChunk(CodeCompletionString::CK_SemiColon);
+  Results.AddResult(CodeCompletionResult(Builder.TakeString()));
+}
+
 static bool WantTypesInContext(Sema::ParserCompletionContext CCC,
const LangOptions ) {
   switch (CCC) {
@@ -2059,6 +2071,9 @@
   

[PATCH] D69987: [RISCV] Assemble/Disassemble v-ext instructions.

2020-06-25 Thread Alex Bradbury via Phabricator via cfe-commits
asb added inline comments.



Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoV.td:9
+///
+/// This file describes the RISC-V instructions from the standard 'V',
+/// Vector instruction set extension.

Please add similar language as in RISCVInstrInfoB.td to indicate the version 
being described and explain this version is experimental and hasn't been 
ratified.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69987



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


[clang] 5b9ce07 - [openmp] Use Directive_enumSize instead of OMPD_unknown position

2020-06-25 Thread via cfe-commits

Author: Valentin Clement
Date: 2020-06-25T09:18:54-04:00
New Revision: 5b9ce07a761f7d62ad793f9827750243de597215

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

LOG: [openmp] Use Directive_enumSize instead of OMPD_unknown position

Summary:
Previously OMPD_unknown was last item in the Directive enumeration and its 
position was
used in various comparison and assertion. With the new Directive enumeration, 
this should be
change with  llvm::omp::Directive_enumSize. This patch fix two place where it 
was not done in
D81736.

Reviewers: vdmitrie, jdoerfert, jdenny

Reviewed By: jdoerfert

Subscribers: yaxunl, guansong, sstefan1, cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/lib/Basic/OpenMPKinds.cpp
clang/lib/Parse/ParseOpenMP.cpp

Removed: 




diff  --git a/clang/lib/Basic/OpenMPKinds.cpp b/clang/lib/Basic/OpenMPKinds.cpp
index a000e4dee3b8..87d2c4b5a056 100644
--- a/clang/lib/Basic/OpenMPKinds.cpp
+++ b/clang/lib/Basic/OpenMPKinds.cpp
@@ -580,7 +580,7 @@ bool 
clang::isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind) {
 void clang::getOpenMPCaptureRegions(
 SmallVectorImpl ,
 OpenMPDirectiveKind DKind) {
-  assert(DKind <= OMPD_unknown);
+  assert(unsigned(DKind) < llvm::omp::Directive_enumSize);
   switch (DKind) {
   case OMPD_parallel:
   case OMPD_parallel_for:

diff  --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 546a265cff85..9fa57d8c9791 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -194,8 +194,9 @@ static OpenMPDirectiveKindExWrapper 
parseOpenMPDirectiveKind(Parser ) {
   DKind = F[I][2];
 }
   }
-  return DKind < OMPD_unknown ? static_cast(DKind)
-  : OMPD_unknown;
+  return unsigned(DKind) < llvm::omp::Directive_enumSize
+ ? static_cast(DKind)
+ : OMPD_unknown;
 }
 
 static DeclarationName parseOpenMPReductionId(Parser ) {



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


Re: [PATCH] D82225: [libTooling] Delete deprecated `Stencil` combinators.

2020-06-25 Thread Yitzhak Mandelbaum via cfe-commits
Thanks for alerting me. Why is it important to strip out this information?
Also, might this be something we can change on the arcanist side (to not
add to the commit message) rather than strip out on the git end?

On Wed, Jun 24, 2020 at 3:28 PM Fangrui Song via Phabricator <
revi...@reviews.llvm.org> wrote:

> MaskRay added a comment.
>
> Hi, your git commit contains extra Phabricator tags. You can drop
> `Reviewers:` `Subscribers:` `Tags:` and the text `Summary:` from the git
> commit with the following script:
>
>   arcfilter () {
>   arc amend
>   git log -1 --pretty=%B | awk '/Reviewers:|Subscribers:/{p=1}
> /Reviewed By:|Differential Revision:/{p=0} !p && !/^Summary:$/
> {sub(/^Summary: /,"");print}' | git commit --amend --date=now -F -
>   }
>
> `Reviewed By: ` is considered important by some people. Please keep the
> tag. (I have updated my script to use `--date=now` (setting author date to
> committer date))
>
> `https://reviews.llvm.org/D80978` 
> contains a git pre-push hook to automate this.
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D82225/new/
>
> https://reviews.llvm.org/D82225
>
>
>
>


smime.p7s
Description: S/MIME Cryptographic Signature
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


<    1   2   3   >