[PATCH] D101973: [OpenMP][NFC] Remove SIMD check lines for non-simd tests

2021-05-05 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert created this revision.
jdoerfert added reviewers: ABataev, ggeorgakoudis.
Herald added subscribers: jfb, guansong, yaxunl.
Herald added a reviewer: bollu.
jdoerfert requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

If a test does not contain an " simd" but -fopenmp-simd RUN lines we can
just check that we do not create __kmpc|__tgt calls.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101973

Files:
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  clang/test/OpenMP/sections_firstprivate_codegen.cpp
  clang/test/OpenMP/sections_lastprivate_codegen.cpp
  clang/test/OpenMP/sections_private_codegen.cpp
  clang/test/OpenMP/sections_reduction_codegen.cpp
  clang/test/OpenMP/sections_reduction_task_codegen.cpp
  clang/test/OpenMP/single_codegen.cpp
  clang/test/OpenMP/single_firstprivate_codegen.cpp
  clang/test/OpenMP/single_private_codegen.cpp
  clang/test/OpenMP/target_codegen_global_capture.cpp
  clang/test/OpenMP/target_map_codegen_03.cpp
  clang/test/OpenMP/target_parallel_codegen.cpp
  clang/test/OpenMP/target_parallel_for_codegen.cpp
  clang/test/OpenMP/target_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/target_parallel_if_codegen.cpp
  clang/test/OpenMP/target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/target_parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/target_teams_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_collapse_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_dist_schedule_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_collapse_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_dist_schedule_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_order_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_reduction_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_schedule_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_private_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_reduction_codegen.cpp
  

[PATCH] D101030: [OpenMP] Overhaul `declare target` handling

2021-05-05 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert updated this revision to Diff 343285.
jdoerfert added a comment.

Reapply test changes accidentally dropped


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101030

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/AttrImpl.cpp
  clang/lib/CodeGen/CGDecl.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/declare_target_device_only_compilation.cpp
  clang/test/OpenMP/declare_target_messages.cpp
  clang/test/OpenMP/declare_target_only_one_side_compilation.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/irbuilder_for_iterator.cpp
  clang/test/OpenMP/irbuilder_for_rangefor.cpp
  clang/test/OpenMP/irbuilder_for_unsigned.c
  clang/test/OpenMP/irbuilder_nested_openmp_parallel_empty.c
  clang/test/OpenMP/irbuilder_nested_parallel_for.c
  clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp
  clang/test/OpenMP/nvptx_declare_variant_name_mangling.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
  clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
  clang/test/OpenMP/sections_firstprivate_codegen.cpp
  clang/test/OpenMP/single_codegen.cpp
  clang/test/OpenMP/single_firstprivate_codegen.cpp
  clang/test/OpenMP/task_codegen.cpp
  clang/test/OpenMP/taskgroup_codegen.cpp
  clang/test/OpenMP/threadprivate_codegen.cpp
  clang/test/OpenMP/tile_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMP.td

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


[PATCH] D101030: [OpenMP] Overhaul `declare target` handling

2021-05-05 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert updated this revision to Diff 343282.
jdoerfert added a comment.
Herald added a subscriber: jfb.

Update tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101030

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/AttrImpl.cpp
  clang/lib/CodeGen/CGDecl.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/declare_target_device_only_compilation.cpp
  clang/test/OpenMP/declare_target_messages.cpp
  clang/test/OpenMP/declare_target_only_one_side_compilation.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/irbuilder_for_iterator.cpp
  clang/test/OpenMP/irbuilder_for_rangefor.cpp
  clang/test/OpenMP/irbuilder_for_unsigned.c
  clang/test/OpenMP/irbuilder_nested_openmp_parallel_empty.c
  clang/test/OpenMP/irbuilder_nested_parallel_for.c
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
  clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
  clang/test/OpenMP/sections_firstprivate_codegen.cpp
  clang/test/OpenMP/single_codegen.cpp
  clang/test/OpenMP/single_firstprivate_codegen.cpp
  clang/test/OpenMP/task_codegen.cpp
  clang/test/OpenMP/taskgroup_codegen.cpp
  clang/test/OpenMP/threadprivate_codegen.cpp
  clang/test/OpenMP/tile_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMP.td

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


[PATCH] D100620: [OpenMP] Make sure classes work on the device as they do on the host

2021-05-05 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert updated this revision to Diff 343279.
jdoerfert marked an inline comment as done.
jdoerfert added a comment.

Split the new/delete operators based on std::nothrow_t and provide the ones
that do not use this type by default, the others as part of .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100620

Files:
  clang/lib/Headers/openmp_wrappers/__clang_openmp_device_functions.h
  clang/lib/Headers/openmp_wrappers/new
  clang/test/Headers/Inputs/include/new
  clang/test/Headers/Inputs/include/stdlib.h
  clang/test/Headers/target_include_new.cpp

Index: clang/test/Headers/target_include_new.cpp
===
--- /dev/null
+++ clang/test/Headers/target_include_new.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/Inputs/include -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64 -emit-llvm-bc %s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/Inputs/include -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64 -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s
+// expected-no-diagnostics
+
+// Ensure we make `_ZdlPv`, aka. `operator delete(void*)` available without the need to `include `.
+
+// CHECK: define {{.*}}_ZdlPv
+
+#ifndef HEADER
+#define HEADER
+
+class Base {
+  public:
+virtual ~Base() = default;
+};
+
+class Derived : public Base {
+  public:
+#pragma omp declare target
+Derived();
+#pragma omp end declare target
+};
+
+Derived::Derived() { }
+
+int main(void) {
+  #pragma omp target
+  {
+  }
+  return 0;
+}
+#endif
Index: clang/test/Headers/Inputs/include/stdlib.h
===
--- clang/test/Headers/Inputs/include/stdlib.h
+++ clang/test/Headers/Inputs/include/stdlib.h
@@ -1,6 +1,9 @@
 #pragma once
 typedef __SIZE_TYPE__ size_t;
 
+void *malloc(size_t);
+void free(void*);
+
 #ifndef __cplusplus
 extern int abs(int __x) __attribute__((__const__));
 #endif
Index: clang/test/Headers/Inputs/include/new
===
--- /dev/null
+++ clang/test/Headers/Inputs/include/new
@@ -0,0 +1,7 @@
+
+namespace std
+{
+
+struct nothrow_t { explicit nothrow_t() = default; };
+
+}
Index: clang/lib/Headers/openmp_wrappers/new
===
--- clang/lib/Headers/openmp_wrappers/new
+++ clang/lib/Headers/openmp_wrappers/new
@@ -9,6 +9,8 @@
 #ifndef __CLANG_OPENMP_WRAPPERS_NEW
 #define __CLANG_OPENMP_WRAPPERS_NEW
 
+// We need the system  for the std::nothrow_t. The new/delete operators
+// which do not use nothrow_t are provided without the  header.
 #include_next 
 
 #if defined(__NVPTX__) && defined(_OPENMP)
@@ -22,48 +24,24 @@
 #define OPENMP_NOEXCEPT
 #endif
 
-// Device overrides for non-placement new and delete.
-inline void *operator new(__SIZE_TYPE__ size) {
-  if (size == 0)
-size = 1;
-  return ::malloc(size);
-}
 inline void *operator new(__SIZE_TYPE__ size,
   const std::nothrow_t &) OPENMP_NOEXCEPT {
   return ::operator new(size);
 }
 
-inline void *operator new[](__SIZE_TYPE__ size) { return ::operator new(size); }
 inline void *operator new[](__SIZE_TYPE__ size, const std::nothrow_t &) {
   return ::operator new(size);
 }
 
-inline void operator delete(void *ptr)OPENMP_NOEXCEPT {
-  if (ptr)
-::free(ptr);
-}
 inline void operator delete(void *ptr, const std::nothrow_t &)OPENMP_NOEXCEPT {
   ::operator delete(ptr);
 }
 
-inline void operator delete[](void *ptr) OPENMP_NOEXCEPT {
-  ::operator delete(ptr);
-}
 inline void operator delete[](void *ptr,
   const std::nothrow_t &) OPENMP_NOEXCEPT {
   ::operator delete(ptr);
 }
 
-// Sized delete, C++14 only.
-#if __cplusplus >= 201402L
-inline void operator delete(void *ptr, __SIZE_TYPE__ size)OPENMP_NOEXCEPT {
-  ::operator delete(ptr);
-}
-inline void operator delete[](void *ptr, __SIZE_TYPE__ size) OPENMP_NOEXCEPT {
-  ::operator delete(ptr);
-}
-#endif
-
 #pragma pop_macro("OPENMP_NOEXCEPT")
 #endif
 
Index: clang/lib/Headers/openmp_wrappers/__clang_openmp_device_functions.h
===
--- clang/lib/Headers/openmp_wrappers/__clang_openmp_device_functions.h
+++ clang/lib/Headers/openmp_wrappers/__clang_openmp_device_functions.h
@@ -39,4 +39,46 @@
 
 #pragma omp end declare variant
 
+// Ensure we make `_ZdlPv`, aka. `operator delete(void*)` available without the
+// need to `include ` in C++ mode.
+#ifdef __cplusplus
+
+// We require malloc/free.
+#include 
+
+#pragma 

[PATCH] D97265: [clang] Allow clang-check to customize analyzer output file or dir name

2021-05-05 Thread Ella Ma via Phabricator via cfe-commits
OikawaKirie added a comment.

Ping @sammccall again for landing this patch on my behalf.
Thanks.


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

https://reviews.llvm.org/D97265

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


[PATCH] D101849: [OpenMP][NFC] Refactor Clang OpenMP tests using update_cc_test_checks

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG207b08a9130b: [OpenMP][NFC] Refactor Clang OpenMP tests 
using update_cc_test_checks (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101849

Files:
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/ordered_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  clang/test/OpenMP/sections_firstprivate_codegen.cpp
  clang/test/OpenMP/sections_lastprivate_codegen.cpp
  

[PATCH] D101952: [OpenMP] Fix non-determinism in clang copyin codegen

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf97b843d8819: [OpenMP] Fix non-determinism in clang copyin 
codegen (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101952

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1006,12 +1006,14 @@
   // need to copy data.
   CopyBegin = createBasicBlock("copyin.not.master");
   CopyEnd = createBasicBlock("copyin.not.master.end");
+  // TODO: Avoid ptrtoint conversion.
+  auto *MasterAddrInt =
+  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy);
+  auto *PrivateAddrInt =
+  Builder.CreatePtrToInt(PrivateAddr.getPointer(), CGM.IntPtrTy);
   Builder.CreateCondBr(
-  Builder.CreateICmpNE(
-  Builder.CreatePtrToInt(MasterAddr.getPointer(), 
CGM.IntPtrTy),
-  Builder.CreatePtrToInt(PrivateAddr.getPointer(),
- CGM.IntPtrTy)),
-  CopyBegin, CopyEnd);
+  Builder.CreateICmpNE(MasterAddrInt, PrivateAddrInt), CopyBegin,
+  CopyEnd);
   EmitBlock(CopyBegin);
 }
 const auto *SrcVD =


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1006,12 +1006,14 @@
   // need to copy data.
   CopyBegin = createBasicBlock("copyin.not.master");
   CopyEnd = createBasicBlock("copyin.not.master.end");
+  // TODO: Avoid ptrtoint conversion.
+  auto *MasterAddrInt =
+  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy);
+  auto *PrivateAddrInt =
+  Builder.CreatePtrToInt(PrivateAddr.getPointer(), CGM.IntPtrTy);
   Builder.CreateCondBr(
-  Builder.CreateICmpNE(
-  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy),
-  Builder.CreatePtrToInt(PrivateAddr.getPointer(),
- CGM.IntPtrTy)),
-  CopyBegin, CopyEnd);
+  Builder.CreateICmpNE(MasterAddrInt, PrivateAddrInt), CopyBegin,
+  CopyEnd);
   EmitBlock(CopyBegin);
 }
 const auto *SrcVD =
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] f97b843 - [OpenMP] Fix non-determinism in clang copyin codegen

2021-05-05 Thread Giorgis Georgakoudis via cfe-commits

Author: Giorgis Georgakoudis
Date: 2021-05-05T19:24:03-07:00
New Revision: f97b843d8819f824dcc1b6afa746ce9a7a386db3

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

LOG: [OpenMP] Fix non-determinism in clang copyin codegen

Codegen for OpeMP copyin has non-deterministic IR output due to the unspecified 
evaluation order in a codegen conditional branch, which makes automatic test 
generation unreliable. This patch refactors codegen code to avoid this 
non-determinism.

Reviewed By: jdoerfert

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

Added: 


Modified: 
clang/lib/CodeGen/CGStmtOpenMP.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp 
b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 1f714b01b3f1c..344fa90253ec3 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1006,12 +1006,14 @@ bool CodeGenFunction::EmitOMPCopyinClause(const 
OMPExecutableDirective ) {
   // need to copy data.
   CopyBegin = createBasicBlock("copyin.not.master");
   CopyEnd = createBasicBlock("copyin.not.master.end");
+  // TODO: Avoid ptrtoint conversion.
+  auto *MasterAddrInt =
+  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy);
+  auto *PrivateAddrInt =
+  Builder.CreatePtrToInt(PrivateAddr.getPointer(), CGM.IntPtrTy);
   Builder.CreateCondBr(
-  Builder.CreateICmpNE(
-  Builder.CreatePtrToInt(MasterAddr.getPointer(), 
CGM.IntPtrTy),
-  Builder.CreatePtrToInt(PrivateAddr.getPointer(),
- CGM.IntPtrTy)),
-  CopyBegin, CopyEnd);
+  Builder.CreateICmpNE(MasterAddrInt, PrivateAddrInt), CopyBegin,
+  CopyEnd);
   EmitBlock(CopyBegin);
 }
 const auto *SrcVD =



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


[PATCH] D101968: Fix bad mangling of for a closure in the initializer of a variable at global namespace scope.

2021-05-05 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith created this revision.
rsmith added a reviewer: rjmccall.
Herald added a subscriber: dexonsmith.
rsmith requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This implements the direction proposed in
https://github.com/itanium-cxx-abi/cxx-abi/pull/126.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101968

Files:
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Basic/LangOptions.h
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGenCXX/clang-abi-compat.cpp
  clang/test/CodeGenCXX/lambda-expressions-nested-linkage.cpp
  clang/test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp

Index: clang/test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp
===
--- clang/test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp
+++ clang/test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp
@@ -38,7 +38,7 @@
 inline auto pack = [](T (&...)[N]) {};
 int arr1[] = {1};
 int arr2[] = {1, 2};
-// CHECK: @_ZNK4packMUlTpTyTpTnT_DpRAT0__S_E_clIJiiEJLi1ELi2DaS2_(
+// CHECK: @_ZNK4packMUlTpTyTpTnT_DpRAT0__S0_E_clIJiiEJLi1ELi2DaS3_(
 void use_pack() { pack(arr1, arr2); }
 
 inline void collision() {
Index: clang/test/CodeGenCXX/lambda-expressions-nested-linkage.cpp
===
--- clang/test/CodeGenCXX/lambda-expressions-nested-linkage.cpp
+++ clang/test/CodeGenCXX/lambda-expressions-nested-linkage.cpp
@@ -22,6 +22,13 @@
   L l; 
 }
 
+// It's important that this is not in a namespace; we're testing the mangling
+// of lambdas in top-level inline variables here.
+inline auto lambda_in_inline_variable = [] {};
+template struct Wrap {};
+// CHECK-LABEL: define {{.*}} @_Z30test_lambda_in_inline_variable4WrapIN25lambda_in_inline_variableMUlvE_EE
+void test_lambda_in_inline_variable(Wrap) {}
+
 namespace lambdas_in_NSDMIs_template_class {
 template
 struct L {
Index: clang/test/CodeGenCXX/clang-abi-compat.cpp
===
--- clang/test/CodeGenCXX/clang-abi-compat.cpp
+++ clang/test/CodeGenCXX/clang-abi-compat.cpp
@@ -13,11 +13,13 @@
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=11 %s -emit-llvm -o - \
 // RUN: | FileCheck --check-prefixes=CHECK,V39,V5,PRE12,PRE12-CXX17 %s
 // RUN: %clang_cc1 -std=c++20 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=11 %s -emit-llvm -o - \
-// RUN: | FileCheck --check-prefixes=CHECK,V39,V5,PRE12,PRE12-CXX17,PRE12-CXX20 %s
+// RUN: | FileCheck --check-prefixes=CHECK,V39,V5,PRE12,PRE12-CXX17,PRE12-CXX20,PRE13-CXX20 %s
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=12 %s -emit-llvm -o - \
+// RUN: | FileCheck --check-prefixes=CHECK,V39,V5,V12,V12-CXX17,V12-CXX20,PRE13-CXX20 %s
 // RUN: %clang_cc1 -std=c++98 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=latest %s -emit-llvm -o - -Wno-c++11-extensions \
 // RUN: | FileCheck --check-prefixes=CHECK,V39,V5,V12 %s
 // RUN: %clang_cc1 -std=c++20 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=latest %s -emit-llvm -o - \
-// RUN: | FileCheck --check-prefixes=CHECK,V39,V5,V12,V12-CXX17,V12-CXX20 %s
+// RUN: | FileCheck --check-prefixes=CHECK,V39,V5,V12,V12-CXX17,V12-CXX20,V13-CXX20 %s
 
 typedef __attribute__((vector_size(8))) long long v1xi64;
 void clang39(v1xi64) {}
@@ -136,3 +138,12 @@
 void test9(void) __attribute__((enable_if(1, ""))) {}
 
 }
+
+#if __cplusplus >= 202002L
+// PRE13-CXX20: @_Z15observe_lambdasI17inline_var_lambdaMUlvE_17inline_var_lambdaMUlvE0_PiS2_S0_S1_EiT_T0_T1_T2_
+// V13-CXX20: @_Z15observe_lambdasIN17inline_var_lambdaMUlvE_ENS0_UlvE0_EPiS3_S1_S2_EiT_T0_T1_T2_
+template 
+int observe_lambdas(T, U, V, W) { return 0; }
+inline auto inline_var_lambda = observe_lambdas([]{}, []{}, (int*)0, (int*)0);
+int use_inline_var_lambda() { return inline_var_lambda; }
+#endif
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -3501,6 +3501,8 @@
 GenerateArg(Args, OPT_fclang_abi_compat_EQ, "9.0", SA);
   else if (Opts.getClangABICompat() == LangOptions::ClangABI::Ver11)
 GenerateArg(Args, OPT_fclang_abi_compat_EQ, "11.0", SA);
+  else if (Opts.getClangABICompat() == LangOptions::ClangABI::Ver12)
+GenerateArg(Args, OPT_fclang_abi_compat_EQ, "12.0", SA);
 
   if (Opts.getSignReturnAddressScope() ==
   LangOptions::SignReturnAddressScopeKind::All)
@@ -3962,6 +3964,8 @@
 Opts.setClangABICompat(LangOptions::ClangABI::Ver9);
   else if (Major <= 11)
 Opts.setClangABICompat(LangOptions::ClangABI::Ver11);
+  else if (Major <= 12)
+

[PATCH] D101967: [Driver] Use x86-64 libc++ headers with -m32

2021-05-05 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: mcgrathr, leonardchan.
Herald added a subscriber: pengfei.
phosek requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

x86 is only used for the bootloader and we use x86-64 libc++ headers
in that case.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101967

Files:
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/i386-unknown-fuchsia/libclang_rt.builtins.a
  clang/test/Driver/fuchsia.cpp


Index: clang/test/Driver/fuchsia.cpp
===
--- clang/test/Driver/fuchsia.cpp
+++ clang/test/Driver/fuchsia.cpp
@@ -13,16 +13,23 @@
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN: --sysroot=%S/platform -fuse-ld=lld 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-RISCV64 %s
+// RUN: %clangxx %s -### -no-canonical-prefixes 
--target=x86_64-unknown-fuchsia -m32 \
+// RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN: --sysroot=%S/platform -fuse-ld=lld 2>&1 \
+// RUN: | FileCheck -check-prefixes=CHECK,CHECK-X86_64-M32 %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK-X86_64: "-triple" "x86_64-unknown-fuchsia"
 // CHECK-AARCH64: "-triple" "aarch64-unknown-fuchsia"
 // CHECK-RISCV64: "-triple" "riscv64-unknown-fuchsia"
+// CHECK-X86_64-M32: "-triple" "i386-unknown-fuchsia"
 // CHECK-NOT: "-fno-use-init-array"
 // CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-X86_64: "-internal-isystem" 
"{{.*[/\\]}}include{{/|}}x86_64-unknown-fuchsia{{/|}}c++{{/|}}v1"
 // CHECK-AARCH64: "-internal-isystem" 
"{{.*[/\\]}}include{{/|}}aarch64-unknown-fuchsia{{/|}}c++{{/|}}v1"
 // CHECK-RISCV64: "-internal-isystem" 
"{{.*[/\\]}}include{{/|}}riscv64-unknown-fuchsia{{/|}}c++{{/|}}v1"
+// CHECK-X86_64-M32: "-internal-isystem" 
"{{.*[/\\]}}include{{/|}}x86_64-unknown-fuchsia{{/|}}c++{{/|}}v1"
 // CHECK: "-internal-isystem" "{{.*[/\\]}}include{{/|}}c++{{/|}}v1"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
 // CHECK: {{.*}}ld.lld{{.*}}" "-z" "now" "-z" "rodynamic" "-z" 
"separate-loadable-segments"
@@ -42,6 +49,7 @@
 // CHECK-X86_64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}x86_64-unknown-fuchsia{{/|}}libclang_rt.builtins.a"
 // CHECK-AARCH64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aarch64-unknown-fuchsia{{/|}}libclang_rt.builtins.a"
 // CHECK-RISCV64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}riscv64-unknown-fuchsia{{/|}}libclang_rt.builtins.a"
+// CHECK-X86_64-M32: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}i386-unknown-fuchsia{{/|}}libclang_rt.builtins.a"
 // CHECK: "-lc"
 // CHECK-NOT: crtend.o
 // CHECK-NOT: crtn.o
Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -358,31 +358,30 @@
   DriverArgs.hasArg(options::OPT_nostdincxx))
 return;
 
-  const Driver  = getDriver();
-  std::string Target = getTripleString();
+  llvm::Triple Triple = getTriple();
+  // x86 is only used for the bootloader and we use x86-64 headers in that 
case.
+  if (Triple.getArch() == llvm::Triple::x86)
+Triple.setArch(llvm::Triple::x86_64);
+
+  switch (GetCXXStdlibType(DriverArgs)) {
+  case ToolChain::CST_Libcxx: {
+SmallString<128> P(getDriver().Dir);
+llvm::sys::path::append(P, "..", "include");
 
-  auto AddCXXIncludePath = [&](StringRef Path) {
-std::string Version = detectLibcxxVersion(Path);
+std::string Version = detectLibcxxVersion(P);
 if (Version.empty())
   return;
 
-// First add the per-target include path.
-SmallString<128> TargetDir(Path);
-llvm::sys::path::append(TargetDir, Target, "c++", Version);
+// First add the per-target include path if it exists.
+SmallString<128> TargetDir(P);
+llvm::sys::path::append(TargetDir, Triple.str(), "c++", Version);
 if (getVFS().exists(TargetDir))
   addSystemInclude(DriverArgs, CC1Args, TargetDir);
 
 // Second add the generic one.
-SmallString<128> Dir(Path);
+SmallString<128> Dir(P);
 llvm::sys::path::append(Dir, "c++", Version);
 addSystemInclude(DriverArgs, CC1Args, Dir);
-  };
-
-  switch (GetCXXStdlibType(DriverArgs)) {
-  case ToolChain::CST_Libcxx: {
-SmallString<128> P(D.Dir);
-llvm::sys::path::append(P, "..", "include");
-AddCXXIncludePath(P);
 break;
   }
 


Index: clang/test/Driver/fuchsia.cpp
===
--- clang/test/Driver/fuchsia.cpp
+++ clang/test/Driver/fuchsia.cpp
@@ -13,16 +13,23 @@
 // RUN: 

[PATCH] D101787: [clang-tidy] Aliasing: Add more support for lambda captures.

2021-05-05 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ updated this revision to Diff 343264.
NoQ added a comment.

Rebase to address the comment!


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

https://reviews.llvm.org/D101787

Files:
  clang-tools-extra/clang-tidy/utils/Aliasing.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-infinite-loop.cpp
  
clang-tools-extra/test/clang-tidy/checkers/bugprone-redundant-branch-condition.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/bugprone-redundant-branch-condition.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/bugprone-redundant-branch-condition.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/bugprone-redundant-branch-condition.cpp
@@ -1260,6 +1260,71 @@
   }
 }
 
+void mutate_at_any_time(bool *x);
+
+void capture_with_branches_inside_lambda_bad() {
+  bool x = true;
+  accept_callback([=]() {
+if (x) {
+  wait();
+  if (x) {
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant condition 'x' [bugprone-redundant-branch-condition]
+  }
+}
+  });
+  mutate_at_any_time();
+}
+
+void capture_with_branches_inside_lambda_good() {
+  bool x = true;
+  accept_callback([&]() {
+if (x) {
+  wait();
+  if (x) {
+  }
+}
+  });
+  mutate_at_any_time();
+}
+
+void capture_with_branches_inside_block_bad() {
+  bool x = true;
+  accept_callback(^{
+if (x) {
+  wait();
+  if (x) {
+ // FIXME: Should warn. It currently reacts to  outside the block
+ // which ideally shouldn't have any effect.
+  }
+}
+  });
+  mutate_at_any_time();
+}
+
+void capture_with_branches_inside_block_bad_simpler() {
+  bool x = true;
+  accept_callback(^{
+if (x) {
+  wait();
+  if (x) {
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant condition 'x' [bugprone-redundant-branch-condition]
+  }
+}
+  });
+}
+
+void capture_with_branches_inside_block_good() {
+  __block bool x = true;
+  accept_callback(^{
+if (x) {
+  wait();
+  if (x) {
+  }
+}
+  });
+  mutate_at_any_time();
+}
+
 // GNU Expression Statements
 
 void negative_gnu_expression_statement() {
Index: clang-tools-extra/test/clang-tidy/checkers/bugprone-infinite-loop.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/bugprone-infinite-loop.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/bugprone-infinite-loop.cpp
@@ -457,6 +457,92 @@
   }
 }
 
+void finish_at_any_time(bool *finished);
+
+void lambda_capture_with_loop_inside_lambda_bad() {
+  bool finished = false;
+  auto lambda = [=]() {
+while (!finished) {
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: this loop is infinite; none of its condition variables (finished) are updated in the loop body [bugprone-infinite-loop]
+  wait();
+}
+  };
+  finish_at_any_time();
+  lambda();
+}
+
+void lambda_capture_with_loop_inside_lambda_bad_init_capture() {
+  bool finished = false;
+  auto lambda = [captured_finished=finished]() {
+while (!captured_finished) {
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: this loop is infinite; none of its condition variables (captured_finished) are updated in the loop body [bugprone-infinite-loop]
+  wait();
+}
+  };
+  finish_at_any_time();
+  lambda();
+}
+
+void lambda_capture_with_loop_inside_lambda_good() {
+  bool finished = false;
+  auto lambda = [&]() {
+while (!finished) {
+  wait(); // No warning: the variable may be updated
+  // from outside the lambda.
+}
+  };
+  finish_at_any_time();
+  lambda();
+}
+
+void lambda_capture_with_loop_inside_lambda_good_init_capture() {
+  bool finished = false;
+  auto lambda = [_finished=finished]() {
+while (!captured_finished) {
+  wait(); // No warning: the variable may be updated
+  // from outside the lambda.
+}
+  };
+  finish_at_any_time();
+  lambda();
+}
+
+void block_capture_with_loop_inside_block_bad() {
+  bool finished = false;
+  auto block = ^() {
+while (!finished) {
+  // FIXME: This should warn. It currently reacts to 
+  // outside the block which ideally shouldn't have any effect.
+  wait();
+}
+  };
+  finish_at_any_time();
+  block();
+}
+
+void block_capture_with_loop_inside_block_bad_simpler() {
+  bool finished = false;
+  auto block = ^() {
+while (!finished) {
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: this loop is infinite; none of its condition variables (finished) are updated in the loop body [bugprone-infinite-loop]
+  wait();
+}
+  };
+  block();
+}
+
+void block_capture_with_loop_inside_block_good() {
+  __block bool finished = false;
+  auto block = ^() {
+while (!finished) {
+  wait(); // No warning: the variable may be updated
+  // from outside the block.
+}
+  };
+  finish_at_any_time();
+  block();
+}
+
 void evaluatable(bool CondVar) {
   for (; false && CondVar;) {
   }

[PATCH] D101787: [clang-tidy] Aliasing: Add more support for lambda captures.

2021-05-05 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/bugprone-redundant-branch-condition.cpp:1
 // RUN: %check_clang_tidy %s bugprone-redundant-branch-condition %t
 

aaron.ballman wrote:
> You need to add `-fblocks` here to enable block support to run the test.
I added them in D96215 but didn't rebase this patch on top of that patch.


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

https://reviews.llvm.org/D101787

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


[PATCH] D96215: [clang-tidy] Aliasing: Add support for lambda captures.

2021-05-05 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: clang-tools-extra/clang-tidy/utils/Aliasing.cpp:45-48
+return llvm::any_of(LE->captures(), [Var](const LambdaCapture ) {
+  return C.capturesVariable() && C.getCaptureKind() == LCK_ByRef &&
+ C.getCapturedVar() == Var;
+});

aaron.ballman wrote:
> Should this use `capturesByRef()` from https://reviews.llvm.org/D101787?
Yes and https://reviews.llvm.org/D101787 already converts this code to use 
`capturesByRef()` as soon as it introduces it!


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

https://reviews.llvm.org/D96215

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


[PATCH] D101952: [OpenMP] Fix non-determinism in clang copyin codegen

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 343262.
ggeorgakoudis added a comment.

Update for comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101952

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1006,12 +1006,14 @@
   // need to copy data.
   CopyBegin = createBasicBlock("copyin.not.master");
   CopyEnd = createBasicBlock("copyin.not.master.end");
+  // TODO: Avoid ptrtoint conversion.
+  auto *MasterAddrInt =
+  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy);
+  auto *PrivateAddrInt =
+  Builder.CreatePtrToInt(PrivateAddr.getPointer(), CGM.IntPtrTy);
   Builder.CreateCondBr(
-  Builder.CreateICmpNE(
-  Builder.CreatePtrToInt(MasterAddr.getPointer(), 
CGM.IntPtrTy),
-  Builder.CreatePtrToInt(PrivateAddr.getPointer(),
- CGM.IntPtrTy)),
-  CopyBegin, CopyEnd);
+  Builder.CreateICmpNE(MasterAddrInt, PrivateAddrInt), CopyBegin,
+  CopyEnd);
   EmitBlock(CopyBegin);
 }
 const auto *SrcVD =


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1006,12 +1006,14 @@
   // need to copy data.
   CopyBegin = createBasicBlock("copyin.not.master");
   CopyEnd = createBasicBlock("copyin.not.master.end");
