[PATCH] D135750: [clang][Interp] Track initialization state of local variables

2022-12-26 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 485271.
tbaeder added a comment.

Add missing inline descriptor handling to local variables created in the 
EvalEmitter.


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

https://reviews.llvm.org/D135750

Files:
  clang/lib/AST/Interp/ByteCodeExprGen.cpp
  clang/lib/AST/Interp/ByteCodeStmtGen.cpp
  clang/lib/AST/Interp/Context.cpp
  clang/lib/AST/Interp/Descriptor.cpp
  clang/lib/AST/Interp/Descriptor.h
  clang/lib/AST/Interp/EvalEmitter.cpp
  clang/lib/AST/Interp/Interp.h
  clang/lib/AST/Interp/InterpBlock.h
  clang/lib/AST/Interp/InterpFrame.cpp
  clang/lib/AST/Interp/InterpFrame.h
  clang/lib/AST/Interp/Pointer.cpp
  clang/lib/AST/Interp/Pointer.h
  clang/lib/AST/Interp/Program.cpp
  clang/lib/AST/Interp/Program.h
  clang/test/AST/Interp/cxx20.cpp
  clang/test/AST/Interp/literals.cpp
  clang/test/AST/Interp/loops.cpp

Index: clang/test/AST/Interp/loops.cpp
===
--- clang/test/AST/Interp/loops.cpp
+++ clang/test/AST/Interp/loops.cpp
@@ -5,6 +5,7 @@
 
 // ref-no-diagnostics
 // expected-no-diagnostics
+// expected-cpp20-no-diagnostics
 
 namespace WhileLoop {
   constexpr int f() {
@@ -165,8 +166,6 @@
   static_assert(f5(true) == 8, "");
   static_assert(f5(false) == 5, "");
 
-  /// FIXME: This should be accepted in C++20 but is currently being rejected
-  ///   because the variable declaration doesn't have an initializier.
 #if __cplusplus >= 202002L
   constexpr int f6() {
 int i;
@@ -176,7 +175,7 @@
 } while (true);
 return i;
   }
-  static_assert(f6() == 5, ""); // expected-cpp20-error {{not an integral constant}}
+  static_assert(f6() == 5, "");
 #endif
 
 #if 0
Index: clang/test/AST/Interp/literals.cpp
===
--- clang/test/AST/Interp/literals.cpp
+++ clang/test/AST/Interp/literals.cpp
@@ -407,8 +407,7 @@
 return 1;
   }
   static_assert(uninit(), ""); // ref-error {{not an integral constant expression}} \
-   // ref-note {{in call to 'uninit()'}} \
-   // expected-error {{not an integral constant expression}}
+   // ref-note {{in call to 'uninit()'}}
 
   constexpr int OverFlow() { // ref-error {{never produces a constant expression}}
 int a = INT_MAX;
Index: clang/test/AST/Interp/cxx20.cpp
===
--- clang/test/AST/Interp/cxx20.cpp
+++ clang/test/AST/Interp/cxx20.cpp
@@ -56,33 +56,51 @@
 }
 static_assert(pointerAssign2() == 12, "");
 
-
 constexpr int unInitLocal() {
   int a;
-  return a; // ref-note{{read of uninitialized object}}
+  return a; // ref-note {{read of uninitialized object}} \
+// expected-note {{read of object outside its lifetime}}
+// FIXME: ^^^ Wrong diagnostic.
 }
-static_assert(unInitLocal() == 0, ""); // expected-error {{not an integral constant expression}} \
-   // ref-error {{not an integral constant expression}} \
-   // ref-note {{in call to 'unInitLocal()'}}
-
-/// TODO: The example above is correctly rejected by the new constexpr
-///   interpreter, but for the wrong reasons. We don't reject it because
-///   it is an uninitialized read, we reject it simply because
-///   the local variable does not have an initializer.
-///
-///   The code below should be accepted but is also being rejected
-///   right now.
-#if 0
+static_assert(unInitLocal() == 0, ""); // ref-error {{not an integral constant expression}} \
+   // ref-note {{in call to 'unInitLocal()'}} \
+   // expected-error {{not an integral constant expression}} \
+   // expected-note {{in call to 'unInitLocal()'}} \
+
 constexpr int initializedLocal() {
   int a;
-  int b;
-
   a = 20;
   return a;
 }
 static_assert(initializedLocal() == 20);
 