+  // TODO: Avoid ptrtoint conversion.
+  auto *MasterAddrInt =
+  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy);
+  auto *PrivateAddrInt =
+  Builder.CreatePtrToInt(PrivateAddr.getPointer(), CGM.IntPtrTy);
   Builder.CreateCondBr(
-  Builder.CreateICmpNE(
-  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy),
-  Builder.CreatePtrToInt(PrivateAddr.getPointer(),
- CGM.IntPtrTy)),
-  CopyBegin, CopyEnd);
+  Builder.CreateICmpNE(MasterAddrInt, PrivateAddrInt), CopyBegin,
+  CopyEnd);
   EmitBlock(CopyBegin);
 }
 const auto *SrcVD =
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77598: Integral template argument suffix and cast printing

2021-05-05 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

Thanks, I'm broadly very happy with this. My remaining comments are all very 
minor.




Comment at: clang/include/clang/AST/Expr.h:1619
 
+  static void streamChar(unsigned val, CharacterKind Kind, raw_ostream ) {
+switch (Kind) {

This is sufficiently large that it should be in the `.cpp` file not in the 
header. I think calling this `print` would be more in line with our normal 
conventions. Please capitalize `val` as `Val`.



Comment at: clang/lib/AST/DeclTemplate.cpp:174
+return true;
+  else {
+const NamedDecl *TemplParam = TPL->getParam(Idx);

Style nit: no need for `else` when the `if` side `return`s.



Comment at: clang/lib/AST/TemplateBase.cpp:90-92
 Out << ((Ch == '\'') ? "'\\" : "'");
 Out.write_escaped(StringRef(, 1), /*UseHexEscapes=*/ true);
 Out << "'";

Can we use `CharacterLiteral::streamChar` here too?



Comment at: clang/lib/AST/TypePrinter.cpp:1996-1997
 const PrintingPolicy , bool SkipBrackets,
-const TemplateParameterList *TPL) {
+const TemplateParameterList *TPL, bool isPack,
+unsigned parmIndex) {
   // Drop trailing template arguments that match default arguments.

Please capitalize `isPack` and `parmIndex`.



Comment at: clang/lib/AST/TypePrinter.cpp:2001
   !Policy.PrintCanonicalTypes && !Args.empty() &&
   Args.size() <= TPL->size()) {
 ASTContext  = TPL->getParam(0)->getASTContext();

This should have a `!isPack` condition -- we don't need this because there 
can't be default arguments for a parameter pack anyway, and we don't want it 
because it's looking at the wrong parameters in `TPL`.


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

https://reviews.llvm.org/D77598

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


[PATCH] D101952: [OpenMP] Fix non-determinism in clang copyin codegen

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

LGTM, two nits, one below.

Add a sentence to the commit message describing the problem.




Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:1013
+  Builder.CreatePtrToInt(PrivateAddr.getPointer(), CGM.IntPtrTy);
+  Builder.CreateCondBr(Builder.CreateICmpNE(A, B), CopyBegin, CopyEnd);
   EmitBlock(CopyBegin);

Rename A to MasterAddrInt and B to PrivateAddrInt, or similar.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101952

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


[PATCH] D101965: Added Support for Warning Flag -Wstack-usage=

2021-05-05 Thread Ryan Santhirarajan via Phabricator via cfe-commits
rsanthir.quic added a comment.

Another approach is explored here:
https://reviews.llvm.org/D101964


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101965

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


[PATCH] D101964: Added support for -Wstack-usage flag and Framesize reporting fix

2021-05-05 Thread Ryan Santhirarajan via Phabricator via cfe-commits
rsanthir.quic added a comment.

Another approach is explored here:
https://reviews.llvm.org/D101965


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101964

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


[PATCH] D101965: Added Support for Warning Flag -Wstack-usage=

2021-05-05 Thread Ryan Santhirarajan via Phabricator via cfe-commits
rsanthir.quic created this revision.
Herald added subscribers: dexonsmith, dang, hiraditya.
rsanthir.quic requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

The -Wstack-usage flag has been added, which provides a
warning message when size of stack exceeds user provided value.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101965

Files:
  clang/include/clang/Basic/DiagnosticFrontendKinds.td
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CodeGenAction.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Frontend/backend-stack-usage-diagnostic.c
  llvm/include/llvm/IR/DiagnosticInfo.h
  llvm/lib/CodeGen/PrologEpilogInserter.cpp

Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp
===
--- llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -143,6 +143,11 @@
   cl::desc("Warn for stack size bigger than the given"
" number"));
 
+static cl::opt
+WarnStackUsage("warn-stack-usage", cl::Hidden, cl::init((unsigned)-1),
+   cl::desc("Warn for stack size bigger than the given"
+" number"));
+
 INITIALIZE_PASS_BEGIN(PEI, DEBUG_TYPE, "Prologue/Epilogue Insertion", false,
   false)
 INITIALIZE_PASS_DEPENDENCY(MachineLoopInfo)
@@ -275,9 +280,16 @@
   if (TRI->requiresRegisterScavenging(MF) && FrameIndexVirtualScavenging)
 scavengeFrameVirtualRegs(MF, *RS);
 
-  // Warn on stack size when we exceeds the given limit.
+  // Warn on stack usage size when we exceed the given limit
   MachineFrameInfo  = MF.getFrameInfo();
   uint64_t StackSize = MFI.getStackSize();
+  if (WarnStackUsage.getNumOccurrences() > 0 && WarnStackUsage <= StackSize) {
+DiagnosticInfoStackSize DiagStackUsage(
+F, StackSize, MFI.hasVarSizedObjects(), true /*Stack Usage*/);
+F.getContext().diagnose(DiagStackUsage);
+  }
+
+  // Warn on stack size when we exceeds the given limit.
   if (WarnStackSize.getNumOccurrences() > 0 && WarnStackSize < StackSize) {
 DiagnosticInfoStackSize DiagStackSize(F, StackSize);
 F.getContext().diagnose(DiagStackSize);
Index: llvm/include/llvm/IR/DiagnosticInfo.h
===
--- llvm/include/llvm/IR/DiagnosticInfo.h
+++ llvm/include/llvm/IR/DiagnosticInfo.h
@@ -216,15 +216,24 @@
 
 class DiagnosticInfoStackSize : public DiagnosticInfoResourceLimit {
   void anchor() override;
+  bool HasVarSizedObjects;
+  bool PrintStackUsageInfo;
+
 public:
   DiagnosticInfoStackSize(const Function , uint64_t StackSize,
+  bool HasVarSizedObjects = false,
+  bool PrintStackUsageInfo = false,
   DiagnosticSeverity Severity = DS_Warning,
   uint64_t StackLimit = 0)
   : DiagnosticInfoResourceLimit(Fn, "stack size", StackSize, Severity,
-DK_StackSize, StackLimit) {}
+DK_StackSize, StackLimit),
+HasVarSizedObjects(HasVarSizedObjects),
+PrintStackUsageInfo(PrintStackUsageInfo) {}
 
   uint64_t getStackSize() const { return getResourceSize(); }
   uint64_t getStackLimit() const { return getResourceLimit(); }
+  bool hasVarSizedObjects() const { return HasVarSizedObjects; }
+  bool printStackUsageInfo() const { return PrintStackUsageInfo; }
 
   static bool classof(const DiagnosticInfo *DI) {
 return DI->getKind() == DK_StackSize;
Index: clang/test/Frontend/backend-stack-usage-diagnostic.c
===
--- /dev/null
+++ clang/test/Frontend/backend-stack-usage-diagnostic.c
@@ -0,0 +1,24 @@
+
+// RUN: %clang -Wstack-usage=0 -o /dev/null -c %s 2> %t.err
+// RUN: FileCheck < %t.err %s --check-prefix=WARN
+// RUN: %clang -Wstack-usage=0 -Wno-stack-usage= -o /dev/null -c %s 2> %t.err
+// RUN: FileCheck < %t.err %s --check-prefix=IGNORE --allow-empty
+// RUN: %clang -Wstack-usage=0 -w -o /dev/null -c %s 2> %t.err
+// RUN: FileCheck < %t.err %s --check-prefix=IGNORE --allow-empty
+// RUN: %clang -Wstack-usage=3 -o /dev/null -c %s 2> %t.err
+// RUN: FileCheck < %t.err %s --check-prefix=WARN
+// RUN: %clang -Wstack-usage=100 -o /dev/null -c %s 2> %t.err
+// RUN: FileCheck < %t.err %s --check-prefix=IGNORE --allow-empty
+
+// WARN: warning: stack usage is {{[0-9]+}} bytes in function 'test_square'
+// IGNORE-NOT:  stack usage is {{[0-9]+}} bytes in function 'test_square'
+int test_square(int num) {
+  return num * num;
+}
+
+// WARN: warning: stack usage might be {{[0-9]+}} bytes in function 'test_unbounded'
+// IGNORE-NOT:  stack usage might be {{[0-9]+}} bytes in function 'test_unbounded'
+int test_unbounded(int len) {
+  char a[len];
+  return 1;
+}
Index: 

[PATCH] D101952: [OpenMP] Fix non-determinism in clang copyin codegen

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 343256.
ggeorgakoudis added a comment.

Update by Johanne's correction on the source of non-determinism


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101952

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1006,12 +1006,11 @@
   // need to copy data.
   CopyBegin = createBasicBlock("copyin.not.master");
   CopyEnd = createBasicBlock("copyin.not.master.end");
-  Builder.CreateCondBr(
-  Builder.CreateICmpNE(
-  Builder.CreatePtrToInt(MasterAddr.getPointer(), 
CGM.IntPtrTy),
-  Builder.CreatePtrToInt(PrivateAddr.getPointer(),
- CGM.IntPtrTy)),
-  CopyBegin, CopyEnd);
+  auto *A =
+  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy);
+  auto *B =
+  Builder.CreatePtrToInt(PrivateAddr.getPointer(), CGM.IntPtrTy);
+  Builder.CreateCondBr(Builder.CreateICmpNE(A, B), CopyBegin, CopyEnd);
   EmitBlock(CopyBegin);
 }
 const auto *SrcVD =


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1006,12 +1006,11 @@
   // need to copy data.
   CopyBegin = createBasicBlock("copyin.not.master");
   CopyEnd = createBasicBlock("copyin.not.master.end");
-  Builder.CreateCondBr(
-  Builder.CreateICmpNE(
-  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy),
-  Builder.CreatePtrToInt(PrivateAddr.getPointer(),
- CGM.IntPtrTy)),
-  CopyBegin, CopyEnd);
+  auto *A =
+  Builder.CreatePtrToInt(MasterAddr.getPointer(), CGM.IntPtrTy);
+  auto *B =
+  Builder.CreatePtrToInt(PrivateAddr.getPointer(), CGM.IntPtrTy);
+  Builder.CreateCondBr(Builder.CreateICmpNE(A, B), CopyBegin, CopyEnd);
   EmitBlock(CopyBegin);
 }
 const auto *SrcVD =
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101964: Added support for -Wstack-usage flag and Framesize reporting fix

2021-05-05 Thread Ryan Santhirarajan via Phabricator via cfe-commits
rsanthir.quic created this revision.
Herald added subscribers: dexonsmith, dang, hiraditya.
rsanthir.quic requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

This patch adds support for the -Wstack-usage flag. It also changes
how -Wframe-larger-than reports it's frame size. It now excludes the
space allocated to hold parameters for called functions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101964

Files:
  clang/include/clang/Basic/DiagnosticFrontendKinds.td
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CodeGenAction.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Frontend/backend-diagnostic.c
  clang/test/Frontend/backend-stack-usage-diagnostic.c
  clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp
  llvm/include/llvm/CodeGen/MachineFrameInfo.h
  llvm/include/llvm/IR/DiagnosticInfo.h
  llvm/lib/CodeGen/PrologEpilogInserter.cpp

Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp
===
--- llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -139,9 +139,14 @@
 char ::PrologEpilogCodeInserterID = PEI::ID;
 
 static cl::opt
-WarnStackSize("warn-stack-size", cl::Hidden, cl::init((unsigned)-1),
-  cl::desc("Warn for stack size bigger than the given"
-   " number"));
+WarnFrameSize("warn-frame-size", cl::Hidden, cl::init((unsigned)-1),
+  cl::desc("Warn for frame size bigger than the given"
+   " number"));
+
+static cl::opt
+WarnStackUsage("warn-stack-usage", cl::Hidden, cl::init((unsigned)-1),
+   cl::desc("Warn for stack size bigger than the given"
+" number"));
 
 INITIALIZE_PASS_BEGIN(PEI, DEBUG_TYPE, "Prologue/Epilogue Insertion", false,
   false)
@@ -275,11 +280,19 @@
   if (TRI->requiresRegisterScavenging(MF) && FrameIndexVirtualScavenging)
 scavengeFrameVirtualRegs(MF, *RS);
 
-  // Warn on stack size when we exceeds the given limit.
+  // Warn on stack usage size when we exceed the given limit
   MachineFrameInfo  = MF.getFrameInfo();
   uint64_t StackSize = MFI.getStackSize();