-/// Similar here, but the uninitialized local is passed as a function parameter.
+constexpr int initializedLocal2() {
+  int a[2];
+  return *a; // expected-note {{read of object outside its lifetime}} \
+ // ref-note {{read of uninitialized object is not allowed in a constant expression}}
+}
+static_assert(initializedLocal2() == 20); // expected-error {{not an integral constant expression}} \
+  // expected-note {{in call to}} \
+  // ref-error {{not an integral constant expression}} \
+  // ref-note {{in call to}}
+
+
+struct Int { int a; };
+constexpr int initializedLocal3() {
+  Int i;
+  return i.a; // expected-note {{read of object outside its lifetime}} \
+  // ref-note {{read of uninitialized object is not allowed in a constant expression}}
+}
+static_assert(initializedLocal3() ==

[PATCH] D82087: AMDGPU/clang: Add builtins for llvm.amdgcn.ballot

2022-12-26 Thread Sameer Sahasrabuddhe via Phabricator via cfe-commits
sameerds accepted this revision.
sameerds added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/lib/Basic/Targets/AMDGPU.cpp:353
+  if (HaveWave32 && HaveWave64) {
+Diags.Report(diag::err_invalid_feature_combination)
+<< "'wavefrontsize32' and 'wavefrontsize64' are mutually exclusive";

I would have preferred this to be a separate change, just like the FIXME for 
diagnosing wavefrontsize32 on targets that don't support it. But not feeling 
strongly enough to block this change!


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

https://reviews.llvm.org/D82087

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


[PATCH] D82087: AMDGPU/clang: Add builtins for llvm.amdgcn.ballot

2022-12-26 Thread Sameer Sahasrabuddhe via Phabricator via cfe-commits
sameerds added a comment.

And note that the change description is written in a first-person train of 
thought. Please do rewrite it!


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

https://reviews.llvm.org/D82087

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


[PATCH] D140619: ExtractFunction: support extracting expressions and selected part of it

2022-12-26 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

Linking to potentially relevant issue on file: 
https://github.com/clangd/clangd/issues/1254


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140619

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


[PATCH] D140155: [Clang][OpenMP] Allow host call to nohost function with host variant

2022-12-26 Thread Michał Górny via Phabricator via cfe-commits
mgorny closed this revision.
mgorny added a comment.

Thank you. I'm going to try if the same solution helps with D139723 
 too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140155

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


[clang] dab67c6 - [clang] [OpenMP] Test amdgcn_openmp_device_math_c.c test on 32-bit platforms

2022-12-26 Thread Michał Górny via cfe-commits

Author: Michał Górny
Date: 2022-12-26T10:38:40+01:00
New Revision: dab67c66932b9149842f7c8431e951f952125fc0

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

LOG: [clang] [OpenMP] Test amdgcn_openmp_device_math_c.c test on 32-bit 
platforms

Explicitly pass triple to the test compiler to prevent failure when
the host triple is 32-bit.  This is the same solution
as f74e3d2f81d2aae47d6032fc1d23114460d48a37, thanks to Joseph Huber
for it.

Added: 


Modified: 
clang/test/Headers/amdgcn_openmp_device_math_c.c

Removed: 




diff  --git a/clang/test/Headers/amdgcn_openmp_device_math_c.c 
b/clang/test/Headers/amdgcn_openmp_device_math_c.c
index 2a54e92ffc4fd..e8c3f3c88ce69 100644
--- a/clang/test/Headers/amdgcn_openmp_device_math_c.c
+++ b/clang/test/Headers/amdgcn_openmp_device_math_c.c
@@ -1,5 +1,5 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --function-signature --include-generated-funcs --replace-value-regex 
"__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" 
"pl_cond[.].+[.|,]"
-// RUN: %clang_cc1 -internal-isystem %S/Inputs/include -x c -fopenmp 
-fopenmp-targets=amdgcn-amd-amdhsa -D__OFFLOAD_ARCH_gfx90a__ -emit-llvm-bc %s 
-o %t-host.bc
+// RUN: %clang_cc1 -internal-isystem %S/Inputs/include -x c -fopenmp 
-fopenmp-targets=amdgcn-amd-amdhsa -triple powerpc64le-unknown-unknown 
-D__OFFLOAD_ARCH_gfx90a__ -emit-llvm-bc %s -o %t-host.bc
 // RUN: %clang_cc1 -include __clang_hip_runtime_wrapper.h -internal-isystem 
%S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h 
-internal-isystem %S/../../lib/Headers/openmp_wrappers -internal-isystem 
%S/Inputs/include -x c -fopenmp -triple amdgcn-amd-amdhsa -aux-triple 
x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s 
-fopenmp-is-device -fopenmp-host-ir-file-path %t-host.bc -o - | FileCheck %s 
--check-prefixes=CHECK
 // REQUIRES: amdgpu-registered-target
 



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


[PATCH] D139723: [OpenMP][AMDGPU] Enable use of abs labs and llabs math functions in C code

2022-12-26 Thread Michał Górny via Phabricator via cfe-commits
mgorny closed this revision.
mgorny added a comment.

I've pushed a fix in dab67c66932b9149842f7c8431e951f952125fc0 
, based on 
@jhuber6's fix from the other diff.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139723

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


[PATCH] D140614: [C++20] Mark lambdas in lambda specifiers as dependent if necessary

2022-12-26 Thread Liming Liu via Phabricator via cfe-commits
lime updated this revision to Diff 485276.
lime retitled this revision from "[C++20] Check the dependency of declaration 
contexts before pumping diagnostics" to "[C++20] Mark lambdas in lambda 
specifiers as dependent if necessary".
lime edited the summary of this revision.

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

https://reviews.llvm.org/D140614

Files:
  clang/lib/Parse/ParseExprCXX.cpp
  clang/test/SemaCXX/lambda-unevaluated.cpp


Index: clang/test/SemaCXX/lambda-unevaluated.cpp
===
--- clang/test/SemaCXX/lambda-unevaluated.cpp
+++ clang/test/SemaCXX/lambda-unevaluated.cpp
@@ -122,6 +122,22 @@
 static_assert(!__is_same(decltype(foo), void));
 } // namespace GH51641
 
+namespace GH57155 {
+auto foo(int t) {
+  int(*f)(int) = [](auto t) -> decltype([=] { return t; } ()) { return t; };
+  return f;
+}
+} // namespace GH57155
+
+namespace GH57170 {
+int(*f)(int) = [](auto t) -> decltype([] {
+return 0;
+  } ()
+){
+  return t;
+};
+} // namespace GH57170
+
 namespace StaticLambdas {
 template  struct Nothing {};
 Nothing<[]() static { return 0; }()> nothing;
Index: clang/lib/Parse/ParseExprCXX.cpp
===
--- clang/lib/Parse/ParseExprCXX.cpp
+++ clang/lib/Parse/ParseExprCXX.cpp
@@ -1477,6 +1477,9 @@
 
 T.consumeClose();
 
+MultiParseScope ScopeForGenericLambda(*this);
+if (Actions.getCurGenericLambda())
+  ScopeForGenericLambda.Enter(Scope::TemplateParamScope);
 // Parse lambda-specifiers.
 ParseLambdaSpecifiers(LParenLoc, /*DeclEndLoc=*/T.getCloseLocation(),
   ParamInfo, EllipsisLoc);


Index: clang/test/SemaCXX/lambda-unevaluated.cpp
===
--- clang/test/SemaCXX/lambda-unevaluated.cpp
+++ clang/test/SemaCXX/lambda-unevaluated.cpp
@@ -122,6 +122,22 @@
 static_assert(!__is_same(decltype(foo), void));
 } // namespace GH51641
 
+namespace GH57155 {
+auto foo(int t) {
+  int(*f)(int) = [](auto t) -> decltype([=] { return t; } ()) { return t; };
+  return f;
+}
+} // namespace GH57155
+
+namespace GH57170 {
+int(*f)(int) = [](auto t) -> decltype([] {
+return 0;
+  } ()
+){
+  return t;
+};
+} // namespace GH57170
+
 namespace StaticLambdas {
 template  struct Nothing {};
 Nothing<[]() static { return 0; }()> nothing;
Index: clang/lib/Parse/ParseExprCXX.cpp
===
--- clang/lib/Parse/ParseExprCXX.cpp
+++ clang/lib/Parse/ParseExprCXX.cpp
@@ -1477,6 +1477,9 @@
 
 T.consumeClose();
 
+MultiParseScope ScopeForGenericLambda(*this);
+if (Actions.getCurGenericLambda())
+  ScopeForGenericLambda.Enter(Scope::TemplateParamScope);
 // Parse lambda-specifiers.
 ParseLambdaSpecifiers(LParenLoc, /*DeclEndLoc=*/T.getCloseLocation(),
   ParamInfo, EllipsisLoc);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D140668: [clang][Interp] Implement remaining bits for MaterializeTemporaryExprs

2022-12-26 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision.
tbaeder added reviewers: aaron.ballman, tahonermann, erichkeane, shafik.
Herald added a project: All.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

I still have this mixed up with the `CompoundLiteral` code since this is was I 
used for testing. I can split this up if needed of course.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140668

Files:
  clang/lib/AST/Interp/ByteCodeExprGen.cpp
  clang/lib/AST/Interp/ByteCodeExprGen.h
  clang/test/AST/Interp/literals.cpp
  clang/test/AST/Interp/records.cpp

Index: clang/test/AST/Interp/records.cpp
===
--- clang/test/AST/Interp/records.cpp
+++ clang/test/AST/Interp/records.cpp
@@ -50,9 +50,6 @@
 static_assert(ints2.b == -30, "");
 static_assert(!ints2.c, "");
 
-#if __cplusplus >= 201703L
-// FIXME: In c++14, this uses a MaterializeTemporaryExpr,
-//   which the new interpreter doesn't support yet.
 constexpr Ints getInts() {
   return {64, 128, true};
 }
@@ -60,7 +57,6 @@
 static_assert(ints3.a == 64, "");
 static_assert(ints3.b == 128, "");
 static_assert(ints3.c, "");
-#endif
 
 constexpr Ints ints4 = {
   .a = 40 * 50,
@@ -88,9 +84,9 @@
   int a = 10;
   int b;
 };
-// FIXME: Broken in the new constant interpreter.
-//   Should be rejected, but without asan errors.
-//constexpr Ints2 ints2;
+constexpr Ints2 ints22; // expected-error {{without a user-provided default constructor}} \
+// expected-error {{must be initialized by a constant expression}} \
+// ref-error {{without a user-provided default constructor}}
 
 class C {
   public:
@@ -124,9 +120,6 @@
 }
 static_assert(getPointer()->a == 100, "");
 
-#if __cplusplus >= 201703L
-// FIXME: In c++14, this uses a MaterializeTemporaryExpr,
-//   which the new interpreter doesn't support yet.
 constexpr C RVOAndParams(const C *c) {
   return C();
 }
@@ -137,7 +130,6 @@
   return C();
 }
 constexpr C RVOAndParamsResult2 = RVOAndParams(12);
-#endif
 
 class Bar { // expected-note {{definition of 'Bar' is not complete}} \
 // ref-note {{definition of 'Bar' is not complete}}
@@ -158,16 +150,16 @@
   c.a = 10;
 
   // Assignment, not an initializer.
-  // c = C(); FIXME
+  c = C();
   c.a = 10;
 
 
   // Assignment, not an initializer.
-  //c = RVOAndParams(&c); FIXME
+  c = RVOAndParams(&c);
 
   return c.a;
 }
-static_assert(locals() == 10, "");
+static_assert(locals() == 100, "");
 
 namespace thisPointer {
   struct S {
@@ -234,10 +226,7 @@
 this->a; // expected-warning {{expression result unused}} \
  // ref-warning {{expression result unused}}
 get5();
-#if __cplusplus >= 201703L
-// FIXME: Enable once we support MaterializeConstantExpr properly.
 getInts();
-#endif
   }
 
   constexpr int m() const {
Index: clang/test/AST/Interp/literals.cpp
===
--- clang/test/AST/Interp/literals.cpp
+++ clang/test/AST/Interp/literals.cpp
@@ -665,3 +665,27 @@
   // ref-note {{in call to 'IntMul}}
 };
 #endif
+
+namespace CompoundLiterals {
+  constexpr int get5() {
+return (int[]){1,2,3,4,5}[4];
+  }
+  static_assert(get5() == 5, "");
+
+  constexpr int get6(int f = (int[]){1,2,6}[2]) { // ref-note {{subexpression not valid in a constant expression}} \
+  // ref-note {{declared here}}
+return f;
+  }
+  static_assert(get6(6) == 6, "");
+  // FIXME: Who's right here?
+  static_assert(get6() == 6, ""); // ref-error {{not an integral constant expression}}
+
+#if __cplusplus >= 202002L
+  constexpr int get3() {
+int m;
+m = (int){3};
+return m;
+  }
+  static_assert(get3() == 3, "");
+#endif
+};
Index: clang/lib/AST/Interp/ByteCodeExprGen.h
===
--- clang/lib/AST/Interp/ByteCodeExprGen.h
+++ clang/lib/AST/Interp/ByteCodeExprGen.h
@@ -88,6 +88,7 @@
   bool VisitFloatCompoundAssignOperator(const CompoundAssignOperator *E);
   bool VisitExprWithCleanups(const ExprWithCleanups *E);
   bool VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *E);
+  bool VisitCompoundLiteralExpr(const CompoundLiteralExpr *E);
 
 protected:
   bool visitExpr(const Expr *E) override;
Index: clang/lib/AST/Interp/ByteCodeExprGen.cpp
===
--- clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -736,19 +736,10 @@
 template 
 bool ByteCodeExprGen::VisitMaterializeTemporaryExpr(
 const MaterializeTemporaryExpr *E) {
-  StorageDuration SD = E->getStorageDuration();
-
-  // We conservatively only support these for now.
-  if (SD != SD_Static && SD != SD_Automatic)
-return false;
-
   const Expr *SubExpr = E->getSubExpr();
   std::optional SubExpr

[PATCH] D140389: [NFC][Clang][RISCV] Rename data member 'DefaultPolicy' to 'PolicyAttrs'

2022-12-26 Thread Zakk Chen via Phabricator via cfe-commits
khchen accepted this revision.
khchen added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140389

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


[PATCH] D138655: [clang-tidy] Fix `cppcoreguidelines-init-variables` for invalid vardecl

2022-12-26 Thread gehry via Phabricator via cfe-commits
Sockke added a comment.

Friendly ping.


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

https://reviews.llvm.org/D138655

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


[PATCH] D140662: [NFC][Clang][RISCV] Reduce boilerplate when determining prototype for segment loads

2022-12-26 Thread Zakk Chen via Phabricator via cfe-commits
khchen added inline comments.



Comment at: clang/include/clang/Basic/riscv_vector.td:847
+
+  // Intrinsic is in the form of below,
+  // Masked: (Vector0, ..., Vector{NF - 1}, Ptr, Mask, VL, Policy)

After remove the builtins comment I don't have idea what's going on this piece 
of code. but I'm okay if there is no concern from the other reviewers.



Comment at: clang/include/clang/Basic/riscv_vector.td:869
 Operands.push_back(ConstantInt::get(Ops.back()->getType(), 
DefaultPolicy));
-assert(Operands.size() == NF + 4);
-  } else {
-// TA builtin: (val0 address, val1 address, ..., ptr, vl)
-// TU builtin: (val0 address, ..., passthru0, ..., ptr, vl)
-// intrinsic: (passthru0, passthru1, ..., ptr, vl)
-if (DefaultPolicy == TAIL_AGNOSTIC) {
-  Operands.append(NF, llvm::PoisonValue::get(ResultType));
-  Operands.push_back(Ops[NF]);
-  Operands.push_back(Ops[NF + 1]);
-} else {
-  for (unsigned I = 0; I < NF; ++I)
-Operands.push_back(Ops[NF + I]);
-  Operands.push_back(Ops[2 * NF]);
-  Operands.push_back(Ops[2 * NF + 1]);
-}
-  }
+
   llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);

nit: nit: there is no assert now, is it still NFC? I'm not sure.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140662

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


[PATCH] D112932: Use llvm.is_fpclass to implement FP classification functions

2022-12-26 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff updated this revision to Diff 485307.
sepavloff added a comment.

Update patch

- Rebase,
- Add test that checks inlining.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112932

Files:
  clang/include/clang/Basic/Builtins.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/X86/strictfp_builtins.c
  clang/test/CodeGen/aarch64-strictfp-builtins.c
  clang/test/CodeGen/builtin_float.c
  clang/test/CodeGen/builtin_float_strictfp.c
  clang/test/CodeGen/builtins.c
  clang/test/CodeGen/isfpclass.c
  clang/test/CodeGen/strictfp_builtins.c

Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -17,7 +17,7 @@
 // CHECK-NEXT:store i32 [[X:%.*]], ptr [[X_ADDR]], align 4
 // CHECK-NEXT:[[TMP0:%.*]] = load ptr, ptr [[STR_ADDR]], align 8
 // CHECK-NEXT:[[TMP1:%.*]] = load i32, ptr [[X_ADDR]], align 4
-// CHECK-NEXT:[[CALL:%.*]] = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef [[TMP0]], i32 noundef [[TMP1]]) [[ATTR4:#.*]]
+// CHECK-NEXT:[[CALL:%.*]] = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef [[TMP0]], i32 noundef [[TMP1]]) #[[ATTR4:[0-9]+]]
 // CHECK-NEXT:ret void
 //
 void p(char *str, int x) {
@@ -31,21 +31,21 @@
 // CHECK-NEXT:[[D_ADDR:%.*]] = alloca double, align 8
 // CHECK-NEXT:store double [[D:%.*]], ptr [[D_ADDR]], align 8
 // CHECK-NEXT:[[TMP0:%.*]] = load double, ptr [[D_ADDR]], align 8
-// CHECK-NEXT:[[ISZERO:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP0]], double 0.00e+00, metadata !"oeq", metadata !"fpexcept.strict") [[ATTR4]]
+// CHECK-NEXT:[[ISZERO:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP0]], double 0.00e+00, metadata !"oeq", metadata !"fpexcept.strict") #[[ATTR4]]
 // CHECK-NEXT:br i1 [[ISZERO]], label [[FPCLASSIFY_END:%.*]], label [[FPCLASSIFY_NOT_ZERO:%.*]]
 // CHECK:   fpclassify_end:
 // CHECK-NEXT:[[FPCLASSIFY_RESULT:%.*]] = phi i32 [ 4, [[ENTRY:%.*]] ], [ 0, [[FPCLASSIFY_NOT_ZERO]] ], [ 1, [[FPCLASSIFY_NOT_NAN:%.*]] ], [ [[TMP2:%.*]], [[FPCLASSIFY_NOT_INF:%.*]] ]
-// CHECK-NEXT:call void @p(ptr noundef @.str.1, i32 noundef [[FPCLASSIFY_RESULT]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(ptr noundef @.str.1, i32 noundef [[FPCLASSIFY_RESULT]]) #[[ATTR4]]
 // CHECK-NEXT:ret void
 // CHECK:   fpclassify_not_zero:
-// CHECK-NEXT:[[CMP:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP0]], double [[TMP0]], metadata !"uno", metadata !"fpexcept.strict") [[ATTR4]]
+// CHECK-NEXT:[[CMP:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP0]], double [[TMP0]], metadata !"uno", metadata !"fpexcept.strict") #[[ATTR4]]
 // CHECK-NEXT:br i1 [[CMP]], label [[FPCLASSIFY_END]], label [[FPCLASSIFY_NOT_NAN]]
 // CHECK:   fpclassify_not_nan:
-// CHECK-NEXT:[[TMP1:%.*]] = call double @llvm.fabs.f64(double [[TMP0]]) [[ATTR5:#.*]]
-// CHECK-NEXT:[[ISINF:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP1]], double 0x7FF0, metadata !"oeq", metadata !"fpexcept.strict") [[ATTR4]]
+// CHECK-NEXT:[[TMP1:%.*]] = call double @llvm.fabs.f64(double [[TMP0]]) #[[ATTR5:[0-9]+]]
+// CHECK-NEXT:[[ISINF:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP1]], double 0x7FF0, metadata !"oeq", metadata !"fpexcept.strict") #[[ATTR4]]
 // CHECK-NEXT:br i1 [[ISINF]], label [[FPCLASSIFY_END]], label [[FPCLASSIFY_NOT_INF]]
 // CHECK:   fpclassify_not_inf:
-// CHECK-NEXT:[[ISNORMAL:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP1]], double 0x10, metadata !"uge", metadata !"fpexcept.strict") [[ATTR4]]
+// CHECK-NEXT:[[ISNORMAL:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP1]], double 0x10, metadata !"uge", metadata !"fpexcept.strict") #[[ATTR4]]
 // CHECK-NEXT:[[TMP2]] = select i1 [[ISNORMAL]], i32 2, i32 3
 // CHECK-NEXT:br label [[FPCLASSIFY_END]]
 //
@@ -57,14 +57,12 @@
 
 // CHECK-LABEL: @test_fp16_isinf(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca half, align 2
-// CHECK-NEXT:store half [[H:%.*]], ptr [[LD_ADDR]], align 2
-// CHECK-NEXT:[[TMP0:%.*]] = load half, ptr [[LD_ADDR]], align 2
-// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
-// CHECK-NEXT:[[SHL1:%.*]] = shl i16 [[BITCAST]], 1
-// CHECK-NEXT:[[CMP:%.*]] = icmp eq i16 [[SHL1]], -2048
-// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
-// CHECK-NEXT:call void @p(ptr noundef @.str.[[#STRID:2]], i32 noundef [[RES]]) [[ATTR4]]
+// CHECK-NEXT:[[H_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], ptr [[H_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, ptr [[H_ADDR]], alig

[PATCH] D140389: [NFC][Clang][RISCV] Rename data member 'DefaultPolicy' to 'PolicyAttrs'

2022-12-26 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 485310.
eopXD added a comment.

Rebae to latest main.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140389

Files:
  clang/include/clang/Basic/riscv_vector.td
  clang/include/clang/Support/RISCVVIntrinsicUtils.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaRISCVVectorLookup.cpp
  clang/lib/Support/RISCVVIntrinsicUtils.cpp
  clang/utils/TableGen/RISCVVEmitter.cpp

Index: clang/utils/TableGen/RISCVVEmitter.cpp
===
--- clang/utils/TableGen/RISCVVEmitter.cpp
+++ clang/utils/TableGen/RISCVVEmitter.cpp
@@ -163,14 +163,14 @@
 OS << "  ID = Intrinsic::riscv_" + RVVI->getIRName() + ";\n";
   if (RVVI->getNF() >= 2)
 OS << "  NF = " + utostr(RVVI->getNF()) + ";\n";
-  // We had initialized DefaultPolicy as TU/TUMU in CodeGen function.
-  if (!RVVI->getDefaultPolicy().isTUPolicy() &&
-  !RVVI->getDefaultPolicy().isTUMUPolicy() && !RVVI->hasPassthruOperand() &&
+  // We had initialized PolicyAttrs as TU/TUMU in CodeGen function.
+  if (!RVVI->getPolicyAttrs().isTUPolicy() &&
+  !RVVI->getPolicyAttrs().isTUMUPolicy() && !RVVI->hasPassthruOperand() &&
   !RVVI->hasManualCodegen() && RVVI->hasVL())
-OS << "  DefaultPolicy = " << RVVI->getDefaultPolicyBits() << ";\n";
+OS << "  PolicyAttrs = " << RVVI->getPolicyAttrsBits() << ";\n";
 
   if (RVVI->hasManualCodegen()) {
-OS << "  DefaultPolicy = " << RVVI->getDefaultPolicyBits() << ";\n";
+OS << "  PolicyAttrs = " << RVVI->getPolicyAttrsBits() << ";\n";
 if (RVVI->isMasked())
   OS << "IsMasked = true;\n";
 else
@@ -195,13 +195,12 @@
   OS << "  std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);\n";
   if (RVVI->hasPolicyOperand())
 OS << "  Ops.push_back(ConstantInt::get(Ops.back()->getType(),"
-  " DefaultPolicy));\n";
-  if (RVVI->hasMaskedOffOperand() &&
-  RVVI->getDefaultPolicy().isTAMAPolicy())
+  " PolicyAttrs));\n";
+  if (RVVI->hasMaskedOffOperand() && RVVI->getPolicyAttrs().isTAMAPolicy())
 OS << "  Ops.insert(Ops.begin(), llvm::UndefValue::get(ResultType));\n";
   // Masked reduction cases.
   if (!RVVI->hasMaskedOffOperand() && RVVI->hasPassthruOperand() &&
-  RVVI->getDefaultPolicy().isTAMAPolicy())
+  RVVI->getPolicyAttrs().isTAMAPolicy())
 OS << "  Ops.insert(Ops.begin(), llvm::UndefValue::get(ResultType));\n";
 } else {
   OS << "  std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end());\n";
@@ -209,9 +208,8 @@
   } else {
 if (RVVI->hasPolicyOperand())
   OS << "  Ops.push_back(ConstantInt::get(Ops.back()->getType(), "
-"DefaultPolicy));\n";
-else if (RVVI->hasPassthruOperand() &&
- RVVI->getDefaultPolicy().isTAPolicy())
+"PolicyAttrs));\n";
+else if (RVVI->hasPassthruOperand() && RVVI->getPolicyAttrs().isTAPolicy())
   OS << "  Ops.insert(Ops.begin(), llvm::UndefValue::get(ResultType));\n";
   }
 
@@ -448,7 +446,7 @@
   llvm::stable_sort(Defs, [](const std::unique_ptr &A,
  const std::unique_ptr &B) {
 if (A->getIRName() == B->getIRName())
-  return (A->getDefaultPolicy() < B->getDefaultPolicy());
+  return (A->getPolicyAttrs() < B->getPolicyAttrs());
 return (A->getIRName() < B->getIRName());
   });
 
@@ -462,7 +460,7 @@
 StringRef CurIRName = Def->getIRName();
 if (CurIRName != PrevDef->getIRName() ||
 (Def->getManualCodegen() != PrevDef->getManualCodegen()) ||
-(Def->getDefaultPolicy() != PrevDef->getDefaultPolicy())) {
+(Def->getPolicyAttrs() != PrevDef->getPolicyAttrs())) {
   emitCodeGenSwitchBody(PrevDef, OS);
 }
 PrevDef = Def.get();
Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -848,12 +848,11 @@
 bool SupportOverloading, bool HasBuiltinAlias, StringRef ManualCodegen,
 const RVVTypes &OutInTypes, const std::vector &NewIntrinsicTypes,
 const std::vector &RequiredFeatures, unsigned NF,
-Policy NewDefaultPolicy, bool IsPrototypeDefaultTU)
+Policy NewPolicyAttrs, bool IsPrototypeDefaultTU)
 : IRName(IRName), IsMasked(IsMasked),
   HasMaskedOffOperand(HasMaskedOffOperand), HasVL(HasVL), Scheme(Scheme),
   SupportOverloading(SupportOverloading), HasBuiltinAlias(HasBuiltinAlias),