-  if (WarnStackSize.getNumOccurrences() > 0 && WarnStackSize < StackSize) {
-DiagnosticInfoStackSize DiagStackSize(F, StackSize);
+  if (WarnStackUsage.getNumOccurrences() > 0 && WarnStackUsage <= StackSize) {
+DiagnosticInfoStackSize DiagStackUsage(
+F, StackSize, MFI.hasVarSizedObjects(), true /*Stack Usage*/);
+F.getContext().diagnose(DiagStackUsage);
+  }
+
+  uint64_t FrameSize = MFI.getFrameSize();
+  // Warn on Frame size when we exceed the given limit.
+  if (WarnFrameSize.getNumOccurrences() > 0 && WarnFrameSize < FrameSize) {
+DiagnosticInfoStackSize DiagStackSize(F, FrameSize);
 F.getContext().diagnose(DiagStackSize);
   }
   ORE->emit([&]() {
@@ -1048,6 +1061,10 @@
   AdjustStackOffset(MFI, SFI, StackGrowsDown, Offset, MaxAlign, Skew);
   }
 
+  int64_t OffsetBeforeMaxCallFrameSize = Offset;
+  int64_t FrameSize = OffsetBeforeMaxCallFrameSize - LocalAreaOffset;
+  MFI.setFrameSize(FrameSize);
+
   if (!TFI.targetHandlesStackFrameRounding()) {
 // If we have reserved argument space for call sites in the function
 // immediately on entry to the current function, count it as part of the
@@ -1073,6 +1090,11 @@
 int64_t OffsetBeforeAlignment = Offset;
 Offset = alignTo(Offset, StackAlign, Skew);
 
+OffsetBeforeMaxCallFrameSize =
+alignTo(OffsetBeforeMaxCallFrameSize, StackAlign, Skew);
+int64_t FrameSize = OffsetBeforeMaxCallFrameSize - LocalAreaOffset;
+MFI.setFrameSize(FrameSize);
+
 // If we have increased the offset to fulfill the alignment constrants,
 // then the scavenging spill slots may become harder to reach from the
 // stack pointer, float them so they stay close.
Index: llvm/include/llvm/IR/DiagnosticInfo.h
===
--- llvm/include/llvm/IR/DiagnosticInfo.h
+++ llvm/include/llvm/IR/DiagnosticInfo.h
@@ -216,15 +216,24 @@
 
 class DiagnosticInfoStackSize : public DiagnosticInfoResourceLimit {
   void anchor() override;
+  bool HasVarSizedObjects;
+  bool PrintStackUsageInfo;
+
 public:
   DiagnosticInfoStackSize(const Function , uint64_t StackSize,
+  bool HasVarSizedObjects = false,
+  bool PrintStackUsageInfo = false,
   DiagnosticSeverity Severity = DS_Warning,
   uint64_t StackLimit = 0)
   : DiagnosticInfoResourceLimit(Fn, "stack size", StackSize, Severity,
-DK_StackSize, StackLimit) {}
+DK_StackSize, StackLimit),
+HasVarSizedObjects(HasVarSizedObjects),
+

[PATCH] D101479: [Driver] Support libc++ in MSVC

2021-05-05 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

In D101479#2733622 , @mstorsjo wrote:

> In D101479#2733434 , @thakis wrote:
>
>> In D101479#2733354 , @mstorsjo 
>> wrote:
>>
>>> Not sure if we want the desicion between static and shared libc++ be 
>>> coupled with `/MT` and `/MD`, as one can quite plausibly want to use e.g. a 
>>> static libc++ with `/MD`.
>>
>> Right, I meant more "how do users pick if they want a statically or 
>> dynamically linked libc++". Sounds like you get a dynamic libc++ by default. 
>> Since Windows doesn't have rpaths afaik, using `-stdlib=libc++` means you'll 
>> get an executable that won't start, unless you know to copy the libc++ dll 
>> next to your executable with this patch as-is, yes?
>
> Yes, that sounds correct.
>
> As for how people choose - I guess unless you resort to trickery - you use 
> whichever is default in the libc++ build that is used.
>
> However, the libc++ headers inject linker directives to pull in the right 
> form of the lib, matching the linkage of the headers. So as long as that 
> isn't disabled, the clang driver shouldn't need to specify any lib to link 
> against at all.

On other platforms the decision whether to use static or shared is controlled 
by `-static-libstdc++`, does CL have a similar flag or shall we support 
`-static-libstdc++` in MSVC driver as well?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101479

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


[PATCH] D97915: [Coroutines] Handle overaligned frame allocation

2021-05-05 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen planned changes to this revision.
ychen added a comment.

Plan to rebase this together with the following patch for two lookups (aligned 
and non-aligned new/delete, and generate code accordingly)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97915

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


[PATCH] D101191: [InstCombine] Fully disable select to and/or i1 folding

2021-05-05 Thread Juneyoung Lee via Phabricator via cfe-commits
aqjune added a comment.

In D101191#2738130 , @nikic wrote:

> LGTM. I can take care of reverting if there are issues.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101191

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


[PATCH] D101960: [openmp] Drop requirement on library path environment variables

2021-05-05 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added inline comments.



Comment at: openmp/libomptarget/src/rtl.cpp:76
 
+  std::string full_plugin_name;
+  void *handle = dlopen("libomptarget.so", RTLD_NOW);

JonChesterfield wrote:
> This logic is cut from D73657 without addressing any of the review comments. 
> Idea is to look for the offloading plugins next to libomptarget, instead of 
> in dlopen's default search path. Will address the previous comments when 
> splitting out to a separate patch.
There's a D87413 that I didn't know about before seeing a comment on D73657 
just now. That uses RTLD_DI_LINKMAP with dlinfo instead. I'm leaning towards 
dladdr because it seems to exist on more platforms but haven't looked into the 
options closely yet.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101960

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


[PATCH] D101870: [clangd] Check if macro is already in the IdentifierTable before loading it

2021-05-05 Thread Queen Dela Cruz via Phabricator via cfe-commits
qdelacru added a comment.

Yes I need help landing this, please use qdela...@cisco.com. Thanks!


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

https://reviews.llvm.org/D101870

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


[PATCH] D101960: [openmp] Drop requirement on library path environment variables

2021-05-05 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added inline comments.



Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:648
 
+void tools::addOpenMPRuntimeSpecificRPath(const ToolChain ,
+  const ArgList ,

Similar to other functions in this file, derived from aomp (by deleting some 
stuff for finding a debug version of the library)

I can make my peace with runpath instead if people are keen to override this 
with LD_LIBRARY_PATH. The rest of clang's toolchains wire things up with rpath 
but that doesn't mean we have to make the same choice here.



Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:1703
 
+  // Add path to runtimes binary folder, used by ENABLE_RUNTIMES build
+  SmallString<256> RuntimesBinPath = llvm::sys::path::parent_path(D.Dir);

Otherwise we need LIBRARY_PATH to run from the build tree, which is awkward for 
tests and for ad hoc running from the build tree. This path is checked last, so 
only changes behaviour from error message to success when the file exists here. 
Split out in D101935



Comment at: clang/tools/amdgpu-arch/CMakeLists.txt:17
 
+set_target_properties(amdgpu-arch PROPERTIES INSTALL_RPATH_USE_LINK_PATH ON)
+

Lets amdgpu-arch work from the build tree, split out in D101926



Comment at: openmp/libomptarget/src/rtl.cpp:76
 
+  std::string full_plugin_name;
+  void *handle = dlopen("libomptarget.so", RTLD_NOW);

This logic is cut from D73657 without addressing any of the review comments. 
Idea is to look for the offloading plugins next to libomptarget, instead of in 
dlopen's default search path. Will address the previous comments when splitting 
out to a separate patch.



Comment at: openmp/libomptarget/test/lit.cfg:72
 config.test_flags += " -Wl,-rpath," + config.omp_host_rtl_directory
 else: # Unices
+config.test_flags += " -Wl,-rpath," + config.library_dir

For copy & paste of a RUN line from a failing test



Comment at: openmp/libomptarget/test/lit.cfg:182
+
+if config.cuda_path and config.cuda_path != 'CUDA_TOOLKIT_ROOT_DIR-NOTFOUND':
   config.substitutions.append(("%cuda_flags", "--cuda-path=" + 
config.cuda_path))

Because otherwise we write `--cuda-path=CUDA_TOOLKIT_ROOT_DIR-NOTFOUND` at the 
top of non-nvptx tests, which is harmless but ugly


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101960

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


[PATCH] D101960: [openmp] Drop requirement on library path environment variables

2021-05-05 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield created this revision.
JonChesterfield added reviewers: jdoerfert, grokos, ABataev, gregrodgers, 
RaviNarayanaswamy, pdhaliwal, hfinkel, tlwilmar, AndreyChurbanov, jlpeyton, 
protze.joachim, ye-luo, tianshilei1992.
Herald added subscribers: kerbowa, guansong, yaxunl, mgorny, nhaehnle, jvesely.
JonChesterfield requested review of this revision.
Herald added subscribers: openmp-commits, cfe-commits, sstefan1.
Herald added projects: clang, OpenMP.

[openmp] Drop requirement on library path environment variables

Involves multiple independent changes, intent is to land one piece at a time.
This diff provides a big picture of one way to avoid needing to specify
LD_LIBRARY_PATH and/or LIBRARY_PATH in order to run any openmp offloading code.
Specific details of the implementation are not necessarily interesting - e.g.
dlinfo appears to be impossible to use safely, so will drop that.

This diff (and associated openmp-dev email to be written shortly) is to start
a discussion on whether requiring users to set LD_LIBRARY_PATH in order to run
any openmp application is what we want.

Reviewers are a guess at interested parties, feel free to add anyone else.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101960

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/tools/amdgpu-arch/CMakeLists.txt
  openmp/libomptarget/src/rtl.cpp
  openmp/libomptarget/test/lit.cfg

Index: openmp/libomptarget/test/lit.cfg
===
--- openmp/libomptarget/test/lit.cfg
+++ openmp/libomptarget/test/lit.cfg
@@ -70,14 +70,10 @@
 config.test_flags += " -Wl,-rpath," + config.library_dir
 config.test_flags += " -Wl,-rpath," + config.omp_host_rtl_directory
 else: # Unices
-append_dynamic_library_path('LD_LIBRARY_PATH', config.library_dir, ":")
-append_dynamic_library_path('LD_LIBRARY_PATH', \
-config.omp_host_rtl_directory, ":")
+config.test_flags += " -Wl,-rpath," + config.library_dir
+config.test_flags += " -Wl,-rpath," + config.omp_host_rtl_directory
 if config.cuda_libdir:
-append_dynamic_library_path('LD_LIBRARY_PATH', config.cuda_libdir, ":")
-append_dynamic_library_path('LIBRARY_PATH', config.library_dir, ":")
-append_dynamic_library_path('LIBRARY_PATH', \
-config.omp_host_rtl_directory, ":")
+config.test_flags += " -Wl,-rpath," + config.cuda_libdir
 
 # substitutions
 # - for targets that exist in the system create the actual command.
@@ -182,7 +178,8 @@
 config.substitutions.append(("%clangxx", config.test_cxx_compiler))
 config.substitutions.append(("%clang", config.test_c_compiler))
 config.substitutions.append(("%openmp_flags", config.test_openmp_flags))
-if config.cuda_path:
+
+if config.cuda_path and config.cuda_path != 'CUDA_TOOLKIT_ROOT_DIR-NOTFOUND':
   config.substitutions.append(("%cuda_flags", "--cuda-path=" + config.cuda_path))
 else:
   config.substitutions.append(("%cuda_flags", ""))
Index: openmp/libomptarget/src/rtl.cpp
===
--- openmp/libomptarget/src/rtl.cpp
+++ openmp/libomptarget/src/rtl.cpp
@@ -73,13 +73,24 @@
 return;
   }
 
+  std::string full_plugin_name;
+  void *handle = dlopen("libomptarget.so", RTLD_NOW);
+  if (!handle)
+DP("dlopen() failed: %s\n", dlerror());
+  char *libomptarget_dir_name = new char[256];
+  if (dlinfo(handle, RTLD_DI_ORIGIN, libomptarget_dir_name) == -1)
+DP("RTLD_DI_ORIGIN failed: %s\n", dlerror());
+
   DP("Loading RTLs...\n");
 
   // Attempt to open all the plugins and, if they exist, check if the interface
   // is correct and if they are supporting any devices.
   for (auto *Name : RTLNames) {
 DP("Loading library '%s'...\n", Name);
-void *dynlib_handle = dlopen(Name, RTLD_NOW);
+
+full_plugin_name.assign(libomptarget_dir_name).append("/").append(Name);
+DP("Loading library '%s'...\n", full_plugin_name.c_str());
+void *dynlib_handle = dlopen(full_plugin_name.c_str(), RTLD_NOW);
 
 if (!dynlib_handle) {
   // Library does not exist or cannot be found.
Index: clang/tools/amdgpu-arch/CMakeLists.txt
===
--- clang/tools/amdgpu-arch/CMakeLists.txt
+++ clang/tools/amdgpu-arch/CMakeLists.txt
@@ -14,4 +14,6 @@
 
 add_clang_tool(amdgpu-arch AMDGPUArch.cpp)
 
+set_target_properties(amdgpu-arch PROPERTIES INSTALL_RPATH_USE_LINK_PATH ON)
+
 clang_target_link_libraries(amdgpu-arch PRIVATE hsa-runtime64::hsa-runtime64)
Index: clang/lib/Driver/ToolChains/CommonArgs.h
===
--- clang/lib/Driver/ToolChains/CommonArgs.h
+++ clang/lib/Driver/ToolChains/CommonArgs.h
@@ -73,6 +73,10 @@
   const llvm::opt::ArgList ,
   llvm::opt::ArgStringList );
 
+void addOpenMPRuntimeSpecificRPath(const ToolChain ,
+   

[PATCH] D101608: [WebAssembly] Support for WebAssembly globals in LLVM IR

2021-05-05 Thread Sam Clegg via Phabricator via cfe-commits
sbc100 added a comment.

How about `WASM_ADDRESS_SPACE_NON_INTEGRAL` or `WASM_ADDRESS_SPACE_OPAQUE` ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101608

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


[PATCH] D101608: [WebAssembly] Support for WebAssembly globals in LLVM IR

2021-05-05 Thread Thomas Lively via Phabricator via cfe-commits
tlively added inline comments.



Comment at: llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.h:40
+  // appropriate.
+  WASM_ADDRESS_SPACE_OBJECT = 1
+};

sbc100 wrote:
> tlively wrote:
> > sbc100 wrote:
> > > tlively wrote:
> > > > sbc100 wrote:
> > > > > tlively wrote:
> > > > > > sbc100 wrote:
> > > > > > > What does "object" mean here?   Are we just talking about 
> > > > > > > reference types?  Or also wasm globals that hold integers (like 
> > > > > > > `__stack_pointer`).   If its just ref types that live in this 
> > > > > > > address space should this be called `WASM_ADDRESS_SPACE_ANYREF`?  
> > > > > > >  If its the latter should this be called 
> > > > > > > `WASM_ADDRESS_SPACE_WASM_GLOBAL`?
> > > > > > I was also wondering about the best name here because OBJECT is 
> > > > > > somewhat vague. I think the idea is that this address space can be 
> > > > > > used for arbitrary Wasm globals of any type, but it could also be 
> > > > > > used later for things like additional tables and memories. It's 
> > > > > > unclear whether those would need separate address spaces for some 
> > > > > > reason, but if they don't, re-using this address space 1 would be 
> > > > > > best.
> > > > > > 
> > > > > > Maybe `WASM_ADDRESS_SPACE_STATIC` would be a better name because it 
> > > > > > will be used for things that are given static indices in the final 
> > > > > > module?
> > > > > > I was also wondering about the best name here because OBJECT is 
> > > > > > somewhat vague. I think the idea is that this address space can be 
> > > > > > used for arbitrary Wasm globals of any type, but it could also be 
> > > > > > used later for things like additional tables and memories. It's 
> > > > > > unclear whether those would need separate address spaces for some 
> > > > > > reason, but if they don't, re-using this address space 1 would be 
> > > > > > best.
> > > > > > 
> > > > > > Maybe `WASM_ADDRESS_SPACE_STATIC` would be a better name because it 
> > > > > > will be used for things that are given static indices in the final 
> > > > > > module?
> > > > > 
> > > > > But that is also true for static data symbols that point memory 
> > > > > addresess.
> > > > Hmm, maybe `WASM_ADDRESS_SPACE_MODULE_ELEMENT`?
> > > The address space is the space of wasm globals right?  So I feel like it 
> > > should probably contain the word global... shouldn't it?
> > No, see my previous comment. It's more general than just globals. Tables 
> > and Memories may also reside in this address space in the future. That 
> > being said, I guess we could just name it `GLOBAL` for now and change the 
> > name once we get table and memory support.
> > 
> > Although now that I think about it, https://reviews.llvm.org/D101140 also 
> > uses this address space for locals, so it's even more general than I was 
> > thinking.
> > No, see my previous comment. It's more general than just globals. Tables 
> > and Memories may also reside in this address space in the future. That 
> > being said, I guess we could just name it `GLOBAL` for now and change the 
> > name once we get table and memory support.
> > 
> > Although now that I think about it, https://reviews.llvm.org/D101140 also 
> > uses this address space for locals, so it's even more general than I was 
> > thinking.
> 
> But are those locals backed by `global.get` and `global.set`?
> 
> OK well I don't feel so strongly about it then.  I had assumed that address 
> space corresponded to wasm globals... 
> 
> 
No, those locals turn into normal locals backed by `local.get` and `local.set`. 
In that case, the address space is used in the type of `alloca` instructions.

I guess maybe OBJECT is an appropriately general label for such a general 
address space. Looking forward to seeing if @wingo has any better ideas!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101608

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


[PATCH] D101957: [clang][Fuchsia] Also use -fc++-abi=fuchsia for selecting relative-vtables multilibs

2021-05-05 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan created this revision.
leonardchan added reviewers: phosek, mcgrathr.
leonardchan added a project: clang.
leonardchan requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101957

Files:
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  clang/test/Driver/fuchsia.cpp

Index: clang/test/Driver/fuchsia.cpp
===
--- clang/test/Driver/fuchsia.cpp
+++ clang/test/Driver/fuchsia.cpp
@@ -89,6 +89,7 @@
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN: -fuse-ld=lld 2>&1\
 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-ASAN-NOEXCEPT-X86
+
 // RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fexperimental-relative-c++-abi-vtables \
 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
@@ -114,11 +115,6 @@
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN: -fuse-ld=lld 2>&1\
 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86
-// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fno-experimental-relative-c++-abi-vtables \
-// RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
-// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
-// RUN: -fuse-ld=lld 2>&1\
-// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86
 // RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fno-experimental-relative-c++-abi-vtables -fexperimental-relative-c++-abi-vtables \
 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
@@ -144,6 +140,59 @@
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN: -fuse-ld=lld 2>&1\
 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-HWASAN-NOEXCEPT-X86
+
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fc++-abi=fuchsia \
+// RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN: -fuse-ld=lld 2>&1\
+// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-X86
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fc++-abi=fuchsia -fno-exceptions \
+// RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN: -fuse-ld=lld 2>&1\
+// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-NOEXCEPT-X86
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fc++-abi=fuchsia -fsanitize=address \
+// RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN: -fuse-ld=lld 2>&1\
+// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-ASAN-X86
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fc++-abi=fuchsia -fno-exceptions -fsanitize=address \
+// RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN: -fuse-ld=lld 2>&1\
+// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-ASAN-NOEXCEPT-X86
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fno-experimental-relative-c++-abi-vtables -fc++-abi=fuchsia \
+// RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN: -fuse-ld=lld 2>&1\
+// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fc++-abi=fuchsia -fsanitize=hwaddress \
+// RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN: -fuse-ld=lld 2>&1\
+// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-HWASAN-X86
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fc++-abi=fuchsia -fno-exceptions -fsanitize=hwaddress \
+// RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN: -fuse-ld=lld 2>&1\
+// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-HWASAN-NOEXCEPT-X86
+
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fc++-abi=itanium -fno-exceptions \
+// RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN: -fuse-ld=lld 2>&1\
+// RUN: | FileCheck %s 

[PATCH] D101608: [WebAssembly] Support for WebAssembly globals in LLVM IR

2021-05-05 Thread Sam Clegg via Phabricator via cfe-commits
sbc100 added inline comments.



Comment at: llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.h:40
+  // appropriate.
+  WASM_ADDRESS_SPACE_OBJECT = 1
+};

tlively wrote:
> sbc100 wrote:
> > tlively wrote:
> > > sbc100 wrote:
> > > > tlively wrote:
> > > > > sbc100 wrote:
> > > > > > What does "object" mean here?   Are we just talking about reference 
> > > > > > types?  Or also wasm globals that hold integers (like 
> > > > > > `__stack_pointer`).   If its just ref types that live in this 
> > > > > > address space should this be called `WASM_ADDRESS_SPACE_ANYREF`?   
> > > > > > If its the latter should this be called 
> > > > > > `WASM_ADDRESS_SPACE_WASM_GLOBAL`?
> > > > > I was also wondering about the best name here because OBJECT is 
> > > > > somewhat vague. I think the idea is that this address space can be 
> > > > > used for arbitrary Wasm globals of any type, but it could also be 
> > > > > used later for things like additional tables and memories. It's 
> > > > > unclear whether those would need separate address spaces for some 
> > > > > reason, but if they don't, re-using this address space 1 would be 
> > > > > best.
> > > > > 
> > > > > Maybe `WASM_ADDRESS_SPACE_STATIC` would be a better name because it 
> > > > > will be used for things that are given static indices in the final 
> > > > > module?
> > > > > I was also wondering about the best name here because OBJECT is 
> > > > > somewhat vague. I think the idea is that this address space can be 
> > > > > used for arbitrary Wasm globals of any type, but it could also be 
> > > > > used later for things like additional tables and memories. It's 
> > > > > unclear whether those would need separate address spaces for some 
> > > > > reason, but if they don't, re-using this address space 1 would be 
> > > > > best.
> > > > > 
> > > > > Maybe `WASM_ADDRESS_SPACE_STATIC` would be a better name because it 
> > > > > will be used for things that are given static indices in the final 
> > > > > module?
> > > > 
> > > > But that is also true for static data symbols that point memory 
> > > > addresess.
> > > Hmm, maybe `WASM_ADDRESS_SPACE_MODULE_ELEMENT`?
> > The address space is the space of wasm globals right?  So I feel like it 
> > should probably contain the word global... shouldn't it?
> No, see my previous comment. It's more general than just globals. Tables and 
> Memories may also reside in this address space in the future. That being 
> said, I guess we could just name it `GLOBAL` for now and change the name once 
> we get table and memory support.
> 
> Although now that I think about it, https://reviews.llvm.org/D101140 also 
> uses this address space for locals, so it's even more general than I was 
> thinking.
> No, see my previous comment. It's more general than just globals. Tables and 
> Memories may also reside in this address space in the future. That being 
> said, I guess we could just name it `GLOBAL` for now and change the name once 
> we get table and memory support.
> 
> Although now that I think about it, https://reviews.llvm.org/D101140 also 
> uses this address space for locals, so it's even more general than I was 
> thinking.

But are those locals backed by `global.get` and `global.set`?

OK well I don't feel so strongly about it then.  I had assumed that address 
space corresponded to wasm globals... 




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101608

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


[PATCH] D101236: [ASTImporter] Import definitions required for layout of [[no_unique_address]] from LLDB

2021-05-05 Thread Raphael Isemann via Phabricator via cfe-commits
teemperor added a comment.

By the way, I set up a WIP patch for changing LLDB's import away from the 
current MinimalImport of records to something that is more in line with how 
Clang works: https://reviews.llvm.org/D101950


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101236

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


[PATCH] D101572: Make `hasTypeLoc` matcher support more node types.

2021-05-05 Thread Weston Carvalho via Phabricator via cfe-commits
SilensAngelusNex added a comment.

Here's my branch on Github: 
https://github.com/SilensAngelusNex/llvm-project/tree/has-type-info




Comment at: clang/include/clang/ASTMatchers/ASTMatchersInternal.h:138-150
+template  struct disjunction;
+template  struct disjunction : public T {};
+template  struct disjunction {
+  using type =
+  typename std::conditional>::type;
+  static constexpr bool value = type::value;
+};

steveire wrote:
> SilensAngelusNex wrote:
> > Is there a better way to express this? I was originally using
> > 
> > ```
> > template  struct is_one_of {
> >   template 
> >   static constexpr bool value = (std::is_base_of_v || ...);
> > };
> > ```
> > but that didn't compile because `is_base_of_v` and fold expressions are 
> > C++17 features.
> > 
> > Maybe it would be better to just explicitly write out an overload of 
> > `GetTypeSourceInfo` for each type?
> 
> I like your c++17 solution too, but given that we have 
> `TypeListContainsSuperOf` in this file used for this kind of thing, I think 
> it makes sense to use that. I think this will work:
> 
> ```
> templatestd::enable_if_t ast_matchers::internal::TypeList<
>   CXXBaseSpecifier, CXXCtorInitializer, CXXTemporaryObjectExpr,
>   CXXUnresolvedConstructExpr, CompoundLiteralExpr, DeclaratorDecl,
>   ObjCPropertyDecl, TemplateArgumentLoc, TypedefNameDecl>, 
> T>::value>
>   * = nullptr>
> ```
> 
Perfect, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101572

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


[PATCH] D101572: Make `hasTypeLoc` matcher support more node types.

2021-05-05 Thread Weston Carvalho via Phabricator via cfe-commits
SilensAngelusNex updated this revision to Diff 343219.
SilensAngelusNex marked 2 inline comments as done.
SilensAngelusNex added a comment.

Regenerate docs and replace `is_one_of` with `TypeListContainsSuperOf`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101572

Files:
  clang/docs/LibASTMatchersReference.html
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/include/clang/ASTMatchers/ASTMatchersInternal.h
  clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

Index: clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -11,6 +11,7 @@
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Tooling/Tooling.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Triple.h"
 #include "llvm/Support/Host.h"
 #include "gtest/gtest.h"
@@ -375,15 +376,104 @@
   typedefNameDecl(hasType(asString("foo")), hasName("bar";
 }
 
-TEST(HasTypeLoc, MatchesDeclaratorDecls) {
+TEST(HasTypeLoc, MatchesBlockDecl) {
+  EXPECT_TRUE(matchesConditionally(
+  "auto x = ^int (int a, int b) { return a + b; };",
+  blockDecl(hasTypeLoc(loc(asString("int (int, int)", true,
+  {"-fblocks"}));
+}
+
+TEST(HasTypeLoc, MatchesCXXBaseSpecifierAndCtorInitializer) {
+  llvm::StringRef code = R"cpp(
+  class Foo {};
+  class Bar : public Foo {
+Bar() : Foo() {}
+  };
+  )cpp";
+
+  EXPECT_TRUE(matches(
+  code, cxxRecordDecl(hasAnyBase(hasTypeLoc(loc(asString("class Foo")));
+  EXPECT_TRUE(matches(
+  code, cxxCtorInitializer(hasTypeLoc(loc(asString("class Foo"));
+}
+
+TEST(HasTypeLoc, MatchesCXXFunctionalCastExpr) {
+  EXPECT_TRUE(matches("auto x = int(3);",
+  cxxFunctionalCastExpr(hasTypeLoc(loc(asString("int"));
+}
+
+TEST(HasTypeLoc, MatchesCXXNewExpr) {
+  EXPECT_TRUE(matches("auto* x = new int(3);",
+  cxxNewExpr(hasTypeLoc(loc(asString("int"));
+  EXPECT_TRUE(matches("class Foo{}; auto* x = new Foo();",
+  cxxNewExpr(hasTypeLoc(loc(asString("class Foo"));
+}
+
+TEST(HasTypeLoc, MatchesCXXTemporaryObjectExpr) {
+  EXPECT_TRUE(
+  matches("struct Foo { Foo(int, int); }; auto x = Foo(1, 2);",
+  cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("struct Foo"));
+}
+
+TEST(HasTypeLoc, MatchesCXXUnresolvedConstructExpr) {
+  EXPECT_TRUE(
+  matches("template  T make() { return T(); }",
+  cxxUnresolvedConstructExpr(hasTypeLoc(loc(asString("T"));
+}
+
+TEST(HasTypeLoc, MatchesClassTemplateSpecializationDecl) {
+  EXPECT_TRUE(matches(
+  "template  class Foo; template <> class Foo {};",
+  classTemplateSpecializationDecl(hasTypeLoc(loc(asString("Foo"));
+}
+
+TEST(HasTypeLoc, MatchesCompoundLiteralExpr) {
+  EXPECT_TRUE(
+  matches("int* x = (int [2]) { 0, 1 };",
+  compoundLiteralExpr(hasTypeLoc(loc(asString("int [2]"));
+}
+
+TEST(HasTypeLoc, MatchesDeclaratorDecl) {
   EXPECT_TRUE(matches("int x;",
   varDecl(hasName("x"), hasTypeLoc(loc(asString("int"));
+  EXPECT_TRUE(matches("int x(3);",
+  varDecl(hasName("x"), hasTypeLoc(loc(asString("int"));
+  EXPECT_TRUE(
+  matches("struct Foo { Foo(int, int); }; Foo x(1, 2);",
+  varDecl(hasName("x"), hasTypeLoc(loc(asString("struct Foo"));
 
   // Make sure we don't crash on implicit constructors.
   EXPECT_TRUE(notMatches("class X {}; X x;",
  declaratorDecl(hasTypeLoc(loc(asString("int"));
 }
 
+TEST(HasTypeLoc, MatchesExplicitCastExpr) {
+  EXPECT_TRUE(matches("auto x = (int) 3;",
+  explicitCastExpr(hasTypeLoc(loc(asString("int"));
+  EXPECT_TRUE(matches("auto x = static_cast(3);",
+  explicitCastExpr(hasTypeLoc(loc(asString("int"));
+}
+
+TEST(HasTypeLoc, MatchesObjCPropertyDecl) {
+  EXPECT_TRUE(matchesObjC(R"objc(
+  @interface Foo
+  @property int enabled;
+  @end
+)objc",
+  objcPropertyDecl(hasTypeLoc(loc(asString("int"));
+}
+
+TEST(HasTypeLoc, MatchesTemplateArgumentLoc) {
+  EXPECT_TRUE(matches("template  class Foo {}; Foo x;",
+  templateArgumentLoc(hasTypeLoc(loc(asString("int"));
+}
+
+TEST(HasTypeLoc, MatchesTypedefNameDecl) {
+  EXPECT_TRUE(matches("typedef int X;",
+  typedefNameDecl(hasTypeLoc(loc(asString("int"));
+  EXPECT_TRUE(matches("using X = int;",
+  typedefNameDecl(hasTypeLoc(loc(asString("int"));
+}
 
 TEST(Callee, MatchesDeclarations) {
   StatementMatcher CallMethodX = callExpr(callee(cxxMethodDecl(hasName("x";
Index: 

[PATCH] D101952: [OpenMP] Fix non-determinism in clang copyin codegen

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis created this revision.
Herald added subscribers: mgrang, guansong, yaxunl.
ggeorgakoudis requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101952

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -971,7 +971,7 @@
   // operator=(threadprivate_var2, master_threadprivate_var2);
   // ...
   // __kmpc_barrier(, global_tid);
-  llvm::DenseSet CopiedVars;
+  llvm::SetVector CopiedVars;
   llvm::BasicBlock *CopyBegin = nullptr, *CopyEnd = nullptr;
   for (const auto *C : D.getClausesOfKind()) {
 auto IRef = C->varlist_begin();
@@ -980,7 +980,7 @@
 for (const Expr *AssignOp : C->assignment_ops()) {
   const auto *VD = cast(cast(*IRef)->getDecl());
   QualType Type = VD->getType();
-  if (CopiedVars.insert(VD->getCanonicalDecl()).second) {
+  if (CopiedVars.insert(VD->getCanonicalDecl())) {
 // Get the address of the master variable. If we are emitting code with
 // TLS support, the address is passed from the master as field in the
 // captured declaration.


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -971,7 +971,7 @@
   // operator=(threadprivate_var2, master_threadprivate_var2);
   // ...
   // __kmpc_barrier(, global_tid);
-  llvm::DenseSet CopiedVars;
+  llvm::SetVector CopiedVars;
   llvm::BasicBlock *CopyBegin = nullptr, *CopyEnd = nullptr;
   for (const auto *C : D.getClausesOfKind()) {
 auto IRef = C->varlist_begin();
@@ -980,7 +980,7 @@
 for (const Expr *AssignOp : C->assignment_ops()) {
   const auto *VD = cast(cast(*IRef)->getDecl());
   QualType Type = VD->getType();
-  if (CopiedVars.insert(VD->getCanonicalDecl()).second) {
+  if (CopiedVars.insert(VD->getCanonicalDecl())) {
 // Get the address of the master variable. If we are emitting code with
 // TLS support, the address is passed from the master as field in the
 // captured declaration.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101608: [WebAssembly] Support for WebAssembly globals in LLVM IR

2021-05-05 Thread Thomas Lively via Phabricator via cfe-commits
tlively added inline comments.



Comment at: llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.h:40
+  // appropriate.
+  WASM_ADDRESS_SPACE_OBJECT = 1
+};

sbc100 wrote:
> tlively wrote:
> > sbc100 wrote:
> > > tlively wrote:
> > > > sbc100 wrote:
> > > > > What does "object" mean here?   Are we just talking about reference 
> > > > > types?  Or also wasm globals that hold integers (like 
> > > > > `__stack_pointer`).   If its just ref types that live in this address 
> > > > > space should this be called `WASM_ADDRESS_SPACE_ANYREF`?   If its the 
> > > > > latter should this be called `WASM_ADDRESS_SPACE_WASM_GLOBAL`?
> > > > I was also wondering about the best name here because OBJECT is 
> > > > somewhat vague. I think the idea is that this address space can be used 
> > > > for arbitrary Wasm globals of any type, but it could also be used later 
> > > > for things like additional tables and memories. It's unclear whether 
> > > > those would need separate address spaces for some reason, but if they 
> > > > don't, re-using this address space 1 would be best.
> > > > 
> > > > Maybe `WASM_ADDRESS_SPACE_STATIC` would be a better name because it 
> > > > will be used for things that are given static indices in the final 
> > > > module?
> > > > I was also wondering about the best name here because OBJECT is 
> > > > somewhat vague. I think the idea is that this address space can be used 
> > > > for arbitrary Wasm globals of any type, but it could also be used later 
> > > > for things like additional tables and memories. It's unclear whether 
> > > > those would need separate address spaces for some reason, but if they 
> > > > don't, re-using this address space 1 would be best.
> > > > 
> > > > Maybe `WASM_ADDRESS_SPACE_STATIC` would be a better name because it 
> > > > will be used for things that are given static indices in the final 
> > > > module?
> > > 
> > > But that is also true for static data symbols that point memory addresess.
> > Hmm, maybe `WASM_ADDRESS_SPACE_MODULE_ELEMENT`?
> The address space is the space of wasm globals right?  So I feel like it 
> should probably contain the word global... shouldn't it?
No, see my previous comment. It's more general than just globals. Tables and 
Memories may also reside in this address space in the future. That being said, 
I guess we could just name it `GLOBAL` for now and change the name once we get 
table and memory support.

Although now that I think about it, https://reviews.llvm.org/D101140 also uses 
this address space for locals, so it's even more general than I was thinking.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101608

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


[PATCH] D101608: [WebAssembly] Support for WebAssembly globals in LLVM IR

2021-05-05 Thread Sam Clegg via Phabricator via cfe-commits
sbc100 added inline comments.



Comment at: llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.h:40
+  // appropriate.
+  WASM_ADDRESS_SPACE_OBJECT = 1
+};

tlively wrote:
> sbc100 wrote:
> > tlively wrote:
> > > sbc100 wrote:
> > > > What does "object" mean here?   Are we just talking about reference 
> > > > types?  Or also wasm globals that hold integers (like 
> > > > `__stack_pointer`).   If its just ref types that live in this address 
> > > > space should this be called `WASM_ADDRESS_SPACE_ANYREF`?   If its the 
> > > > latter should this be called `WASM_ADDRESS_SPACE_WASM_GLOBAL`?
> > > I was also wondering about the best name here because OBJECT is somewhat 
> > > vague. I think the idea is that this address space can be used for 
> > > arbitrary Wasm globals of any type, but it could also be used later for 
> > > things like additional tables and memories. It's unclear whether those 
> > > would need separate address spaces for some reason, but if they don't, 
> > > re-using this address space 1 would be best.
> > > 
> > > Maybe `WASM_ADDRESS_SPACE_STATIC` would be a better name because it will 
> > > be used for things that are given static indices in the final module?
> > > I was also wondering about the best name here because OBJECT is somewhat 
> > > vague. I think the idea is that this address space can be used for 
> > > arbitrary Wasm globals of any type, but it could also be used later for 
> > > things like additional tables and memories. It's unclear whether those 
> > > would need separate address spaces for some reason, but if they don't, 
> > > re-using this address space 1 would be best.
> > > 
> > > Maybe `WASM_ADDRESS_SPACE_STATIC` would be a better name because it will 
> > > be used for things that are given static indices in the final module?
> > 
> > But that is also true for static data symbols that point memory addresess.
> Hmm, maybe `WASM_ADDRESS_SPACE_MODULE_ELEMENT`?
The address space is the space of wasm globals right?  So I feel like it should 
probably contain the word global... shouldn't it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101608

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


[PATCH] D101608: [WebAssembly] Support for WebAssembly globals in LLVM IR

2021-05-05 Thread Thomas Lively via Phabricator via cfe-commits
tlively added inline comments.



Comment at: llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.h:40
+  // appropriate.
+  WASM_ADDRESS_SPACE_OBJECT = 1
+};

sbc100 wrote:
> tlively wrote:
> > sbc100 wrote:
> > > What does "object" mean here?   Are we just talking about reference 
> > > types?  Or also wasm globals that hold integers (like `__stack_pointer`). 
> > >   If its just ref types that live in this address space should this be 
> > > called `WASM_ADDRESS_SPACE_ANYREF`?   If its the latter should this be 
> > > called `WASM_ADDRESS_SPACE_WASM_GLOBAL`?
> > I was also wondering about the best name here because OBJECT is somewhat 
> > vague. I think the idea is that this address space can be used for 
> > arbitrary Wasm globals of any type, but it could also be used later for 
> > things like additional tables and memories. It's unclear whether those 
> > would need separate address spaces for some reason, but if they don't, 
> > re-using this address space 1 would be best.
> > 
> > Maybe `WASM_ADDRESS_SPACE_STATIC` would be a better name because it will be 
> > used for things that are given static indices in the final module?
> > I was also wondering about the best name here because OBJECT is somewhat 
> > vague. I think the idea is that this address space can be used for 
> > arbitrary Wasm globals of any type, but it could also be used later for 
> > things like additional tables and memories. It's unclear whether those 
> > would need separate address spaces for some reason, but if they don't, 
> > re-using this address space 1 would be best.
> > 
> > Maybe `WASM_ADDRESS_SPACE_STATIC` would be a better name because it will be 
> > used for things that are given static indices in the final module?
> 
> But that is also true for static data symbols that point memory addresess.
Hmm, maybe `WASM_ADDRESS_SPACE_MODULE_ELEMENT`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101608

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


[PATCH] D101608: [WebAssembly] Support for WebAssembly globals in LLVM IR

2021-05-05 Thread Sam Clegg via Phabricator via cfe-commits
sbc100 added inline comments.



Comment at: llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.h:40
+  // appropriate.
+  WASM_ADDRESS_SPACE_OBJECT = 1
+};

tlively wrote:
> sbc100 wrote:
> > What does "object" mean here?   Are we just talking about reference types?  
> > Or also wasm globals that hold integers (like `__stack_pointer`).   If its 
> > just ref types that live in this address space should this be called 
> > `WASM_ADDRESS_SPACE_ANYREF`?   If its the latter should this be called 
> > `WASM_ADDRESS_SPACE_WASM_GLOBAL`?
> I was also wondering about the best name here because OBJECT is somewhat 
> vague. I think the idea is that this address space can be used for arbitrary 
> Wasm globals of any type, but it could also be used later for things like 
> additional tables and memories. It's unclear whether those would need 
> separate address spaces for some reason, but if they don't, re-using this 
> address space 1 would be best.
> 
> Maybe `WASM_ADDRESS_SPACE_STATIC` would be a better name because it will be 
> used for things that are given static indices in the final module?
> I was also wondering about the best name here because OBJECT is somewhat 
> vague. I think the idea is that this address space can be used for arbitrary 
> Wasm globals of any type, but it could also be used later for things like 
> additional tables and memories. It's unclear whether those would need 
> separate address spaces for some reason, but if they don't, re-using this 
> address space 1 would be best.
> 
> Maybe `WASM_ADDRESS_SPACE_STATIC` would be a better name because it will be 
> used for things that are given static indices in the final module?

But that is also true for static data symbols that point memory addresess.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101608

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


[PATCH] D101813: [Driver] Move -print-runtime-dir and -print-resource-dir tests

2021-05-05 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9d3dbcd24c7d: [Driver] Move -print-runtime-dir and 
-print-resource-dir tests (authored by phosek).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101813

Files:
  clang/test/Driver/immediate-options.c
  clang/test/Driver/print-resource-dir.c
  clang/test/Driver/print-runtime-dir.c


Index: clang/test/Driver/print-runtime-dir.c
===
--- /dev/null
+++ clang/test/Driver/print-runtime-dir.c
@@ -0,0 +1,11 @@
+// Default directory layout
+// RUN: %clang -print-runtime-dir --target=x86_64-pc-windows-msvc \
+// RUN:   -resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck --check-prefix=PRINT-RUNTIME-DIR 
-DFILE=%S/Inputs/resource_dir %s
+// PRINT-RUNTIME-DIR: [[FILE]]{{/|\\}}lib{{/|\\}}windows
+
+// Per-target directory layout
+// RUN: %clang -print-runtime-dir --target=x86_64-pc-windows-msvc \
+// RUN:   -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN:   | FileCheck --check-prefix=PRINT-RUNTIME-DIR-PER-TARGET 
-DFILE=%S/Inputs/resource_dir_with_per_target_subdir  %s
+// PRINT-RUNTIME-DIR-PER-TARGET: 
[[FILE]]{{/|\\}}lib{{/|\\}}x86_64-pc-windows-msvc
Index: clang/test/Driver/print-resource-dir.c
===
--- /dev/null
+++ clang/test/Driver/print-resource-dir.c
@@ -0,0 +1,4 @@
+// RUN: %clang -print-resource-dir --target=x86_64-unknown-linux-gnu \
+// RUN:   -resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck -check-prefix=PRINT-RESOURCE-DIR 
-DFILE=%S/Inputs/resource_dir %s
+// PRINT-RESOURCE-DIR: [[FILE]]
Index: clang/test/Driver/immediate-options.c
===
--- clang/test/Driver/immediate-options.c
+++ clang/test/Driver/immediate-options.c
@@ -12,20 +12,3 @@
 
 // RUN: %clang -dumpversion | FileCheck %s -check-prefix=DUMPVERSION
 // DUMPVERSION: {{[0-9]+\.[0-9.]+}}
-
-// Test if the -print-resource-dir option is accepted without error.
-// Allow unspecified output because the value of CLANG_RESOURCE_DIR is unknown.
-// RUN: %clang -print-resource-dir | FileCheck %s 
-check-prefix=PRINT-RESOURCE-DIR
-// PRINT-RESOURCE-DIR: {{.+}}
-
-// Default resource-dir layout
-// RUN: %clang -print-runtime-dir --target=x86_64-pc-windows-msvc \
-// RUN:-resource-dir=%S/Inputs/resource_dir \
-// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
-// PRINT-RUNTIME-DIR: lib{{/|\\}}windows
-
-// Per target dir layout
-// RUN: %clang -print-runtime-dir --target=x86_64-pc-windows-msvc \
-// RUN:-resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
-// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR-PER-TARGET %s
-// PRINT-RUNTIME-DIR-PER-TARGET: lib{{/|\\}}x86_64-pc-windows-msvc


Index: clang/test/Driver/print-runtime-dir.c
===
--- /dev/null
+++ clang/test/Driver/print-runtime-dir.c
@@ -0,0 +1,11 @@
+// Default directory layout
+// RUN: %clang -print-runtime-dir --target=x86_64-pc-windows-msvc \
+// RUN:   -resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck --check-prefix=PRINT-RUNTIME-DIR -DFILE=%S/Inputs/resource_dir %s
+// PRINT-RUNTIME-DIR: [[FILE]]{{/|\\}}lib{{/|\\}}windows
+
+// Per-target directory layout
+// RUN: %clang -print-runtime-dir --target=x86_64-pc-windows-msvc \
+// RUN:   -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN:   | FileCheck --check-prefix=PRINT-RUNTIME-DIR-PER-TARGET -DFILE=%S/Inputs/resource_dir_with_per_target_subdir  %s
+// PRINT-RUNTIME-DIR-PER-TARGET: [[FILE]]{{/|\\}}lib{{/|\\}}x86_64-pc-windows-msvc
Index: clang/test/Driver/print-resource-dir.c
===
--- /dev/null
+++ clang/test/Driver/print-resource-dir.c
@@ -0,0 +1,4 @@
+// RUN: %clang -print-resource-dir --target=x86_64-unknown-linux-gnu \
+// RUN:   -resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck -check-prefix=PRINT-RESOURCE-DIR -DFILE=%S/Inputs/resource_dir %s
+// PRINT-RESOURCE-DIR: [[FILE]]
Index: clang/test/Driver/immediate-options.c
===
--- clang/test/Driver/immediate-options.c
+++ clang/test/Driver/immediate-options.c
@@ -12,20 +12,3 @@
 
 // RUN: %clang -dumpversion | FileCheck %s -check-prefix=DUMPVERSION
 // DUMPVERSION: {{[0-9]+\.[0-9.]+}}
-
-// Test if the -print-resource-dir option is accepted without error.
-// Allow unspecified output because the value of CLANG_RESOURCE_DIR is unknown.
-// RUN: %clang -print-resource-dir | FileCheck %s -check-prefix=PRINT-RESOURCE-DIR
-// PRINT-RESOURCE-DIR: {{.+}}
-
-// Default resource-dir layout
-// RUN: %clang -print-runtime-dir --target=x86_64-pc-windows-msvc \
-// RUN:-resource-dir=%S/Inputs/resource_dir \
-// RUN:  

[clang] 9d3dbcd - [Driver] Move -print-runtime-dir and -print-resource-dir tests

2021-05-05 Thread Petr Hosek via cfe-commits

Author: Petr Hosek
Date: 2021-05-05T15:23:49-07:00
New Revision: 9d3dbcd24c7d61e83fe5b3c4e7b7e4ecf9d70cd7

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

LOG: [Driver] Move -print-runtime-dir and -print-resource-dir tests

Put these into a separate files to match other -print-* options tests.

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

Added: 
clang/test/Driver/print-resource-dir.c
clang/test/Driver/print-runtime-dir.c

Modified: 
clang/test/Driver/immediate-options.c

Removed: 




diff  --git a/clang/test/Driver/immediate-options.c 
b/clang/test/Driver/immediate-options.c
index c398e0d41c6e..77878fe2e9c5 100644
--- a/clang/test/Driver/immediate-options.c
+++ b/clang/test/Driver/immediate-options.c
@@ -12,20 +12,3 @@
 
 // RUN: %clang -dumpversion | FileCheck %s -check-prefix=DUMPVERSION
 // DUMPVERSION: {{[0-9]+\.[0-9.]+}}
-
-// Test if the -print-resource-dir option is accepted without error.
-// Allow unspecified output because the value of CLANG_RESOURCE_DIR is unknown.
-// RUN: %clang -print-resource-dir | FileCheck %s 
-check-prefix=PRINT-RESOURCE-DIR
-// PRINT-RESOURCE-DIR: {{.+}}
-
-// Default resource-dir layout
-// RUN: %clang -print-runtime-dir --target=x86_64-pc-windows-msvc \
-// RUN:-resource-dir=%S/Inputs/resource_dir \
-// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
-// PRINT-RUNTIME-DIR: lib{{/|\\}}windows
-
-// Per target dir layout
-// RUN: %clang -print-runtime-dir --target=x86_64-pc-windows-msvc \
-// RUN:-resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
-// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR-PER-TARGET %s
-// PRINT-RUNTIME-DIR-PER-TARGET: lib{{/|\\}}x86_64-pc-windows-msvc

diff  --git a/clang/test/Driver/print-resource-dir.c 
b/clang/test/Driver/print-resource-dir.c
new file mode 100644
index ..d5459a5c5142
--- /dev/null
+++ b/clang/test/Driver/print-resource-dir.c
@@ -0,0 +1,4 @@
+// RUN: %clang -print-resource-dir --target=x86_64-unknown-linux-gnu \
+// RUN:   -resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck -check-prefix=PRINT-RESOURCE-DIR 
-DFILE=%S/Inputs/resource_dir %s
+// PRINT-RESOURCE-DIR: [[FILE]]

diff  --git a/clang/test/Driver/print-runtime-dir.c 
b/clang/test/Driver/print-runtime-dir.c
new file mode 100644
index ..550ffef1aaf6
--- /dev/null
+++ b/clang/test/Driver/print-runtime-dir.c
@@ -0,0 +1,11 @@
+// Default directory layout
+// RUN: %clang -print-runtime-dir --target=x86_64-pc-windows-msvc \
+// RUN:   -resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck --check-prefix=PRINT-RUNTIME-DIR 
-DFILE=%S/Inputs/resource_dir %s
+// PRINT-RUNTIME-DIR: [[FILE]]{{/|\\}}lib{{/|\\}}windows
+
+// Per-target directory layout
+// RUN: %clang -print-runtime-dir --target=x86_64-pc-windows-msvc \
+// RUN:   -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN:   | FileCheck --check-prefix=PRINT-RUNTIME-DIR-PER-TARGET 
-DFILE=%S/Inputs/resource_dir_with_per_target_subdir  %s
+// PRINT-RUNTIME-DIR-PER-TARGET: 
[[FILE]]{{/|\\}}lib{{/|\\}}x86_64-pc-windows-msvc



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


[PATCH] D101849: [OpenMP][NFC] Refactor Clang OpenMP tests using update_cc_test_checks

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 343210.
ggeorgakoudis added a comment.

More updates to tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101849

Files:
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/ordered_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  clang/test/OpenMP/sections_firstprivate_codegen.cpp
  clang/test/OpenMP/sections_lastprivate_codegen.cpp
  clang/test/OpenMP/sections_private_codegen.cpp
  clang/test/OpenMP/sections_reduction_codegen.cpp
  clang/test/OpenMP/sections_reduction_task_codegen.cpp
  

[PATCH] D93668: [clang] Override the Fuchsia platform ABI using the triple environment

2021-05-05 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan abandoned this revision.
leonardchan added a comment.

Abandoned in favor of D85802 .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93668

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


[PATCH] D101899: std::forward_list::swap to use propagate_on_container_swap for noexcept specification

2021-05-05 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added subscribers: ldionne, Quuxplusone.
Quuxplusone accepted this revision as: Quuxplusone.
Quuxplusone added a comment.

This does actually look like a pretty straightforward typo in `forward_list`; 
the other containers all seem to get it right.
It's too bad that none of our tests notice the change; but, the 
POCCA/POCMA/POCS traits are obscure, and this affects literally nothing but 
`-std=c++11` mode. I don't think it makes sense to hold up this patch for lack 
of tests.
(@airglow923 please wait for an approval from "libc++" before landing. @ldionne 
ping! am I missing anything subtle here?)


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D101899

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


[clang] 6bbfa0f - When performing template argument deduction to select a partial

2021-05-05 Thread Richard Smith via cfe-commits

Author: Richard Smith
Date: 2021-05-05T14:47:18-07:00
New Revision: 6bbfa0fd408e81055c360c2e059554dd76fd7f09

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

LOG: When performing template argument deduction to select a partial
specialization while substituting a partial template parameter pack,
don't try to extend the existing deduction.

This caused us to select the wrong partial specialization in some rare
cases. A recent change to libc++ caused this to happen in practice for
code using std::conjunction.

Added: 


Modified: 
clang/lib/Sema/SemaTemplateDeduction.cpp
clang/test/SemaTemplate/partial-spec-instantiate.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaTemplateDeduction.cpp 
b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 7d548e4f8dee1..3c66c8eeda8b9 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -3079,6 +3079,10 @@ 
Sema::DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial,
   *this, Sema::ExpressionEvaluationContext::Unevaluated);
   SFINAETrap Trap(*this);
 
+  // This deduction has no relation to any outer instantiation we might be
+  // performing.
+  LocalInstantiationScope InstantiationScope(*this);
+
   SmallVector Deduced;
   Deduced.resize(Partial->getTemplateParameters()->size());
   if (TemplateDeductionResult Result
@@ -3127,6 +3131,10 @@ 
Sema::DeduceTemplateArguments(VarTemplatePartialSpecializationDecl *Partial,
   *this, Sema::ExpressionEvaluationContext::Unevaluated);
   SFINAETrap Trap(*this);
 
+  // This deduction has no relation to any outer instantiation we might be
+  // performing.
+  LocalInstantiationScope InstantiationScope(*this);
+
   SmallVector Deduced;
   Deduced.resize(Partial->getTemplateParameters()->size());
   if (TemplateDeductionResult Result = ::DeduceTemplateArguments(

diff  --git a/clang/test/SemaTemplate/partial-spec-instantiate.cpp 
b/clang/test/SemaTemplate/partial-spec-instantiate.cpp
index 3b7cee88c42ec..369ff69aa3756 100644
--- a/clang/test/SemaTemplate/partial-spec-instantiate.cpp
+++ b/clang/test/SemaTemplate/partial-spec-instantiate.cpp
@@ -112,3 +112,25 @@ namespace InstantiationDependent {
   _Static_assert(!A::specialized, "");
   _Static_assert(A::specialized, "");
 }
+
+namespace IgnorePartialSubstitution {
+  template  struct tuple {}; // expected-warning 
0-1{{extension}}
+  template  struct IsTuple {
+enum { value = false };
+  };
+  template  struct IsTuple > { // 
expected-warning 0-1{{extension}}
+enum { value = true };
+  };
+
+  template  using ignore = void; // expected-warning 0-2{{extension}}
+  template  ignore helper(); // 
expected-warning 0-1{{extension}}
+
+  using S = IsTuple >; // expected-warning 0-1{{extension}}
+
+  // This used to pick the primary template, because we got confused and
+  // thought that template parameter 0 was the current partially-substituted
+  // pack (from `helper`) during the deduction for the partial specialization.
+  void f() { helper(); }
+
+  _Static_assert(S::value, "");
+}



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


[PATCH] D101935: [clang] Search runtimes build tree for openmp runtime

2021-05-05 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

I think the lit test suite is intended to set environment variables such that 
this is not necessary.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101935

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


[PATCH] D95425: Implementation of global.get/set for reftypes in LLVM IR

2021-05-05 Thread Thomas Lively via Phabricator via cfe-commits
tlively added inline comments.



Comment at: llvm/lib/Target/WebAssembly/WebAssemblyInstrTable.td:15
 multiclass TABLE {
+  let mayLoad = 1 in
   defm TABLE_GET_#rt : I<(outs rt:$res), (ins table32_op:$table),

wingo wrote:
> I think you may need `hasSideEffects = 0` for these annotations to have an 
> effect.
I would be surprised if this were true!



Comment at: llvm/lib/Target/WebAssembly/WebAssemblyInstrTable.td:19
  [],
  "table.get\t$res, $table",
  "table.get\t$table",

wingo wrote:
> Not something for this patch, but this is certainly bogus: surely we mean 
> `table.get\t$table, $i` and we have an i32 index argument?
Agree about the i32 index argument, but it is correct to have the result as 
part of the string for the register-based output format.



Comment at: llvm/test/CodeGen/WebAssembly/externref-globalget.ll:4
+%extern = type opaque
+%externref = type %extern addrspace(1)* ;; addrspace 1 is nonintegral
+

wingo wrote:
> tlively wrote:
> > wingo wrote:
> > > A design document for how this works would really be helpful :)  So LLVM 
> > > is going to consider that any pointer to address space 1 has MVT 
> > > exterrnref at lowering-time?  It's interesting to go down this route 
> > > rather than adding a new `llvm::Type`.
> > We essentially consider changes to LLVM IR to be out of scope to the extent 
> > possible. If we only touch code in the WebAssembly backend and maybe fix a 
> > few bugs in target independent code, then we are comfortable signing off on 
> > patches within the team, but if we do anything non-trivial in target 
> > independent code, we need sign off from the wider LLVM community. Changes 
> > to LLVM IR would require a full-blown RFC process and I expect they would 
> > not be accepted.
> I guess my open question is really as regards the C mapping -- would the idea 
> be for the front-end to also specially recognize pointers in address space 1 
> ?  If there were a first-class IR type for these values, as is the case for 
> SVE, you'd have a straightforward answer.  More discussion in 
> https://docs.google.com/document/d/1aVX0tQChxA2Tlno2KmEUjdruLoNgpwzV5Kv335HvNmI/edit#heading=h.u50o9qhzzjy6.
I forget if we had or resolved this conversation elsewhere already, but I would 
expect clang to emit pointers in the correct address spaces, yes. The SVE folks 
had to go though multiple years of effort to add scalable vectors to LLVM IR 
because there was no existing way to model their semantics in IR such that they 
could implement all the vectorization optimizations they wanted. We are lucky 
that we can get away with using address space pointers directly without having 
to add new types to the IR.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95425

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


[PATCH] D77598: Integral template argument suffix and cast printing

2021-05-05 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

My concerns are addressed, but I think @rsmith hasn't confirmed that all his 
concerns are addressed yet.


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

https://reviews.llvm.org/D77598

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


[PATCH] D101902: [clangd] Split CC and refs limit and increase refs limit to 1000

2021-05-05 Thread Kirill Bobyrev via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe623ce6188d6: [clangd] Split CC and refs limit and increase 
refs limit to 1000 (authored by kbobyrev).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101902

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


Index: clang-tools-extra/clangd/tool/ClangdMain.cpp
===
--- clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -292,6 +292,14 @@
 init(100),
 };
 
+opt ReferencesLimit{
+"limit-references",
+cat(Features),
+desc("Limit the number of references returned by clangd. "
+ "0 means no limit (default=1000)"),
+init(1000),
+};
+
 list TweakList{
 "tweaks",
 cat(Features),
@@ -821,6 +829,7 @@
   }
 #endif
   Opts.BackgroundIndex = EnableBackgroundIndex;
+  Opts.ReferencesLimit = ReferencesLimit;
   auto PAI = createProjectAwareIndex(loadExternalIndex, Sync);
   if (StaticIdx) {
 IdxStack.emplace_back(std::move(StaticIdx));
Index: clang-tools-extra/clangd/ClangdLSPServer.h
===
--- clang-tools-extra/clangd/ClangdLSPServer.h
+++ clang-tools-extra/clangd/ClangdLSPServer.h
@@ -65,6 +65,9 @@
 
 /// Enable preview of InlayHints feature.
 bool InlayHints = false;
+
+/// Limit the number of references returned (0 means no limit).
+size_t ReferencesLimit = 0;
   };
 
   ClangdLSPServer(Transport , const ThreadsafeFS ,
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -1264,7 +1264,7 @@
 void ClangdLSPServer::onReference(const ReferenceParams ,
   Callback> Reply) {
   Server->findReferences(
-  Params.textDocument.uri.file(), Params.position, Opts.CodeComplete.Limit,
+  Params.textDocument.uri.file(), Params.position, Opts.ReferencesLimit,
   [Reply = std::move(Reply),
IncludeDecl(Params.context.includeDeclaration)](
   llvm::Expected Refs) mutable {


Index: clang-tools-extra/clangd/tool/ClangdMain.cpp
===
--- clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -292,6 +292,14 @@
 init(100),
 };
 
+opt ReferencesLimit{
+"limit-references",
+cat(Features),
+desc("Limit the number of references returned by clangd. "
+ "0 means no limit (default=1000)"),
+init(1000),
+};
+
 list TweakList{
 "tweaks",
 cat(Features),
@@ -821,6 +829,7 @@
   }
 #endif
   Opts.BackgroundIndex = EnableBackgroundIndex;
+  Opts.ReferencesLimit = ReferencesLimit;
   auto PAI = createProjectAwareIndex(loadExternalIndex, Sync);
   if (StaticIdx) {
 IdxStack.emplace_back(std::move(StaticIdx));
Index: clang-tools-extra/clangd/ClangdLSPServer.h
===
--- clang-tools-extra/clangd/ClangdLSPServer.h
+++ clang-tools-extra/clangd/ClangdLSPServer.h
@@ -65,6 +65,9 @@
 
 /// Enable preview of InlayHints feature.
 bool InlayHints = false;
+
+/// Limit the number of references returned (0 means no limit).
+size_t ReferencesLimit = 0;
   };
 
   ClangdLSPServer(Transport , const ThreadsafeFS ,
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -1264,7 +1264,7 @@
 void ClangdLSPServer::onReference(const ReferenceParams ,
   Callback> Reply) {
   Server->findReferences(
-  Params.textDocument.uri.file(), Params.position, Opts.CodeComplete.Limit,
+  Params.textDocument.uri.file(), Params.position, Opts.ReferencesLimit,
   [Reply = std::move(Reply),
IncludeDecl(Params.context.includeDeclaration)](
   llvm::Expected Refs) mutable {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] e623ce6 - [clangd] Split CC and refs limit and increase refs limit to 1000

2021-05-05 Thread Kirill Bobyrev via cfe-commits

Author: Kirill Bobyrev
Date: 2021-05-05T23:39:48+02:00
New Revision: e623ce6188d698422d4ead24065056d6a869e6f8

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

LOG: [clangd] Split CC and refs limit and increase refs limit to 1000

Related discussion: https://github.com/clangd/clangd/discussions/761

Reviewed By: kadircet

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

Added: 


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

Removed: 




diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp 
b/clang-tools-extra/clangd/ClangdLSPServer.cpp
index 77fc948cbfe08..913c5c3219a5c 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -1264,7 +1264,7 @@ void ClangdLSPServer::onChangeConfiguration(
 void ClangdLSPServer::onReference(const ReferenceParams ,
   Callback> Reply) {
   Server->findReferences(
-  Params.textDocument.uri.file(), Params.position, Opts.CodeComplete.Limit,
+  Params.textDocument.uri.file(), Params.position, Opts.ReferencesLimit,
   [Reply = std::move(Reply),
IncludeDecl(Params.context.includeDeclaration)](
   llvm::Expected Refs) mutable {

diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.h 
b/clang-tools-extra/clangd/ClangdLSPServer.h
index 3f5cc9abc688a..8c43d18502875 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.h
+++ b/clang-tools-extra/clangd/ClangdLSPServer.h
@@ -65,6 +65,9 @@ class ClangdLSPServer : private ClangdServer::Callbacks,
 
 /// Enable preview of InlayHints feature.
 bool InlayHints = false;
+
+/// Limit the number of references returned (0 means no limit).
+size_t ReferencesLimit = 0;
   };
 
   ClangdLSPServer(Transport , const ThreadsafeFS ,

diff  --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp 
b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index 07fec2fc76358..f0aa89b8091fb 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -292,6 +292,14 @@ opt LimitResults{
 init(100),
 };
 
+opt ReferencesLimit{
+"limit-references",
+cat(Features),
+desc("Limit the number of references returned by clangd. "
+ "0 means no limit (default=1000)"),
+init(1000),
+};
+
 list TweakList{
 "tweaks",
 cat(Features),
@@ -821,6 +829,7 @@ clangd accepts flags on the commandline, and in the 
CLANGD_FLAGS environment var
   }
 #endif
   Opts.BackgroundIndex = EnableBackgroundIndex;
+  Opts.ReferencesLimit = ReferencesLimit;
   auto PAI = createProjectAwareIndex(loadExternalIndex, Sync);
   if (StaticIdx) {
 IdxStack.emplace_back(std::move(StaticIdx));



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


[PATCH] D101849: [OpenMP][NFC] Refactor Clang OpenMP tests using update_cc_test_checks

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 343197.
ggeorgakoudis added a comment.

Update tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101849

Files:
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/ordered_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/parallel_private_codegen.cpp
  clang/test/OpenMP/parallel_reduction_codegen.cpp
  clang/test/OpenMP/parallel_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_sections_codegen.cpp
  clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
  clang/test/OpenMP/sections_firstprivate_codegen.cpp
  clang/test/OpenMP/sections_lastprivate_codegen.cpp
  clang/test/OpenMP/sections_private_codegen.cpp
  clang/test/OpenMP/sections_reduction_codegen.cpp
  clang/test/OpenMP/sections_reduction_task_codegen.cpp
  clang/test/OpenMP/single_codegen.cpp
  

[PATCH] D101902: [clangd] Split CC and refs limit and increase refs limit to 1000

2021-05-05 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 343196.
kbobyrev marked an inline comment as done.
kbobyrev added a comment.

s/LimitReferences/ReferencesLimit/g


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101902

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


Index: clang-tools-extra/clangd/tool/ClangdMain.cpp
===
--- clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -292,6 +292,14 @@
 init(100),
 };
 
+opt ReferencesLimit{
+"limit-references",
+cat(Features),
+desc("Limit the number of references returned by clangd. "
+ "0 means no limit (default=1000)"),
+init(1000),
+};
+
 list TweakList{
 "tweaks",
 cat(Features),
@@ -821,6 +829,7 @@
   }
 #endif
   Opts.BackgroundIndex = EnableBackgroundIndex;
+  Opts.ReferencesLimit = ReferencesLimit;
   auto PAI = createProjectAwareIndex(loadExternalIndex, Sync);
   if (StaticIdx) {
 IdxStack.emplace_back(std::move(StaticIdx));
Index: clang-tools-extra/clangd/ClangdLSPServer.h
===
--- clang-tools-extra/clangd/ClangdLSPServer.h
+++ clang-tools-extra/clangd/ClangdLSPServer.h
@@ -65,6 +65,9 @@
 
 /// Enable preview of InlayHints feature.
 bool InlayHints = false;
+
+/// Limit the number of references returned (0 means no limit).
+size_t ReferencesLimit = 0;
   };
 
   ClangdLSPServer(Transport , const ThreadsafeFS ,
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -1264,7 +1264,7 @@
 void ClangdLSPServer::onReference(const ReferenceParams ,
   Callback> Reply) {
   Server->findReferences(
-  Params.textDocument.uri.file(), Params.position, Opts.CodeComplete.Limit,
+  Params.textDocument.uri.file(), Params.position, Opts.ReferencesLimit,
   [Reply = std::move(Reply),
IncludeDecl(Params.context.includeDeclaration)](
   llvm::Expected Refs) mutable {


Index: clang-tools-extra/clangd/tool/ClangdMain.cpp
===
--- clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -292,6 +292,14 @@
 init(100),
 };
 
+opt ReferencesLimit{
+"limit-references",
+cat(Features),
+desc("Limit the number of references returned by clangd. "
+ "0 means no limit (default=1000)"),
+init(1000),
+};
+
 list TweakList{
 "tweaks",
 cat(Features),
@@ -821,6 +829,7 @@
   }
 #endif
   Opts.BackgroundIndex = EnableBackgroundIndex;
+  Opts.ReferencesLimit = ReferencesLimit;
   auto PAI = createProjectAwareIndex(loadExternalIndex, Sync);
   if (StaticIdx) {
 IdxStack.emplace_back(std::move(StaticIdx));
Index: clang-tools-extra/clangd/ClangdLSPServer.h
===
--- clang-tools-extra/clangd/ClangdLSPServer.h
+++ clang-tools-extra/clangd/ClangdLSPServer.h
@@ -65,6 +65,9 @@
 
 /// Enable preview of InlayHints feature.
 bool InlayHints = false;
+
+/// Limit the number of references returned (0 means no limit).
+size_t ReferencesLimit = 0;
   };
 
   ClangdLSPServer(Transport , const ThreadsafeFS ,
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -1264,7 +1264,7 @@
 void ClangdLSPServer::onReference(const ReferenceParams ,
   Callback> Reply) {
   Server->findReferences(
-  Params.textDocument.uri.file(), Params.position, Opts.CodeComplete.Limit,
+  Params.textDocument.uri.file(), Params.position, Opts.ReferencesLimit,
   [Reply = std::move(Reply),
IncludeDecl(Params.context.includeDeclaration)](
   llvm::Expected Refs) mutable {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101608: [WebAssembly] Support for WebAssembly globals in LLVM IR

2021-05-05 Thread Thomas Lively via Phabricator via cfe-commits
tlively added a comment.

LGTM with Sam's comments resolved!




Comment at: llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.h:40
+  // appropriate.
+  WASM_ADDRESS_SPACE_OBJECT = 1
+};

sbc100 wrote:
> What does "object" mean here?   Are we just talking about reference types?  
> Or also wasm globals that hold integers (like `__stack_pointer`).   If its 
> just ref types that live in this address space should this be called 
> `WASM_ADDRESS_SPACE_ANYREF`?   If its the latter should this be called 
> `WASM_ADDRESS_SPACE_WASM_GLOBAL`?
I was also wondering about the best name here because OBJECT is somewhat vague. 
I think the idea is that this address space can be used for arbitrary Wasm 
globals of any type, but it could also be used later for things like additional 
tables and memories. It's unclear whether those would need separate address 
spaces for some reason, but if they don't, re-using this address space 1 would 
be best.

Maybe `WASM_ADDRESS_SPACE_STATIC` would be a better name because it will be 
used for things that are given static indices in the final module?



Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISD.def:48
+
+// Reference Types
+HANDLE_MEM_NODETYPE(GLOBAL_GET)

sbc100 wrote:
> Is this just for ref types or also for global that hold integers too (like 
> `__stack_pointer`)
Yep, it's for arbitrary types (see the tests), so this comment should be 
updated.



Comment at: llvm/test/CodeGen/WebAssembly/global-get.ll:13
+; CHECK-NEXT: end_function
+  %v = load i32, i32 addrspace(1)* @i32_global
+  ret i32 %v

sbc100 wrote:
> I don't suppose there is any way to give `addrspace(1)` a symbolic name is 
> there?
Not that I know of, unfortunately :(


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101608

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


[PATCH] D101878: [git-clang-format] Do not apply clang-format to symlinks

2021-05-05 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 343194.
pirama added a comment.

Add release note


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101878

Files:
  clang/docs/ReleaseNotes.rst
  clang/tools/clang-format/git-clang-format


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -137,10 +137,15 @@
   if opts.verbose >= 1:
 ignored_files = set(changed_lines)
   filter_by_extension(changed_lines, opts.extensions.lower().split(','))
+  # The computed diff outputs absolute paths, so we must cd before accessing
+  # those files.
+  cd_to_toplevel()
+  filter_symlinks(changed_lines)
   if opts.verbose >= 1:
 ignored_files.difference_update(changed_lines)
 if ignored_files:
-  print('Ignoring changes in the following files (wrong extension):')
+  print(
+'Ignoring changes in the following files (wrong extension or 
symlink):')
   for filename in ignored_files:
 print('%s' % filename)
 if changed_lines:
@@ -151,9 +156,6 @@
 if opts.verbose >= 0:
   print('no modified files to format')
 return
-  # The computed diff outputs absolute paths, so we must cd before accessing
-  # those files.
-  cd_to_toplevel()
   if len(commits) > 1:
 old_tree = commits[1]
 new_tree = run_clang_format_and_save_to_tree(changed_lines,
@@ -337,6 +339,13 @@
   del dictionary[filename]
 
 
+def filter_symlinks(dictionary):
+  """Delete every key in `dictionary` that is a symlink."""
+  for filename in list(dictionary.keys()):
+if os.path.islink(filename):
+  del dictionary[filename]
+
+
 def cd_to_toplevel():
   """Change to the top level of the git repository."""
   toplevel = run('git', 'rev-parse', '--show-toplevel')
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -243,6 +243,9 @@
   accepts ``AllIfsAndElse`` value that allows to put "else if" and "else" short
   statements on a single line. (Fixes https://llvm.org/PR50019.)
 
+- ``git-clang-format`` no longer formats changes to symbolic links. (Fixes
+  https://llvm.org/PR46992.)
+
 libclang
 
 


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -137,10 +137,15 @@
   if opts.verbose >= 1:
 ignored_files = set(changed_lines)
   filter_by_extension(changed_lines, opts.extensions.lower().split(','))
+  # The computed diff outputs absolute paths, so we must cd before accessing
+  # those files.
+  cd_to_toplevel()
+  filter_symlinks(changed_lines)
   if opts.verbose >= 1:
 ignored_files.difference_update(changed_lines)
 if ignored_files:
-  print('Ignoring changes in the following files (wrong extension):')
+  print(
+'Ignoring changes in the following files (wrong extension or symlink):')
   for filename in ignored_files:
 print('%s' % filename)
 if changed_lines:
@@ -151,9 +156,6 @@
 if opts.verbose >= 0:
   print('no modified files to format')
 return
-  # The computed diff outputs absolute paths, so we must cd before accessing
-  # those files.
-  cd_to_toplevel()
   if len(commits) > 1:
 old_tree = commits[1]
 new_tree = run_clang_format_and_save_to_tree(changed_lines,
@@ -337,6 +339,13 @@
   del dictionary[filename]
 
 
+def filter_symlinks(dictionary):
+  """Delete every key in `dictionary` that is a symlink."""
+  for filename in list(dictionary.keys()):
+if os.path.islink(filename):
+  del dictionary[filename]
+
+
 def cd_to_toplevel():
   """Change to the top level of the git repository."""
   toplevel = run('git', 'rev-parse', '--show-toplevel')
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -243,6 +243,9 @@
   accepts ``AllIfsAndElse`` value that allows to put "else if" and "else" short
   statements on a single line. (Fixes https://llvm.org/PR50019.)
 
+- ``git-clang-format`` no longer formats changes to symbolic links. (Fixes
+  https://llvm.org/PR46992.)
+
 libclang
 
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D100604: [PowerPC] Improve codegen for int-to-fp conversion of subword vector extract

2021-05-05 Thread Albion Fung via Phabricator via cfe-commits
Conanap updated this revision to Diff 343193.
Conanap added a comment.

Rebased and fixed indentations


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

https://reviews.llvm.org/D100604

Files:
  llvm/lib/Target/PowerPC/PPCInstrVSX.td
  llvm/test/CodeGen/PowerPC/uint-to-fp-v4i32.ll
  llvm/test/CodeGen/PowerPC/vec-extract-itofp.ll
  llvm/test/CodeGen/PowerPC/vec_conv_i16_to_fp32_elts.ll
  llvm/test/CodeGen/PowerPC/vec_conv_i8_to_fp32_elts.ll

Index: llvm/test/CodeGen/PowerPC/vec_conv_i8_to_fp32_elts.ll
===
--- llvm/test/CodeGen/PowerPC/vec_conv_i8_to_fp32_elts.ll
+++ llvm/test/CodeGen/PowerPC/vec_conv_i8_to_fp32_elts.ll
@@ -32,17 +32,11 @@
 ; CHECK-P9-LABEL: test2elt:
 ; CHECK-P9:   # %bb.0: # %entry
 ; CHECK-P9-NEXT:mtvsrws v2, r3
-; CHECK-P9-NEXT:li r3, 0
-; CHECK-P9-NEXT:vextubrx r3, r3, v2
-; CHECK-P9-NEXT:clrlwi r3, r3, 24
-; CHECK-P9-NEXT:mtfprwz f0, r3
-; CHECK-P9-NEXT:li r3, 1
-; CHECK-P9-NEXT:xscvuxdsp f0, f0
-; CHECK-P9-NEXT:vextubrx r3, r3, v2
-; CHECK-P9-NEXT:clrlwi r3, r3, 24
+; CHECK-P9-NEXT:vextractub v3, v2, 15
+; CHECK-P9-NEXT:vextractub v2, v2, 14
+; CHECK-P9-NEXT:xscvuxdsp f0, v3
 ; CHECK-P9-NEXT:xscvdpspn v3, f0
-; CHECK-P9-NEXT:mtfprwz f0, r3
-; CHECK-P9-NEXT:xscvuxdsp f0, f0
+; CHECK-P9-NEXT:xscvuxdsp f0, v2
 ; CHECK-P9-NEXT:xscvdpspn v2, f0
 ; CHECK-P9-NEXT:vmrghw v2, v2, v3
 ; CHECK-P9-NEXT:mfvsrld r3, v2
@@ -51,17 +45,11 @@
 ; CHECK-BE-LABEL: test2elt:
 ; CHECK-BE:   # %bb.0: # %entry
 ; CHECK-BE-NEXT:mtvsrws v2, r3
-; CHECK-BE-NEXT:li r3, 1
-; CHECK-BE-NEXT:vextublx r3, r3, v2
-; CHECK-BE-NEXT:clrlwi r3, r3, 24
-; CHECK-BE-NEXT:mtfprwz f0, r3
-; CHECK-BE-NEXT:li r3, 0
-; CHECK-BE-NEXT:xscvuxdsp f0, f0
-; CHECK-BE-NEXT:vextublx r3, r3, v2
-; CHECK-BE-NEXT:clrlwi r3, r3, 24
+; CHECK-BE-NEXT:vextractub v3, v2, 2
+; CHECK-BE-NEXT:vextractub v2, v2, 0
+; CHECK-BE-NEXT:xscvuxdsp f0, v3
 ; CHECK-BE-NEXT:xscvdpspn v3, f0
-; CHECK-BE-NEXT:mtfprwz f0, r3
-; CHECK-BE-NEXT:xscvuxdsp f0, f0
+; CHECK-BE-NEXT:xscvuxdsp f0, v2
 ; CHECK-BE-NEXT:xscvdpspn v2, f0
 ; CHECK-BE-NEXT:vmrgow v2, v2, v3
 ; CHECK-BE-NEXT:mfvsrd r3, v2
@@ -293,17 +281,13 @@
 ; CHECK-P9-LABEL: test2elt_signed:
 ; CHECK-P9:   # %bb.0: # %entry
 ; CHECK-P9-NEXT:mtvsrws v2, r3
-; CHECK-P9-NEXT:li r3, 0
-; CHECK-P9-NEXT:vextubrx r3, r3, v2
-; CHECK-P9-NEXT:extsb r3, r3
-; CHECK-P9-NEXT:mtfprwa f0, r3
-; CHECK-P9-NEXT:li r3, 1
-; CHECK-P9-NEXT:xscvsxdsp f0, f0
-; CHECK-P9-NEXT:vextubrx r3, r3, v2
-; CHECK-P9-NEXT:extsb r3, r3
+; CHECK-P9-NEXT:vextractub v3, v2, 15
+; CHECK-P9-NEXT:vextractub v2, v2, 14
+; CHECK-P9-NEXT:vextsh2d v3, v3
+; CHECK-P9-NEXT:vextsh2d v2, v2
+; CHECK-P9-NEXT:xscvsxdsp f0, v3
 ; CHECK-P9-NEXT:xscvdpspn v3, f0
-; CHECK-P9-NEXT:mtfprwa f0, r3
-; CHECK-P9-NEXT:xscvsxdsp f0, f0
+; CHECK-P9-NEXT:xscvsxdsp f0, v2
 ; CHECK-P9-NEXT:xscvdpspn v2, f0
 ; CHECK-P9-NEXT:vmrghw v2, v2, v3
 ; CHECK-P9-NEXT:mfvsrld r3, v2
@@ -312,17 +296,13 @@
 ; CHECK-BE-LABEL: test2elt_signed:
 ; CHECK-BE:   # %bb.0: # %entry
 ; CHECK-BE-NEXT:mtvsrws v2, r3
-; CHECK-BE-NEXT:li r3, 1
-; CHECK-BE-NEXT:vextublx r3, r3, v2
-; CHECK-BE-NEXT:extsb r3, r3
-; CHECK-BE-NEXT:mtfprwa f0, r3
-; CHECK-BE-NEXT:li r3, 0
-; CHECK-BE-NEXT:xscvsxdsp f0, f0
-; CHECK-BE-NEXT:vextublx r3, r3, v2
-; CHECK-BE-NEXT:extsb r3, r3
+; CHECK-BE-NEXT:vextractub v3, v2, 2
+; CHECK-BE-NEXT:vextractub v2, v2, 0
+; CHECK-BE-NEXT:vextsh2d v3, v3
+; CHECK-BE-NEXT:vextsh2d v2, v2
+; CHECK-BE-NEXT:xscvsxdsp f0, v3
 ; CHECK-BE-NEXT:xscvdpspn v3, f0
-; CHECK-BE-NEXT:mtfprwa f0, r3
-; CHECK-BE-NEXT:xscvsxdsp f0, f0
+; CHECK-BE-NEXT:xscvsxdsp f0, v2
 ; CHECK-BE-NEXT:xscvdpspn v2, f0
 ; CHECK-BE-NEXT:vmrgow v2, v2, v3
 ; CHECK-BE-NEXT:mfvsrd r3, v2
Index: llvm/test/CodeGen/PowerPC/vec_conv_i16_to_fp32_elts.ll
===
--- llvm/test/CodeGen/PowerPC/vec_conv_i16_to_fp32_elts.ll
+++ llvm/test/CodeGen/PowerPC/vec_conv_i16_to_fp32_elts.ll
@@ -32,17 +32,11 @@
 ; CHECK-P9-LABEL: test2elt:
 ; CHECK-P9:   # %bb.0: # %entry
 ; CHECK-P9-NEXT:mtvsrws v2, r3
-; CHECK-P9-NEXT:li r3, 0
-; CHECK-P9-NEXT:vextuhrx r3, r3, v2
-; CHECK-P9-NEXT:clrlwi r3, r3, 16
-; CHECK-P9-NEXT:mtfprwz f0, r3
-; CHECK-P9-NEXT:li r3, 2
-; CHECK-P9-NEXT:xscvuxdsp f0, f0
-; CHECK-P9-NEXT:vextuhrx r3, r3, v2
-; CHECK-P9-NEXT:clrlwi r3, r3, 16
+; CHECK-P9-NEXT:vextractuh v3, v2, 14
+; CHECK-P9-NEXT:vextractuh v2, v2, 12
+; CHECK-P9-NEXT:xscvuxdsp f0, v3
 ; CHECK-P9-NEXT:xscvdpspn v3, f0
-; CHECK-P9-NEXT:mtfprwz f0, r3
-; CHECK-P9-NEXT:xscvuxdsp f0, f0
+; CHECK-P9-NEXT:xscvuxdsp f0, 

[PATCH] D101934: [Utils][NFC] Rename replace-function-regex in update_cc_test_checks

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG78a7d8c4dd10: [Utils][NFC] Rename replace-function-regex in 
update_cc_test_checks (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101934

Files:
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/target_parallel_debug_codegen.cpp
  clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
  clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_analyze_test_checks.py
  llvm/utils/update_llc_test_checks.py

Index: llvm/utils/update_llc_test_checks.py
===
--- llvm/utils/update_llc_test_checks.py
+++ llvm/utils/update_llc_test_checks.py
@@ -108,12 +108,12 @@
   check_indent = ''
 
 builder = common.FunctionTestBuilder(
-run_list=run_list, 
+run_list=run_list,
 flags=type('', (object,), {
 'verbose': ti.args.verbose,
 'function_signature': False,
 'check_attributes': False,
-'replace_function_regex': []}),
+'replace_value_regex': []}),
 scrubber_args=[ti.args])
 
 for prefixes, llc_tool, llc_args, preprocess_cmd, triple_in_cmd, march_in_cmd in run_list:
Index: llvm/utils/update_analyze_test_checks.py
===
--- llvm/utils/update_analyze_test_checks.py
+++ llvm/utils/update_analyze_test_checks.py
@@ -114,7 +114,7 @@
 'verbose': args.verbose,
 'function_signature': False,
 'check_attributes': False,
-'replace_function_regex': []}),
+'replace_value_regex': []}),
   scrubber_args = [])
 
 for prefixes, opt_args in prefix_list:
Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -32,8 +32,8 @@
help='Activate CHECK line generation from this point forward')
   parser.add_argument('--disable', action='store_false', dest='enabled',
   help='Deactivate CHECK line generation from this point forward')
-  parser.add_argument('--replace-function-regex', nargs='+', default=[],
-  help='List of regular expressions to replace matching function names')
+  parser.add_argument('--replace-value-regex', nargs='+', default=[],
+  help='List of regular expressions to replace matching value names')
   parser.add_argument('--prefix-filecheck-ir-name', default='',
   help='Add a prefix to FileCheck IR value names to avoid conflicts with scripted names')
   args = parser.parse_args()
@@ -297,7 +297,7 @@
 self._check_attributes = flags.check_attributes
 self._scrubber_args = scrubber_args
 # Strip double-quotes if input was read by UTC_ARGS
-self._replace_function_regex = list(map(lambda x: x.strip('"'), flags.replace_function_regex))
+self._replace_value_regex = list(map(lambda x: x.strip('"'), flags.replace_value_regex))
 self._func_dict = {}
 self._func_order = {}
 self._global_var_dict = {}
@@ -372,7 +372,7 @@
   continue
 
 # Replace function names matching the regex.
-for regex in self._replace_function_regex:
+for regex in self._replace_value_regex:
   # Pattern that matches capture groups in the regex in leftmost order.
   group_regex = re.compile('\(.*?\)')
   # Replace function name with regex.
Index: clang/test/utils/update_cc_test_checks/generated-funcs-regex.test

[clang] 78a7d8c - [Utils][NFC] Rename replace-function-regex in update_cc_test_checks

2021-05-05 Thread Giorgis Georgakoudis via cfe-commits

Author: Giorgis Georgakoudis
Date: 2021-05-05T14:19:30-07:00
New Revision: 78a7d8c4dd1076dccfde2c48fc924d8f5529f4d1

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

LOG: [Utils][NFC] Rename replace-function-regex in update_cc_test_checks

This patch renames the replace-function-regex to replace-value-regex to 
indicate that the existing regex replacement functionality can replace any IR 
value besides functions.

Reviewed By: jdoerfert

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

Added: 


Modified: 
clang/test/OpenMP/nvptx_allocate_codegen.cpp
clang/test/OpenMP/nvptx_data_sharing.cpp
clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
clang/test/OpenMP/nvptx_lambda_capturing.cpp
clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
clang/test/OpenMP/nvptx_parallel_codegen.cpp
clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
clang/test/OpenMP/nvptx_target_codegen.cpp
clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
clang/test/OpenMP/nvptx_target_teams_codegen.cpp
clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp

clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp

clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
clang/test/OpenMP/target_parallel_debug_codegen.cpp
clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c

clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
llvm/utils/UpdateTestChecks/common.py
llvm/utils/update_analyze_test_checks.py
llvm/utils/update_llc_test_checks.py

Removed: 




diff  --git a/clang/test/OpenMP/nvptx_allocate_codegen.cpp 
b/clang/test/OpenMP/nvptx_allocate_codegen.cpp
index 4ca4796cbd27c..50b482d606d59 100644
--- a/clang/test/OpenMP/nvptx_allocate_codegen.cpp
+++ b/clang/test/OpenMP/nvptx_allocate_codegen.cpp
@@ -1,4 +1,4 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --function-signature --include-generated-funcs 
--replace-function-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+"
+// 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]+"
 // RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin10.6.0 
-fopenmp-targets=nvptx64-nvidia-cuda  -emit-llvm-bc -o %t-host.bc %s
 // RUN: %clang_cc1 -verify -fopenmp -triple nvptx64-nvidia-cuda 
-fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device 
-fopenmp-host-ir-file-path %t-host.bc -o - -disable-llvm-optzns | FileCheck %s
 // expected-no-diagnostics

diff  --git a/clang/test/OpenMP/nvptx_data_sharing.cpp 
b/clang/test/OpenMP/nvptx_data_sharing.cpp
index 792d9c664591b..6a68d46ee2884 100644
--- a/clang/test/OpenMP/nvptx_data_sharing.cpp
+++ b/clang/test/OpenMP/nvptx_data_sharing.cpp
@@ -1,4 +1,4 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --function-signature --include-generated-funcs 
--replace-function-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+"
+// 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]+"
 // Test device global memory data sharing codegen.
 
///==///
 

diff  --git 
a/clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp 
b/clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
index f3485f4f0b4b2..0a74ecaec9025 100644
--- a/clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
+++ b/clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
@@ -1,4 +1,4 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --function-signature --include-generated-funcs 
--replace-function-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+"
+// 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]+"
 // Test target codegen - host bc file has to be created first.
 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 

[PATCH] D101805: [WebAssembly] Add codegen test for wasm_simd128.h

2021-05-05 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D101805#2740150 , @tlively wrote:

> @dblaikie, what's the best practice for making tests robust to this 
> difference?

If you need a label or register (eg: if you want to check a branch branches to 
some particular spot) - the first mention of the label or register should use a 
pattern match (which I think this test already do generally for 
instructions/values - but not for labels)

I'm not sure there's a canonical way to skip over the unused "entry" label in 
an asserts build while not tripping up the non-asserts build (perhaps you could 
look around at similar tests) - I guess probably not & people accept a bit of 
looseness in the tests by not using CHECK-NEXT for that first instruction/line 
in the test. You could add a CHECK-NOT (or --implicit-check-not) maybe for " = 
" which would catch some instructions (not all of them - those that don't 
return a value, for instance) if they snuck in between the start of the 
function and the first instruction the test was checking for.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101805

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


[PATCH] D101813: [Driver] Move -print-runtime-dir and -print-resource-dir tests

2021-05-05 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101813

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


[PATCH] D101813: [Driver] Move -print-runtime-dir and -print-resource-dir tests

2021-05-05 Thread Petr Hosek via Phabricator via cfe-commits
phosek added inline comments.



Comment at: clang/test/Driver/print-resource-dir.c:3
+// RUN:-resource-dir=%S/Inputs/resource-dir \
+// RUN:  | FileCheck %s -check-prefix=PRINT-RESOURCE-DIR
+// PRINT-RESOURCE-DIR: Inputs{{/|\\}}resource-dir

MaskRay wrote:
> You can use `-DFILE=%S/Inputs/resource-dir` and check that the printed string 
> is exactly `[[FILE]]`.
> 
> Just use `/` and let Harbomaster confirm that Windows doesn't need backslash.
Thanks for the suggestion.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101813

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


[PATCH] D101878: [git-clang-format] Do not apply clang-format to symlinks

2021-05-05 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius added a comment.

Oh, I forgot, please add a release note.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101878

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


[PATCH] D101878: [git-clang-format] Do not apply clang-format to symlinks

2021-05-05 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama marked an inline comment as done.
pirama added a comment.

In D101878#2740133 , @curdeius wrote:

> LGTM but let's wait a day or two before landing, so that others can chime in.
> Btw, do you have commit rights? If no, please provide "Name " for 
> commit attribution.

Yes, I do have commit rights.  Let's wait for comments and I'll submit it on 
Monday.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101878

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


[PATCH] D101862: [clang-format] Rename common types between C#/JS

2021-05-05 Thread Eliza Velasquez via Phabricator via cfe-commits
exv updated this revision to Diff 343182.
exv added a comment.

Rebase again in an attempt to fix CI


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101862

Files:
  clang/lib/Format/FormatToken.h
  clang/lib/Format/FormatTokenLexer.cpp
  clang/lib/Format/TokenAnnotator.cpp
  clang/lib/Format/UnwrappedLineParser.cpp

Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -1480,9 +1480,9 @@
 }
 case tok::equal:
   // Fat arrows (=>) have tok::TokenKind tok::equal but TokenType
-  // TT_JsFatArrow. The always start an expression or a child block if
+  // TT_FatArrow. The always start an expression or a child block if
   // followed by a curly.
-  if (FormatTok->is(TT_JsFatArrow)) {
+  if (FormatTok->is(TT_FatArrow)) {
 nextToken();
 if (FormatTok->is(tok::l_brace)) {
   // C# may break after => if the next character is a newline.
@@ -1588,7 +1588,7 @@
   --Line->Level;
   break;
 case tok::equal:
-  if (FormatTok->is(TT_JsFatArrow)) {
+  if (FormatTok->is(TT_FatArrow)) {
 ++Line->Level;
 do {
   nextToken();
@@ -1791,7 +1791,7 @@
   // replace this by using parseAssigmentExpression() inside.
   do {
 if (Style.isCSharp()) {
-  if (FormatTok->is(TT_JsFatArrow)) {
+  if (FormatTok->is(TT_FatArrow)) {
 nextToken();
 // Fat arrows can be followed by simple expressions or by child blocks
 // in curly braces.
@@ -1807,7 +1807,7 @@
 tryToParseJSFunction();
 continue;
   }
-  if (FormatTok->is(TT_JsFatArrow)) {
+  if (FormatTok->is(TT_FatArrow)) {
 nextToken();
 // Fat arrows can be followed by simple expressions or by child blocks
 // in curly braces.
Index: clang/lib/Format/TokenAnnotator.cpp
===
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -1365,7 +1365,7 @@
 if (!CurrentToken->isOneOf(
 TT_LambdaLSquare, TT_LambdaLBrace, TT_AttributeMacro,
 TT_ForEachMacro, TT_TypenameMacro, TT_FunctionLBrace,
-TT_ImplicitStringLiteral, TT_InlineASMBrace, TT_JsFatArrow,
+TT_ImplicitStringLiteral, TT_InlineASMBrace, TT_FatArrow,
 TT_LambdaArrow, TT_NamespaceMacro, TT_OverloadedOperator,
 TT_RegexLiteral, TT_TemplateString, TT_ObjCStringLiteral,
 TT_UntouchableMacroFunc, TT_ConstraintJunctions,
@@ -1578,13 +1578,13 @@
 tok::kw_false, tok::kw_true, Keywords.kw_type, Keywords.kw_get,
 Keywords.kw_set) ||
 Current.Previous->Tok.isLiteral()) {
-  Current.setType(TT_JsNonNullAssertion);
+  Current.setType(TT_NonNullAssertion);
   return;
 }
   }
   if (Current.Next &&
   Current.Next->isOneOf(TT_BinaryOperator, Keywords.kw_as)) {
-Current.setType(TT_JsNonNullAssertion);
+Current.setType(TT_NonNullAssertion);
 return;
   }
 }
@@ -2174,7 +2174,7 @@
 return prec::Assignment;
   if (Current->is(TT_LambdaArrow))
 return prec::Comma;
-  if (Current->is(TT_JsFatArrow))
+  if (Current->is(TT_FatArrow))
 return prec::Assignment;
   if (Current->isOneOf(tok::semi, TT_InlineASMColon, TT_SelectorName) ||
   (Current->is(tok::comment) && NextNonComment &&
@@ -3145,7 +3145,7 @@
   return true;
 
 // Spaces around '=>'.
-if (Left.is(TT_JsFatArrow) || Right.is(TT_JsFatArrow))
+if (Left.is(TT_FatArrow) || Right.is(TT_FatArrow))
   return true;
 
 // No spaces around attribute target colons
@@ -3165,7 +3165,7 @@
   return false;
 
 // No space before null forgiving '!'.
-if (Right.is(TT_JsNonNullAssertion))
+if (Right.is(TT_NonNullAssertion))
   return false;
 
 // No space between consecutive commas '[,,]'.
@@ -3193,7 +3193,7 @@
 Right.is(tok::l_paren))
   return true;
   } else if (Style.Language == FormatStyle::LK_JavaScript) {
-if (Left.is(TT_JsFatArrow))
+if (Left.is(TT_FatArrow))
   return true;
 // for await ( ...
 if (Right.is(tok::l_paren) && Left.is(Keywords.kw_await) && Left.Previous &&
@@ -3204,7 +3204,7 @@
   const FormatToken *Next = Right.MatchingParen->getNextNonComment();
   // An async arrow function, for example: `x = async () => foo();`,
   // as opposed to calling a function called async: `x = async();`
-  if (Next && Next->is(TT_JsFatArrow))
+  if (Next && Next->is(TT_FatArrow))
 return true;
 }
 if ((Left.is(TT_TemplateString) && Left.TokenText.endswith("${")) ||
@@ -3278,9 +3278,9 @@
   // locations that should have whitespace following 

[PATCH] D101805: [WebAssembly] Add codegen test for wasm_simd128.h

2021-05-05 Thread Thomas Lively via Phabricator via cfe-commits
tlively added a comment.

@dblaikie, what's the best practice for making tests robust to this difference?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101805

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


[PATCH] D101860: [clang-format] Fix C# nullable-related errors

2021-05-05 Thread Eliza Velasquez via Phabricator via cfe-commits
exv updated this revision to Diff 343180.
exv added a comment.

Rebase again in an attempt to fix CI


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101860

Files:
  clang/lib/Format/FormatToken.h
  clang/lib/Format/TokenAnnotator.cpp
  clang/lib/Format/UnwrappedLineParser.cpp
  clang/lib/Format/UnwrappedLineParser.h
  clang/unittests/Format/FormatTestCSharp.cpp

Index: clang/unittests/Format/FormatTestCSharp.cpp
===
--- clang/unittests/Format/FormatTestCSharp.cpp
+++ clang/unittests/Format/FormatTestCSharp.cpp
@@ -848,6 +848,21 @@
   verifyFormat(R"(var x = (int?)y;)", Style); // Cast to a nullable type.
 
   verifyFormat(R"(var x = new MyContainer();)", Style); // Generics.
+
+  verifyFormat(R"(//
+public interface I {
+  int? Function();
+})",
+   Style); // Interface methods.
+
+  Style.ColumnLimit = 10;
+  verifyFormat(R"(//
+public VeryLongType? Function(
+int arg1,
+int arg2) {
+  //
+})",
+   Style); // ? sticks with identifier.
 }
 
 TEST_F(FormatTestCSharp, CSharpArraySubscripts) {
Index: clang/lib/Format/UnwrappedLineParser.h
===
--- clang/lib/Format/UnwrappedLineParser.h
+++ clang/lib/Format/UnwrappedLineParser.h
@@ -114,6 +114,7 @@
   void parseNew();
   void parseAccessSpecifier();
   bool parseEnum();
+  bool parseStructLike();
   void parseConcept();
   void parseRequires();
   void parseRequiresExpression(unsigned int OriginalLevel);
Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -1316,15 +1316,7 @@
 case tok::kw_struct:
 case tok::kw_union:
 case tok::kw_class:
-  // parseRecord falls through and does not yet add an unwrapped line as a
-  // record declaration or definition can start a structural element.
-  parseRecord();
-  // This does not apply for Java, JavaScript and C#.
-  if (Style.Language == FormatStyle::LK_Java ||
-  Style.Language == FormatStyle::LK_JavaScript || Style.isCSharp()) {
-if (FormatTok->is(tok::semi))
-  nextToken();
-addUnwrappedLine();
+  if (parseStructLike()) {
 return;
   }
   break;
@@ -1438,6 +1430,13 @@
 return;
   }
 
+  if (FormatTok->is(Keywords.kw_interface)) {
+if (parseStructLike()) {
+  return;
+}
+break;
+  }
+
   if (Style.isCpp() && FormatTok->is(TT_StatementMacro)) {
 parseStatementMacro();
 return;
@@ -2525,6 +2524,21 @@
   // "} n, m;" will end up in one unwrapped line.
 }
 
+bool UnwrappedLineParser::parseStructLike() {
+  // parseRecord falls through and does not yet add an unwrapped line as a
+  // record declaration or definition can start a structural element.
+  parseRecord();
+  // This does not apply to Java, JavaScript and C#.
+  if (Style.Language == FormatStyle::LK_Java ||
+  Style.Language == FormatStyle::LK_JavaScript || Style.isCSharp()) {
+if (FormatTok->is(tok::semi))
+  nextToken();
+addUnwrappedLine();
+return true;
+  }
+  return false;
+}
+
 namespace {
 // A class used to set and restore the Token position when peeking
 // ahead in the token source.
Index: clang/lib/Format/TokenAnnotator.cpp
===
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -1078,7 +1078,7 @@
 (Tok->Next && Tok->Next->isOneOf(tok::r_paren, tok::greater)) ||
 (Tok->Next && Tok->Next->is(tok::identifier) && Tok->Next->Next &&
  Tok->Next->Next->is(tok::equal))) {
-  Tok->setType(TT_JsTypeOptionalQuestion);
+  Tok->setType(TT_CSharpNullable);
   break;
 }
   }
@@ -3161,7 +3161,7 @@
   return Style.SpacesInSquareBrackets;
 
 // No space before ? in nullable types.
-if (Right.is(TT_JsTypeOptionalQuestion))
+if (Right.is(TT_CSharpNullable))
   return false;
 
 // No space before null forgiving '!'.
@@ -3818,6 +3818,10 @@
 // Only break after commas for generic type constraints.
 if (Line.First->is(TT_CSharpGenericTypeConstraint))
   return Left.is(TT_CSharpGenericTypeConstraintComma);
+// Keep nullable operators attached to their identifiers.
+if (Right.is(TT_CSharpNullable)) {
+  return false;
+}
   } else if (Style.Language == FormatStyle::LK_Java) {
 if (Left.isOneOf(Keywords.kw_throws, Keywords.kw_extends,
  Keywords.kw_implements))
Index: clang/lib/Format/FormatToken.h
===
--- clang/lib/Format/FormatToken.h
+++ clang/lib/Format/FormatToken.h
@@ -112,6 +112,7 @@
   

[PATCH] D101878: [git-clang-format] Do not apply clang-format to symlinks

2021-05-05 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius accepted this revision.
curdeius added a comment.
This revision is now accepted and ready to land.

LGTM but let's wait a day or two before landing, so that others can chime in.
Btw, do you have commit rights? If no, please provide "Name " for commit 
attribution.




Comment at: clang/tools/clang-format/git-clang-format:345
+  for filename in list(dictionary.keys()):
+print(os.getcwd())
+if os.path.islink(filename):

pirama wrote:
> curdeius wrote:
> > Is this print supposed to stay or is it a remnant of print-debugging?
> Oops, can't believe it slipped through.  Sorry about that.
No worries, the review serves its purpose!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101878

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


[PATCH] D101702: [clang-format] Add more support for C# 8 nullables

2021-05-05 Thread Eliza Velasquez via Phabricator via cfe-commits
exv updated this revision to Diff 343177.
exv added a comment.

Rebase again in an attempt to fix CI


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101702

Files:
  clang/lib/Format/FormatToken.h
  clang/lib/Format/FormatTokenLexer.cpp
  clang/lib/Format/FormatTokenLexer.h
  clang/lib/Format/TokenAnnotator.cpp
  clang/unittests/Format/FormatTestCSharp.cpp

Index: clang/unittests/Format/FormatTestCSharp.cpp
===
--- clang/unittests/Format/FormatTestCSharp.cpp
+++ clang/unittests/Format/FormatTestCSharp.cpp
@@ -358,6 +358,39 @@
   verifyFormat("return _name ?? \"DEF\";");
 }
 
+TEST_F(FormatTestCSharp, CSharpNullCoalescingAssignment) {
+  FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp);
+  Style.SpaceBeforeAssignmentOperators = true;
+
+  verifyFormat(R"(test ??= ABC;)", Style);
+  verifyFormat(R"(test ??= true;)", Style);
+
+  Style.SpaceBeforeAssignmentOperators = false;
+
+  verifyFormat(R"(test??= ABC;)", Style);
+  verifyFormat(R"(test??= true;)", Style);
+}
+
+TEST_F(FormatTestCSharp, CSharpNullForgiving) {
+  FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp);
+
+  verifyFormat("var test = null!;", Style);
+  verifyFormat("string test = someFunctionCall()! + \"ABC\"!", Style);
+  verifyFormat("int test = (1! + 2 + bar! + foo())!", Style);
+  verifyFormat(R"(test ??= !foo!;)", Style);
+  verifyFormat("test = !bar! ?? !foo!;", Style);
+  verifyFormat("bool test = !(!true && !true! || !null && !null! || !false && "
+   "!false! && !bar()! + (!foo()))!",
+   Style);
+
+  // Check that line break keeps identifier with the bang.
+  Style.ColumnLimit = 14;
+
+  verifyFormat("var test =\n"
+   "foo!;",
+   Style);
+}
+
 TEST_F(FormatTestCSharp, AttributesIndentation) {
   FormatStyle Style = getMicrosoftStyle(FormatStyle::LK_CSharp);
   Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None;
Index: clang/lib/Format/TokenAnnotator.cpp
===
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -1055,13 +1055,6 @@
 CurrentToken->Previous->setType(TT_OverloadedOperator);
   break;
 case tok::question:
-  if (Tok->is(TT_CSharpNullConditionalLSquare)) {
-if (!parseSquare())
-  return false;
-break;
-  }
-  if (Tok->isOneOf(TT_CSharpNullConditional, TT_CSharpNullCoalescing))
-break;
   if (Style.Language == FormatStyle::LK_JavaScript && Tok->Next &&
   Tok->Next->isOneOf(tok::semi, tok::comma, tok::colon, tok::r_paren,
  tok::r_brace)) {
@@ -1085,7 +1078,7 @@
 (Tok->Next && Tok->Next->isOneOf(tok::r_paren, tok::greater)) ||
 (Tok->Next && Tok->Next->is(tok::identifier) && Tok->Next->Next &&
  Tok->Next->Next->is(tok::equal))) {
-  Tok->setType(TT_CSharpNullable);
+  Tok->setType(TT_JsTypeOptionalQuestion);
   break;
 }
   }
@@ -1571,39 +1564,29 @@
   // The token type is already known.
   return;
 
-if (Style.isCSharp() && CurrentToken->is(tok::question)) {
-  if (CurrentToken->TokenText == "??") {
-Current.setType(TT_CSharpNullCoalescing);
-return;
-  }
-  if (CurrentToken->TokenText == "?.") {
-Current.setType(TT_CSharpNullConditional);
-return;
-  }
-  if (CurrentToken->TokenText == "?[") {
-Current.setType(TT_CSharpNullConditionalLSquare);
-return;
-  }
-}
-
-if (Style.Language == FormatStyle::LK_JavaScript) {
-  if (Current.is(tok::exclaim)) {
-if (Current.Previous &&
-(Keywords.IsJavaScriptIdentifier(
- *Current.Previous, /* AcceptIdentifierName= */ true) ||
- Current.Previous->isOneOf(
- tok::kw_namespace, tok::r_paren, tok::r_square, tok::r_brace,
- Keywords.kw_type, Keywords.kw_get, Keywords.kw_set) ||
- Current.Previous->Tok.isLiteral())) {
-  Current.setType(TT_JsNonNullAssertion);
-  return;
-}
-if (Current.Next &&
-Current.Next->isOneOf(TT_BinaryOperator, Keywords.kw_as)) {
+if ((Style.Language == FormatStyle::LK_JavaScript || Style.isCSharp()) &&
+Current.is(tok::exclaim)) {
+  if (Current.Previous) {
+bool IsIdentifier =
+Style.Language == FormatStyle::LK_JavaScript
+? Keywords.IsJavaScriptIdentifier(
+  *Current.Previous, /* AcceptIdentifierName= */ true)
+: Current.Previous->is(tok::identifier);
+if (IsIdentifier ||
+Current.Previous->isOneOf(
+tok::kw_namespace, tok::r_paren, tok::r_square, tok::r_brace,
+tok::kw_false, tok::kw_true, Keywords.kw_type, 

[PATCH] D101870: [clangd] Check if macro is already in the IdentifierTable before loading it

2021-05-05 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.

please provide an email address (for attribution) if i should land this for you.


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

https://reviews.llvm.org/D101870

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


[PATCH] D101885: [WebAssembly] Add SIMD const_splat intrinsics

2021-05-05 Thread Thomas Lively via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG81fce29d6e1f: [WebAssembly] Add SIMD const_splat intrinsics 
(authored by tlively).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101885

Files:
  clang/lib/Headers/wasm_simd128.h
  clang/test/Headers/wasm.c

Index: clang/test/Headers/wasm.c
===
--- clang/test/Headers/wasm.c
+++ clang/test/Headers/wasm.c
@@ -386,6 +386,54 @@
   return wasm_f64x2_const(0, 1);
 }
 
+// CHECK-LABEL: @test_i8x16_const_splat(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:ret <4 x i32> 
+//
+v128_t test_i8x16_const_splat() {
+  return wasm_i8x16_const_splat(42);
+}
+
+// CHECK-LABEL: @test_i16x8_const_splat(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:ret <4 x i32> 
+//
+v128_t test_i16x8_const_splat() {
+  return wasm_i16x8_const_splat(42);
+}
+
+// CHECK-LABEL: @test_i32x4_const_splat(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:ret <4 x i32> 
+//
+v128_t test_i32x4_const_splat() {
+  return wasm_i32x4_const_splat(42);
+}
+
+// CHECK-LABEL: @test_i64x2_const_splat(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:ret <4 x i32> 
+//
+v128_t test_i64x2_const_splat() {
+  return wasm_i64x2_const_splat(42);
+}
+
+// CHECK-LABEL: @test_f32x4_const_splat(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:ret <4 x i32> 
+//
+v128_t test_f32x4_const_splat() {
+  return wasm_f32x4_const_splat(42);
+}
+
+// CHECK-LABEL: @test_f64x2_const_splat(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:ret <4 x i32> 
+//
+v128_t test_f64x2_const_splat() {
+  return wasm_f64x2_const_splat(42);
+}
+
 // CHECK-LABEL: @test_i8x16_splat(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[VECINIT_I:%.*]] = insertelement <16 x i8> undef, i8 [[A:%.*]], i32 0
Index: clang/lib/Headers/wasm_simd128.h
===
--- clang/lib/Headers/wasm_simd128.h
+++ clang/lib/Headers/wasm_simd128.h
@@ -229,6 +229,11 @@
   return (v128_t)(__i32x4){__c0, __c1, __c2, __c3};
 }
 
+static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_make(int64_t __c0,
+int64_t __c1) {
+  return (v128_t)(__i64x2){__c0, __c1};
+}
+
 static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_make(float __c0,
 float __c1,
 float __c2,
@@ -236,11 +241,6 @@
   return (v128_t)(__f32x4){__c0, __c1, __c2, __c3};
 }
 
-static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_make(int64_t __c0,
-int64_t __c1) {
-  return (v128_t)(__i64x2){__c0, __c1};
-}
-
 static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_make(double __c0,
 double __c1) {
   return (v128_t)(__f64x2){__c0, __c1};
@@ -291,20 +291,20 @@
 (v128_t)(__i32x4){__c0, __c1, __c2, __c3}; \
   })
 
-#define wasm_f32x4_const(__c0, __c1, __c2, __c3)   \
+#define wasm_i64x2_const(__c0, __c1)   \
   __extension__({  \
 __REQUIRE_CONSTANT(__c0);  \
 __REQUIRE_CONSTANT(__c1);  \
-__REQUIRE_CONSTANT(__c2);  \
-__REQUIRE_CONSTANT(__c3);  \
-(v128_t)(__f32x4){__c0, __c1, __c2, __c3}; \
+(v128_t)(__i64x2){__c0, __c1}; \
   })
 
-#define wasm_i64x2_const(__c0, __c1)   \
+#define wasm_f32x4_const(__c0, __c1, __c2, __c3)   \
   __extension__({  \
 __REQUIRE_CONSTANT(__c0);  \
 __REQUIRE_CONSTANT(__c1);  \
-(v128_t)(__i64x2){__c0, __c1}; \
+__REQUIRE_CONSTANT(__c2);  \
+__REQUIRE_CONSTANT(__c3);  \
+(v128_t)(__f32x4){__c0, __c1, __c2, __c3}; \
   })
 
 #define wasm_f64x2_const(__c0, __c1)   \
@@ -314,6 +314,21 @@
 (v128_t)(__f64x2){__c0, __c1}; \
   })
 
+#define wasm_i8x16_const_splat(__c)\
+  wasm_i8x16_const(__c, __c, __c, __c, __c, __c, __c, __c, __c, 

[clang] 81fce29 - [WebAssembly] Add SIMD const_splat intrinsics

2021-05-05 Thread Thomas Lively via cfe-commits

Author: Thomas Lively
Date: 2021-05-05T13:46:45-07:00
New Revision: 81fce29d6e1f0a83e8a4170c7f24cdd93869d55a

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

LOG: [WebAssembly] Add SIMD const_splat intrinsics

These intrinsics do not correspond to their own underlying instruction, but are
a convenience for the common case of materializing a constant vector that has
the same value in each lane.

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

Added: 


Modified: 
clang/lib/Headers/wasm_simd128.h
clang/test/Headers/wasm.c

Removed: 




diff  --git a/clang/lib/Headers/wasm_simd128.h 
b/clang/lib/Headers/wasm_simd128.h
index 21571253e7b96..e6fb0496e5140 100644
--- a/clang/lib/Headers/wasm_simd128.h
+++ b/clang/lib/Headers/wasm_simd128.h
@@ -229,6 +229,11 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS 
wasm_i32x4_make(int32_t __c0,
   return (v128_t)(__i32x4){__c0, __c1, __c2, __c3};
 }
 
+static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_make(int64_t __c0,
+int64_t __c1) {
+  return (v128_t)(__i64x2){__c0, __c1};
+}
+
 static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_make(float __c0,
 float __c1,
 float __c2,
@@ -236,11 +241,6 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS 
wasm_f32x4_make(float __c0,
   return (v128_t)(__f32x4){__c0, __c1, __c2, __c3};
 }
 
-static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_make(int64_t __c0,
-int64_t __c1) {
-  return (v128_t)(__i64x2){__c0, __c1};
-}
-
 static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_make(double __c0,
 double __c1) {
   return (v128_t)(__f64x2){__c0, __c1};
@@ -291,20 +291,20 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS 
wasm_f64x2_make(double __c0,
 (v128_t)(__i32x4){__c0, __c1, __c2, __c3}; 
\
   })
 
-#define wasm_f32x4_const(__c0, __c1, __c2, __c3)   
\
+#define wasm_i64x2_const(__c0, __c1)   
\
   __extension__({  
\
 __REQUIRE_CONSTANT(__c0);  
\
 __REQUIRE_CONSTANT(__c1);  
\
-__REQUIRE_CONSTANT(__c2);  
\
-__REQUIRE_CONSTANT(__c3);  
\
-(v128_t)(__f32x4){__c0, __c1, __c2, __c3}; 
\
+(v128_t)(__i64x2){__c0, __c1}; 
\
   })
 
-#define wasm_i64x2_const(__c0, __c1)   
\
+#define wasm_f32x4_const(__c0, __c1, __c2, __c3)   
\
   __extension__({  
\
 __REQUIRE_CONSTANT(__c0);  
\
 __REQUIRE_CONSTANT(__c1);  
\
-(v128_t)(__i64x2){__c0, __c1}; 
\
+__REQUIRE_CONSTANT(__c2);  
\
+__REQUIRE_CONSTANT(__c3);  
\
+(v128_t)(__f32x4){__c0, __c1, __c2, __c3}; 
\
   })
 
 #define wasm_f64x2_const(__c0, __c1)   
\
@@ -314,6 +314,21 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS 
wasm_f64x2_make(double __c0,
 (v128_t)(__f64x2){__c0, __c1}; 
\
   })
 
+#define wasm_i8x16_const_splat(__c)
\
+  wasm_i8x16_const(__c, __c, __c, __c, __c, __c, __c, __c, __c, __c, __c, __c, 
\
+   __c, __c, __c, __c)
+
+#define wasm_i16x8_const_splat(__c)
\
+  wasm_i16x8_const(__c, __c, __c, __c, __c, __c, __c, __c)
+
+#define wasm_i32x4_const_splat(__c) wasm_i32x4_const(__c, __c, __c, __c)
+
+#define wasm_i64x2_const_splat(__c) wasm_i64x2_const(__c, __c)
+
+#define wasm_f32x4_const_splat(__c) wasm_i32x4_const(__c, __c, __c, __c)
+
+#define wasm_f64x2_const_splat(__c) wasm_i64x2_const(__c, __c)
+
 static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_splat(int8_t __a) {
   return (v128_t)(__i8x16){__a, __a, __a, __a, __a, __a, __a, __a,
__a, __a, __a, __a, __a, __a, __a, __a};

diff  --git a/clang/test/Headers/wasm.c b/clang/test/Headers/wasm.c
index 

[PATCH] D100581: [Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable

2021-05-05 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks accepted this revision.
aeubanks added a comment.

If you'd like you can split this into separate changes, one for adding the 
warning and another for adding it into warning groups, either way is fine.
Seems like the reported false positives have been addressed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100581

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


[PATCH] D101878: [git-clang-format] Do not apply clang-format to symlinks

2021-05-05 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama marked an inline comment as done.
pirama added inline comments.



Comment at: clang/tools/clang-format/git-clang-format:345
+  for filename in list(dictionary.keys()):
+print(os.getcwd())
+if os.path.islink(filename):

curdeius wrote:
> Is this print supposed to stay or is it a remnant of print-debugging?
Oops, can't believe it slipped through.  Sorry about that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101878

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


[PATCH] D101878: [git-clang-format] Do not apply clang-format to symlinks

2021-05-05 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 343171.
pirama added a comment.

Remove debug print().


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101878

Files:
  clang/tools/clang-format/git-clang-format


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -137,10 +137,15 @@
   if opts.verbose >= 1:
 ignored_files = set(changed_lines)
   filter_by_extension(changed_lines, opts.extensions.lower().split(','))
+  # The computed diff outputs absolute paths, so we must cd before accessing
+  # those files.
+  cd_to_toplevel()
+  filter_symlinks(changed_lines)
   if opts.verbose >= 1:
 ignored_files.difference_update(changed_lines)
 if ignored_files:
-  print('Ignoring changes in the following files (wrong extension):')
+  print(
+'Ignoring changes in the following files (wrong extension or 
symlink):')
   for filename in ignored_files:
 print('%s' % filename)
 if changed_lines:
@@ -151,9 +156,6 @@
 if opts.verbose >= 0:
   print('no modified files to format')
 return
-  # The computed diff outputs absolute paths, so we must cd before accessing
-  # those files.
-  cd_to_toplevel()
   if len(commits) > 1:
 old_tree = commits[1]
 new_tree = run_clang_format_and_save_to_tree(changed_lines,
@@ -337,6 +339,13 @@
   del dictionary[filename]
 
 
+def filter_symlinks(dictionary):
+  """Delete every key in `dictionary` that is a symlink."""
+  for filename in list(dictionary.keys()):
+if os.path.islink(filename):
+  del dictionary[filename]
+
+
 def cd_to_toplevel():
   """Change to the top level of the git repository."""
   toplevel = run('git', 'rev-parse', '--show-toplevel')


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -137,10 +137,15 @@
   if opts.verbose >= 1:
 ignored_files = set(changed_lines)
   filter_by_extension(changed_lines, opts.extensions.lower().split(','))
+  # The computed diff outputs absolute paths, so we must cd before accessing
+  # those files.
+  cd_to_toplevel()
+  filter_symlinks(changed_lines)
   if opts.verbose >= 1:
 ignored_files.difference_update(changed_lines)
 if ignored_files:
-  print('Ignoring changes in the following files (wrong extension):')
+  print(
+'Ignoring changes in the following files (wrong extension or symlink):')
   for filename in ignored_files:
 print('%s' % filename)
 if changed_lines:
@@ -151,9 +156,6 @@
 if opts.verbose >= 0:
   print('no modified files to format')
 return
-  # The computed diff outputs absolute paths, so we must cd before accessing
-  # those files.
-  cd_to_toplevel()
   if len(commits) > 1:
 old_tree = commits[1]
 new_tree = run_clang_format_and_save_to_tree(changed_lines,
@@ -337,6 +339,13 @@
   del dictionary[filename]
 
 
+def filter_symlinks(dictionary):
+  """Delete every key in `dictionary` that is a symlink."""
+  for filename in list(dictionary.keys()):
+if os.path.islink(filename):
+  del dictionary[filename]
+
+
 def cd_to_toplevel():
   """Change to the top level of the git repository."""
   toplevel = run('git', 'rev-parse', '--show-toplevel')
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101878: [git-clang-format] Do not apply clang-format to symlinks

2021-05-05 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius added inline comments.



Comment at: clang/tools/clang-format/git-clang-format:345
+  for filename in list(dictionary.keys()):
+print(os.getcwd())
+if os.path.islink(filename):

Is this print supposed to stay or is it a remnant of print-debugging?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101878

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


[clang] 602f318 - [WebAssembly] Fix constness of pointer params to load intrinsics

2021-05-05 Thread Thomas Lively via cfe-commits

Author: Thomas Lively
Date: 2021-05-05T13:16:56-07:00
New Revision: 602f318cfdac999a8604f1588159326b1a1a1a23

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

LOG: [WebAssembly] Fix constness of pointer params to load intrinsics

Update the SIMD builtin load functions to take pointers to const data and update
the intrinsics themselves to not cast away constness.

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

Added: 


Modified: 
clang/include/clang/Basic/BuiltinsWebAssembly.def
clang/lib/Headers/wasm_simd128.h
clang/test/CodeGen/builtins-wasm.c
clang/test/Headers/wasm.c

Removed: 




diff  --git a/clang/include/clang/Basic/BuiltinsWebAssembly.def 
b/clang/include/clang/Basic/BuiltinsWebAssembly.def
index e3e223f05db08..c114907719737 100644
--- a/clang/include/clang/Basic/BuiltinsWebAssembly.def
+++ b/clang/include/clang/Basic/BuiltinsWebAssembly.def
@@ -194,13 +194,13 @@ 
TARGET_BUILTIN(__builtin_wasm_trunc_sat_zero_u_f64x2_i32x4, "V4UiV2d", "nc", "si
 TARGET_BUILTIN(__builtin_wasm_demote_zero_f64x2_f32x4, "V4fV2d", "nc", 
"simd128")
 TARGET_BUILTIN(__builtin_wasm_promote_low_f32x4_f64x2, "V2dV4f", "nc", 
"simd128")
 
-TARGET_BUILTIN(__builtin_wasm_load32_zero, "V4ii*", "n", "simd128")
-TARGET_BUILTIN(__builtin_wasm_load64_zero, "V2LLiLLi*", "n", "simd128")
+TARGET_BUILTIN(__builtin_wasm_load32_zero, "V4iiC*", "n", "simd128")
+TARGET_BUILTIN(__builtin_wasm_load64_zero, "V2LLiLLiC*", "n", "simd128")
 
-TARGET_BUILTIN(__builtin_wasm_load8_lane, "V16ScSc*V16ScIi", "n", "simd128")
-TARGET_BUILTIN(__builtin_wasm_load16_lane, "V8ss*V8sIi", "n", "simd128")
-TARGET_BUILTIN(__builtin_wasm_load32_lane, "V4ii*V4iIi", "n", "simd128")
-TARGET_BUILTIN(__builtin_wasm_load64_lane, "V2LLiLLi*V2LLiIi", "n", "simd128")
+TARGET_BUILTIN(__builtin_wasm_load8_lane, "V16ScScC*V16ScIi", "n", "simd128")
+TARGET_BUILTIN(__builtin_wasm_load16_lane, "V8ssC*V8sIi", "n", "simd128")
+TARGET_BUILTIN(__builtin_wasm_load32_lane, "V4iiC*V4iIi", "n", "simd128")
+TARGET_BUILTIN(__builtin_wasm_load64_lane, "V2LLiLLiC*V2LLiIi", "n", "simd128")
 TARGET_BUILTIN(__builtin_wasm_store8_lane, "vSc*V16ScIi", "n", "simd128")
 TARGET_BUILTIN(__builtin_wasm_store16_lane, "vs*V8sIi", "n", "simd128")
 TARGET_BUILTIN(__builtin_wasm_store32_lane, "vi*V4iIi", "n", "simd128")

diff  --git a/clang/lib/Headers/wasm_simd128.h 
b/clang/lib/Headers/wasm_simd128.h
index 2ed07bac420c3..21571253e7b96 100644
--- a/clang/lib/Headers/wasm_simd128.h
+++ b/clang/lib/Headers/wasm_simd128.h
@@ -169,18 +169,19 @@ wasm_v128_load64_zero(const void *__mem) {
 }
 
 #define wasm_v128_load8_lane(__ptr, __vec, __i)
\
-  ((v128_t)__builtin_wasm_load8_lane((signed char *)(__ptr), (__i8x16)(__vec), 
\
- (__i)))
+  ((v128_t)__builtin_wasm_load8_lane((const signed char *)(__ptr), 
\
+ (__i8x16)(__vec), (__i)))
 
 #define wasm_v128_load16_lane(__ptr, __vec, __i)   
\
-  ((v128_t)__builtin_wasm_load16_lane((short *)(__ptr), (__i16x8)(__vec),  
\
-  (__i)))
+  ((v128_t)__builtin_wasm_load16_lane((const short *)(__ptr),  
\
+  (__i16x8)(__vec), (__i)))
 
 #define wasm_v128_load32_lane(__ptr, __vec, __i)   
\
-  ((v128_t)__builtin_wasm_load32_lane((int *)(__ptr), (__i32x4)(__vec), (__i)))
+  ((v128_t)__builtin_wasm_load32_lane((const int *)(__ptr), (__i32x4)(__vec),  
\
+  (__i)))
 
 #define wasm_v128_load64_lane(__ptr, __vec, __i)   
\
-  ((v128_t)__builtin_wasm_load64_lane((long long int *)(__ptr),
\
+  ((v128_t)__builtin_wasm_load64_lane((const long long int *)(__ptr),  
\
   (__i64x2)(__vec), (__i)))
 
 static __inline__ void __DEFAULT_FN_ATTRS wasm_v128_store(void *__mem,

diff  --git a/clang/test/CodeGen/builtins-wasm.c 
b/clang/test/CodeGen/builtins-wasm.c
index 6d774b198af05..151bddc4ee039 100644
--- a/clang/test/CodeGen/builtins-wasm.c
+++ b/clang/test/CodeGen/builtins-wasm.c
@@ -284,28 +284,28 @@ f64x2 replace_lane_f64x2(f64x2 v, double x) {
   // WEBASSEMBLY-NEXT: ret
 }
 
-i8x16 load8_lane(signed char *p, i8x16 v) {
+i8x16 load8_lane(const signed char *p, i8x16 v) {
   return __builtin_wasm_load8_lane(p, v, 0);
   // WEBASSEMBLY: tail call <16 x i8> @llvm.wasm.load8.lane(
   // WEBASSEMBLY-SAME: i8* %p, <16 x i8> %v, i32 0)
   // WEBASSEMBLY-NEXT: ret
 }
 
-i16x8 load16_lane(short *p, i16x8 v) {
+i16x8 load16_lane(const short *p, i16x8 v) {
   return __builtin_wasm_load16_lane(p, v, 0);
   // WEBASSEMBLY: tail call <8 x i16> @llvm.wasm.load16.lane(

[PATCH] D101884: [WebAssembly] Fix constness of pointer params to load intrinsics

2021-05-05 Thread Thomas Lively via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG602f318cfdac: [WebAssembly] Fix constness of pointer params 
to load intrinsics (authored by tlively).

Changed prior to commit:
  https://reviews.llvm.org/D101884?vs=342951=343158#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101884

Files:
  clang/include/clang/Basic/BuiltinsWebAssembly.def
  clang/lib/Headers/wasm_simd128.h
  clang/test/CodeGen/builtins-wasm.c
  clang/test/Headers/wasm.c

Index: clang/test/Headers/wasm.c
===
--- clang/test/Headers/wasm.c
+++ clang/test/Headers/wasm.c
@@ -1,7 +1,7 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --force-update
 // REQUIRES: webassembly-registered-target, asserts
 
-// RUN: %clang %s -O2 -emit-llvm -S -o - -target wasm32-unknown-unknown -msimd128 | FileCheck %s
+// RUN: %clang %s -O2 -emit-llvm -S -o - -target wasm32-unknown-unknown -msimd128 -Wcast-qual -Werror | FileCheck %s
 
 #include 
 
@@ -165,7 +165,7 @@
 // CHECK-NEXT:[[TMP2:%.*]] = bitcast <16 x i8> [[TMP1]] to <4 x i32>
 // CHECK-NEXT:ret <4 x i32> [[TMP2]]
 //
-v128_t test_v128_load8_lane(uint8_t *ptr, v128_t vec) {
+v128_t test_v128_load8_lane(const uint8_t *ptr, v128_t vec) {
   return wasm_v128_load8_lane(ptr, vec, 15);
 }
 
@@ -176,7 +176,7 @@
 // CHECK-NEXT:[[TMP2:%.*]] = bitcast <8 x i16> [[TMP1]] to <4 x i32>
 // CHECK-NEXT:ret <4 x i32> [[TMP2]]
 //
-v128_t test_v128_load16_lane(uint16_t *ptr, v128_t vec) {
+v128_t test_v128_load16_lane(const uint16_t *ptr, v128_t vec) {
   return wasm_v128_load16_lane(ptr, vec, 7);
 }
 
@@ -185,7 +185,7 @@
 // CHECK-NEXT:[[TMP0:%.*]] = tail call <4 x i32> @llvm.wasm.load32.lane(i32* [[PTR:%.*]], <4 x i32> [[VEC:%.*]], i32 3)
 // CHECK-NEXT:ret <4 x i32> [[TMP0]]
 //
-v128_t test_v128_load32_lane(uint32_t *ptr, v128_t vec) {
+v128_t test_v128_load32_lane(const uint32_t *ptr, v128_t vec) {
   return wasm_v128_load32_lane(ptr, vec, 3);
 }
 
@@ -196,7 +196,7 @@
 // CHECK-NEXT:[[TMP2:%.*]] = bitcast <2 x i64> [[TMP1]] to <4 x i32>
 // CHECK-NEXT:ret <4 x i32> [[TMP2]]
 //
-v128_t test_v128_load64_lane(uint64_t *ptr, v128_t vec) {
+v128_t test_v128_load64_lane(const uint64_t *ptr, v128_t vec) {
   return wasm_v128_load64_lane(ptr, vec, 1);
 }
 
Index: clang/test/CodeGen/builtins-wasm.c
===
--- clang/test/CodeGen/builtins-wasm.c
+++ clang/test/CodeGen/builtins-wasm.c
@@ -284,28 +284,28 @@
   // WEBASSEMBLY-NEXT: ret
 }
 
-i8x16 load8_lane(signed char *p, i8x16 v) {
+i8x16 load8_lane(const signed char *p, i8x16 v) {
   return __builtin_wasm_load8_lane(p, v, 0);
   // WEBASSEMBLY: tail call <16 x i8> @llvm.wasm.load8.lane(
   // WEBASSEMBLY-SAME: i8* %p, <16 x i8> %v, i32 0)
   // WEBASSEMBLY-NEXT: ret
 }
 
-i16x8 load16_lane(short *p, i16x8 v) {
+i16x8 load16_lane(const short *p, i16x8 v) {
   return __builtin_wasm_load16_lane(p, v, 0);
   // WEBASSEMBLY: tail call <8 x i16> @llvm.wasm.load16.lane(
   // WEBASSEMBLY-SAME: i16* %p, <8 x i16> %v, i32 0)
   // WEBASSEMBLY-NEXT: ret
 }
 
-i32x4 load32_lane(int *p, i32x4 v) {
+i32x4 load32_lane(const int *p, i32x4 v) {
   return __builtin_wasm_load32_lane(p, v, 0);
   // WEBASSEMBLY: tail call <4 x i32> @llvm.wasm.load32.lane(
   // WEBASSEMBLY-SAME: i32* %p, <4 x i32> %v, i32 0)
   // WEBASSEMBLY-NEXT: ret
 }
 
-i64x2 load64_lane(long long *p, i64x2 v) {
+i64x2 load64_lane(const long long *p, i64x2 v) {
   return __builtin_wasm_load64_lane(p, v, 0);
   // WEBASSEMBLY: tail call <2 x i64> @llvm.wasm.load64.lane(
   // WEBASSEMBLY-SAME: i64* %p, <2 x i64> %v, i32 0)
@@ -904,13 +904,13 @@
   // WEBASSEMBLY: ret
 }
 
-i32x4 load32_zero(int *p) {
+i32x4 load32_zero(const int *p) {
   return __builtin_wasm_load32_zero(p);
   // WEBASSEMBLY: call <4 x i32> @llvm.wasm.load32.zero(i32* %p)
   // WEBASSEMBLY: ret
 }
 
-i64x2 load64_zero(long long *p) {
+i64x2 load64_zero(const long long *p) {
   return __builtin_wasm_load64_zero(p);
   // WEBASSEMBLY: call <2 x i64> @llvm.wasm.load64.zero(i64* %p)
   // WEBASSEMBLY: ret
Index: clang/lib/Headers/wasm_simd128.h
===
--- clang/lib/Headers/wasm_simd128.h
+++ clang/lib/Headers/wasm_simd128.h
@@ -169,18 +169,19 @@
 }
 
 #define wasm_v128_load8_lane(__ptr, __vec, __i)\
-  ((v128_t)__builtin_wasm_load8_lane((signed char *)(__ptr), (__i8x16)(__vec), \
- (__i)))
+  ((v128_t)__builtin_wasm_load8_lane((const signed char *)(__ptr), \
+ (__i8x16)(__vec), (__i)))
 
 #define wasm_v128_load16_lane(__ptr, __vec, __i)   \
-  

[PATCH] D101884: [WebAssembly] Fix constness of pointer params to load intrinsics

2021-05-05 Thread Thomas Lively via Phabricator via cfe-commits
tlively added a comment.

In D101884#2739898 , @aheejin wrote:

> I see, thanks. Then other load instructions are OK not to be fixed?
>
> - `v128.load`
> - `v128.loadN_splat`
> - `v128.loadNxM_s/u`

Yep, the intrinsics for those instructions were already using const pointers 
correctly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101884

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


[PATCH] D101934: [Utils][NFC] Rename replace-function-regex in update_cc_test_checks

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

LG


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101934

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


[clang] 627a526 - [WebAssembly] Update narrowing builtin function operand types

2021-05-05 Thread Thomas Lively via cfe-commits

Author: Thomas Lively
Date: 2021-05-05T13:04:04-07:00
New Revision: 627a52695537dd2bea068630887431febbf06856

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

LOG: [WebAssembly] Update narrowing builtin function operand types

Make the inputs to all narrowing builtins signed, which is how they are
interpreted by the underlying instructions (only the result changes sign
between instructions).

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

Added: 


Modified: 
clang/include/clang/Basic/BuiltinsWebAssembly.def
clang/test/CodeGen/builtins-wasm.c

Removed: 




diff  --git a/clang/include/clang/Basic/BuiltinsWebAssembly.def 
b/clang/include/clang/Basic/BuiltinsWebAssembly.def
index 1a89b006e75bd..e3e223f05db08 100644
--- a/clang/include/clang/Basic/BuiltinsWebAssembly.def
+++ b/clang/include/clang/Basic/BuiltinsWebAssembly.def
@@ -185,9 +185,9 @@ TARGET_BUILTIN(__builtin_wasm_trunc_saturate_s_i32x4_f32x4, 
"V4iV4f", "nc", "sim
 TARGET_BUILTIN(__builtin_wasm_trunc_saturate_u_i32x4_f32x4, "V4iV4f", "nc", 
"simd128")
 
 TARGET_BUILTIN(__builtin_wasm_narrow_s_i8x16_i16x8, "V16ScV8sV8s", "nc", 
"simd128")
-TARGET_BUILTIN(__builtin_wasm_narrow_u_i8x16_i16x8, "V16UcV8UsV8Us", "nc", 
"simd128")
+TARGET_BUILTIN(__builtin_wasm_narrow_u_i8x16_i16x8, "V16UcV8sV8s", "nc", 
"simd128")
 TARGET_BUILTIN(__builtin_wasm_narrow_s_i16x8_i32x4, "V8sV4iV4i", "nc", 
"simd128")
-TARGET_BUILTIN(__builtin_wasm_narrow_u_i16x8_i32x4, "V8UsV4UiV4Ui", "nc", 
"simd128")
+TARGET_BUILTIN(__builtin_wasm_narrow_u_i16x8_i32x4, "V8UsV4iV4i", "nc", 
"simd128")
 
 TARGET_BUILTIN(__builtin_wasm_trunc_sat_zero_s_f64x2_i32x4, "V4iV2d", "nc", 
"simd128")
 TARGET_BUILTIN(__builtin_wasm_trunc_sat_zero_u_f64x2_i32x4, "V4UiV2d", "nc", 
"simd128")

diff  --git a/clang/test/CodeGen/builtins-wasm.c 
b/clang/test/CodeGen/builtins-wasm.c
index a7268faa613e6..6d774b198af05 100644
--- a/clang/test/CodeGen/builtins-wasm.c
+++ b/clang/test/CodeGen/builtins-wasm.c
@@ -857,7 +857,7 @@ i8x16 narrow_s_i8x16_i16x8(i16x8 low, i16x8 high) {
   // WEBASSEMBLY: ret
 }
 
-u8x16 narrow_u_i8x16_i16x8(u16x8 low, u16x8 high) {
+u8x16 narrow_u_i8x16_i16x8(i16x8 low, i16x8 high) {
   return __builtin_wasm_narrow_u_i8x16_i16x8(low, high);
   // WEBASSEMBLY: call <16 x i8> @llvm.wasm.narrow.unsigned.v16i8.v8i16(
   // WEBASSEMBLY-SAME: <8 x i16> %low, <8 x i16> %high)
@@ -871,7 +871,7 @@ i16x8 narrow_s_i16x8_i32x4(i32x4 low, i32x4 high) {
   // WEBASSEMBLY: ret
 }
 
-u16x8 narrow_u_i16x8_i32x4(u32x4 low, u32x4 high) {
+u16x8 narrow_u_i16x8_i32x4(i32x4 low, i32x4 high) {
   return __builtin_wasm_narrow_u_i16x8_i32x4(low, high);
   // WEBASSEMBLY: call <8 x i16> @llvm.wasm.narrow.unsigned.v8i16.v4i32(
   // WEBASSEMBLY-SAME: <4 x i32> %low, <4 x i32> %high)



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


[PATCH] D101883: [WebAssembly] Update narrowing builtin function operand types

2021-05-05 Thread Thomas Lively via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG627a52695537: [WebAssembly] Update narrowing builtin 
function operand types (authored by tlively).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101883

Files:
  clang/include/clang/Basic/BuiltinsWebAssembly.def
  clang/test/CodeGen/builtins-wasm.c


Index: clang/test/CodeGen/builtins-wasm.c
===
--- clang/test/CodeGen/builtins-wasm.c
+++ clang/test/CodeGen/builtins-wasm.c
@@ -857,7 +857,7 @@
   // WEBASSEMBLY: ret
 }
 
-u8x16 narrow_u_i8x16_i16x8(u16x8 low, u16x8 high) {
+u8x16 narrow_u_i8x16_i16x8(i16x8 low, i16x8 high) {
   return __builtin_wasm_narrow_u_i8x16_i16x8(low, high);
   // WEBASSEMBLY: call <16 x i8> @llvm.wasm.narrow.unsigned.v16i8.v8i16(
   // WEBASSEMBLY-SAME: <8 x i16> %low, <8 x i16> %high)
@@ -871,7 +871,7 @@
   // WEBASSEMBLY: ret
 }
 
-u16x8 narrow_u_i16x8_i32x4(u32x4 low, u32x4 high) {
+u16x8 narrow_u_i16x8_i32x4(i32x4 low, i32x4 high) {
   return __builtin_wasm_narrow_u_i16x8_i32x4(low, high);
   // WEBASSEMBLY: call <8 x i16> @llvm.wasm.narrow.unsigned.v8i16.v4i32(
   // WEBASSEMBLY-SAME: <4 x i32> %low, <4 x i32> %high)
Index: clang/include/clang/Basic/BuiltinsWebAssembly.def
===
--- clang/include/clang/Basic/BuiltinsWebAssembly.def
+++ clang/include/clang/Basic/BuiltinsWebAssembly.def
@@ -185,9 +185,9 @@
 TARGET_BUILTIN(__builtin_wasm_trunc_saturate_u_i32x4_f32x4, "V4iV4f", "nc", 
"simd128")
 
 TARGET_BUILTIN(__builtin_wasm_narrow_s_i8x16_i16x8, "V16ScV8sV8s", "nc", 
"simd128")
-TARGET_BUILTIN(__builtin_wasm_narrow_u_i8x16_i16x8, "V16UcV8UsV8Us", "nc", 
"simd128")
+TARGET_BUILTIN(__builtin_wasm_narrow_u_i8x16_i16x8, "V16UcV8sV8s", "nc", 
"simd128")
 TARGET_BUILTIN(__builtin_wasm_narrow_s_i16x8_i32x4, "V8sV4iV4i", "nc", 
"simd128")
-TARGET_BUILTIN(__builtin_wasm_narrow_u_i16x8_i32x4, "V8UsV4UiV4Ui", "nc", 
"simd128")
+TARGET_BUILTIN(__builtin_wasm_narrow_u_i16x8_i32x4, "V8UsV4iV4i", "nc", 
"simd128")
 
 TARGET_BUILTIN(__builtin_wasm_trunc_sat_zero_s_f64x2_i32x4, "V4iV2d", "nc", 
"simd128")
 TARGET_BUILTIN(__builtin_wasm_trunc_sat_zero_u_f64x2_i32x4, "V4UiV2d", "nc", 
"simd128")


Index: clang/test/CodeGen/builtins-wasm.c
===
--- clang/test/CodeGen/builtins-wasm.c
+++ clang/test/CodeGen/builtins-wasm.c
@@ -857,7 +857,7 @@
   // WEBASSEMBLY: ret
 }
 
-u8x16 narrow_u_i8x16_i16x8(u16x8 low, u16x8 high) {
+u8x16 narrow_u_i8x16_i16x8(i16x8 low, i16x8 high) {
   return __builtin_wasm_narrow_u_i8x16_i16x8(low, high);
   // WEBASSEMBLY: call <16 x i8> @llvm.wasm.narrow.unsigned.v16i8.v8i16(
   // WEBASSEMBLY-SAME: <8 x i16> %low, <8 x i16> %high)
@@ -871,7 +871,7 @@
   // WEBASSEMBLY: ret
 }
 
-u16x8 narrow_u_i16x8_i32x4(u32x4 low, u32x4 high) {
+u16x8 narrow_u_i16x8_i32x4(i32x4 low, i32x4 high) {
   return __builtin_wasm_narrow_u_i16x8_i32x4(low, high);
   // WEBASSEMBLY: call <8 x i16> @llvm.wasm.narrow.unsigned.v8i16.v4i32(
   // WEBASSEMBLY-SAME: <4 x i32> %low, <4 x i32> %high)
Index: clang/include/clang/Basic/BuiltinsWebAssembly.def
===
--- clang/include/clang/Basic/BuiltinsWebAssembly.def
+++ clang/include/clang/Basic/BuiltinsWebAssembly.def
@@ -185,9 +185,9 @@
 TARGET_BUILTIN(__builtin_wasm_trunc_saturate_u_i32x4_f32x4, "V4iV4f", "nc", "simd128")
 
 TARGET_BUILTIN(__builtin_wasm_narrow_s_i8x16_i16x8, "V16ScV8sV8s", "nc", "simd128")
-TARGET_BUILTIN(__builtin_wasm_narrow_u_i8x16_i16x8, "V16UcV8UsV8Us", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_narrow_u_i8x16_i16x8, "V16UcV8sV8s", "nc", "simd128")
 TARGET_BUILTIN(__builtin_wasm_narrow_s_i16x8_i32x4, "V8sV4iV4i", "nc", "simd128")
-TARGET_BUILTIN(__builtin_wasm_narrow_u_i16x8_i32x4, "V8UsV4UiV4Ui", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_narrow_u_i16x8_i32x4, "V8UsV4iV4i", "nc", "simd128")
 
 TARGET_BUILTIN(__builtin_wasm_trunc_sat_zero_s_f64x2_i32x4, "V4iV2d", "nc", "simd128")
 TARGET_BUILTIN(__builtin_wasm_trunc_sat_zero_u_f64x2_i32x4, "V4UiV2d", "nc", "simd128")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101572: Make `hasTypeLoc` matcher support more node types.

2021-05-05 Thread Stephen Kelly via Phabricator via cfe-commits
steveire added a comment.

Please run `llvm-project/clang/docs/tools/dump_ast_matchers.py` to generate 
updated documentation for this (there is a `urlopen(url)` which slows things 
down, so I usually comment that out when running it).

Do you have this on a git clone somewhere? It's easier to take a patch and try 
it out from a git repo than phab.




Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:3919
+/// cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"
+///   matches Foo(1, 2)
+AST_POLYMORPHIC_MATCHER_P(

This should somehow document the types it works with. You don't have to add 
examples for all of the nodes though. `hasDeclaration` is another example of a 
matcher supporting many different nodes. It has `Usable as:` at the bottom of 
its docs which gets parsed by `dump_ast_matchers.py`. Please make a similar 
change here to verify that the script generates docs for each type.



Comment at: clang/include/clang/ASTMatchers/ASTMatchersInternal.h:138-150
+template  struct disjunction;
+template  struct disjunction : public T {};
+template  struct disjunction {
+  using type =
+  typename std::conditional>::type;
+  static constexpr bool value = type::value;
+};

SilensAngelusNex wrote:
> Is there a better way to express this? I was originally using
> 
> ```
> template  struct is_one_of {
>   template 
>   static constexpr bool value = (std::is_base_of_v || ...);
> };
> ```
> but that didn't compile because `is_base_of_v` and fold expressions are C++17 
> features.
> 
> Maybe it would be better to just explicitly write out an overload of 
> `GetTypeSourceInfo` for each type?

I like your c++17 solution too, but given that we have 
`TypeListContainsSuperOf` in this file used for this kind of thing, I think it 
makes sense to use that. I think this will work:

```
template , 
T>::value>
  * = nullptr>
```



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101572

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


[PATCH] D101878: [git-clang-format] Do not apply clang-format to symlinks

2021-05-05 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment.

I have not a great knowledge about python, but it looks okay.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101878

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


[PATCH] D101937: [Clang][Manual] Mention -fdebug-info-for-profiling.

2021-05-05 Thread Michael Benfield via Phabricator via cfe-commits
mbenfield created this revision.
mbenfield added reviewers: rsmith, wmi.
Herald added a subscriber: wenlei.
mbenfield requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This option is necessary for effective AutoFDO, and it also seems that
the `create_llvm_prof` converter won't work if the binary is compiled
without it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101937

Files:
  clang/docs/UsersManual.rst


Index: clang/docs/UsersManual.rst
===
--- clang/docs/UsersManual.rst
+++ clang/docs/UsersManual.rst
@@ -1911,14 +1911,16 @@
 usual build cycle when using sample profilers for optimization:
 
 1. Build the code with source line table information. You can use all the
-   usual build flags that you always build your application with. The only
-   requirement is that you add ``-gline-tables-only`` or ``-g`` to the
-   command line. This is important for the profiler to be able to map
-   instructions back to source line locations.
+   usual build flags that you always build your application with. There are two
+   flags you must use. The first is ``-gline-tables-only`` or ``-g``. This is
+   important for the profiler to be able to map instructions back to source 
line
+   locations. The second is ``-fdebug-info-for-profiling``. This will add
+   discriminators so that different expressions on the same source line can be
+   distinguished, as well as some other changes making profiling more 
effective.
 
.. code-block:: console
 
- $ clang++ -O2 -gline-tables-only code.cc -o code
+ $ clang++ -O2 -fdebug-info-for-profiling -gline-tables-only code.cc -o 
code
 
 2. Run the executable under a sampling profiler. The specific profiler
you use does not really matter, as long as its output can be converted


Index: clang/docs/UsersManual.rst
===
--- clang/docs/UsersManual.rst
+++ clang/docs/UsersManual.rst
@@ -1911,14 +1911,16 @@
 usual build cycle when using sample profilers for optimization:
 
 1. Build the code with source line table information. You can use all the
-   usual build flags that you always build your application with. The only
-   requirement is that you add ``-gline-tables-only`` or ``-g`` to the
-   command line. This is important for the profiler to be able to map
-   instructions back to source line locations.
+   usual build flags that you always build your application with. There are two
+   flags you must use. The first is ``-gline-tables-only`` or ``-g``. This is
+   important for the profiler to be able to map instructions back to source line
+   locations. The second is ``-fdebug-info-for-profiling``. This will add
+   discriminators so that different expressions on the same source line can be
+   distinguished, as well as some other changes making profiling more effective.
 
.. code-block:: console
 
- $ clang++ -O2 -gline-tables-only code.cc -o code
+ $ clang++ -O2 -fdebug-info-for-profiling -gline-tables-only code.cc -o code
 
 2. Run the executable under a sampling profiler. The specific profiler
you use does not really matter, as long as its output can be converted
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101884: [WebAssembly] Fix constness of pointer params to load intrinsics

2021-05-05 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin accepted this revision.
aheejin added a comment.
This revision is now accepted and ready to land.

I see, thanks. Then other load instructions are OK not to be fixed?

- `v128.load`
- `v128.loadN_splat`
- `v128.loadNxM_s/u`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101884

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


[PATCH] D101860: [clang-format] Fix C# nullable-related errors

2021-05-05 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay accepted this revision.
MyDeveloperDay added a comment.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101860

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


[PATCH] D101884: [WebAssembly] Fix constness of pointer params to load intrinsics

2021-05-05 Thread Thomas Lively via Phabricator via cfe-commits
tlively added a comment.

It only matters for pointer parameters. For example, `const int *` is 
meaningfully different from `int *`, but `const int` is not usefully different 
from `int`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101884

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


[PATCH] D101862: [clang-format] Rename common types between C#/JS

2021-05-05 Thread Eliza Velasquez via Phabricator via cfe-commits
exv updated this revision to Diff 343144.
exv added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101862

Files:
  clang/lib/Format/FormatToken.h
  clang/lib/Format/FormatTokenLexer.cpp
  clang/lib/Format/TokenAnnotator.cpp
  clang/lib/Format/UnwrappedLineParser.cpp

Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -1480,9 +1480,9 @@
 }
 case tok::equal:
   // Fat arrows (=>) have tok::TokenKind tok::equal but TokenType
-  // TT_JsFatArrow. The always start an expression or a child block if
+  // TT_FatArrow. The always start an expression or a child block if
   // followed by a curly.
-  if (FormatTok->is(TT_JsFatArrow)) {
+  if (FormatTok->is(TT_FatArrow)) {
 nextToken();
 if (FormatTok->is(tok::l_brace)) {
   // C# may break after => if the next character is a newline.
@@ -1588,7 +1588,7 @@
   --Line->Level;
   break;
 case tok::equal:
-  if (FormatTok->is(TT_JsFatArrow)) {
+  if (FormatTok->is(TT_FatArrow)) {
 ++Line->Level;
 do {
   nextToken();
@@ -1791,7 +1791,7 @@
   // replace this by using parseAssigmentExpression() inside.
   do {
 if (Style.isCSharp()) {
-  if (FormatTok->is(TT_JsFatArrow)) {
+  if (FormatTok->is(TT_FatArrow)) {
 nextToken();
 // Fat arrows can be followed by simple expressions or by child blocks
 // in curly braces.
@@ -1807,7 +1807,7 @@
 tryToParseJSFunction();
 continue;
   }
-  if (FormatTok->is(TT_JsFatArrow)) {
+  if (FormatTok->is(TT_FatArrow)) {
 nextToken();
 // Fat arrows can be followed by simple expressions or by child blocks
 // in curly braces.
Index: clang/lib/Format/TokenAnnotator.cpp
===
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -1365,7 +1365,7 @@
 if (!CurrentToken->isOneOf(
 TT_LambdaLSquare, TT_LambdaLBrace, TT_AttributeMacro,
 TT_ForEachMacro, TT_TypenameMacro, TT_FunctionLBrace,
-TT_ImplicitStringLiteral, TT_InlineASMBrace, TT_JsFatArrow,
+TT_ImplicitStringLiteral, TT_InlineASMBrace, TT_FatArrow,
 TT_LambdaArrow, TT_NamespaceMacro, TT_OverloadedOperator,
 TT_RegexLiteral, TT_TemplateString, TT_ObjCStringLiteral,
 TT_UntouchableMacroFunc, TT_ConstraintJunctions,
@@ -1578,13 +1578,13 @@
 tok::kw_false, tok::kw_true, Keywords.kw_type, Keywords.kw_get,
 Keywords.kw_set) ||
 Current.Previous->Tok.isLiteral()) {
-  Current.setType(TT_JsNonNullAssertion);
+  Current.setType(TT_NonNullAssertion);
   return;
 }
   }
   if (Current.Next &&
   Current.Next->isOneOf(TT_BinaryOperator, Keywords.kw_as)) {
-Current.setType(TT_JsNonNullAssertion);
+Current.setType(TT_NonNullAssertion);
 return;
   }
 }
@@ -2174,7 +2174,7 @@
 return prec::Assignment;
   if (Current->is(TT_LambdaArrow))
 return prec::Comma;
-  if (Current->is(TT_JsFatArrow))
+  if (Current->is(TT_FatArrow))
 return prec::Assignment;
   if (Current->isOneOf(tok::semi, TT_InlineASMColon, TT_SelectorName) ||
   (Current->is(tok::comment) && NextNonComment &&
@@ -3145,7 +3145,7 @@
   return true;
 
 // Spaces around '=>'.
-if (Left.is(TT_JsFatArrow) || Right.is(TT_JsFatArrow))
+if (Left.is(TT_FatArrow) || Right.is(TT_FatArrow))
   return true;
 
 // No spaces around attribute target colons
@@ -3165,7 +3165,7 @@
   return false;
 
 // No space before null forgiving '!'.
-if (Right.is(TT_JsNonNullAssertion))
+if (Right.is(TT_NonNullAssertion))
   return false;
 
 // No space between consecutive commas '[,,]'.
@@ -3193,7 +3193,7 @@
 Right.is(tok::l_paren))
   return true;
   } else if (Style.Language == FormatStyle::LK_JavaScript) {
-if (Left.is(TT_JsFatArrow))
+if (Left.is(TT_FatArrow))
   return true;
 // for await ( ...
 if (Right.is(tok::l_paren) && Left.is(Keywords.kw_await) && Left.Previous &&
@@ -3204,7 +3204,7 @@
   const FormatToken *Next = Right.MatchingParen->getNextNonComment();
   // An async arrow function, for example: `x = async () => foo();`,
   // as opposed to calling a function called async: `x = async();`
-  if (Next && Next->is(TT_JsFatArrow))
+  if (Next && Next->is(TT_FatArrow))
 return true;
 }
 if ((Left.is(TT_TemplateString) && Left.TokenText.endswith("${")) ||
@@ -3278,9 +3278,9 @@
   // locations that should have whitespace following are identified by the
   

[PATCH] D101860: [clang-format] Fix C# nullable-related errors

2021-05-05 Thread Eliza Velasquez via Phabricator via cfe-commits
exv updated this revision to Diff 343143.
exv marked an inline comment as done.
exv added a comment.

- Incorporate curdeius's feedback


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101860

Files:
  clang/lib/Format/FormatToken.h
  clang/lib/Format/TokenAnnotator.cpp
  clang/lib/Format/UnwrappedLineParser.cpp
  clang/lib/Format/UnwrappedLineParser.h
  clang/unittests/Format/FormatTestCSharp.cpp

Index: clang/unittests/Format/FormatTestCSharp.cpp
===
--- clang/unittests/Format/FormatTestCSharp.cpp
+++ clang/unittests/Format/FormatTestCSharp.cpp
@@ -848,6 +848,21 @@
   verifyFormat(R"(var x = (int?)y;)", Style); // Cast to a nullable type.
 
   verifyFormat(R"(var x = new MyContainer();)", Style); // Generics.
+
+  verifyFormat(R"(//
+public interface I {
+  int? Function();
+})",
+   Style); // Interface methods.
+
+  Style.ColumnLimit = 10;
+  verifyFormat(R"(//
+public VeryLongType? Function(
+int arg1,
+int arg2) {
+  //
+})",
+   Style); // ? sticks with identifier.
 }
 
 TEST_F(FormatTestCSharp, CSharpArraySubscripts) {
Index: clang/lib/Format/UnwrappedLineParser.h
===
--- clang/lib/Format/UnwrappedLineParser.h
+++ clang/lib/Format/UnwrappedLineParser.h
@@ -114,6 +114,7 @@
   void parseNew();
   void parseAccessSpecifier();
   bool parseEnum();
+  bool parseStructLike();
   void parseConcept();
   void parseRequires();
   void parseRequiresExpression(unsigned int OriginalLevel);
Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -1316,15 +1316,7 @@
 case tok::kw_struct:
 case tok::kw_union:
 case tok::kw_class:
-  // parseRecord falls through and does not yet add an unwrapped line as a
-  // record declaration or definition can start a structural element.
-  parseRecord();
-  // This does not apply for Java, JavaScript and C#.
-  if (Style.Language == FormatStyle::LK_Java ||
-  Style.Language == FormatStyle::LK_JavaScript || Style.isCSharp()) {
-if (FormatTok->is(tok::semi))
-  nextToken();
-addUnwrappedLine();
+  if (parseStructLike()) {
 return;
   }
   break;
@@ -1438,6 +1430,13 @@
 return;
   }
 
+  if (FormatTok->is(Keywords.kw_interface)) {
+if (parseStructLike()) {
+  return;
+}
+break;
+  }
+
   if (Style.isCpp() && FormatTok->is(TT_StatementMacro)) {
 parseStatementMacro();
 return;
@@ -2525,6 +2524,21 @@
   // "} n, m;" will end up in one unwrapped line.
 }
 
+bool UnwrappedLineParser::parseStructLike() {
+  // parseRecord falls through and does not yet add an unwrapped line as a
+  // record declaration or definition can start a structural element.
+  parseRecord();
+  // This does not apply to Java, JavaScript and C#.
+  if (Style.Language == FormatStyle::LK_Java ||
+  Style.Language == FormatStyle::LK_JavaScript || Style.isCSharp()) {
+if (FormatTok->is(tok::semi))
+  nextToken();
+addUnwrappedLine();
+return true;
+  }
+  return false;
+}
+
 namespace {
 // A class used to set and restore the Token position when peeking
 // ahead in the token source.
Index: clang/lib/Format/TokenAnnotator.cpp
===
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -1078,7 +1078,7 @@
 (Tok->Next && Tok->Next->isOneOf(tok::r_paren, tok::greater)) ||
 (Tok->Next && Tok->Next->is(tok::identifier) && Tok->Next->Next &&
  Tok->Next->Next->is(tok::equal))) {
-  Tok->setType(TT_JsTypeOptionalQuestion);
+  Tok->setType(TT_CSharpNullable);
   break;
 }
   }
@@ -3161,7 +3161,7 @@
   return Style.SpacesInSquareBrackets;
 
 // No space before ? in nullable types.
-if (Right.is(TT_JsTypeOptionalQuestion))
+if (Right.is(TT_CSharpNullable))
   return false;
 
 // No space before null forgiving '!'.
@@ -3818,6 +3818,10 @@
 // Only break after commas for generic type constraints.
 if (Line.First->is(TT_CSharpGenericTypeConstraint))
   return Left.is(TT_CSharpGenericTypeConstraintComma);
+// Keep nullable operators attached to their identifiers.
+if (Right.is(TT_CSharpNullable)) {
+  return false;
+}
   } else if (Style.Language == FormatStyle::LK_Java) {
 if (Left.isOneOf(Keywords.kw_throws, Keywords.kw_extends,
  Keywords.kw_implements))
Index: clang/lib/Format/FormatToken.h
===
--- clang/lib/Format/FormatToken.h
+++ clang/lib/Format/FormatToken.h

[PATCH] D101702: [clang-format] Add more support for C# 8 nullables

2021-05-05 Thread Eliza Velasquez via Phabricator via cfe-commits
exv added a comment.

Rebased and comments addressed!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101702

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


[PATCH] D101870: [clangd] Check if macro is already in the IdentifierTable before loading it

2021-05-05 Thread Queen Dela Cruz via Phabricator via cfe-commits
qdelacru updated this revision to Diff 343141.
qdelacru added a comment.

Added suggested new test case


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

https://reviews.llvm.org/D101870

Files:
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp


Index: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
===
--- clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
+++ clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
@@ -3139,6 +3139,15 @@
  Kind(CompletionItemKind::Constructor;
 }
 
+TEST(CompletionTest, NoCrashDueToMacroOrdering) {
+  EXPECT_THAT(completions(R"cpp(
+#define ECHO(X) X
+#define ECHO2(X) ECHO(X)
+int finish_preamble = EC^HO(2);)cpp")
+  .Completions,
+  UnorderedElementsAre(Labeled("ECHO(X)"), Labeled("ECHO2(X)")));
+}
+
 } // namespace
 } // namespace clangd
 } // namespace clang
Index: clang-tools-extra/clangd/CodeComplete.cpp
===
--- clang-tools-extra/clangd/CodeComplete.cpp
+++ clang-tools-extra/clangd/CodeComplete.cpp
@@ -1105,14 +1105,19 @@
   ExternalPreprocessorSource *PreambleMacros = PP.getExternalSource();
   // As we have the names of the macros, we can look up their IdentifierInfo
   // and then use this to load just the macros we want.
+  const auto  = PP.getIdentifierTable();
   IdentifierInfoLookup *PreambleIdentifiers =
-  PP.getIdentifierTable().getExternalIdentifierLookup();
+  ITable.getExternalIdentifierLookup();
+
   if (!PreambleIdentifiers || !PreambleMacros)
 return;
-  for (const auto  : Preamble.Macros.Names)
+  for (const auto  : Preamble.Macros.Names) {
+if (ITable.find(MacroName.getKey()) != ITable.end())
+  continue;
 if (auto *II = PreambleIdentifiers->get(MacroName.getKey()))
   if (II->isOutOfDate())
 PreambleMacros->updateOutOfDateIdentifier(*II);
+  }
 }
 
 // Invokes Sema code completion on a file.


Index: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
===
--- clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
+++ clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
@@ -3139,6 +3139,15 @@
  Kind(CompletionItemKind::Constructor;
 }
 
+TEST(CompletionTest, NoCrashDueToMacroOrdering) {
+  EXPECT_THAT(completions(R"cpp(
+#define ECHO(X) X
+#define ECHO2(X) ECHO(X)
+int finish_preamble = EC^HO(2);)cpp")
+  .Completions,
+  UnorderedElementsAre(Labeled("ECHO(X)"), Labeled("ECHO2(X)")));
+}
+
 } // namespace
 } // namespace clangd
 } // namespace clang
Index: clang-tools-extra/clangd/CodeComplete.cpp
===
--- clang-tools-extra/clangd/CodeComplete.cpp
+++ clang-tools-extra/clangd/CodeComplete.cpp
@@ -1105,14 +1105,19 @@
   ExternalPreprocessorSource *PreambleMacros = PP.getExternalSource();
   // As we have the names of the macros, we can look up their IdentifierInfo
   // and then use this to load just the macros we want.
+  const auto  = PP.getIdentifierTable();
   IdentifierInfoLookup *PreambleIdentifiers =
-  PP.getIdentifierTable().getExternalIdentifierLookup();
+  ITable.getExternalIdentifierLookup();
+
   if (!PreambleIdentifiers || !PreambleMacros)
 return;
-  for (const auto  : Preamble.Macros.Names)
+  for (const auto  : Preamble.Macros.Names) {
+if (ITable.find(MacroName.getKey()) != ITable.end())
+  continue;
 if (auto *II = PreambleIdentifiers->get(MacroName.getKey()))
   if (II->isOutOfDate())
 PreambleMacros->updateOutOfDateIdentifier(*II);
+  }
 }
 
 // Invokes Sema code completion on a file.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101702: [clang-format] Add more support for C# 8 nullables

2021-05-05 Thread Eliza Velasquez via Phabricator via cfe-commits
exv updated this revision to Diff 343142.
exv marked 3 inline comments as done.
exv added a comment.

- Incorporate krasimir's feedback


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101702

Files:
  clang/lib/Format/FormatToken.h
  clang/lib/Format/FormatTokenLexer.cpp
  clang/lib/Format/FormatTokenLexer.h
  clang/lib/Format/TokenAnnotator.cpp
  clang/unittests/Format/FormatTestCSharp.cpp

Index: clang/unittests/Format/FormatTestCSharp.cpp
===
--- clang/unittests/Format/FormatTestCSharp.cpp
+++ clang/unittests/Format/FormatTestCSharp.cpp
@@ -358,6 +358,39 @@
   verifyFormat("return _name ?? \"DEF\";");
 }
 
+TEST_F(FormatTestCSharp, CSharpNullCoalescingAssignment) {
+  FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp);
+  Style.SpaceBeforeAssignmentOperators = true;
+
+  verifyFormat(R"(test ??= ABC;)", Style);
+  verifyFormat(R"(test ??= true;)", Style);
+
+  Style.SpaceBeforeAssignmentOperators = false;
+
+  verifyFormat(R"(test??= ABC;)", Style);
+  verifyFormat(R"(test??= true;)", Style);
+}
+
+TEST_F(FormatTestCSharp, CSharpNullForgiving) {
+  FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp);
+
+  verifyFormat("var test = null!;", Style);
+  verifyFormat("string test = someFunctionCall()! + \"ABC\"!", Style);
+  verifyFormat("int test = (1! + 2 + bar! + foo())!", Style);
+  verifyFormat(R"(test ??= !foo!;)", Style);
+  verifyFormat("test = !bar! ?? !foo!;", Style);
+  verifyFormat("bool test = !(!true && !true! || !null && !null! || !false && "
+   "!false! && !bar()! + (!foo()))!",
+   Style);
+
+  // Check that line break keeps identifier with the bang.
+  Style.ColumnLimit = 14;
+
+  verifyFormat("var test =\n"
+   "foo!;",
+   Style);
+}
+
 TEST_F(FormatTestCSharp, AttributesIndentation) {
   FormatStyle Style = getMicrosoftStyle(FormatStyle::LK_CSharp);
   Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None;
Index: clang/lib/Format/TokenAnnotator.cpp
===
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -1055,13 +1055,6 @@
 CurrentToken->Previous->setType(TT_OverloadedOperator);
   break;
 case tok::question:
-  if (Tok->is(TT_CSharpNullConditionalLSquare)) {
-if (!parseSquare())
-  return false;
-break;
-  }
-  if (Tok->isOneOf(TT_CSharpNullConditional, TT_CSharpNullCoalescing))
-break;
   if (Style.Language == FormatStyle::LK_JavaScript && Tok->Next &&
   Tok->Next->isOneOf(tok::semi, tok::comma, tok::colon, tok::r_paren,
  tok::r_brace)) {
@@ -1085,7 +1078,7 @@
 (Tok->Next && Tok->Next->isOneOf(tok::r_paren, tok::greater)) ||
 (Tok->Next && Tok->Next->is(tok::identifier) && Tok->Next->Next &&
  Tok->Next->Next->is(tok::equal))) {
-  Tok->setType(TT_CSharpNullable);
+  Tok->setType(TT_JsTypeOptionalQuestion);
   break;
 }
   }
@@ -1571,39 +1564,29 @@
   // The token type is already known.
   return;
 
-if (Style.isCSharp() && CurrentToken->is(tok::question)) {
-  if (CurrentToken->TokenText == "??") {
-Current.setType(TT_CSharpNullCoalescing);
-return;
-  }
-  if (CurrentToken->TokenText == "?.") {
-Current.setType(TT_CSharpNullConditional);
-return;
-  }
-  if (CurrentToken->TokenText == "?[") {
-Current.setType(TT_CSharpNullConditionalLSquare);
-return;
-  }
-}
-
-if (Style.Language == FormatStyle::LK_JavaScript) {
-  if (Current.is(tok::exclaim)) {
-if (Current.Previous &&
-(Keywords.IsJavaScriptIdentifier(
- *Current.Previous, /* AcceptIdentifierName= */ true) ||
- Current.Previous->isOneOf(
- tok::kw_namespace, tok::r_paren, tok::r_square, tok::r_brace,
- Keywords.kw_type, Keywords.kw_get, Keywords.kw_set) ||
- Current.Previous->Tok.isLiteral())) {
-  Current.setType(TT_JsNonNullAssertion);
-  return;
-}
-if (Current.Next &&
-Current.Next->isOneOf(TT_BinaryOperator, Keywords.kw_as)) {
+if ((Style.Language == FormatStyle::LK_JavaScript || Style.isCSharp()) &&
+Current.is(tok::exclaim)) {
+  if (Current.Previous) {
+bool IsIdentifier =
+Style.Language == FormatStyle::LK_JavaScript
+? Keywords.IsJavaScriptIdentifier(
+  *Current.Previous, /* AcceptIdentifierName= */ true)
+: Current.Previous->is(tok::identifier);
+if (IsIdentifier ||
+Current.Previous->isOneOf(
+tok::kw_namespace, tok::r_paren, tok::r_square, tok::r_brace,
+tok::kw_false, 

[PATCH] D101805: [WebAssembly] Add codegen test for wasm_simd128.h

2021-05-05 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D101805#2739814 , @tlively wrote:

> Thanks, @hans! That's very surprising; I'll take a deeper look at what was 
> going wrong.

Labels (& instructions/values) are only named in ASSERTS enabled builds (or you 
can opt into them more narrowly with some other build config)

eg:
With asserts:

  ; Function Attrs: nounwind uwtable
  define dso_local void @func(i32 %b, i32 %i, i32 %j) local_unnamed_addr #0 {
  entry:
%tobool.not = icmp eq i32 %b, 0
br i1 %tobool.not, label %if.end, label %if.then
  
  if.then:  ; preds = %entry
tail call void (...) @f1() #2
br label %if.end
  
  if.end:   ; preds = %if.then, %entry
ret void
  }

Without asserts:

  ; Function Attrs: nounwind uwtable
  define dso_local void @func(i32 %0, i32 %1, i32 %2) local_unnamed_addr #0 {
%4 = icmp eq i32 %0, 0
br i1 %4, label %6, label %5
  
  5:; preds = %3
tail call void (...) @f1() #2
br label %6
  
  6:; preds = %5, %3
ret void
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101805

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


[PATCH] D101805: [WebAssembly] Add codegen test for wasm_simd128.h

2021-05-05 Thread Thomas Lively via Phabricator via cfe-commits
tlively added a comment.

Thanks, @hans! That's very surprising; I'll take a deeper look at what was 
going wrong.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101805

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


[PATCH] D101684: [WebAssembly] Add end-to-end codegen tests for wasm_simd128.h

2021-05-05 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D101684#2737868 , @tlively wrote:

> In D101684#2737842 , @penzn wrote:
>
>> I think there is another dimension to this aside from project composition - 
>> intrinsics have a tendency to "interact" with their surroundings, and it 
>> better to capture the IR rather than the end result. Even if we can verify 
>> that simple calls produce instructions we expect, this might not hold true 
>> is the arguments change, or the call is in a different context. IR 
>> definitely gives more opportunities to test things through.
>
> Yeah, the contract that specific instructions are generated really only holds 
> in trivial cases by design. I'm not sure how to best formalize that, though.

I don't know that much about intrinsics, but happy to help with test 
suggestions - do you have any practical examples of this you could show & I can 
see if I've got any ideas of good ways to test them?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101684

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


[PATCH] D101868: [clang-format] Adds a formatter for aligning arrays of structs

2021-05-05 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment.

I really like alignment! :)

But why is this completely different than the other alignment options?

You should also add an entry to the release notes.




Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:32
+// The notion here is that we walk through the annotated line looking for
+// things like static initialization of arrays and flag them
+bool isArrayOfStructuresInit(const AnnotatedLine ) {

Dot at the end. :)



Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:37
+  const auto *CurrentToken = Line.First;
+  enum class DetectAsiFsm {
+null,

What stands AsiFsm for?



Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:82
+}
+CurrentToken = CurrentToken->getNextNonComment();
+  }

I would prefer a
`for(; CurrentToken != Line.Last && CurrentToken != nullptr; CurrentToken = 
CurrentToken->getNextNonComment())



Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:1232
+  } else if (CurrentToken->is(tok::r_brace)) {
+Depth--;
+  }

Why postfix, especially if using prefix in the `if`?



Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:1244
+  Column = 0;
+  Row++;
+} else {

Same.



Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:1276
+}
+Layout.emplace_back(std::vector{});
+auto Row = Layout.size() - 1;

With this you should save yourself the temporary.



Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:1278
+auto Row = Layout.size() - 1;
+Layout[Row].push_back(0);
+auto Column = 0U;

But why not just initialize the vector directly with 1 element of 0?



Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:1316-1327
+while (true) {
+  auto MaxColumn = 0U;
+  for (auto Row = 0U; Row < RowCount; Row++) {
+MaxColumn = std::max(MaxColumn, LayoutMatrix[Row][Column]);
+  }
+  for (auto Row = 0U; Row < RowCount; Row++) {
+LayoutMatrix[Row][Column] = MaxColumn - LayoutMatrix[Row][Column];

You should also assert that `LayoutMatrix.size() > 0`.



Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:1404
+ isArrayOfStructuresInit(TheLine));
+  if (AlignArrayOfStructuresInit) {
+Penalty += AlignedArrayOfStructuresInitLineFormatter(

I'm not sure that you should go before the no column limit. In either case you 
should have a test case for that.



Comment at: clang/unittests/Format/FormatTest.cpp:16371
+   Style);
+}
+

curdeius wrote:
> I think we need more tests:
> * with a comma after the last element of array
> * with assignment and not only initialization?
> * without `struct` keyword
> * with short lines/long values to see how wrapping behaves
>   * also, with multiple string literals in one struct, e.g. `"hello" "world"` 
> (that will get splitted into multiple lines)
> * with non-plain-array types (i.e. missing `[]`/`[3]`)
> * interaction with other Align* options (e.g. `AlignConsecutiveAssignments`, 
> two arrays one after another, `AlignConsecutiveDeclarations`).
In addition to that I want to see:
* How it behaves with a smaller column limit which would be violated if there 
is no additional wrapping. There I also want one without `verifyFormat`.
* With no column limit.
* Maybe with a `const`, `inline` or something similar. (How about east `const` 
vs. west `const`?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101868

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


[PATCH] D101935: [clang] Search runtimes build tree for openmp runtime

2021-05-05 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield created this revision.
JonChesterfield added reviewers: jdoerfert, pdhaliwal, ronlieb, grokos, 
tianshilei1992.
Herald added subscribers: guansong, yaxunl.
JonChesterfield requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

[clang] Search runtimes build tree for openmp runtime

D96248  added support for finding the openmp 
devicertl bitcode in the clang
lib directory where it is installed, or in the LIBRARY_PATH environment.

When testing openmp from a build using ENABLE_RUNTIMES, the corresponding
bitcode may be found under runtimes/runtimes-bins. This patch adds that to
the list of places clang looks, at lower priority then the others.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101935

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp


Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1686,6 +1686,12 @@
   llvm::sys::path::append(DefaultLibPath, Twine("lib") + CLANG_LIBDIR_SUFFIX);
   LibraryPaths.emplace_back(DefaultLibPath.c_str());
 
+  // Add path to runtimes binary folder, used by ENABLE_RUNTIMES build
+  SmallString<256> RuntimesBinPath = llvm::sys::path::parent_path(D.Dir);
+  llvm::sys::path::append(RuntimesBinPath,
+  "runtimes/runtimes-bins/openmp/libomptarget");
+  LibraryPaths.emplace_back(RuntimesBinPath.c_str());
+
   OptSpecifier LibomptargetBCPathOpt =
   Triple.isAMDGCN() ? options::OPT_libomptarget_amdgcn_bc_path_EQ
 : options::OPT_libomptarget_nvptx_bc_path_EQ;


Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1686,6 +1686,12 @@
   llvm::sys::path::append(DefaultLibPath, Twine("lib") + CLANG_LIBDIR_SUFFIX);
   LibraryPaths.emplace_back(DefaultLibPath.c_str());
 
+  // Add path to runtimes binary folder, used by ENABLE_RUNTIMES build
+  SmallString<256> RuntimesBinPath = llvm::sys::path::parent_path(D.Dir);
+  llvm::sys::path::append(RuntimesBinPath,
+  "runtimes/runtimes-bins/openmp/libomptarget");
+  LibraryPaths.emplace_back(RuntimesBinPath.c_str());
+
   OptSpecifier LibomptargetBCPathOpt =
   Triple.isAMDGCN() ? options::OPT_libomptarget_amdgcn_bc_path_EQ
 : options::OPT_libomptarget_nvptx_bc_path_EQ;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101934: [Utils][NFC] Rename replace-function-regex in update_cc_test_checks

2021-05-05 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis created this revision.
Herald added a subscriber: arichardson.
ggeorgakoudis requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, cfe-commits, sstefan1.
Herald added projects: clang, LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101934

Files:
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/target_parallel_debug_codegen.cpp
  clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
  clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_analyze_test_checks.py
  llvm/utils/update_llc_test_checks.py

Index: llvm/utils/update_llc_test_checks.py
===
--- llvm/utils/update_llc_test_checks.py
+++ llvm/utils/update_llc_test_checks.py
@@ -108,12 +108,12 @@
   check_indent = ''
 
 builder = common.FunctionTestBuilder(
-run_list=run_list, 
+run_list=run_list,
 flags=type('', (object,), {
 'verbose': ti.args.verbose,
 'function_signature': False,
 'check_attributes': False,
-'replace_function_regex': []}),
+'replace_value_regex': []}),
 scrubber_args=[ti.args])
 
 for prefixes, llc_tool, llc_args, preprocess_cmd, triple_in_cmd, march_in_cmd in run_list:
Index: llvm/utils/update_analyze_test_checks.py
===
--- llvm/utils/update_analyze_test_checks.py
+++ llvm/utils/update_analyze_test_checks.py
@@ -114,7 +114,7 @@
 'verbose': args.verbose,
 'function_signature': False,
 'check_attributes': False,
-'replace_function_regex': []}),
+'replace_value_regex': []}),
   scrubber_args = [])
 
 for prefixes, opt_args in prefix_list:
Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -32,8 +32,8 @@
help='Activate CHECK line generation from this point forward')
   parser.add_argument('--disable', action='store_false', dest='enabled',
   help='Deactivate CHECK line generation from this point forward')
-  parser.add_argument('--replace-function-regex', nargs='+', default=[],
-  help='List of regular expressions to replace matching function names')
+  parser.add_argument('--replace-value-regex', nargs='+', default=[],
+  help='List of regular expressions to replace matching value names')
   parser.add_argument('--prefix-filecheck-ir-name', default='',
   help='Add a prefix to FileCheck IR value names to avoid conflicts with scripted names')
   args = parser.parse_args()
@@ -297,7 +297,7 @@
 self._check_attributes = flags.check_attributes
 self._scrubber_args = scrubber_args
 # Strip double-quotes if input was read by UTC_ARGS
-self._replace_function_regex = list(map(lambda x: x.strip('"'), flags.replace_function_regex))
+self._replace_value_regex = list(map(lambda x: x.strip('"'), flags.replace_value_regex))
 self._func_dict = {}
 self._func_order = {}
 self._global_var_dict = {}
@@ -372,7 +372,7 @@
   continue
 
 # Replace function names matching the regex.
-for regex in self._replace_function_regex:
+for regex in self._replace_value_regex:
   # Pattern that matches capture groups in the regex in leftmost order.
   group_regex = re.compile('\(.*?\)')
   # Replace function name with regex.
Index: clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
===
--- 

[PATCH] D101702: [clang-format] Add more support for C# 8 nullables

2021-05-05 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added inline comments.



Comment at: clang/lib/Format/FormatTokenLexer.cpp:135
   return;
+}
   }

krasimir wrote:
> nit: use spaces for indentation, no tabs (Phabricator makes it look this line 
> starts with a tab character)
That's not a tab, I fell for that one too once. It just visualizes that there 
was only whitespace added.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101702

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


[PATCH] D100782: [PowerPC] Improve f32 to i32 bitcast code gen

2021-05-05 Thread Albion Fung via Phabricator via cfe-commits
Conanap updated this revision to Diff 343115.
Conanap marked 2 inline comments as done.
Conanap added a comment.

Updated `COPY_TO_REGCLASS` to `SUBREG_TO_REG`, added a test case.


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

https://reviews.llvm.org/D100782

Files:
  llvm/lib/Target/PowerPC/PPCInstrVSX.td
  llvm/test/CodeGen/PowerPC/aix-p9-xxinsertw-xxextractuw.ll
  llvm/test/CodeGen/PowerPC/aix-vec_insert_elt.ll
  llvm/test/CodeGen/PowerPC/bitcasts-direct-move.ll
  llvm/test/CodeGen/PowerPC/p9-xxinsertw-xxextractuw.ll
  llvm/test/CodeGen/PowerPC/scalar_vector_test_4.ll
  llvm/test/CodeGen/PowerPC/vec_insert_elt.ll

Index: llvm/test/CodeGen/PowerPC/vec_insert_elt.ll
===
--- llvm/test/CodeGen/PowerPC/vec_insert_elt.ll
+++ llvm/test/CodeGen/PowerPC/vec_insert_elt.ll
@@ -200,21 +200,19 @@
 ; CHECK-LABEL: testFloat1:
 ; CHECK:   # %bb.0: # %entry
 ; CHECK-NEXT:xscvdpspn vs0, f1
-; CHECK-NEXT:extsw r3, r6
-; CHECK-NEXT:slwi r3, r3, 2
-; CHECK-NEXT:xxsldwi vs0, vs0, vs0, 3
-; CHECK-NEXT:mffprwz r4, f0
-; CHECK-NEXT:vinswrx v2, r3, r4
+; CHECK-NEXT:extsw r4, r6
+; CHECK-NEXT:slwi r4, r4, 2
+; CHECK-NEXT:mffprwz r3, f0
+; CHECK-NEXT:vinswrx v2, r4, r3
 ; CHECK-NEXT:blr
 ;
 ; CHECK-BE-LABEL: testFloat1:
 ; CHECK-BE:   # %bb.0: # %entry
 ; CHECK-BE-NEXT:xscvdpspn vs0, f1
-; CHECK-BE-NEXT:extsw r3, r6
-; CHECK-BE-NEXT:slwi r3, r3, 2
-; CHECK-BE-NEXT:xxsldwi vs0, vs0, vs0, 3
-; CHECK-BE-NEXT:mffprwz r4, f0
-; CHECK-BE-NEXT:vinswlx v2, r3, r4
+; CHECK-BE-NEXT:extsw r4, r6
+; CHECK-BE-NEXT:slwi r4, r4, 2
+; CHECK-BE-NEXT:mffprwz r3, f0
+; CHECK-BE-NEXT:vinswlx v2, r4, r3
 ; CHECK-BE-NEXT:blr
 ;
 ; CHECK-P9-LABEL: testFloat1:
@@ -346,7 +344,6 @@
 ; CHECK-LABEL: testFloatImm1:
 ; CHECK:   # %bb.0: # %entry
 ; CHECK-NEXT:xscvdpspn vs0, f1
-; CHECK-NEXT:xxsldwi vs0, vs0, vs0, 3
 ; CHECK-NEXT:xxinsertw v2, vs0, 12
 ; CHECK-NEXT:xxinsertw v2, vs0, 4
 ; CHECK-NEXT:blr
@@ -354,7 +351,6 @@
 ; CHECK-BE-LABEL: testFloatImm1:
 ; CHECK-BE:   # %bb.0: # %entry
 ; CHECK-BE-NEXT:xscvdpspn vs0, f1
-; CHECK-BE-NEXT:xxsldwi vs0, vs0, vs0, 3
 ; CHECK-BE-NEXT:xxinsertw v2, vs0, 0
 ; CHECK-BE-NEXT:xxinsertw v2, vs0, 8
 ; CHECK-BE-NEXT:blr
@@ -362,7 +358,6 @@
 ; CHECK-P9-LABEL: testFloatImm1:
 ; CHECK-P9:   # %bb.0: # %entry
 ; CHECK-P9-NEXT:xscvdpspn vs0, f1
-; CHECK-P9-NEXT:xxsldwi vs0, vs0, vs0, 3
 ; CHECK-P9-NEXT:xxinsertw v2, vs0, 0
 ; CHECK-P9-NEXT:xxinsertw v2, vs0, 8
 ; CHECK-P9-NEXT:blr
@@ -393,11 +388,9 @@
 ; CHECK-P9:   # %bb.0: # %entry
 ; CHECK-P9-NEXT:lfs f0, 0(r5)
 ; CHECK-P9-NEXT:xscvdpspn vs0, f0
-; CHECK-P9-NEXT:xxsldwi vs0, vs0, vs0, 3
 ; CHECK-P9-NEXT:xxinsertw v2, vs0, 0
 ; CHECK-P9-NEXT:lfs f0, 4(r5)
 ; CHECK-P9-NEXT:xscvdpspn vs0, f0
-; CHECK-P9-NEXT:xxsldwi vs0, vs0, vs0, 3
 ; CHECK-P9-NEXT:xxinsertw v2, vs0, 8
 ; CHECK-P9-NEXT:blr
 entry:
@@ -439,11 +432,9 @@
 ; CHECK-P9-NEXT:li r3, 1
 ; CHECK-P9-NEXT:rldic r3, r3, 38, 25
 ; CHECK-P9-NEXT:xscvdpspn vs0, f0
-; CHECK-P9-NEXT:xxsldwi vs0, vs0, vs0, 3
 ; CHECK-P9-NEXT:xxinsertw v2, vs0, 0
 ; CHECK-P9-NEXT:lfsx f0, r5, r3
 ; CHECK-P9-NEXT:xscvdpspn vs0, f0
-; CHECK-P9-NEXT:xxsldwi vs0, vs0, vs0, 3
 ; CHECK-P9-NEXT:xxinsertw v2, vs0, 8
 ; CHECK-P9-NEXT:blr
 entry:
@@ -738,3 +729,28 @@
   ret <2 x double> %vecins
 }
 
+define dso_local <4 x float> @testInsertDoubleToFloat(<4 x float> %a, double %b) local_unnamed_addr #0 {
+; CHECK-LABEL: testInsertDoubleToFloat:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:xscvdpsp f0, f1
+; CHECK-NEXT:xxinsertw v2, vs0, 8
+; CHECK-NEXT:blr
+;
+; CHECK-BE-LABEL: testInsertDoubleToFloat:
+; CHECK-BE:   # %bb.0: # %entry
+; CHECK-BE-NEXT:xsrsp f0, f1
+; CHECK-BE-NEXT:xscvdpspn vs0, f0
+; CHECK-BE-NEXT:xxinsertw v2, vs0, 4
+; CHECK-BE-NEXT:blr
+;
+; CHECK-P9-LABEL: testInsertDoubleToFloat:
+; CHECK-P9:   # %bb.0: # %entry
+; CHECK-P9-NEXT:xsrsp f0, f1
+; CHECK-P9-NEXT:xscvdpspn vs0, f0
+; CHECK-P9-NEXT:xxinsertw v2, vs0, 4
+; CHECK-P9-NEXT:blr
+entry:
+  %conv = fptrunc double %b to float
+  %vecins = insertelement <4 x float> %a, float %conv, i32 1
+  ret <4 x float> %vecins
+}
Index: llvm/test/CodeGen/PowerPC/scalar_vector_test_4.ll
===
--- llvm/test/CodeGen/PowerPC/scalar_vector_test_4.ll
+++ llvm/test/CodeGen/PowerPC/scalar_vector_test_4.ll
@@ -216,7 +216,6 @@
 ; P9LE:   # %bb.0: # %entry
 ; P9LE-NEXT:lfs f0, 0(r3)
 ; P9LE-NEXT:xscvdpspn vs0, f0
-; P9LE-NEXT:xxsldwi vs0, vs0, vs0, 3
 ; P9LE-NEXT:xxinsertw v2, vs0, 12
 ; P9LE-NEXT:blr
 ;
@@ -224,7 +223,6 @@
 ; P9BE:   # %bb.0: # %entry
 ; P9BE-NEXT:lfs f0, 0(r3)
 ; P9BE-NEXT:xscvdpspn vs0, f0
-; P9BE-NEXT:

  1   2   >