-  ManualCodegen(ManualCodegen.str()), NF(NF),
-  DefaultPolicy(NewDefaultPolicy) {
+  ManualCodegen(ManualCodegen.str()), NF(NF), PolicyAttrs(NewPolicyAttrs) {
 
   // Init BuiltinName, Name and OverloadedName
   BuiltinName = NewName.str();
@@ -868,7 +867,7 @@
 OverloadedName += "_" + OverloadedSuffix.str();
 
   updateNamesAndPolicy(IsMasked, hasPolicy(), IsPrototypeDefaul

[PATCH] D140389: [NFC][Clang][RISCV] Rename data member 'DefaultPolicy' to 'PolicyAttrs'

2022-12-26 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 485311.
eopXD added a comment.

Change: Recover mis-deleted lines.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140389

Files:
  clang/include/clang/Basic/riscv_vector.td
  clang/include/clang/Support/RISCVVIntrinsicUtils.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaRISCVVectorLookup.cpp
  clang/lib/Support/RISCVVIntrinsicUtils.cpp
  clang/utils/TableGen/RISCVVEmitter.cpp

Index: clang/utils/TableGen/RISCVVEmitter.cpp
===
--- clang/utils/TableGen/RISCVVEmitter.cpp
+++ clang/utils/TableGen/RISCVVEmitter.cpp
@@ -163,14 +163,14 @@
 OS << "  ID = Intrinsic::riscv_" + RVVI->getIRName() + ";\n";
   if (RVVI->getNF() >= 2)
 OS << "  NF = " + utostr(RVVI->getNF()) + ";\n";
-  // We had initialized DefaultPolicy as TU/TUMU in CodeGen function.
-  if (!RVVI->getDefaultPolicy().isTUPolicy() &&
-  !RVVI->getDefaultPolicy().isTUMUPolicy() && !RVVI->hasPassthruOperand() &&
+  // We had initialized PolicyAttrs as TU/TUMU in CodeGen function.
+  if (!RVVI->getPolicyAttrs().isTUPolicy() &&
+  !RVVI->getPolicyAttrs().isTUMUPolicy() && !RVVI->hasPassthruOperand() &&
   !RVVI->hasManualCodegen() && RVVI->hasVL())
-OS << "  DefaultPolicy = " << RVVI->getDefaultPolicyBits() << ";\n";
+OS << "  PolicyAttrs = " << RVVI->getPolicyAttrsBits() << ";\n";
 
   if (RVVI->hasManualCodegen()) {
-OS << "  DefaultPolicy = " << RVVI->getDefaultPolicyBits() << ";\n";
+OS << "  PolicyAttrs = " << RVVI->getPolicyAttrsBits() << ";\n";
 if (RVVI->isMasked())
   OS << "IsMasked = true;\n";
 else
@@ -195,13 +195,12 @@
   OS << "  std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);\n";
   if (RVVI->hasPolicyOperand())
 OS << "  Ops.push_back(ConstantInt::get(Ops.back()->getType(),"
-  " DefaultPolicy));\n";
-  if (RVVI->hasMaskedOffOperand() &&
-  RVVI->getDefaultPolicy().isTAMAPolicy())
+  " PolicyAttrs));\n";
+  if (RVVI->hasMaskedOffOperand() && RVVI->getPolicyAttrs().isTAMAPolicy())
 OS << "  Ops.insert(Ops.begin(), llvm::UndefValue::get(ResultType));\n";
   // Masked reduction cases.
   if (!RVVI->hasMaskedOffOperand() && RVVI->hasPassthruOperand() &&
-  RVVI->getDefaultPolicy().isTAMAPolicy())
+  RVVI->getPolicyAttrs().isTAMAPolicy())
 OS << "  Ops.insert(Ops.begin(), llvm::UndefValue::get(ResultType));\n";
 } else {
   OS << "  std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end());\n";
@@ -209,9 +208,8 @@
   } else {
 if (RVVI->hasPolicyOperand())
   OS << "  Ops.push_back(ConstantInt::get(Ops.back()->getType(), "
-"DefaultPolicy));\n";
-else if (RVVI->hasPassthruOperand() &&
- RVVI->getDefaultPolicy().isTAPolicy())
+"PolicyAttrs));\n";
+else if (RVVI->hasPassthruOperand() && RVVI->getPolicyAttrs().isTAPolicy())
   OS << "  Ops.insert(Ops.begin(), llvm::UndefValue::get(ResultType));\n";
   }
 
@@ -448,7 +446,7 @@
   llvm::stable_sort(Defs, [](const std::unique_ptr &A,
  const std::unique_ptr &B) {
 if (A->getIRName() == B->getIRName())
-  return (A->getDefaultPolicy() < B->getDefaultPolicy());
+  return (A->getPolicyAttrs() < B->getPolicyAttrs());
 return (A->getIRName() < B->getIRName());
   });
 
@@ -462,7 +460,7 @@
 StringRef CurIRName = Def->getIRName();
 if (CurIRName != PrevDef->getIRName() ||
 (Def->getManualCodegen() != PrevDef->getManualCodegen()) ||
-(Def->getDefaultPolicy() != PrevDef->getDefaultPolicy())) {
+(Def->getPolicyAttrs() != PrevDef->getPolicyAttrs())) {
   emitCodeGenSwitchBody(PrevDef, OS);
 }
 PrevDef = Def.get();
Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -848,12 +848,11 @@
 bool SupportOverloading, bool HasBuiltinAlias, StringRef ManualCodegen,
 const RVVTypes &OutInTypes, const std::vector &NewIntrinsicTypes,
 const std::vector &RequiredFeatures, unsigned NF,
-Policy NewDefaultPolicy, bool IsPrototypeDefaultTU)
+Policy NewPolicyAttrs, bool IsPrototypeDefaultTU)
 : IRName(IRName), IsMasked(IsMasked),
   HasMaskedOffOperand(HasMaskedOffOperand), HasVL(HasVL), Scheme(Scheme),
   SupportOverloading(SupportOverloading), HasBuiltinAlias(HasBuiltinAlias),
-  ManualCodegen(ManualCodegen.str()), NF(NF),
-  DefaultPolicy(NewDefaultPolicy) {
+  ManualCodegen(ManualCodegen.str()), NF(NF), PolicyAttrs(NewPolicyAttrs) {
 
   // Init BuiltinName, Name and OverloadedName
   BuiltinName = NewName.str();
@@ -868,7 +867,7 @@
 OverloadedName += "_" + OverloadedSuffix.str();
 
   updateNamesAndPolicy(IsMasked, hasPolicy(), IsPr

[PATCH] D140389: [NFC][Clang][RISCV] Rename data member 'DefaultPolicy' to 'PolicyAttrs'

2022-12-26 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 485312.
eopXD added a comment.

Recover mis-deleted lines.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140389

Files:
  clang/include/clang/Basic/riscv_vector.td
  clang/include/clang/Support/RISCVVIntrinsicUtils.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaRISCVVectorLookup.cpp
  clang/lib/Support/RISCVVIntrinsicUtils.cpp
  clang/utils/TableGen/RISCVVEmitter.cpp

Index: clang/utils/TableGen/RISCVVEmitter.cpp
===
--- clang/utils/TableGen/RISCVVEmitter.cpp
+++ clang/utils/TableGen/RISCVVEmitter.cpp
@@ -163,14 +163,14 @@
 OS << "  ID = Intrinsic::riscv_" + RVVI->getIRName() + ";\n";
   if (RVVI->getNF() >= 2)
 OS << "  NF = " + utostr(RVVI->getNF()) + ";\n";
-  // We had initialized DefaultPolicy as TU/TUMU in CodeGen function.
-  if (!RVVI->getDefaultPolicy().isTUPolicy() &&
-  !RVVI->getDefaultPolicy().isTUMUPolicy() && !RVVI->hasPassthruOperand() &&
+  // We had initialized PolicyAttrs as TU/TUMU in CodeGen function.
+  if (!RVVI->getPolicyAttrs().isTUPolicy() &&
+  !RVVI->getPolicyAttrs().isTUMUPolicy() && !RVVI->hasPassthruOperand() &&
   !RVVI->hasManualCodegen() && RVVI->hasVL())
-OS << "  DefaultPolicy = " << RVVI->getDefaultPolicyBits() << ";\n";
+OS << "  PolicyAttrs = " << RVVI->getPolicyAttrsBits() << ";\n";
 
   if (RVVI->hasManualCodegen()) {
-OS << "  DefaultPolicy = " << RVVI->getDefaultPolicyBits() << ";\n";
+OS << "  PolicyAttrs = " << RVVI->getPolicyAttrsBits() << ";\n";
 if (RVVI->isMasked())
   OS << "IsMasked = true;\n";
 else
@@ -195,13 +195,12 @@
   OS << "  std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);\n";
   if (RVVI->hasPolicyOperand())
 OS << "  Ops.push_back(ConstantInt::get(Ops.back()->getType(),"
-  " DefaultPolicy));\n";
-  if (RVVI->hasMaskedOffOperand() &&
-  RVVI->getDefaultPolicy().isTAMAPolicy())
+  " PolicyAttrs));\n";
+  if (RVVI->hasMaskedOffOperand() && RVVI->getPolicyAttrs().isTAMAPolicy())
 OS << "  Ops.insert(Ops.begin(), llvm::UndefValue::get(ResultType));\n";
   // Masked reduction cases.
   if (!RVVI->hasMaskedOffOperand() && RVVI->hasPassthruOperand() &&
-  RVVI->getDefaultPolicy().isTAMAPolicy())
+  RVVI->getPolicyAttrs().isTAMAPolicy())
 OS << "  Ops.insert(Ops.begin(), llvm::UndefValue::get(ResultType));\n";
 } else {
   OS << "  std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end());\n";
@@ -209,9 +208,8 @@
   } else {
 if (RVVI->hasPolicyOperand())
   OS << "  Ops.push_back(ConstantInt::get(Ops.back()->getType(), "
-"DefaultPolicy));\n";
-else if (RVVI->hasPassthruOperand() &&
- RVVI->getDefaultPolicy().isTAPolicy())
+"PolicyAttrs));\n";
+else if (RVVI->hasPassthruOperand() && RVVI->getPolicyAttrs().isTAPolicy())
   OS << "  Ops.insert(Ops.begin(), llvm::UndefValue::get(ResultType));\n";
   }
 
@@ -448,7 +446,7 @@
   llvm::stable_sort(Defs, [](const std::unique_ptr &A,
  const std::unique_ptr &B) {
 if (A->getIRName() == B->getIRName())
-  return (A->getDefaultPolicy() < B->getDefaultPolicy());
+  return (A->getPolicyAttrs() < B->getPolicyAttrs());
 return (A->getIRName() < B->getIRName());
   });
 
@@ -462,7 +460,7 @@
 StringRef CurIRName = Def->getIRName();
 if (CurIRName != PrevDef->getIRName() ||
 (Def->getManualCodegen() != PrevDef->getManualCodegen()) ||
-(Def->getDefaultPolicy() != PrevDef->getDefaultPolicy())) {
+(Def->getPolicyAttrs() != PrevDef->getPolicyAttrs())) {
   emitCodeGenSwitchBody(PrevDef, OS);
 }
 PrevDef = Def.get();
Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -848,12 +848,11 @@
 bool SupportOverloading, bool HasBuiltinAlias, StringRef ManualCodegen,
 const RVVTypes &OutInTypes, const std::vector &NewIntrinsicTypes,
 const std::vector &RequiredFeatures, unsigned NF,
-Policy NewDefaultPolicy, bool IsPrototypeDefaultTU)
+Policy NewPolicyAttrs, bool IsPrototypeDefaultTU)
 : IRName(IRName), IsMasked(IsMasked),
   HasMaskedOffOperand(HasMaskedOffOperand), HasVL(HasVL), Scheme(Scheme),
   SupportOverloading(SupportOverloading), HasBuiltinAlias(HasBuiltinAlias),
-  ManualCodegen(ManualCodegen.str()), NF(NF),
-  DefaultPolicy(NewDefaultPolicy) {
+  ManualCodegen(ManualCodegen.str()), NF(NF), PolicyAttrs(NewPolicyAttrs) {
 
   // Init BuiltinName, Name and OverloadedName
   BuiltinName = NewName.str();
@@ -868,7 +867,7 @@
 OverloadedName += "_" + OverloadedSuffix.str();
 
   updateNamesAndPolicy(IsMasked, hasPolicy(), IsPrototypeD

[PATCH] D140662: [NFC][Clang][RISCV] Reduce boilerplate when determining prototype for segment loads

2022-12-26 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: clang/include/clang/Basic/riscv_vector.td:862
+  Value *VLOperand = Ops[PtrOperandIdx + 1];
+  Operands.append(NF, PassThruOperand);
+  Operands.push_back(PtrOperand);

This doesn't look right to me. This append call appends `PassThruOperand` `NF` 
times. In the non-agnostic case, it needs to append `NF` different values.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140662

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


[PATCH] D140678: [RISCV][WIP] Use SmallVector::append to replace some for loops in intrinsic creation. NFC

2022-12-26 Thread Craig Topper via Phabricator via cfe-commits
craig.topper created this revision.
craig.topper added a reviewer: eopXD.
Herald added subscribers: sunshaoce, VincentWu, StephenFan, vkmr, frasercrmck, 
evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, 
jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, 
zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, 
rbar, asb, arichardson.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added a subscriber: pcwang-thead.
Herald added a project: clang.

This conflicts with D140662 , but wanted to 
post it for discussion.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140678

Files:
  clang/include/clang/Basic/riscv_vector.td


Index: clang/include/clang/Basic/riscv_vector.td
===
--- clang/include/clang/Basic/riscv_vector.td
+++ clang/include/clang/Basic/riscv_vector.td
@@ -853,8 +853,7 @@
   Operands.push_back(Ops[NF]);
   Operands.push_back(Ops[NF + 2]);
 } else {
-  for (unsigned I = 0; I < NF; ++I)
-Operands.push_back(Ops[NF + I + 1]);
+  Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
   Operands.push_back(Ops[2 * NF + 1]);
   Operands.push_back(Ops[NF]);
   Operands.push_back(Ops[2 * NF + 2]);
@@ -870,10 +869,7 @@
   Operands.push_back(Ops[NF]);
   Operands.push_back(Ops[NF + 1]);
 } else {
-  for (unsigned I = 0; I < NF; ++I)
-Operands.push_back(Ops[NF + I]);
-  Operands.push_back(Ops[2 * NF]);
-  Operands.push_back(Ops[2 * NF + 1]);
+  Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF + 2);
 }
   }
   llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
@@ -931,8 +927,7 @@
   Operands.push_back(Ops[NF + 3]);
   NewVL = Ops[NF + 2];
 } else {
-  for (unsigned I = 0; I < NF; ++I)
-Operands.push_back(Ops[NF + I + 1]);
+  Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
   Operands.push_back(Ops[2 * NF + 1]);
   Operands.push_back(Ops[NF]);
   Operands.push_back(Ops[2 * NF + 3]);
@@ -950,8 +945,7 @@
   Operands.push_back(Ops[NF + 2]);
   NewVL = Ops[NF + 1];
 } else {
-  for (unsigned I = 0; I < NF; ++I)
-Operands.push_back(Ops[NF + I]);
+  Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
   Operands.push_back(Ops[2 * NF]);
   Operands.push_back(Ops[2 * NF + 2]);
   NewVL = Ops[2 * NF + 1];
@@ -1012,8 +1006,7 @@
   Operands.push_back(Ops[NF]);
   Operands.push_back(Ops[NF + 3]);
 } else {
-  for (unsigned I = 0; I < NF; ++I)
-Operands.push_back(Ops[NF + I + 1]);
+  Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
   Operands.push_back(Ops[2 * NF + 1]);
   Operands.push_back(Ops[2 * NF + 2]);
   Operands.push_back(Ops[NF]);
@@ -1031,8 +1024,7 @@
   Operands.push_back(Ops[NF + 1]);
   Operands.push_back(Ops[NF + 2]);
 } else {
-  for (unsigned I = 0; I < NF; ++I)
-Operands.push_back(Ops[NF + I]);
+  Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
   Operands.push_back(Ops[2 * NF]);
   Operands.push_back(Ops[2 * NF + 1]);
   Operands.push_back(Ops[2 * NF + 2]);
@@ -1087,8 +1079,7 @@
   Operands.push_back(Ops[NF + 3]);
   IntrinsicTypes = {ResultType, Ops[NF + 2]->getType(), 
Ops.back()->getType()};
 } else {
-  for (unsigned I = 0; I < NF; ++I)
-Operands.push_back(Ops[NF + I + 1]);
+  Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
   Operands.push_back(Ops[2 * NF + 1]);
   Operands.push_back(Ops[2 * NF + 2]);
   Operands.push_back(Ops[NF]);
@@ -1108,8 +1099,7 @@
   Operands.push_back(Ops[NF + 2]);
   IntrinsicTypes = {ResultType, Ops[NF + 1]->getType(), 
Ops.back()->getType()};
 } else {
-  for (unsigned I = 0; I < NF; ++I)
-Operands.push_back(Ops[NF + I]);
+  Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
   Operands.push_back(Ops[2 * NF]);
   Operands.push_back(Ops[2 * NF + 1]);
   Operands.push_back(Ops[2 * NF + 2]);


Index: clang/include/clang/Basic/riscv_vector.td
===
--- clang/include/clang/Basic/riscv_vector.td
+++ clang/include/clang/Basic/riscv_vector.td
@@ -853,8 +853,7 @@
   Operands.push_back(Ops[NF]);
   Operands.push_back(Ops[NF + 2]);
 } else {
-  for (unsigned I = 0; I < NF; ++I)
-Operands.push_back(Ops[NF + I + 1]);
+  Operands.append(Ops.begin() + NF +

[PATCH] D140059: [APSInt] Fix bug in APSInt mentioned in https://github.com/llvm/llvm-project/issues/59515

2022-12-26 Thread Peter Rong via Phabricator via cfe-commits
Peter updated this revision to Diff 485327.
Peter added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Update clang


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140059

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp


Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -5380,10 +5380,11 @@
   llvm::DIExpression *InitExpr = nullptr;
   if (CGM.getContext().getTypeSize(VD->getType()) <= 64) {
 // FIXME: Add a representation for integer constants wider than 64 bits.
-if (Init.isInt())
-  InitExpr =
-  DBuilder.createConstantValueExpression(Init.getInt().getExtValue());
-else if (Init.isFloat())
+if (Init.isInt()) {
+  auto InitInt = Init.getInt().tryExtValue();
+  if (InitInt)
+InitExpr = DBuilder.createConstantValueExpression(InitInt.value());
+} else if (Init.isFloat())
   InitExpr = DBuilder.createConstantValueExpression(
   Init.getFloat().bitcastToAPInt().getZExtValue());
   }


Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -5380,10 +5380,11 @@
   llvm::DIExpression *InitExpr = nullptr;
   if (CGM.getContext().getTypeSize(VD->getType()) <= 64) {
 // FIXME: Add a representation for integer constants wider than 64 bits.
-if (Init.isInt())
-  InitExpr =
-  DBuilder.createConstantValueExpression(Init.getInt().getExtValue());
-else if (Init.isFloat())
+if (Init.isInt()) {
+  auto InitInt = Init.getInt().tryExtValue();
+  if (InitInt)
+InitExpr = DBuilder.createConstantValueExpression(InitInt.value());
+} else if (Init.isFloat())
   InitExpr = DBuilder.createConstantValueExpression(
   Init.getFloat().bitcastToAPInt().getZExtValue());
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D140059: [APSInt] Fix bug in APSInt mentioned in https://github.com/llvm/llvm-project/issues/59515

2022-12-26 Thread Peter Rong via Phabricator via cfe-commits
Peter updated this revision to Diff 485328.
Peter added a comment.

change base


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140059

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  llvm/include/llvm/ADT/APSInt.h
  llvm/lib/CodeGen/MIRParser/MIParser.cpp
  llvm/unittests/ADT/APSIntTest.cpp

Index: llvm/unittests/ADT/APSIntTest.cpp
===
--- llvm/unittests/ADT/APSIntTest.cpp
+++ llvm/unittests/ADT/APSIntTest.cpp
@@ -62,6 +62,13 @@
   EXPECT_EQ(UINT64_C(0) - 7, APSInt::getUnsigned(-7).getZExtValue());
 }
 
+TEST(APSIntTest, isRepresentableByInt64) {
+  ASSERT_TRUE(APSInt(APInt(3, 7), true).isRepresentableByInt64());
+  ASSERT_TRUE(APSInt(APInt(128, 7), true).isRepresentableByInt64());
+  ASSERT_TRUE(APSInt(APInt(128, 7), false).isRepresentableByInt64());
+  ASSERT_TRUE(APSInt(APInt(64, -1), false).isRepresentableByInt64());
+  ASSERT_FALSE(APSInt(APInt(64, (uint64_t)-1), true).isRepresentableByInt64());
+}
 TEST(APSIntTest, getExtValue) {
   EXPECT_TRUE(APSInt(APInt(3, 7), true).isUnsigned());
   EXPECT_TRUE(APSInt(APInt(3, 7), false).isSigned());
@@ -76,6 +83,16 @@
   EXPECT_EQ(9, APSInt(APInt(4, -7), true).getExtValue());
   EXPECT_EQ(-7, APSInt(APInt(4, -7), false).getExtValue());
 }
+TEST(APSIntTest, tryExtValue) {
+  ASSERT_EQ(-7, APSInt(APInt(64, -7), false).tryExtValue().value_or(42));
+  ASSERT_EQ(42, APSInt(APInt(128, -7), false).tryExtValue().value_or(42));
+  ASSERT_EQ(-1,
+APSInt(APInt::getAllOnes(128), false).tryExtValue().value_or(42));
+  ASSERT_EQ(42, APSInt(APInt(64, -7), true).tryExtValue().value_or(42));
+  ASSERT_EQ(1, APSInt(APInt(128, 1), true).tryExtValue().value_or(42));
+  ASSERT_EQ(42,
+APSInt(APInt::getAllOnes(128), true).tryExtValue().value_or(42));
+}
 
 TEST(APSIntTest, compareValues) {
   auto U = [](uint64_t V) { return APSInt::getUnsigned(V); };
Index: llvm/lib/CodeGen/MIRParser/MIParser.cpp
===
--- llvm/lib/CodeGen/MIRParser/MIParser.cpp
+++ llvm/lib/CodeGen/MIRParser/MIParser.cpp
@@ -1778,9 +1778,12 @@
 bool MIParser::parseImmediateOperand(MachineOperand &Dest) {
   assert(Token.is(MIToken::IntegerLiteral));
   const APSInt &Int = Token.integerValue();
-  if (Int.getMinSignedBits() > 64)
+  if (auto SImm = Int.trySExtValue(); Int.isSigned() && SImm.has_value())
+Dest = MachineOperand::CreateImm(*SImm);
+  else if (auto UImm = Int.tryZExtValue(); !Int.isSigned() && UImm.has_value())
+Dest = MachineOperand::CreateImm(*UImm);
+  else
 return error("integer literal is too large to be an immediate operand");
-  Dest = MachineOperand::CreateImm(Int.getExtValue());
   lex();
   return false;
 }
Index: llvm/include/llvm/ADT/APSInt.h
===
--- llvm/include/llvm/ADT/APSInt.h
+++ llvm/include/llvm/ADT/APSInt.h
@@ -85,12 +85,26 @@
   }
   using APInt::toString;
 
+  /// If this int is representable using an int64_t.
+  bool isRepresentableByInt64() const {
+// For unsigned values with 64 active bits, they technically fit into a
+// int64_t, but the user may get negative numbers and has to manually cast
+// them to unsigned. Let's not bet the user has the sanity to do that and
+// not give them a vague value at the first place.
+return isSigned() ? isSignedIntN(64) : isIntN(63);
+  }
+
   /// Get the correctly-extended \c int64_t value.
   int64_t getExtValue() const {
-assert(getMinSignedBits() <= 64 && "Too many bits for int64_t");
+assert(isRepresentableByInt64() && "Too many bits for int64_t");
 return isSigned() ? getSExtValue() : getZExtValue();
   }
 
+  std::optional tryExtValue() const {
+return isRepresentableByInt64() ? std::optional(getExtValue())
+: std::nullopt;
+  }
+
   APSInt trunc(uint32_t width) const {
 return APSInt(APInt::trunc(width), IsUnsigned);
   }
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -5380,10 +5380,11 @@
   llvm::DIExpression *InitExpr = nullptr;
   if (CGM.getContext().getTypeSize(VD->getType()) <= 64) {
 // FIXME: Add a representation for integer constants wider than 64 bits.
-if (Init.isInt())
-  InitExpr =
-  DBuilder.createConstantValueExpression(Init.getInt().getExtValue());
-else if (Init.isFloat())
+if (Init.isInt()) {
+  auto InitInt = Init.getInt().tryExtValue();
+  if (InitInt)
+InitExpr = DBuilder.createConstantValueExpression(InitInt.value());
+} else if (Init.isFloat())
   InitExpr = DBuilder.createConstantValueExpression(
   Init.getFloat().bitcastToAPInt().getZExtValue());
   }
___
cfe-commits mailing list
cfe-commi

[PATCH] D140059: [APSInt] Fix bug in APSInt mentioned in https://github.com/llvm/llvm-project/issues/59515

2022-12-26 Thread Peter Rong via Phabricator via cfe-commits
Peter added a comment.

After this patch the semantics of getExtValue changed and thus broke clang. 
@pcc Would you mind take a look if the modification works for clang.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140059

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


[PATCH] D139686: [lsan] Add lsan support for loongarch64

2022-12-26 Thread Xiaodong Liu via Phabricator via cfe-commits
XiaodongLoong added a comment.

Please rebase code for test errors.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139686

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


[clang] 1deb6bc - [NFC][Clang][RISCV] Rename data member 'DefaultPolicy' to 'PolicyAttrs'

2022-12-26 Thread via cfe-commits

Author: eopXD
Date: 2022-12-26T22:31:05-08:00
New Revision: 1deb6bce8931543bc3649ba5b0e32ae7e044d243

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

LOG: [NFC][Clang][RISCV] Rename data member 'DefaultPolicy' to 'PolicyAttrs'

The naming here is strange since the value may still be updated.

Reviewed By: kito-cheng, khchen

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

Added: 


Modified: 
clang/include/clang/Basic/riscv_vector.td
clang/include/clang/Support/RISCVVIntrinsicUtils.h
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Sema/SemaRISCVVectorLookup.cpp
clang/lib/Support/RISCVVIntrinsicUtils.cpp
clang/utils/TableGen/RISCVVEmitter.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/riscv_vector.td 
b/clang/include/clang/Basic/riscv_vector.td
index 1ed8e00dd82ba..2669df028d934 100644
--- a/clang/include/clang/Basic/riscv_vector.td
+++ b/clang/include/clang/Basic/riscv_vector.td
@@ -629,12 +629,12 @@ multiclass RVVVLEFFBuiltin types> {
 if (IsMasked) {
   // Move mask to right before vl.
   std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
-  if (DefaultPolicy == TAIL_AGNOSTIC_MASK_AGNOSTIC)
+  if (PolicyAttrs == TAIL_AGNOSTIC_MASK_AGNOSTIC)
 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
-  Ops.push_back(ConstantInt::get(Ops.back()->getType(), 
DefaultPolicy));
+  Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
   IntrinsicTypes = {ResultType, Ops[4]->getType()};
 } else {
-  if (DefaultPolicy == TAIL_AGNOSTIC)
+  if (PolicyAttrs == TAIL_AGNOSTIC)
 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
   IntrinsicTypes = {ResultType, Ops[3]->getType()};
 }
@@ -847,7 +847,7 @@ multiclass RVVUnitStridedSegLoad {
 // TAMA builtin: (val0 address, ..., mask, ptr, vl)
 // builtin: (val0 address, ..., mask, maskedoff0, ..., ptr, vl)
 // intrinsic: (maskedoff0, ..., ptr, mask, vl)
-if (DefaultPolicy == TAIL_AGNOSTIC_MASK_AGNOSTIC) {
+if (PolicyAttrs == TAIL_AGNOSTIC_MASK_AGNOSTIC) {
   Operands.append(NF, llvm::PoisonValue::get(ResultType));
   Operands.push_back(Ops[NF + 1]);
   Operands.push_back(Ops[NF]);
@@ -859,13 +859,13 @@ multiclass RVVUnitStridedSegLoad {
   Operands.push_back(Ops[NF]);
   Operands.push_back(Ops[2 * NF + 2]);
 }
-Operands.push_back(ConstantInt::get(Ops.back()->getType(), 
DefaultPolicy));
+Operands.push_back(ConstantInt::get(Ops.back()->getType(), 
PolicyAttrs));
 assert(Operands.size() == NF + 4);
   } else {
 // TA builtin: (val0 address, val1 address, ..., ptr, vl)
 // TU builtin: (val0 address, ..., passthru0, ..., ptr, vl)
 // intrinsic: (passthru0, passthru1, ..., ptr, vl)
-if (DefaultPolicy == TAIL_AGNOSTIC) {
+if (PolicyAttrs == TAIL_AGNOSTIC) {
   Operands.append(NF, llvm::PoisonValue::get(ResultType));
   Operands.push_back(Ops[NF]);
   Operands.push_back(Ops[NF + 1]);
@@ -924,7 +924,7 @@ multiclass RVVUnitStridedSegLoadFF {
 // TAMA builtin: (val0 address, ..., mask, ptr, new_vl, vl)
 // builtin: (val0 address, ..., mask, maskedoff0, ..., ptr, new_vl, vl)
 // intrinsic: (maskedoff0, ..., ptr, mask, vl)
-if (DefaultPolicy == TAIL_AGNOSTIC_MASK_AGNOSTIC) {
+if (PolicyAttrs == TAIL_AGNOSTIC_MASK_AGNOSTIC) {
   Operands.append(NF, llvm::PoisonValue::get(ResultType));
   Operands.push_back(Ops[NF + 1]);
   Operands.push_back(Ops[NF]);
@@ -938,13 +938,13 @@ multiclass RVVUnitStridedSegLoadFF {
   Operands.push_back(Ops[2 * NF + 3]);
   NewVL = Ops[2 * NF + 2];
 }
-Operands.push_back(ConstantInt::get(Ops.back()->getType(), 
DefaultPolicy));
+Operands.push_back(ConstantInt::get(Ops.back()->getType(), 
PolicyAttrs));
 assert(Operands.size() == NF + 4);
   } else {
 // TA builtin: (val0 address, val1 address, ..., ptr, new_vl, vl)
 // TU builtin: (val0 address, ..., passthru0, ..., ptr, new_vl, vl)
 // intrinsic: (passthru0, passthru1, ..., ptr, vl)
-if (DefaultPolicy == TAIL_AGNOSTIC) {
+if (PolicyAttrs == TAIL_AGNOSTIC) {
   Operands.append(NF, llvm::PoisonValue::get(ResultType));
   Operands.push_back(Ops[NF]);
   Operands.push_back(Ops[NF + 2]);
@@ -1005,7 +1005,7 @@ multiclass RVVStridedSegLoad {
 // TAMA builtin: (val0 address, ..., mask, ptr, stride, vl)
 // builtin: (val0 address, ..., mask, maskedoff0, ..., ptr, stride, vl)
 // intrinsic: (maskedoff0, ..., ptr, s

[PATCH] D140389: [NFC][Clang][RISCV] Rename data member 'DefaultPolicy' to 'PolicyAttrs'

2022-12-26 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1deb6bce8931: [NFC][Clang][RISCV] Rename data member 
'DefaultPolicy' to 'PolicyAttrs' (authored by eopXD).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140389

Files:
  clang/include/clang/Basic/riscv_vector.td
  clang/include/clang/Support/RISCVVIntrinsicUtils.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaRISCVVectorLookup.cpp
  clang/lib/Support/RISCVVIntrinsicUtils.cpp
  clang/utils/TableGen/RISCVVEmitter.cpp

Index: clang/utils/TableGen/RISCVVEmitter.cpp
===
--- clang/utils/TableGen/RISCVVEmitter.cpp
+++ clang/utils/TableGen/RISCVVEmitter.cpp
@@ -163,14 +163,14 @@
 OS << "  ID = Intrinsic::riscv_" + RVVI->getIRName() + ";\n";
   if (RVVI->getNF() >= 2)
 OS << "  NF = " + utostr(RVVI->getNF()) + ";\n";
-  // We had initialized DefaultPolicy as TU/TUMU in CodeGen function.
-  if (!RVVI->getDefaultPolicy().isTUPolicy() &&
-  !RVVI->getDefaultPolicy().isTUMUPolicy() && !RVVI->hasPassthruOperand() &&
+  // We had initialized PolicyAttrs as TU/TUMU in CodeGen function.
+  if (!RVVI->getPolicyAttrs().isTUPolicy() &&
+  !RVVI->getPolicyAttrs().isTUMUPolicy() && !RVVI->hasPassthruOperand() &&
   !RVVI->hasManualCodegen() && RVVI->hasVL())
-OS << "  DefaultPolicy = " << RVVI->getDefaultPolicyBits() << ";\n";
+OS << "  PolicyAttrs = " << RVVI->getPolicyAttrsBits() << ";\n";
 
   if (RVVI->hasManualCodegen()) {
-OS << "  DefaultPolicy = " << RVVI->getDefaultPolicyBits() << ";\n";
+OS << "  PolicyAttrs = " << RVVI->getPolicyAttrsBits() << ";\n";
 if (RVVI->isMasked())
   OS << "IsMasked = true;\n";
 else
@@ -195,13 +195,12 @@
   OS << "  std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);\n";
   if (RVVI->hasPolicyOperand())
 OS << "  Ops.push_back(ConstantInt::get(Ops.back()->getType(),"
-  " DefaultPolicy));\n";
-  if (RVVI->hasMaskedOffOperand() &&
-  RVVI->getDefaultPolicy().isTAMAPolicy())
+  " PolicyAttrs));\n";
+  if (RVVI->hasMaskedOffOperand() && RVVI->getPolicyAttrs().isTAMAPolicy())
 OS << "  Ops.insert(Ops.begin(), llvm::UndefValue::get(ResultType));\n";
   // Masked reduction cases.
   if (!RVVI->hasMaskedOffOperand() && RVVI->hasPassthruOperand() &&
-  RVVI->getDefaultPolicy().isTAMAPolicy())
+  RVVI->getPolicyAttrs().isTAMAPolicy())
 OS << "  Ops.insert(Ops.begin(), llvm::UndefValue::get(ResultType));\n";
 } else {
   OS << "  std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end());\n";
@@ -209,9 +208,8 @@
   } else {
 if (RVVI->hasPolicyOperand())
   OS << "  Ops.push_back(ConstantInt::get(Ops.back()->getType(), "
-"DefaultPolicy));\n";
-else if (RVVI->hasPassthruOperand() &&
- RVVI->getDefaultPolicy().isTAPolicy())
+"PolicyAttrs));\n";
+else if (RVVI->hasPassthruOperand() && RVVI->getPolicyAttrs().isTAPolicy())
   OS << "  Ops.insert(Ops.begin(), llvm::UndefValue::get(ResultType));\n";
   }
 
@@ -448,7 +446,7 @@
   llvm::stable_sort(Defs, [](const std::unique_ptr &A,
  const std::unique_ptr &B) {
 if (A->getIRName() == B->getIRName())
-  return (A->getDefaultPolicy() < B->getDefaultPolicy());
+  return (A->getPolicyAttrs() < B->getPolicyAttrs());
 return (A->getIRName() < B->getIRName());
   });
 
@@ -462,7 +460,7 @@
 StringRef CurIRName = Def->getIRName();
 if (CurIRName != PrevDef->getIRName() ||
 (Def->getManualCodegen() != PrevDef->getManualCodegen()) ||
-(Def->getDefaultPolicy() != PrevDef->getDefaultPolicy())) {
+(Def->getPolicyAttrs() != PrevDef->getPolicyAttrs())) {
   emitCodeGenSwitchBody(PrevDef, OS);
 }
 PrevDef = Def.get();
Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -848,12 +848,11 @@
 bool SupportOverloading, bool HasBuiltinAlias, StringRef ManualCodegen,
 const RVVTypes &OutInTypes, const std::vector &NewIntrinsicTypes,
 const std::vector &RequiredFeatures, unsigned NF,
-Policy NewDefaultPolicy, bool IsPrototypeDefaultTU)
+Policy NewPolicyAttrs, bool IsPrototypeDefaultTU)
 : IRName(IRName), IsMasked(IsMasked),
   HasMaskedOffOperand(HasMaskedOffOperand), HasVL(HasVL), Scheme(Scheme),
   SupportOverloading(SupportOverloading), HasBuiltinAlias(HasBuiltinAlias),
-  ManualCodegen(ManualCodegen.str()), NF(NF),
-  DefaultPolicy(NewDefaultPolicy) {
+  ManualCodegen(ManualCodegen.str()), NF(NF), PolicyAttrs(NewPolicyAttrs) {
 
   // Init BuiltinName, Name and OverloadedName
   BuiltinName = NewName.str();
@@ -868,7 +867,7 @@
 Over

[PATCH] D139686: [lsan] Add lsan support for loongarch64

2022-12-26 Thread Youling Tang via Phabricator via cfe-commits
tangyouling updated this revision to Diff 485349.
tangyouling added a comment.

rebase code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139686

Files:
  clang/lib/Driver/ToolChains/Linux.cpp
  clang/test/Driver/fsanitize.c
  compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
  compiler-rt/lib/lsan/lsan_common.cpp
  compiler-rt/lib/lsan/lsan_common.h
  compiler-rt/test/asan/lit.cfg.py
  compiler-rt/test/lsan/TestCases/swapcontext.cpp
  compiler-rt/test/lsan/TestCases/use_registers.cpp
  compiler-rt/test/lsan/lit.common.cfg.py

Index: compiler-rt/test/lsan/lit.common.cfg.py
===
--- compiler-rt/test/lsan/lit.common.cfg.py
+++ compiler-rt/test/lsan/lit.common.cfg.py
@@ -74,9 +74,9 @@
 config.substitutions.append( ("%clangxx_lsan ", build_invocation(clang_lsan_cxxflags)) )
 
 # LeakSanitizer tests are currently supported on
-# Android{aarch64, x86, x86_64}, x86-64 Linux, PowerPC64 Linux, arm Linux, mips64 Linux, s390x Linux and x86_64 Darwin.
+# Android{aarch64, x86, x86_64}, x86-64 Linux, PowerPC64 Linux, arm Linux, mips64 Linux, s390x Linux, loongarch64 Linux and x86_64 Darwin.
 supported_android = config.android and config.target_arch in ['x86_64', 'i386', 'aarch64'] and 'android-thread-properties-api' in config.available_features
-supported_linux = (not config.android) and config.host_os == 'Linux' and config.host_arch in ['aarch64', 'x86_64', 'ppc64', 'ppc64le', 'mips64', 'riscv64', 'arm', 'armhf', 'armv7l', 's390x']
+supported_linux = (not config.android) and config.host_os == 'Linux' and config.host_arch in ['aarch64', 'x86_64', 'ppc64', 'ppc64le', 'mips64', 'riscv64', 'arm', 'armhf', 'armv7l', 's390x', 'loongarch64']
 supported_darwin = config.host_os == 'Darwin' and config.target_arch in ['x86_64']
 supported_netbsd = config.host_os == 'NetBSD' and config.target_arch in ['x86_64', 'i386']
 if not (supported_android or supported_linux or supported_darwin or supported_netbsd):
Index: compiler-rt/test/lsan/TestCases/use_registers.cpp
===
--- compiler-rt/test/lsan/TestCases/use_registers.cpp
+++ compiler-rt/test/lsan/TestCases/use_registers.cpp
@@ -43,6 +43,8 @@
   "mov x14, %0"
   :
   : "r"(p));
+#elif defined(__loongarch_lp64)
+  asm("move $s8, %0" : : "r"(p));
 #elif defined(__powerpc__)
   asm("mr 30, %0"
   :
Index: compiler-rt/test/lsan/TestCases/swapcontext.cpp
===
--- compiler-rt/test/lsan/TestCases/swapcontext.cpp
+++ compiler-rt/test/lsan/TestCases/swapcontext.cpp
@@ -5,7 +5,7 @@
 // RUN: %env_lsan_opts= %run %t 2>&1
 // RUN: %env_lsan_opts= not %run %t foo 2>&1 | FileCheck %s
 // Missing 'getcontext' and 'makecontext' on Android.
-// UNSUPPORTED: target={{(arm|aarch64|powerpc64).*}},android
+// UNSUPPORTED: target={{(arm|aarch64|loongarch64|powerpc64).*}},android
 
 #include "sanitizer_common/sanitizer_ucontext.h"
 #include 
Index: compiler-rt/test/asan/lit.cfg.py
===
--- compiler-rt/test/asan/lit.cfg.py
+++ compiler-rt/test/asan/lit.cfg.py
@@ -202,7 +202,7 @@
 
 # Turn on leak detection on 64-bit Linux.
 leak_detection_android = config.android and 'android-thread-properties-api' in config.available_features and (config.target_arch in ['x86_64', 'i386', 'i686', 'aarch64'])
-leak_detection_linux = (config.host_os == 'Linux') and (not config.android) and (config.target_arch in ['x86_64', 'i386', 'riscv64'])
+leak_detection_linux = (config.host_os == 'Linux') and (not config.android) and (config.target_arch in ['x86_64', 'i386', 'riscv64', 'loongarch64'])
 leak_detection_mac = (config.host_os == 'Darwin') and (config.apple_platform == 'osx')
 leak_detection_netbsd = (config.host_os == 'NetBSD') and (config.target_arch in ['x86_64', 'i386'])
 if leak_detection_android or leak_detection_linux or leak_detection_mac or leak_detection_netbsd:
Index: compiler-rt/lib/lsan/lsan_common.h
===
--- compiler-rt/lib/lsan/lsan_common.h
+++ compiler-rt/lib/lsan/lsan_common.h
@@ -43,6 +43,8 @@
 #  define CAN_SANITIZE_LEAKS 1
 #elif defined(__arm__) && SANITIZER_LINUX
 #  define CAN_SANITIZE_LEAKS 1
+#elif SANITIZER_LOONGARCH64 && SANITIZER_LINUX
+#  define CAN_SANITIZE_LEAKS 1
 #elif SANITIZER_RISCV64 && SANITIZER_LINUX
 #  define CAN_SANITIZE_LEAKS 1
 #elif SANITIZER_NETBSD || SANITIZER_FUCHSIA
Index: compiler-rt/lib/lsan/lsan_common.cpp
===
--- compiler-rt/lib/lsan/lsan_common.cpp
+++ compiler-rt/lib/lsan/lsan_common.cpp
@@ -277,6 +277,9 @@
 #  elif defined(__aarch64__)
   // Accept up to 48 bit VMA.
   return ((p >> 48) == 0);
+#  elif defined(__loongarch_lp64)
+  // Allow 47-bit user-space VMA at current.
+  return ((p >> 47) 

[PATCH] D140614: [C++20] Mark lambdas in lambda specifiers as dependent if necessary

2022-12-26 Thread Liming Liu via Phabricator via cfe-commits
lime added a comment.

There should be a more general solution. This patch does not solve the issue 
here .


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

https://reviews.llvm.org/D140614

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


[PATCH] D140462: [clangd] Add schema for `.clangd` config

2022-12-26 Thread Edwin Kofler via Phabricator via cfe-commits
hyperupcall updated this revision to Diff 485351.
hyperupcall added a comment.

Improve schema correctness


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140462

Files:
  clang-tools-extra/clangd/schema/config.json

Index: clang-tools-extra/clangd/schema/config.json
===
--- /dev/null
+++ clang-tools-extra/clangd/schema/config.json
@@ -0,0 +1,180 @@
+{
+	"$schema": "http://json-schema.org/draft-07/schema";,
+	"$defs": {
+		"stringOrArrayOf": {
+			"oneOf": [
+{
+	"type": "string"
+},
+{
+	"type": "array",
+	"items": {
+		"type": "string"
+	}
+}
+			]
+		}
+	},
+	"type": "object",
+	"properties": {
+		"If": {
+			"description": "Conditions in the If block restrict when a fragment applies.",
+			"type": "object",
+			"properties": {
+"PathMatch": {
+	"description": "The file being processed must fully match a regular expression.",
+	"$ref": "#/$defs/stringOrArrayOf"
+},
+"PathExclude": {
+	"description": "The file being processed must not fully match a regular expression.",
+	"$ref": "#/$defs/stringOrArrayOf"
+}
+			}
+		},
+		"CompileFlags": {
+			"description": "Affects how a source file is parsed.",
+			"type": "object",
+			"properties": {
+"Add": {
+	"description": "List of flags to append to the compile command.",
+	"$ref": "#/$defs/stringOrArrayOf"
+},
+"Remove": {
+	"description": "List of flags to remove from the compile command",
+	"$ref": "#/$defs/stringOrArrayOf"
+},
+"CompilationDatabase": {
+	"description": "Directory to search for compilation database (compile_commands.json etc).",
+	"oneOf": [
+		{
+			"type": "string"
+		},
+		{
+			"enum": ["Ancestors", "None"]
+		}
+	]
+},
+"Compiler": {
+	"description": "String to replace the executable name in the compile flags. The name controls flag parsing (clang vs clang-cl), target inference (gcc-arm-noneabi) etc.",
+	"type": "string"
+}
+			}
+		},
+		"Index": {
+			"description": "Controls how clangd understands code outside the current file.",
+			"type": "object",
+			"properties": {
+"Background": {
+	"description": "Whether files are built in the background to produce a project index. This is checked for translation units only, not headers they include.",
+	"type": "string",
+	"enum": ["Build", "Skip"],
+	"default": "Build"
+},
+"External": {
+	"description": "Used to define an external index source",
+	"type": "object",
+	"oneOf": [
+		{
+			"properties": {
+"File": {
+	"type": "string"
+}
+			},
+			"required": ["File"]
+		},
+		{
+			"properties": {
+"Server": {
+	"type": "string"
+},
+"MountPoint": {
+	"type": "string"
+}
+			},
+			"required": ["Server"]
+		}
+	]
+}
+			}
+		},
+		"Style": {
+			"description": "Describes the style of the codebase, beyond formatting",
+			"type": "object",
+			"properties": {
+"FullyQualifiedNamespaces": {
+	"type": "boolean"
+}
+			}
+		},
+		"Diagnostics": {
+			"type": "object",
+			"properties": {
+"Suppress": {
+	"description": "Diagnostic codes that should be suppressed.",
+	"$ref": "#/$defs/stringOrArrayOf"
+},
+"ClangTidy": {
+	"description": "Configure how clang-tidy runs over your files. The settings are merged with any settings found in .clang-tidy configuration files with the ones from clangd configs taking precedence.",
+	"type": "object",
+	"properties": {
+		"Add": {
+			"description": "List of checks to enable, can be globs.",
+			"$ref": "#/$defs/stringOrArrayOf"
+		},
+		"Remove": {
+			"description": "List of checks to disable, can be globs.",
+			"$ref": "#/$defs/stringOrArrayOf"
+		},
+		"CheckOptions": {
+			"description": "Key-value pairs of options for clang-tidy checks",
+			"type": "object"
+		},
+		"UnusedIncludes": {
+			"description": "Enables Include Cleaner's unused includes diagnostics.",
+			"type": "string",
+			"enum": ["None", "Strict"],
+			"default": "None"
+		}
+	}
+}
+			}
+		},
+		"Completion": {
+			"type": "object",
+			"properties": {
+"AllScopes": {
+	"description": "Whether code completion should include suggestions from scopes that are not visible. The required scope prefix will be inserted.",
+	"type": "boolean"
+}
+			}
+		},
+		"InlayHints": {
+			"description": "Configures the behaviour of the inlay-hints feature.",
+			"type": "object",
+			"properties": {
+"Enabled": {
+	"description": "A boolean that enables/disables the inlay-hints feature for all kinds, when disabled, configuration for specific kinds are ignored.",
+	"type": "boolean"
+}

[PATCH] D140462: [clangd] Add schema for `.clangd` config

2022-12-26 Thread Edwin Kofler via Phabricator via cfe-commits
hyperupcall updated this revision to Diff 485352.
hyperupcall added a comment.

Apply `clang-format`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140462

Files:
  clang-tools-extra/clangd/schema/config.json

Index: clang-tools-extra/clangd/schema/config.json
===
--- /dev/null
+++ clang-tools-extra/clangd/schema/config.json
@@ -0,0 +1,193 @@
+{
+  "$schema": "http://json-schema.org/draft-07/schema";,
+  "$defs": {
+"stringOrArrayOf": {
+  "oneOf": [
+{
+  "type": "string"
+},
+{
+  "type": "array",
+  "items": {
+"type": "string"
+  }
+}
+  ]
+}
+  },
+  "type": "object",
+  "properties": {
+"If": {
+  "description": "Conditions in the If block restrict when a fragment applies.",
+  "type": "object",
+  "properties": {
+"PathMatch": {
+  "description": "The file being processed must fully match a regular expression.",
+  "$ref": "#/$defs/stringOrArrayOf"
+},
+"PathExclude": {
+  "description": "The file being processed must not fully match a regular expression.",
+  "$ref": "#/$defs/stringOrArrayOf"
+}
+  }
+},
+"CompileFlags": {
+  "description": "Affects how a source file is parsed.",
+  "type": "object",
+  "properties": {
+"Add": {
+  "description": "List of flags to append to the compile command.",
+  "$ref": "#/$defs/stringOrArrayOf"
+},
+"Remove": {
+  "description": "List of flags to remove from the compile command",
+  "$ref": "#/$defs/stringOrArrayOf"
+},
+"CompilationDatabase": {
+  "description": "Directory to search for compilation database (compile_commands.json etc).",
+  "oneOf": [
+{
+  "type": "string"
+},
+{
+  "enum": [
+"Ancestors",
+"None"
+  ]
+}
+  ]
+},
+"Compiler": {
+  "description": "String to replace the executable name in the compile flags. The name controls flag parsing (clang vs clang-cl), target inference (gcc-arm-noneabi) etc.",
+  "type": "string"
+}
+  }
+},
+"Index": {
+  "description": "Controls how clangd understands code outside the current file.",
+  "type": "object",
+  "properties": {
+"Background": {
+  "description": "Whether files are built in the background to produce a project index. This is checked for translation units only, not headers they include.",
+  "type": "string",
+  "enum": [
+"Build",
+"Skip"
+  ],
+  "default": "Build"
+},
+"External": {
+  "description": "Used to define an external index source",
+  "type": "object",
+  "oneOf": [
+{
+  "properties": {
+"File": {
+  "type": "string"
+}
+  },
+  "required": [
+"File"
+  ]
+},
+{
+  "properties": {
+"Server": {
+  "type": "string"
+},
+"MountPoint": {
+  "type": "string"
+}
+  },
+  "required": [
+"Server"
+  ]
+}
+  ]
+}
+  }
+},
+"Style": {
+  "description": "Describes the style of the codebase, beyond formatting",
+  "type": "object",
+  "properties": {
+"FullyQualifiedNamespaces": {
+  "type": "boolean"
+}
+  }
+},
+"Diagnostics": {
+  "type": "object",
+  "properties": {
+"Suppress": {
+  "description": "Diagnostic codes that should be suppressed.",
+  "$ref": "#/$defs/stringOrArrayOf"
+},
+"ClangTidy": {
+  "description": "Configure how clang-tidy runs over your files. The settings are merged with any settings found in .clang-tidy configuration files with the ones from clangd configs taking precedence.",
+  "type": "object",
+  "properties": {
+"Add": {
+  "description": "List of checks to enable, can be globs.",
+  "$ref": "#/$defs/stringOrArrayOf"
+},
+"Remove": {
+  "description": "List of checks to disable, can be globs.",
+  "$ref": "#/$defs/stringOrArrayOf"
+},
+"CheckOptions": {
+  "description": "Key-value pairs of options for clang-tidy checks",
+  "type": "object"
+},
+"UnusedIncludes": {
+  "description": "Enables Include Cleaner's un

[PATCH] D140462: [clangd] Add schema for `.clangd` config

2022-12-26 Thread Edwin Kofler via Phabricator via cfe-commits
hyperupcall added a comment.

Thank you for the suggestions - I applied all of the fixes!

As someone who helps maintain a lot of the schemas 
 on schemastore, it's nice when 
schemas are in-tree with their respective project, but I totally understand 
that this can increase complexity, especially for the reasons stated.

In D140462#4014944 , @sammccall wrote:

> given lack of any automation/tests.



In D140462#4014997 , @nridge wrote:

> And perhaps, if someone contributes automated tests for the schema in the 
> future, we could consider upgrading its status to "maintained" at that time?

If you would like me to add tests to verify the schema (for now or later?), is 
there a utility within LLVM to help do so? I saw TableGen was mentioned, but it 
sounds like the schema validation use case is a different issue.

In D140462#4014944 , @sammccall wrote:

> One practical question: AIUI the main point of having this is so it can be 
> provided to the VSCode YAML extension so it understands .clangd files. How 
> does this work mechanically? Does it need to be part of the vscode-clangd 
> repo instead?

I think it's worth mentioning that the JSON schema can be hosted anywhere. As 
already mentioned, the YAML extension automatically downloads and uses the 
schema if it finds a `.clangd` file, and the schema can point to an external 
URL. One example of that in practice is the xunit-2.2.json 

 schema; it simply contains a `$ref` to the actual schema on xunit.net. Whether 
this schema goes in `clangd/schema/config.json`, 
`clangd/contrib/schema/config.json`, or in `vscode-clangd` - on the SchemaStore 
end, all I have to do is update `$ref`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140462

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


[PATCH] D140462: [clangd] Add schema for `.clangd` config

2022-12-26 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

In D140462#4017237 , @hyperupcall 
wrote:

> If you would like me to add tests to verify the schema (for now or later?), 
> is there a utility within LLVM to help do so? I saw TableGen was mentioned, 
> but it sounds like the schema validation use case is a different issue.

Is there a command-line tool that can perform JSON schema validation which is 
included in a commonly used package that's available in the default package 
repositories of major Linux distros? If so, we may be able to get away with 
just requiring that the buildbots have that package installed.

If not, then we'd need to check in such a tool into the LLVM repo (and if it 
needs building, integrate its build into the build system).

In either case, the tests themselves can take the form of simple lit tests 
 that invoke that tool on some 
test config files.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140462

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


[PATCH] D140462: [clangd] Add schema for `.clangd` config

2022-12-26 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

In D140462#4017240 , @nridge wrote:

> Is there a command-line tool that can perform JSON schema validation

(well, more specifically that can validate YAML files against a JSON schema)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140462

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