[llvm-branch-commits] [mlir] [MLIR][LLVM][SROA] Support incorrectly typed memory accesses (PR #85813)

2024-03-20 Thread Tobias Gysi via llvm-branch-commits

https://github.com/gysit approved this pull request.

Thanks LGTM!

https://github.com/llvm/llvm-project/pull/85813
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] release/18.x: [Mips] Fix missing sign extension in expansion of sub-word atomic max (#77072) (PR #84566)

2024-03-20 Thread via llvm-branch-commits


@@ -2001,8 +2225,6 @@ define i16 @test_umax_16(ptr nocapture %ptr, i16 signext 
%val) {
 ; MIPSELR6-NEXT:  $BB6_1: # %entry
 ; MIPSELR6-NEXT:# =>This Inner Loop Header: Depth=1
 ; MIPSELR6-NEXT:ll $2, 0($6)
-; MIPSELR6-NEXT:and $2, $2, $8

yingopq wrote:

@topperc I have submit pr: https://github.com/llvm/llvm-project/pull/85902, 
please help review, thanks again.

https://github.com/llvm/llvm-project/pull/84566
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] release/18.x: [libcxx] [modules] Fix relative paths with absolute LIBCXX_INSTALL_MODULES_DIR (#85756) (PR #85907)

2024-03-20 Thread via llvm-branch-commits

https://github.com/llvmbot created 
https://github.com/llvm/llvm-project/pull/85907

Backport 272d1b44efdedb68c194970a610f0ca1b7b769c5

Requested by: @mstorsjo

>From 7ed553656598a0360901235b9a6c401f82fa07c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= 
Date: Wed, 20 Mar 2024 10:45:43 +0200
Subject: [PATCH] [libcxx] [modules] Fix relative paths with absolute
 LIBCXX_INSTALL_MODULES_DIR (#85756)

In other contexts, install directories such as
LIBCXX_INSTALL_LIBRARY_DIR and LIBCXX_INSTALL_MODULES_DIR can be
specified either as a relative path, relative to CMAKE_INSTALL_PREFIX,
or as an absolute path.

When calculating the relative path between the two, account for the fact
that LIBCXX_INSTALL_MODULES_DIR and LIBCXX_INSTALL_LIBRARY_DIR can be
absolute paths too.

(cherry picked from commit 272d1b44efdedb68c194970a610f0ca1b7b769c5)
---
 libcxx/modules/CMakeLists.txt | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libcxx/modules/CMakeLists.txt b/libcxx/modules/CMakeLists.txt
index 0dea8cfca94ac3..8dd1b51aac2f72 100644
--- a/libcxx/modules/CMakeLists.txt
+++ b/libcxx/modules/CMakeLists.txt
@@ -206,9 +206,15 @@ add_custom_target(generate-cxx-modules
 # Configure the modules manifest.
 # Use the relative path between the installation and the module in the json
 # file. This allows moving the entire installation to a different location.
+cmake_path(ABSOLUTE_PATH LIBCXX_INSTALL_LIBRARY_DIR
+  BASE_DIRECTORY ${CMAKE_INSTALL_PREFIX}
+  OUTPUT_VARIABLE ABS_LIBRARY_DIR)
+cmake_path(ABSOLUTE_PATH LIBCXX_INSTALL_MODULES_DIR
+  BASE_DIRECTORY ${CMAKE_INSTALL_PREFIX}
+  OUTPUT_VARIABLE ABS_MODULES_DIR)
 file(RELATIVE_PATH LIBCXX_MODULE_RELATIVE_PATH
-  ${CMAKE_INSTALL_PREFIX}/${LIBCXX_INSTALL_LIBRARY_DIR}
-  ${CMAKE_INSTALL_PREFIX}/${LIBCXX_INSTALL_MODULES_DIR})
+  ${ABS_LIBRARY_DIR}
+  ${ABS_MODULES_DIR})
 configure_file(
   "modules.json.in"
   "${LIBCXX_LIBRARY_DIR}/libc++.modules.json"

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


[llvm-branch-commits] [libcxx] release/18.x: [libcxx] [modules] Fix relative paths with absolute LIBCXX_INSTALL_MODULES_DIR (#85756) (PR #85907)

2024-03-20 Thread via llvm-branch-commits

llvmbot wrote:

@mordante What do you think about merging this PR to the release branch?

https://github.com/llvm/llvm-project/pull/85907
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] release/18.x: [libcxx] [modules] Fix relative paths with absolute LIBCXX_INSTALL_MODULES_DIR (#85756) (PR #85907)

2024-03-20 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/85907
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] release/18.x: [libcxx] [modules] Fix relative paths with absolute LIBCXX_INSTALL_MODULES_DIR (#85756) (PR #85907)

2024-03-20 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-libcxx

Author: None (llvmbot)


Changes

Backport 272d1b44efdedb68c194970a610f0ca1b7b769c5

Requested by: @mstorsjo

---
Full diff: https://github.com/llvm/llvm-project/pull/85907.diff


1 Files Affected:

- (modified) libcxx/modules/CMakeLists.txt (+8-2) 


``diff
diff --git a/libcxx/modules/CMakeLists.txt b/libcxx/modules/CMakeLists.txt
index 0dea8cfca94ac3..8dd1b51aac2f72 100644
--- a/libcxx/modules/CMakeLists.txt
+++ b/libcxx/modules/CMakeLists.txt
@@ -206,9 +206,15 @@ add_custom_target(generate-cxx-modules
 # Configure the modules manifest.
 # Use the relative path between the installation and the module in the json
 # file. This allows moving the entire installation to a different location.
+cmake_path(ABSOLUTE_PATH LIBCXX_INSTALL_LIBRARY_DIR
+  BASE_DIRECTORY ${CMAKE_INSTALL_PREFIX}
+  OUTPUT_VARIABLE ABS_LIBRARY_DIR)
+cmake_path(ABSOLUTE_PATH LIBCXX_INSTALL_MODULES_DIR
+  BASE_DIRECTORY ${CMAKE_INSTALL_PREFIX}
+  OUTPUT_VARIABLE ABS_MODULES_DIR)
 file(RELATIVE_PATH LIBCXX_MODULE_RELATIVE_PATH
-  ${CMAKE_INSTALL_PREFIX}/${LIBCXX_INSTALL_LIBRARY_DIR}
-  ${CMAKE_INSTALL_PREFIX}/${LIBCXX_INSTALL_MODULES_DIR})
+  ${ABS_LIBRARY_DIR}
+  ${ABS_MODULES_DIR})
 configure_file(
   "modules.json.in"
   "${LIBCXX_LIBRARY_DIR}/libc++.modules.json"

``




https://github.com/llvm/llvm-project/pull/85907
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 06f3d68 - Revert "[FMV] Emit the resolver along with the default version definition. (#…"

2024-03-20 Thread via llvm-branch-commits

Author: Alexandros Lamprineas
Date: 2024-03-20T10:08:24Z
New Revision: 06f3d687a8ecbef5d5c21bc73723e4e4c55997bd

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

LOG: Revert "[FMV] Emit the resolver along with the default version definition. 
(#…"

This reverts commit e6b5bd5854c80eac05f415ad282ba84b840b8af8.

Added: 


Modified: 
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/test/CodeGen/attr-target-version.c
clang/test/CodeGenCXX/attr-target-version.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CodeGenModule.cpp 
b/clang/lib/CodeGen/CodeGenModule.cpp
index cb153066b28dd1..bb26bfcddaeb78 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -3449,9 +3449,6 @@ bool CodeGenModule::MayBeEmittedEagerly(const ValueDecl 
*Global) {
   // Implicit template instantiations may change linkage if they are later
   // explicitly instantiated, so they should not be emitted eagerly.
   return false;
-// Defer until all versions have been semantically checked.
-if (FD->hasAttr() && !FD->isMultiVersion())
-  return false;
   }
   if (const auto *VD = dyn_cast(Global)) {
 if (Context.getInlineVariableDefinitionKind(VD) ==
@@ -4000,13 +3997,10 @@ void 
CodeGenModule::EmitMultiVersionFunctionDefinition(GlobalDecl GD,
 EmitGlobalFunctionDefinition(GD.getWithMultiVersionIndex(I), nullptr);
 // Ensure that the resolver function is also emitted.
 GetOrCreateMultiVersionResolver(GD);
+  } else if (FD->hasAttr()) {
+GetOrCreateMultiVersionResolver(GD);
   } else
 EmitGlobalFunctionDefinition(GD, GV);
-
-  // Defer the resolver emission until we can reason whether the TU
-  // contains a default target version implementation.
-  if (FD->isTargetVersionMultiVersion())
-AddDeferredMultiVersionResolverToEmit(GD);
 }
 
 void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD, llvm::GlobalValue *GV) 
{
@@ -4099,11 +4093,10 @@ void CodeGenModule::emitMultiVersionFunctions() {
 const auto *FD = cast(GD.getDecl());
 assert(FD && "Expected a FunctionDecl");
 
-bool EmitResolver = !FD->isTargetVersionMultiVersion();
 SmallVector Options;
 if (FD->isTargetMultiVersion()) {
   getContext().forEachMultiversionedFunctionVersion(
-  FD, [this, &GD, &Options, &EmitResolver](const FunctionDecl *CurFD) {
+  FD, [this, &GD, &Options](const FunctionDecl *CurFD) {
 GlobalDecl CurGD{
 (CurFD->isDefined() ? CurFD->getDefinition() : CurFD)};
 StringRef MangledName = getMangledName(CurGD);
@@ -4129,9 +4122,6 @@ void CodeGenModule::emitMultiVersionFunctions() {
TA->getArchitecture(), Feats);
 } else {
   const auto *TVA = CurFD->getAttr();
-  if (CurFD->isUsed() || (TVA->isDefaultVersion() &&
-  CurFD->doesThisDeclarationHaveABody()))
-EmitResolver = true;
   llvm::SmallVector Feats;
   TVA->getFeatures(Feats);
   Options.emplace_back(cast(Func),
@@ -4187,27 +4177,22 @@ void CodeGenModule::emitMultiVersionFunctions() {
   continue;
 }
 
-if (!EmitResolver)
-  continue;
-
 llvm::Constant *ResolverConstant = GetOrCreateMultiVersionResolver(GD);
 if (auto *IFunc = dyn_cast(ResolverConstant)) {
   ResolverConstant = IFunc->getResolver();
   if (FD->isTargetClonesMultiVersion() ||
   FD->isTargetVersionMultiVersion()) {
+const CGFunctionInfo &FI = getTypes().arrangeGlobalDeclaration(GD);
+llvm::FunctionType *DeclTy = getTypes().GetFunctionType(FI);
 std::string MangledName = getMangledNameImpl(
 *this, GD, FD, /*OmitMultiVersionMangling=*/true);
-if (!GetGlobalValue(MangledName + ".ifunc")) {
-  const CGFunctionInfo &FI = getTypes().arrangeGlobalDeclaration(GD);
-  llvm::FunctionType *DeclTy = getTypes().GetFunctionType(FI);
-  // In prior versions of Clang, the mangling for ifuncs incorrectly
-  // included an .ifunc suffix. This alias is generated for backward
-  // compatibility. It is deprecated, and may be removed in the future.
-  auto *Alias = llvm::GlobalAlias::create(
-  DeclTy, 0, getMultiversionLinkage(*this, GD),
-  MangledName + ".ifunc", IFunc, &getModule());
-  SetCommonAttributes(FD, Alias);
-}
+// In prior versions of Clang, the mangling for ifuncs incorrectly
+// included an .ifunc suffix. This alias is generated for backward
+// compatibility. It is deprecated, and may be removed in the future.
+auto *Alias = llvm::GlobalAlias::create(
+  

[llvm-branch-commits] [libcxx] [libc++][TZDB] Adds sys_info formatter. (PR #85896)

2024-03-20 Thread Mark de Wever via llvm-branch-commits

https://github.com/mordante updated 
https://github.com/llvm/llvm-project/pull/85896

>From 7372394c21017fe3840a6c7a6c92ff9b66f0d13d Mon Sep 17 00:00:00 2001
From: Mark de Wever 
Date: Sun, 10 Mar 2024 17:49:39 +0100
Subject: [PATCH] [libc++][TZDB] Adds sys_info formatter.

Implements parts of:
- P0355 Extending  to Calendars and Time Zones
- P1361 Integration of chrono with text formatting
---
 libcxx/docs/Status/FormatPaper.csv|   2 +-
 libcxx/include/__chrono/convert_to_tm.h   |   5 +
 libcxx/include/__chrono/formatter.h   |  37 +
 libcxx/include/__chrono/ostream.h |  20 +++
 libcxx/include/__chrono/sys_info.h|   6 +-
 libcxx/include/chrono |   5 +
 .../time.zone.info.sys/ostream.pass.cpp   |  71 +
 .../test/libcxx/transitive_includes/cxx23.csv |   1 -
 .../test/libcxx/transitive_includes/cxx26.csv |   1 -
 .../time/time.syn/formatter.sys_info.pass.cpp | 137 ++
 .../time.zone.info.sys/ostream.pass.cpp   |  48 ++
 11 files changed, 326 insertions(+), 7 deletions(-)
 create mode 100644 
libcxx/test/libcxx/time/time.zone/time.zone.info/time.zone.info.sys/ostream.pass.cpp
 create mode 100644 libcxx/test/std/time/time.syn/formatter.sys_info.pass.cpp
 create mode 100644 
libcxx/test/std/time/time.zone/time.zone.info/time.zone.info.sys/ostream.pass.cpp

diff --git a/libcxx/docs/Status/FormatPaper.csv 
b/libcxx/docs/Status/FormatPaper.csv
index 82da54284c7386..32166ec72da753 100644
--- a/libcxx/docs/Status/FormatPaper.csv
+++ b/libcxx/docs/Status/FormatPaper.csv
@@ -24,7 +24,7 @@ Section,Description,Dependencies,Assignee,Status,First 
released version
 `[time.syn] `_,"Formatter 
``chrono::year_month_weekday``",,Mark de Wever,|Complete|,16.0
 `[time.syn] `_,"Formatter 
``chrono::year_month_weekday_last``",,Mark de Wever,|Complete|,16.0
 `[time.syn] `_,"Formatter 
``chrono::hh_mm_ss>``",,Mark de Wever,|Complete|,17.0
-`[time.syn] `_,"Formatter ``chrono::sys_info``",A 
 implementation,Mark de Wever,,
+`[time.syn] `_,"Formatter 
``chrono::sys_info``",,Mark de Wever,|Complete|,19.0
 `[time.syn] `_,"Formatter 
``chrono::local_info``",A  implementation,Mark de Wever,,
 `[time.syn] `_,"Formatter 
``chrono::zoned_time``",A  
implementation,Mark de Wever,,
 
diff --git a/libcxx/include/__chrono/convert_to_tm.h 
b/libcxx/include/__chrono/convert_to_tm.h
index 1301cd6f1f1ada..d2c5cf922ba671 100644
--- a/libcxx/include/__chrono/convert_to_tm.h
+++ b/libcxx/include/__chrono/convert_to_tm.h
@@ -20,6 +20,7 @@
 #include <__chrono/month_weekday.h>
 #include <__chrono/monthday.h>
 #include <__chrono/statically_widen.h>
+#include <__chrono/sys_info.h>
 #include <__chrono/system_clock.h>
 #include <__chrono/time_point.h>
 #include <__chrono/weekday.h>
@@ -171,6 +172,10 @@ _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _ChronoT& 
__value) {
   if (__value.hours().count() > 
std::numeric_limits::max())
 std::__throw_format_error("Formatting hh_mm_ss, encountered an hour 
overflow");
 __result.tm_hour = __value.hours().count();
+#  if !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB)
+  } else if constexpr (same_as<_ChronoT, chrono::sys_info>) {
+// Has no time information.
+#  endif
   } else
 static_assert(sizeof(_ChronoT) == 0, "Add the missing type 
specialization");
 
diff --git a/libcxx/include/__chrono/formatter.h 
b/libcxx/include/__chrono/formatter.h
index 8b8592041a1fb9..f5474e3ea6d078 100644
--- a/libcxx/include/__chrono/formatter.h
+++ b/libcxx/include/__chrono/formatter.h
@@ -24,6 +24,7 @@
 #include <__chrono/ostream.h>
 #include <__chrono/parser_std_format_spec.h>
 #include <__chrono/statically_widen.h>
+#include <__chrono/sys_info.h>
 #include <__chrono/system_clock.h>
 #include <__chrono/time_point.h>
 #include <__chrono/weekday.h>
@@ -202,6 +203,12 @@ struct _LIBCPP_HIDE_FROM_ABI __time_zone {
 template 
 _LIBCPP_HIDE_FROM_ABI __time_zone __convert_to_time_zone([[maybe_unused]] 
const _Tp& __value) {
   __time_zone __result;
+#  if !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB)
+  if constexpr (same_as<_Tp, chrono::sys_info>) {
+__result.__offset = __value.offset;
+__result.__abbrev = __value.abbrev;
+  }
+#  endif
   return __result;
 }
 
@@ -411,6 +418,10 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_ok(const 
_Tp& __value) {
 return __value.weekday().ok();
   else if constexpr (__is_hh_mm_ss<_Tp>)
 return true;
+#  if !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB)
+  else if constexpr (same_as<_Tp, chrono::sys_info>)
+return true;
+#  endif
   else
 static_assert(sizeof(_Tp) == 0, "Add the missing type specialization");
 }
@@ -451,6 +462,10 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool 
__weekday_name_ok(const _Tp& __value) {
 return __value.weekday().ok();
   else if co

[llvm-branch-commits] [libcxx] release/18.x: [libcxx] [modules] Fix relative paths with absolute LIBCXX_INSTALL_MODULES_DIR (#85756) (PR #85907)

2024-03-20 Thread Mark de Wever via llvm-branch-commits

https://github.com/mordante approved this pull request.


https://github.com/llvm/llvm-project/pull/85907
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] [libc++][TZDB] Adds sys_info formatter. (PR #85896)

2024-03-20 Thread Mark de Wever via llvm-branch-commits

https://github.com/mordante updated 
https://github.com/llvm/llvm-project/pull/85896

>From 0dbc61d5f18f9fe5f20119805baa968f66504144 Mon Sep 17 00:00:00 2001
From: Mark de Wever 
Date: Sun, 10 Mar 2024 17:49:39 +0100
Subject: [PATCH] [libc++][TZDB] Adds sys_info formatter.

Implements parts of:
- P0355 Extending  to Calendars and Time Zones
- P1361 Integration of chrono with text formatting
---
 libcxx/docs/Status/FormatPaper.csv|   2 +-
 libcxx/include/__chrono/convert_to_tm.h   |   5 +
 libcxx/include/__chrono/formatter.h   |  44 +-
 libcxx/include/__chrono/ostream.h |  20 +++
 libcxx/include/__chrono/sys_info.h|   6 +-
 libcxx/include/chrono |   5 +
 .../time.zone.info.sys/ostream.pass.cpp   |  71 +
 .../test/libcxx/transitive_includes/cxx23.csv |   1 -
 .../test/libcxx/transitive_includes/cxx26.csv |   1 -
 .../time/time.syn/formatter.sys_info.pass.cpp | 137 ++
 .../time.zone.info.sys/ostream.pass.cpp   |  48 ++
 11 files changed, 330 insertions(+), 10 deletions(-)
 create mode 100644 
libcxx/test/libcxx/time/time.zone/time.zone.info/time.zone.info.sys/ostream.pass.cpp
 create mode 100644 libcxx/test/std/time/time.syn/formatter.sys_info.pass.cpp
 create mode 100644 
libcxx/test/std/time/time.zone/time.zone.info/time.zone.info.sys/ostream.pass.cpp

diff --git a/libcxx/docs/Status/FormatPaper.csv 
b/libcxx/docs/Status/FormatPaper.csv
index 82da54284c7386..32166ec72da753 100644
--- a/libcxx/docs/Status/FormatPaper.csv
+++ b/libcxx/docs/Status/FormatPaper.csv
@@ -24,7 +24,7 @@ Section,Description,Dependencies,Assignee,Status,First 
released version
 `[time.syn] `_,"Formatter 
``chrono::year_month_weekday``",,Mark de Wever,|Complete|,16.0
 `[time.syn] `_,"Formatter 
``chrono::year_month_weekday_last``",,Mark de Wever,|Complete|,16.0
 `[time.syn] `_,"Formatter 
``chrono::hh_mm_ss>``",,Mark de Wever,|Complete|,17.0
-`[time.syn] `_,"Formatter ``chrono::sys_info``",A 
 implementation,Mark de Wever,,
+`[time.syn] `_,"Formatter 
``chrono::sys_info``",,Mark de Wever,|Complete|,19.0
 `[time.syn] `_,"Formatter 
``chrono::local_info``",A  implementation,Mark de Wever,,
 `[time.syn] `_,"Formatter 
``chrono::zoned_time``",A  
implementation,Mark de Wever,,
 
diff --git a/libcxx/include/__chrono/convert_to_tm.h 
b/libcxx/include/__chrono/convert_to_tm.h
index 1301cd6f1f1ada..d2c5cf922ba671 100644
--- a/libcxx/include/__chrono/convert_to_tm.h
+++ b/libcxx/include/__chrono/convert_to_tm.h
@@ -20,6 +20,7 @@
 #include <__chrono/month_weekday.h>
 #include <__chrono/monthday.h>
 #include <__chrono/statically_widen.h>
+#include <__chrono/sys_info.h>
 #include <__chrono/system_clock.h>
 #include <__chrono/time_point.h>
 #include <__chrono/weekday.h>
@@ -171,6 +172,10 @@ _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _ChronoT& 
__value) {
   if (__value.hours().count() > 
std::numeric_limits::max())
 std::__throw_format_error("Formatting hh_mm_ss, encountered an hour 
overflow");
 __result.tm_hour = __value.hours().count();
+#  if !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB)
+  } else if constexpr (same_as<_ChronoT, chrono::sys_info>) {
+// Has no time information.
+#  endif
   } else
 static_assert(sizeof(_ChronoT) == 0, "Add the missing type 
specialization");
 
diff --git a/libcxx/include/__chrono/formatter.h 
b/libcxx/include/__chrono/formatter.h
index 8b8592041a1fb9..6a9f5870458b32 100644
--- a/libcxx/include/__chrono/formatter.h
+++ b/libcxx/include/__chrono/formatter.h
@@ -24,6 +24,7 @@
 #include <__chrono/ostream.h>
 #include <__chrono/parser_std_format_spec.h>
 #include <__chrono/statically_widen.h>
+#include <__chrono/sys_info.h>
 #include <__chrono/system_clock.h>
 #include <__chrono/time_point.h>
 #include <__chrono/weekday.h>
@@ -185,10 +186,11 @@ __format_zone_offset(basic_stringstream<_CharT>& __sstr, 
chrono::seconds __offse
 
   chrono::hh_mm_ss __hms{__offset};
   std::ostreambuf_iterator<_CharT> __out_it{__sstr};
+  // Note HMS does not allow formatting hours > 23, but the offset is not 
limited to 24H.
+  std::format_to(__out_it, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:02}"), 
__hms.hours().count());
   if (__modifier)
-std::format_to(__out_it, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:%H:%M}"), 
__hms);
-  else
-std::format_to(__out_it, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:%H%M}"), 
__hms);
+__sstr << _CharT(':');
+  std::format_to(__out_it, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:02}"), 
__hms.minutes().count());
 }
 
 // Helper to store the time zone information needed for formatting.
@@ -202,6 +204,12 @@ struct _LIBCPP_HIDE_FROM_ABI __time_zone {
 template 
 _LIBCPP_HIDE_FROM_ABI __time_zone __convert_to_time_zone([[maybe_unused]] 
const _Tp& __value) {
   __time_zone __re

[llvm-branch-commits] [llvm] release/18.x: [ARM] Update IsRestored for LR based on all returns (#82745) (PR #83129)

2024-03-20 Thread Florian Hahn via llvm-branch-commits

https://github.com/fhahn approved this pull request.

LGTM, would be good to back-port.

https://github.com/llvm/llvm-project/pull/83129
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] [libc++][TZDB] Adds sys_info formatter. (PR #85896)

2024-03-20 Thread Mark de Wever via llvm-branch-commits

https://github.com/mordante updated 
https://github.com/llvm/llvm-project/pull/85896

>From caa67f946d7128ebe63c859ed7aa9a03c825e81e Mon Sep 17 00:00:00 2001
From: Mark de Wever 
Date: Sun, 10 Mar 2024 17:49:39 +0100
Subject: [PATCH] [libc++][TZDB] Adds sys_info formatter.

Implements parts of:
- P0355 Extending  to Calendars and Time Zones
- P1361 Integration of chrono with text formatting
---
 libcxx/docs/Status/FormatPaper.csv|   2 +-
 libcxx/include/__chrono/convert_to_tm.h   |   5 +
 libcxx/include/__chrono/formatter.h   |  44 +-
 libcxx/include/__chrono/ostream.h |  20 +++
 libcxx/include/__chrono/sys_info.h|   6 +-
 libcxx/include/chrono |   5 +
 .../time.zone.info.sys/ostream.pass.cpp   |  71 +
 .../test/libcxx/transitive_includes/cxx23.csv |   1 -
 .../test/libcxx/transitive_includes/cxx26.csv |   1 -
 .../time/time.syn/formatter.sys_info.pass.cpp | 137 ++
 .../time.zone.info.sys/ostream.pass.cpp   |  49 +++
 11 files changed, 331 insertions(+), 10 deletions(-)
 create mode 100644 
libcxx/test/libcxx/time/time.zone/time.zone.info/time.zone.info.sys/ostream.pass.cpp
 create mode 100644 libcxx/test/std/time/time.syn/formatter.sys_info.pass.cpp
 create mode 100644 
libcxx/test/std/time/time.zone/time.zone.info/time.zone.info.sys/ostream.pass.cpp

diff --git a/libcxx/docs/Status/FormatPaper.csv 
b/libcxx/docs/Status/FormatPaper.csv
index 82da54284c7386..32166ec72da753 100644
--- a/libcxx/docs/Status/FormatPaper.csv
+++ b/libcxx/docs/Status/FormatPaper.csv
@@ -24,7 +24,7 @@ Section,Description,Dependencies,Assignee,Status,First 
released version
 `[time.syn] `_,"Formatter 
``chrono::year_month_weekday``",,Mark de Wever,|Complete|,16.0
 `[time.syn] `_,"Formatter 
``chrono::year_month_weekday_last``",,Mark de Wever,|Complete|,16.0
 `[time.syn] `_,"Formatter 
``chrono::hh_mm_ss>``",,Mark de Wever,|Complete|,17.0
-`[time.syn] `_,"Formatter ``chrono::sys_info``",A 
 implementation,Mark de Wever,,
+`[time.syn] `_,"Formatter 
``chrono::sys_info``",,Mark de Wever,|Complete|,19.0
 `[time.syn] `_,"Formatter 
``chrono::local_info``",A  implementation,Mark de Wever,,
 `[time.syn] `_,"Formatter 
``chrono::zoned_time``",A  
implementation,Mark de Wever,,
 
diff --git a/libcxx/include/__chrono/convert_to_tm.h 
b/libcxx/include/__chrono/convert_to_tm.h
index 1301cd6f1f1ada..d2c5cf922ba671 100644
--- a/libcxx/include/__chrono/convert_to_tm.h
+++ b/libcxx/include/__chrono/convert_to_tm.h
@@ -20,6 +20,7 @@
 #include <__chrono/month_weekday.h>
 #include <__chrono/monthday.h>
 #include <__chrono/statically_widen.h>
+#include <__chrono/sys_info.h>
 #include <__chrono/system_clock.h>
 #include <__chrono/time_point.h>
 #include <__chrono/weekday.h>
@@ -171,6 +172,10 @@ _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _ChronoT& 
__value) {
   if (__value.hours().count() > 
std::numeric_limits::max())
 std::__throw_format_error("Formatting hh_mm_ss, encountered an hour 
overflow");
 __result.tm_hour = __value.hours().count();
+#  if !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB)
+  } else if constexpr (same_as<_ChronoT, chrono::sys_info>) {
+// Has no time information.
+#  endif
   } else
 static_assert(sizeof(_ChronoT) == 0, "Add the missing type 
specialization");
 
diff --git a/libcxx/include/__chrono/formatter.h 
b/libcxx/include/__chrono/formatter.h
index 8b8592041a1fb9..6a9f5870458b32 100644
--- a/libcxx/include/__chrono/formatter.h
+++ b/libcxx/include/__chrono/formatter.h
@@ -24,6 +24,7 @@
 #include <__chrono/ostream.h>
 #include <__chrono/parser_std_format_spec.h>
 #include <__chrono/statically_widen.h>
+#include <__chrono/sys_info.h>
 #include <__chrono/system_clock.h>
 #include <__chrono/time_point.h>
 #include <__chrono/weekday.h>
@@ -185,10 +186,11 @@ __format_zone_offset(basic_stringstream<_CharT>& __sstr, 
chrono::seconds __offse
 
   chrono::hh_mm_ss __hms{__offset};
   std::ostreambuf_iterator<_CharT> __out_it{__sstr};
+  // Note HMS does not allow formatting hours > 23, but the offset is not 
limited to 24H.
+  std::format_to(__out_it, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:02}"), 
__hms.hours().count());
   if (__modifier)
-std::format_to(__out_it, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:%H:%M}"), 
__hms);
-  else
-std::format_to(__out_it, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:%H%M}"), 
__hms);
+__sstr << _CharT(':');
+  std::format_to(__out_it, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:02}"), 
__hms.minutes().count());
 }
 
 // Helper to store the time zone information needed for formatting.
@@ -202,6 +204,12 @@ struct _LIBCPP_HIDE_FROM_ABI __time_zone {
 template 
 _LIBCPP_HIDE_FROM_ABI __time_zone __convert_to_time_zone([[maybe_unused]] 
const _Tp& __value) {
   __time_zone __r

[llvm-branch-commits] [libcxx] [libc++][TZDB] Adds sys_info formatter. (PR #85896)

2024-03-20 Thread Mark de Wever via llvm-branch-commits

https://github.com/mordante updated 
https://github.com/llvm/llvm-project/pull/85896

>From 1c5788302b38da71881854bbee772e3ad8d58cb4 Mon Sep 17 00:00:00 2001
From: Mark de Wever 
Date: Sun, 10 Mar 2024 17:49:39 +0100
Subject: [PATCH] [libc++][TZDB] Adds sys_info formatter.

Implements parts of:
- P0355 Extending  to Calendars and Time Zones
- P1361 Integration of chrono with text formatting
---
 libcxx/docs/Status/FormatPaper.csv|   2 +-
 libcxx/include/__chrono/convert_to_tm.h   |   5 +
 libcxx/include/__chrono/formatter.h   |  44 +-
 libcxx/include/__chrono/ostream.h |  20 +++
 libcxx/include/__chrono/sys_info.h|   6 +-
 libcxx/include/chrono |   7 +-
 .../time.zone.info.sys/ostream.pass.cpp   |  74 ++
 .../test/libcxx/transitive_includes/cxx23.csv |   1 -
 .../test/libcxx/transitive_includes/cxx26.csv |   1 -
 .../time/time.syn/formatter.sys_info.pass.cpp | 137 ++
 .../time.zone.info.sys/ostream.pass.cpp   |  52 +++
 11 files changed, 338 insertions(+), 11 deletions(-)
 create mode 100644 
libcxx/test/libcxx/time/time.zone/time.zone.info/time.zone.info.sys/ostream.pass.cpp
 create mode 100644 libcxx/test/std/time/time.syn/formatter.sys_info.pass.cpp
 create mode 100644 
libcxx/test/std/time/time.zone/time.zone.info/time.zone.info.sys/ostream.pass.cpp

diff --git a/libcxx/docs/Status/FormatPaper.csv 
b/libcxx/docs/Status/FormatPaper.csv
index 82da54284c7386..32166ec72da753 100644
--- a/libcxx/docs/Status/FormatPaper.csv
+++ b/libcxx/docs/Status/FormatPaper.csv
@@ -24,7 +24,7 @@ Section,Description,Dependencies,Assignee,Status,First 
released version
 `[time.syn] `_,"Formatter 
``chrono::year_month_weekday``",,Mark de Wever,|Complete|,16.0
 `[time.syn] `_,"Formatter 
``chrono::year_month_weekday_last``",,Mark de Wever,|Complete|,16.0
 `[time.syn] `_,"Formatter 
``chrono::hh_mm_ss>``",,Mark de Wever,|Complete|,17.0
-`[time.syn] `_,"Formatter ``chrono::sys_info``",A 
 implementation,Mark de Wever,,
+`[time.syn] `_,"Formatter 
``chrono::sys_info``",,Mark de Wever,|Complete|,19.0
 `[time.syn] `_,"Formatter 
``chrono::local_info``",A  implementation,Mark de Wever,,
 `[time.syn] `_,"Formatter 
``chrono::zoned_time``",A  
implementation,Mark de Wever,,
 
diff --git a/libcxx/include/__chrono/convert_to_tm.h 
b/libcxx/include/__chrono/convert_to_tm.h
index 1301cd6f1f1ada..d2c5cf922ba671 100644
--- a/libcxx/include/__chrono/convert_to_tm.h
+++ b/libcxx/include/__chrono/convert_to_tm.h
@@ -20,6 +20,7 @@
 #include <__chrono/month_weekday.h>
 #include <__chrono/monthday.h>
 #include <__chrono/statically_widen.h>
+#include <__chrono/sys_info.h>
 #include <__chrono/system_clock.h>
 #include <__chrono/time_point.h>
 #include <__chrono/weekday.h>
@@ -171,6 +172,10 @@ _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _ChronoT& 
__value) {
   if (__value.hours().count() > 
std::numeric_limits::max())
 std::__throw_format_error("Formatting hh_mm_ss, encountered an hour 
overflow");
 __result.tm_hour = __value.hours().count();
+#  if !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB)
+  } else if constexpr (same_as<_ChronoT, chrono::sys_info>) {
+// Has no time information.
+#  endif
   } else
 static_assert(sizeof(_ChronoT) == 0, "Add the missing type 
specialization");
 
diff --git a/libcxx/include/__chrono/formatter.h 
b/libcxx/include/__chrono/formatter.h
index 8b8592041a1fb9..6a9f5870458b32 100644
--- a/libcxx/include/__chrono/formatter.h
+++ b/libcxx/include/__chrono/formatter.h
@@ -24,6 +24,7 @@
 #include <__chrono/ostream.h>
 #include <__chrono/parser_std_format_spec.h>
 #include <__chrono/statically_widen.h>
+#include <__chrono/sys_info.h>
 #include <__chrono/system_clock.h>
 #include <__chrono/time_point.h>
 #include <__chrono/weekday.h>
@@ -185,10 +186,11 @@ __format_zone_offset(basic_stringstream<_CharT>& __sstr, 
chrono::seconds __offse
 
   chrono::hh_mm_ss __hms{__offset};
   std::ostreambuf_iterator<_CharT> __out_it{__sstr};
+  // Note HMS does not allow formatting hours > 23, but the offset is not 
limited to 24H.
+  std::format_to(__out_it, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:02}"), 
__hms.hours().count());
   if (__modifier)
-std::format_to(__out_it, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:%H:%M}"), 
__hms);
-  else
-std::format_to(__out_it, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:%H%M}"), 
__hms);
+__sstr << _CharT(':');
+  std::format_to(__out_it, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:02}"), 
__hms.minutes().count());
 }
 
 // Helper to store the time zone information needed for formatting.
@@ -202,6 +204,12 @@ struct _LIBCPP_HIDE_FROM_ABI __time_zone {
 template 
 _LIBCPP_HIDE_FROM_ABI __time_zone __convert_to_time_zone([[maybe_unused]] 
const _Tp& __value) {
   __time_zone _

[llvm-branch-commits] [mlir] release/18.x: [MLIR] [Transforms] Let `transform.structured.convert_to_loops` return handles to loops (#83984) (PR #85942)

2024-03-20 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/85942
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [mlir] release/18.x: [MLIR] [Transforms] Let `transform.structured.convert_to_loops` return handles to loops (#83984) (PR #85942)

2024-03-20 Thread via llvm-branch-commits

https://github.com/llvmbot created 
https://github.com/llvm/llvm-project/pull/85942

Backport 0597644a6466ae9148b0b41cb8f95d5022e045c2 
47bc565ca7990a2de20af4030baf08ac62739aca

Requested by: @lhunloh

>From d5933a73516f3bdfc37216d52278e0ca3d42859d Mon Sep 17 00:00:00 2001
From: Congcong Cai 
Date: Tue, 5 Mar 2024 03:58:12 +0800
Subject: [PATCH 1/2] [mlir][transform] replace original op to loop ops
 (#83537)

(cherry picked from commit 0597644a6466ae9148b0b41cb8f95d5022e045c2)
---
 mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp  | 1 +
 .../TilingInterface/lower-to-loops-using-interface.mlir  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp 
b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index 140bdd1f2db361..be875297fc93ca 100644
--- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
+++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
@@ -2092,6 +2092,7 @@ DiagnosedSilenceableFailure 
transform::ConvertToLoopsOp::applyToOne(
   scf::lowerToLoopsUsingSCFForOp(rewriter, target);
   if (failed(loops))
 return emitDefaultDefiniteFailure(target);
+  rewriter.eraseOp(target);
   return DiagnosedSilenceableFailure::success();
 }
 
diff --git 
a/mlir/test/Interfaces/TilingInterface/lower-to-loops-using-interface.mlir 
b/mlir/test/Interfaces/TilingInterface/lower-to-loops-using-interface.mlir
index 7969de0d456bb6..1b2c553b25ded0 100644
--- a/mlir/test/Interfaces/TilingInterface/lower-to-loops-using-interface.mlir
+++ b/mlir/test/Interfaces/TilingInterface/lower-to-loops-using-interface.mlir
@@ -33,6 +33,7 @@ module attributes {transform.with_named_sequence} {
 //   CHECK: %[[MULF:.+]] = arith.mulf %[[LHS]], %[[RHS]]
 //   CHECK: %[[ADDF:.+]] = arith.addf %[[OUT]], %[[MULF]]
 //   CHECK: memref.store %[[ADDF]], %[[ARG2]][%[[IV0]], %[[IV1]]]
+//   CHECK-NOT:   linalg.matmul ins(%arg0, %arg1 : memref, 
memref)
 
 // -
 

>From 6db21232a2f1d47c61fb3bf5985487ee695491f3 Mon Sep 17 00:00:00 2001
From: lhunloh <8047408+lhun...@users.noreply.github.com>
Date: Wed, 6 Mar 2024 22:07:30 +
Subject: [PATCH 2/2] [MLIR] [Transforms] Let
 `transform.structured.convert_to_loops` return handles to loops (#83984)

This lets `transform.structured.convert_to_loops` return handles to the
generated loops, making this transformation more useful to use for
(transformation-)nesting purposes. This is modelled after SCFs
`transform.loop.forall_to_for` which returns handles to loops.

Introduced in commit aa2a96a24ae3a8cc04635ab6ede474c5f2665053, with a
note that they might move out of the `Linalg`-Dialect, but no reason
given for the non-return of handles. As far as I can see, this transform
always returns loops.

(cherry picked from commit 47bc565ca7990a2de20af4030baf08ac62739aca)
---
 .../Linalg/TransformOps/LinalgTransformOps.td | 22 +++---
 .../TransformOps/LinalgTransformOps.cpp   | 35 ++---
 .../lower-to-loops-using-interface.mlir   | 75 +--
 3 files changed, 101 insertions(+), 31 deletions(-)

diff --git 
a/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td 
b/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
index b139f1ef58b3a9..da7183dae75ffc 100644
--- a/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
+++ b/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
@@ -1274,33 +1274,29 @@ def ScalarizeOp : Op,
  ReportTrackingListenerFailuresOpTrait]> {
   let description = [{
 For operations that implement the `TilingInterface`, and implement
 the `generateScalarImplementation` method, lowers the operation to
-loops. This operation does not return any handles.
+loops. The return handle points to all generated loops.
+Fails if the payload ops cannot be lowered to loops.
   }];
 
   let arguments = (ins TransformHandleTypeInterface:$target);
-  let results = (outs);
+  let results = (outs TransformHandleTypeInterface:$result);
 
   let assemblyFormat = [{
-$target attr-dict `:` type($target)
-  }];
-
-  let extraClassDeclaration = [{
-::mlir::DiagnosedSilenceableFailure applyToOne(
-::mlir::transform::TransformRewriter &rewriter,
-::mlir::TilingInterface target,
-::mlir::transform::ApplyToEachResultList &results,
-::mlir::transform::TransformState &state);
+$target attr-dict `:` functional-type(operands, results)
   }];
 }
 
-
 
//===--===//
 // DecomposeInterfaceOp
 
//===--===//
diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp 
b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index be875297fc93ca..905875ae43ce8a 100644
--- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
+++ b/mlir/lib/Dialect/Linalg/TransformOps

[llvm-branch-commits] [mlir] release/18.x: [MLIR] [Transforms] Let `transform.structured.convert_to_loops` return handles to loops (#83984) (PR #85942)

2024-03-20 Thread via llvm-branch-commits

llvmbot wrote:

@hanhanW @lhunloh What do you think about merging this PR to the release branch?

https://github.com/llvm/llvm-project/pull/85942
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [mlir] release/18.x: [MLIR] [Transforms] Let `transform.structured.convert_to_loops` return handles to loops (#83984) (PR #85942)

2024-03-20 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-mlir

Author: None (llvmbot)


Changes

Backport 0597644a6466ae9148b0b41cb8f95d5022e045c2 
47bc565ca7990a2de20af4030baf08ac62739aca

Requested by: @lhunloh

---
Full diff: https://github.com/llvm/llvm-project/pull/85942.diff


3 Files Affected:

- (modified) 
mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td (+9-13) 
- (modified) mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp 
(+25-9) 
- (modified) 
mlir/test/Interfaces/TilingInterface/lower-to-loops-using-interface.mlir 
(+68-8) 


``diff
diff --git 
a/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td 
b/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
index b139f1ef58b3a9..da7183dae75ffc 100644
--- a/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
+++ b/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
@@ -1274,33 +1274,29 @@ def ScalarizeOp : Op,
  ReportTrackingListenerFailuresOpTrait]> {
   let description = [{
 For operations that implement the `TilingInterface`, and implement
 the `generateScalarImplementation` method, lowers the operation to
-loops. This operation does not return any handles.
+loops. The return handle points to all generated loops.
+Fails if the payload ops cannot be lowered to loops.
   }];
 
   let arguments = (ins TransformHandleTypeInterface:$target);
-  let results = (outs);
+  let results = (outs TransformHandleTypeInterface:$result);
 
   let assemblyFormat = [{
-$target attr-dict `:` type($target)
-  }];
-
-  let extraClassDeclaration = [{
-::mlir::DiagnosedSilenceableFailure applyToOne(
-::mlir::transform::TransformRewriter &rewriter,
-::mlir::TilingInterface target,
-::mlir::transform::ApplyToEachResultList &results,
-::mlir::transform::TransformState &state);
+$target attr-dict `:` functional-type(operands, results)
   }];
 }
 
-
 
//===--===//
 // DecomposeInterfaceOp
 
//===--===//
diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp 
b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index 140bdd1f2db361..905875ae43ce8a 100644
--- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
+++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
@@ -2083,15 +2083,31 @@ 
transform::ScalarizeOp::applyToOne(transform::TransformRewriter &rewriter,
 // ConvertToLoopsOp
 
//===--===//
 
-DiagnosedSilenceableFailure transform::ConvertToLoopsOp::applyToOne(
-transform::TransformRewriter &rewriter, TilingInterface target,
-transform::ApplyToEachResultList &results,
-transform::TransformState &state) {
-  rewriter.setInsertionPoint(target);
-  FailureOr> loops =
-  scf::lowerToLoopsUsingSCFForOp(rewriter, target);
-  if (failed(loops))
-return emitDefaultDefiniteFailure(target);
+DiagnosedSilenceableFailure
+transform::ConvertToLoopsOp::apply(transform::TransformRewriter &rewriter,
+   transform::TransformResults &results,
+   transform::TransformState &state) {
+  SmallVector loops;
+  for (Operation *target : state.getPayloadOps(getTarget())) {
+auto tilingOp = dyn_cast(*target);
+if (!target) {
+  DiagnosedSilenceableFailure diag =
+  emitSilenceableError()
+  << "expected the payload to implement TilingInterface";
+  diag.attachNote(target->getLoc()) << "payload op";
+  return diag;
+}
+rewriter.setInsertionPoint(target);
+FailureOr> generatedLoops =
+scf::lowerToLoopsUsingSCFForOp(rewriter, tilingOp);
+if (failed(generatedLoops))
+  return emitDefaultDefiniteFailure(target);
+for (scf::ForOp &loop : *generatedLoops) {
+  loops.push_back(loop.getOperation());
+}
+rewriter.eraseOp(target);
+  }
+  results.set(cast(getResult()), loops);
   return DiagnosedSilenceableFailure::success();
 }
 
diff --git 
a/mlir/test/Interfaces/TilingInterface/lower-to-loops-using-interface.mlir 
b/mlir/test/Interfaces/TilingInterface/lower-to-loops-using-interface.mlir
index 7969de0d456bb6..8cbee3cbb758b2 100644
--- a/mlir/test/Interfaces/TilingInterface/lower-to-loops-using-interface.mlir
+++ b/mlir/test/Interfaces/TilingInterface/lower-to-loops-using-interface.mlir
@@ -11,7 +11,8 @@ module attributes {transform.with_named_sequence} {
   transform.named_sequence @__transform_main(%arg1 : !transform.any_op 
{transform.readonly}) {
 %matmul = transform.structured.match ops{["linalg.matmul"]} in %arg1
   : (!transform.any_op) -> !transform.any_op
-transform.structured.convert_to_loops %matmul : !transform.any_op
+%0 = transform.structured.convert_to_loops %matmul
+  : (!transform.any_op) -> (!transform.any

[llvm-branch-commits] [mlir] release/18.x: [MLIR] [Transforms] Let `transform.structured.convert_to_loops` return handles to loops (#83984) (PR #85942)

2024-03-20 Thread via llvm-branch-commits

https://github.com/llvmbot updated 
https://github.com/llvm/llvm-project/pull/85942

>From 7cab6f18c4b16ff78edc01f36a51bb66d97e4481 Mon Sep 17 00:00:00 2001
From: Congcong Cai 
Date: Tue, 5 Mar 2024 03:58:12 +0800
Subject: [PATCH 1/2] [mlir][transform] replace original op to loop ops
 (#83537)

(cherry picked from commit 0597644a6466ae9148b0b41cb8f95d5022e045c2)
---
 mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp  | 1 +
 .../TilingInterface/lower-to-loops-using-interface.mlir  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp 
b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index 140bdd1f2db361..be875297fc93ca 100644
--- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
+++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
@@ -2092,6 +2092,7 @@ DiagnosedSilenceableFailure 
transform::ConvertToLoopsOp::applyToOne(
   scf::lowerToLoopsUsingSCFForOp(rewriter, target);
   if (failed(loops))
 return emitDefaultDefiniteFailure(target);
+  rewriter.eraseOp(target);
   return DiagnosedSilenceableFailure::success();
 }
 
diff --git 
a/mlir/test/Interfaces/TilingInterface/lower-to-loops-using-interface.mlir 
b/mlir/test/Interfaces/TilingInterface/lower-to-loops-using-interface.mlir
index 7969de0d456bb6..1b2c553b25ded0 100644
--- a/mlir/test/Interfaces/TilingInterface/lower-to-loops-using-interface.mlir
+++ b/mlir/test/Interfaces/TilingInterface/lower-to-loops-using-interface.mlir
@@ -33,6 +33,7 @@ module attributes {transform.with_named_sequence} {
 //   CHECK: %[[MULF:.+]] = arith.mulf %[[LHS]], %[[RHS]]
 //   CHECK: %[[ADDF:.+]] = arith.addf %[[OUT]], %[[MULF]]
 //   CHECK: memref.store %[[ADDF]], %[[ARG2]][%[[IV0]], %[[IV1]]]
+//   CHECK-NOT:   linalg.matmul ins(%arg0, %arg1 : memref, 
memref)
 
 // -
 

>From 4c6f7d840b7805bdb7701b1c27e968cefcd1f1fe Mon Sep 17 00:00:00 2001
From: lhunloh <8047408+lhun...@users.noreply.github.com>
Date: Wed, 6 Mar 2024 22:07:30 +
Subject: [PATCH 2/2] [MLIR] [Transforms] Let
 `transform.structured.convert_to_loops` return handles to loops (#83984)

This lets `transform.structured.convert_to_loops` return handles to the
generated loops, making this transformation more useful to use for
(transformation-)nesting purposes. This is modelled after SCFs
`transform.loop.forall_to_for` which returns handles to loops.

Introduced in commit aa2a96a24ae3a8cc04635ab6ede474c5f2665053, with a
note that they might move out of the `Linalg`-Dialect, but no reason
given for the non-return of handles. As far as I can see, this transform
always returns loops.

(cherry picked from commit 47bc565ca7990a2de20af4030baf08ac62739aca)
---
 .../Linalg/TransformOps/LinalgTransformOps.td | 22 +++---
 .../TransformOps/LinalgTransformOps.cpp   | 35 ++---
 .../lower-to-loops-using-interface.mlir   | 75 +--
 3 files changed, 101 insertions(+), 31 deletions(-)

diff --git 
a/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td 
b/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
index b139f1ef58b3a9..da7183dae75ffc 100644
--- a/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
+++ b/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
@@ -1274,33 +1274,29 @@ def ScalarizeOp : Op,
  ReportTrackingListenerFailuresOpTrait]> {
   let description = [{
 For operations that implement the `TilingInterface`, and implement
 the `generateScalarImplementation` method, lowers the operation to
-loops. This operation does not return any handles.
+loops. The return handle points to all generated loops.
+Fails if the payload ops cannot be lowered to loops.
   }];
 
   let arguments = (ins TransformHandleTypeInterface:$target);
-  let results = (outs);
+  let results = (outs TransformHandleTypeInterface:$result);
 
   let assemblyFormat = [{
-$target attr-dict `:` type($target)
-  }];
-
-  let extraClassDeclaration = [{
-::mlir::DiagnosedSilenceableFailure applyToOne(
-::mlir::transform::TransformRewriter &rewriter,
-::mlir::TilingInterface target,
-::mlir::transform::ApplyToEachResultList &results,
-::mlir::transform::TransformState &state);
+$target attr-dict `:` functional-type(operands, results)
   }];
 }
 
-
 
//===--===//
 // DecomposeInterfaceOp
 
//===--===//
diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp 
b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index be875297fc93ca..905875ae43ce8a 100644
--- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
+++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
@@ -2083,16 +2083,31 @@ 
transform::ScalarizeOp::applyToOne(transform::TransformRewriter &rew

[llvm-branch-commits] [mlir] release/18.x: [MLIR] [Transforms] Let `transform.structured.convert_to_loops` return handles to loops (#83984) (PR #85942)

2024-03-20 Thread via llvm-branch-commits

lhunloh wrote:

Also humbly pinging @qedawkins as the reviewer for the second commit. :)

https://github.com/llvm/llvm-project/pull/85942
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [openmp] 5e2b234 - Revert "[libomptarget][nextgen-plugin] Use SCRELEASE/SCACQUIRE in packet head…"

2024-03-20 Thread via llvm-branch-commits

Author: Gheorghe-Teodor Bercea
Date: 2024-03-20T11:38:03-04:00
New Revision: 5e2b2342f2eba197bb1e555c1e70710c055f7df1

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

LOG: Revert "[libomptarget][nextgen-plugin] Use SCRELEASE/SCACQUIRE in packet 
head…"

This reverts commit 927308a52bc51ae786db1bd645ad5ef5889fdb2a.

Added: 


Modified: 
libc/utils/gpu/loader/amdgpu/Loader.cpp
openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp

Removed: 




diff  --git a/libc/utils/gpu/loader/amdgpu/Loader.cpp 
b/libc/utils/gpu/loader/amdgpu/Loader.cpp
index 7fd45acfd47e97..e3911eda2bd82a 100644
--- a/libc/utils/gpu/loader/amdgpu/Loader.cpp
+++ b/libc/utils/gpu/loader/amdgpu/Loader.cpp
@@ -276,8 +276,7 @@ hsa_status_t launch_kernel(hsa_agent_t dev_agent, 
hsa_executable_t executable,
   (HSA_FENCE_SCOPE_SYSTEM << HSA_PACKET_HEADER_SCACQUIRE_FENCE_SCOPE) |
   (HSA_FENCE_SCOPE_SYSTEM << HSA_PACKET_HEADER_SCRELEASE_FENCE_SCOPE);
   uint32_t header_word = header | (setup << 16u);
-  __atomic_store_n(reinterpret_cast(packet), header_word,
-   __ATOMIC_RELEASE);
+  __atomic_store_n((uint32_t *)&packet->header, header_word, __ATOMIC_RELEASE);
   hsa_signal_store_relaxed(queue->doorbell_signal, packet_id);
 
   // Wait until the kernel has completed execution on the device. Periodically

diff  --git a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp 
b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
index c147cefe58e9b4..fce7454bf2800d 100644
--- a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
+++ b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
@@ -826,15 +826,15 @@ struct AMDGPUQueueTy {
   /// Assumes the queue lock is acquired.
   void publishKernelPacket(uint64_t PacketId, uint16_t Setup,
hsa_kernel_dispatch_packet_t *Packet) {
-uint16_t Header =
-(HSA_PACKET_TYPE_KERNEL_DISPATCH << HSA_PACKET_HEADER_TYPE) |
-(HSA_FENCE_SCOPE_SYSTEM << HSA_PACKET_HEADER_SCACQUIRE_FENCE_SCOPE) |
-(HSA_FENCE_SCOPE_SYSTEM << HSA_PACKET_HEADER_SCRELEASE_FENCE_SCOPE);
+uint32_t *PacketPtr = reinterpret_cast(Packet);
+
+uint16_t Header = HSA_PACKET_TYPE_KERNEL_DISPATCH << 
HSA_PACKET_HEADER_TYPE;
+Header |= HSA_FENCE_SCOPE_SYSTEM << HSA_PACKET_HEADER_ACQUIRE_FENCE_SCOPE;
+Header |= HSA_FENCE_SCOPE_SYSTEM << HSA_PACKET_HEADER_RELEASE_FENCE_SCOPE;
 
 // Publish the packet. Do not modify the package after this point.
 uint32_t HeaderWord = Header | (Setup << 16u);
-__atomic_store_n(reinterpret_cast(Packet), HeaderWord,
- __ATOMIC_RELEASE);
+__atomic_store_n(PacketPtr, HeaderWord, __ATOMIC_RELEASE);
 
 // Signal the doorbell about the published packet.
 hsa_signal_store_relaxed(Queue->doorbell_signal, PacketId);
@@ -845,16 +845,15 @@ struct AMDGPUQueueTy {
   /// barrier dependencies (signals) are satisfied. Assumes the queue is locked
   void publishBarrierPacket(uint64_t PacketId,
 hsa_barrier_and_packet_t *Packet) {
+uint32_t *PacketPtr = reinterpret_cast(Packet);
 uint16_t Setup = 0;
-uint16_t Header =
-(HSA_PACKET_TYPE_BARRIER_AND << HSA_PACKET_HEADER_TYPE) |
-(HSA_FENCE_SCOPE_SYSTEM << HSA_PACKET_HEADER_SCACQUIRE_FENCE_SCOPE) |
-(HSA_FENCE_SCOPE_SYSTEM << HSA_PACKET_HEADER_SCRELEASE_FENCE_SCOPE);
+uint16_t Header = HSA_PACKET_TYPE_BARRIER_AND << HSA_PACKET_HEADER_TYPE;
+Header |= HSA_FENCE_SCOPE_SYSTEM << HSA_PACKET_HEADER_ACQUIRE_FENCE_SCOPE;
+Header |= HSA_FENCE_SCOPE_SYSTEM << HSA_PACKET_HEADER_RELEASE_FENCE_SCOPE;
 
 // Publish the packet. Do not modify the package after this point.
 uint32_t HeaderWord = Header | (Setup << 16u);
-__atomic_store_n(reinterpret_cast(Packet), HeaderWord,
- __ATOMIC_RELEASE);
+__atomic_store_n(PacketPtr, HeaderWord, __ATOMIC_RELEASE);
 
 // Signal the doorbell about the published packet.
 hsa_signal_store_relaxed(Queue->doorbell_signal, PacketId);



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


[llvm-branch-commits] [libcxx] release/18.x: [libcxx] [modules] Fix relative paths with absolute LIBCXX_INSTALL_MODULES_DIR (#85756) (PR #85907)

2024-03-20 Thread via llvm-branch-commits
Martin =?utf-8?q?Storsjö?= 
Message-ID:
In-Reply-To: 


https://github.com/llvmbot updated 
https://github.com/llvm/llvm-project/pull/85907

>From 66b7f2d14b941962ccba83662073afa41c6c08f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= 
Date: Wed, 20 Mar 2024 10:45:43 +0200
Subject: [PATCH 1/2] [libcxx] [modules] Fix relative paths with absolute
 LIBCXX_INSTALL_MODULES_DIR (#85756)

In other contexts, install directories such as
LIBCXX_INSTALL_LIBRARY_DIR and LIBCXX_INSTALL_MODULES_DIR can be
specified either as a relative path, relative to CMAKE_INSTALL_PREFIX,
or as an absolute path.

When calculating the relative path between the two, account for the fact
that LIBCXX_INSTALL_MODULES_DIR and LIBCXX_INSTALL_LIBRARY_DIR can be
absolute paths too.

(cherry picked from commit 272d1b44efdedb68c194970a610f0ca1b7b769c5)
---
 libcxx/modules/CMakeLists.txt | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libcxx/modules/CMakeLists.txt b/libcxx/modules/CMakeLists.txt
index 0dea8cfca94ac3..8dd1b51aac2f72 100644
--- a/libcxx/modules/CMakeLists.txt
+++ b/libcxx/modules/CMakeLists.txt
@@ -206,9 +206,15 @@ add_custom_target(generate-cxx-modules
 # Configure the modules manifest.
 # Use the relative path between the installation and the module in the json
 # file. This allows moving the entire installation to a different location.
+cmake_path(ABSOLUTE_PATH LIBCXX_INSTALL_LIBRARY_DIR
+  BASE_DIRECTORY ${CMAKE_INSTALL_PREFIX}
+  OUTPUT_VARIABLE ABS_LIBRARY_DIR)
+cmake_path(ABSOLUTE_PATH LIBCXX_INSTALL_MODULES_DIR
+  BASE_DIRECTORY ${CMAKE_INSTALL_PREFIX}
+  OUTPUT_VARIABLE ABS_MODULES_DIR)
 file(RELATIVE_PATH LIBCXX_MODULE_RELATIVE_PATH
-  ${CMAKE_INSTALL_PREFIX}/${LIBCXX_INSTALL_LIBRARY_DIR}
-  ${CMAKE_INSTALL_PREFIX}/${LIBCXX_INSTALL_MODULES_DIR})
+  ${ABS_LIBRARY_DIR}
+  ${ABS_MODULES_DIR})
 configure_file(
   "modules.json.in"
   "${LIBCXX_LIBRARY_DIR}/libc++.modules.json"

>From 059dab03505d98d34e9d922fd76b3ce3b7b568a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= 
Date: Wed, 20 Mar 2024 17:48:48 +0200
Subject: [PATCH 2/2] [libcxx] [cmake] Fix cmake_path(ABSOLUTE_PATH) for empty
 CMAKE_INSTALL_PREFIX

This should hopefully fix the issue brought up at
https://github.com/llvm/llvm-project/pull/85756#issuecomment-2009852291.

(cherry picked from commit d209d1340b99d4fbd325dffb5e13b757ab8264ea)
---
 libcxx/modules/CMakeLists.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcxx/modules/CMakeLists.txt b/libcxx/modules/CMakeLists.txt
index 8dd1b51aac2f72..6c917200d6f318 100644
--- a/libcxx/modules/CMakeLists.txt
+++ b/libcxx/modules/CMakeLists.txt
@@ -207,10 +207,10 @@ add_custom_target(generate-cxx-modules
 # Use the relative path between the installation and the module in the json
 # file. This allows moving the entire installation to a different location.
 cmake_path(ABSOLUTE_PATH LIBCXX_INSTALL_LIBRARY_DIR
-  BASE_DIRECTORY ${CMAKE_INSTALL_PREFIX}
+  BASE_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
   OUTPUT_VARIABLE ABS_LIBRARY_DIR)
 cmake_path(ABSOLUTE_PATH LIBCXX_INSTALL_MODULES_DIR
-  BASE_DIRECTORY ${CMAKE_INSTALL_PREFIX}
+  BASE_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
   OUTPUT_VARIABLE ABS_MODULES_DIR)
 file(RELATIVE_PATH LIBCXX_MODULE_RELATIVE_PATH
   ${ABS_LIBRARY_DIR}

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


[llvm-branch-commits] [libcxx] release/18.x: [libcxx] [modules] Fix relative paths with absolute LIBCXX_INSTALL_MODULES_DIR (#85756) (PR #85907)

2024-03-20 Thread Martin Storsjö via llvm-branch-commits

mstorsjo wrote:

Closing this backport PR, the original commits had to be reverted (in 
407937036fa7640f61f225474b1ea6623a40dbdd).

https://github.com/llvm/llvm-project/pull/85907
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] release/18.x: [libcxx] [modules] Fix relative paths with absolute LIBCXX_INSTALL_MODULES_DIR (#85756) (PR #85907)

2024-03-20 Thread Martin Storsjö via llvm-branch-commits

https://github.com/mstorsjo closed 
https://github.com/llvm/llvm-project/pull/85907
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [flang][OpenMP] Refactor nested default clause tests (PR #85978)

2024-03-20 Thread Leandro Lupori via llvm-branch-commits

https://github.com/luporl created 
https://github.com/llvm/llvm-project/pull/85978

Split nested default clause tests into multiple subroutines, to
make it easier to find failures. While here, fix indentation of
the modified lines.


>From 39b3e13e42cd9416101ddb7b5cbb4137e5bd66f3 Mon Sep 17 00:00:00 2001
From: Leandro Lupori 
Date: Wed, 20 Mar 2024 14:16:10 -0300
Subject: [PATCH] [flang][OpenMP] Refactor nested default clause tests

Split nested default clause tests into multiple subroutines, to
make it easier to find failures. While here, fix indentation of
the modified lines.
---
 .../Lower/OpenMP/default-clause-byref.f90 |   6 +-
 flang/test/Lower/OpenMP/default-clause.f90| 273 ++
 2 files changed, 155 insertions(+), 124 deletions(-)

diff --git a/flang/test/Lower/OpenMP/default-clause-byref.f90 
b/flang/test/Lower/OpenMP/default-clause-byref.f90
index 5d9538e53069d6..86da354910a8ef 100644
--- a/flang/test/Lower/OpenMP/default-clause-byref.f90
+++ b/flang/test/Lower/OpenMP/default-clause-byref.f90
@@ -226,8 +226,6 @@ subroutine nested_default_clause_tests
 !CHECK: %[[PRIVATE_Y_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_Y]] {uniq_name = 
"_QFnested_default_clause_testsEy"} : (!fir.ref) -> (!fir.ref, 
!fir.ref)
 !CHECK: %[[PRIVATE_Z:.*]] = fir.alloca i32 {bindc_name = "z", pinned, 
uniq_name = "_QFnested_default_clause_testsEz"}
 !CHECK: %[[PRIVATE_Z_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_Z]] {uniq_name = 
"_QFnested_default_clause_testsEz"} : (!fir.ref) -> (!fir.ref, 
!fir.ref)
-!CHECK: %[[PRIVATE_W:.*]] = fir.alloca i32 {bindc_name = "w", pinned, 
uniq_name = "_QFnested_default_clause_testsEw"}
-!CHECK: %[[PRIVATE_W_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_W]] {uniq_name = 
"_QFnested_default_clause_testsEw"} : (!fir.ref) -> (!fir.ref, 
!fir.ref)
 !CHECK: omp.parallel {
 !CHECK: %[[PRIVATE_INNER_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, 
uniq_name = "_QFnested_default_clause_testsEx"}
 !CHECK: %[[PRIVATE_INNER_X_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_INNER_X]] 
{uniq_name = "_QFnested_default_clause_testsEx"} : (!fir.ref) -> 
(!fir.ref, !fir.ref)
@@ -242,12 +240,14 @@ subroutine nested_default_clause_tests
 !CHECK: omp.terminator
 !CHECK: }
 !CHECK: omp.parallel {
+!CHECK: %[[PRIVATE_INNER_Z:.*]] = fir.alloca i32 {bindc_name = "z", pinned, 
uniq_name = "_QFnested_default_clause_testsEz"}
+!CHECK: %[[PRIVATE_INNER_Z_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_INNER_Z]] 
{uniq_name = "_QFnested_default_clause_testsEz"} : (!fir.ref) -> 
(!fir.ref, !fir.ref)
 !CHECK: %[[PRIVATE_INNER_W:.*]] = fir.alloca i32 {bindc_name = "w", pinned, 
uniq_name = "_QFnested_default_clause_testsEw"}
 !CHECK: %[[PRIVATE_INNER_W_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_INNER_W]] 
{uniq_name = "_QFnested_default_clause_testsEw"} : (!fir.ref) -> 
(!fir.ref, !fir.ref)
 !CHECK: %[[PRIVATE_INNER_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, 
uniq_name = "_QFnested_default_clause_testsEx"}
 !CHECK: %[[PRIVATE_INNER_X_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_INNER_X]] 
{uniq_name = "_QFnested_default_clause_testsEx"} : (!fir.ref) -> 
(!fir.ref, !fir.ref)
 !CHECK: %[[TEMP_1:.*]] = fir.load %[[PRIVATE_INNER_X_DECL]]#0 : !fir.ref
-!CHECK: %[[TEMP_2:.*]] = fir.load %[[PRIVATE_Z_DECL]]#0 : !fir.ref
+!CHECK: %[[TEMP_2:.*]] = fir.load %[[PRIVATE_INNER_Z_DECL]]#0 : !fir.ref
 !CHECK: %[[RESULT:.*]] = arith.addi %{{.*}}, %{{.*}} : i32
 !CHECK: hlfir.assign %[[RESULT]] to %[[PRIVATE_INNER_W_DECL]]#0 : i32, 
!fir.ref
 !CHECK: omp.terminator
diff --git a/flang/test/Lower/OpenMP/default-clause.f90 
b/flang/test/Lower/OpenMP/default-clause.f90
index 6f949785876f66..f69b5e607d3561 100644
--- a/flang/test/Lower/OpenMP/default-clause.f90
+++ b/flang/test/Lower/OpenMP/default-clause.f90
@@ -148,34 +148,33 @@ program default_clause_lowering
 
 end program default_clause_lowering
 
-subroutine nested_default_clause_tests
-integer :: x, y, z, w, k, a
-!CHECK: %[[K:.*]] = fir.alloca i32 {bindc_name = "k", uniq_name = 
"_QFnested_default_clause_testsEk"}
-!CHECK: %[[K_DECL:.*]]:2 = hlfir.declare %[[K]] {uniq_name = 
"_QFnested_default_clause_testsEk"} : (!fir.ref) -> (!fir.ref, 
!fir.ref)
-!CHECK: %[[W:.*]] = fir.alloca i32 {bindc_name = "w", uniq_name = 
"_QFnested_default_clause_testsEw"}
-!CHECK: %[[W_DECL:.*]]:2 = hlfir.declare %[[W]] {uniq_name = 
"_QFnested_default_clause_testsEw"} : (!fir.ref) -> (!fir.ref, 
!fir.ref)
-!CHECK: %[[X:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = 
"_QFnested_default_clause_testsEx"}
-!CHECK: %[[X_DECL:.*]]:2 = hlfir.declare %[[X]] {uniq_name = 
"_QFnested_default_clause_testsEx"} : (!fir.ref) -> (!fir.ref, 
!fir.ref)
-!CHECK: %[[Y:.*]] = fir.alloca i32 {bindc_name = "y", uniq_name = 
"_QFnested_default_clause_testsEy"}
-!CHECK: %[[Y_DECL:.*]]:2 = hlfir.declare %[[Y]] {uniq_name = 
"_QFnested_default_clause_testsEy"} : (!fir.ref) -> (!fir.ref, 
!fir.ref)
-!CHECK: %[[Z:.*]] = fir.alloca i32 {bindc_name = "z", uniq_name = 
"_QFnested_default_clause_testsEz"}
-!CHECK: %[[Z_DECL:.*]]:2 = hl

[llvm-branch-commits] [flang] [flang][OpenMP] Refactor nested default clause tests (PR #85978)

2024-03-20 Thread via llvm-branch-commits

llvmbot wrote:



@llvm/pr-subscribers-flang-fir-hlfir

@llvm/pr-subscribers-flang-openmp

Author: Leandro Lupori (luporl)


Changes

Split nested default clause tests into multiple subroutines, to
make it easier to find failures. While here, fix indentation of
the modified lines.


---

Patch is 30.61 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/85978.diff


2 Files Affected:

- (modified) flang/test/Lower/OpenMP/default-clause-byref.f90 (+3-3) 
- (modified) flang/test/Lower/OpenMP/default-clause.f90 (+152-121) 


``diff
diff --git a/flang/test/Lower/OpenMP/default-clause-byref.f90 
b/flang/test/Lower/OpenMP/default-clause-byref.f90
index 5d9538e53069d6..86da354910a8ef 100644
--- a/flang/test/Lower/OpenMP/default-clause-byref.f90
+++ b/flang/test/Lower/OpenMP/default-clause-byref.f90
@@ -226,8 +226,6 @@ subroutine nested_default_clause_tests
 !CHECK: %[[PRIVATE_Y_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_Y]] {uniq_name = 
"_QFnested_default_clause_testsEy"} : (!fir.ref) -> (!fir.ref, 
!fir.ref)
 !CHECK: %[[PRIVATE_Z:.*]] = fir.alloca i32 {bindc_name = "z", pinned, 
uniq_name = "_QFnested_default_clause_testsEz"}
 !CHECK: %[[PRIVATE_Z_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_Z]] {uniq_name = 
"_QFnested_default_clause_testsEz"} : (!fir.ref) -> (!fir.ref, 
!fir.ref)
-!CHECK: %[[PRIVATE_W:.*]] = fir.alloca i32 {bindc_name = "w", pinned, 
uniq_name = "_QFnested_default_clause_testsEw"}
-!CHECK: %[[PRIVATE_W_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_W]] {uniq_name = 
"_QFnested_default_clause_testsEw"} : (!fir.ref) -> (!fir.ref, 
!fir.ref)
 !CHECK: omp.parallel {
 !CHECK: %[[PRIVATE_INNER_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, 
uniq_name = "_QFnested_default_clause_testsEx"}
 !CHECK: %[[PRIVATE_INNER_X_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_INNER_X]] 
{uniq_name = "_QFnested_default_clause_testsEx"} : (!fir.ref) -> 
(!fir.ref, !fir.ref)
@@ -242,12 +240,14 @@ subroutine nested_default_clause_tests
 !CHECK: omp.terminator
 !CHECK: }
 !CHECK: omp.parallel {
+!CHECK: %[[PRIVATE_INNER_Z:.*]] = fir.alloca i32 {bindc_name = "z", pinned, 
uniq_name = "_QFnested_default_clause_testsEz"}
+!CHECK: %[[PRIVATE_INNER_Z_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_INNER_Z]] 
{uniq_name = "_QFnested_default_clause_testsEz"} : (!fir.ref) -> 
(!fir.ref, !fir.ref)
 !CHECK: %[[PRIVATE_INNER_W:.*]] = fir.alloca i32 {bindc_name = "w", pinned, 
uniq_name = "_QFnested_default_clause_testsEw"}
 !CHECK: %[[PRIVATE_INNER_W_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_INNER_W]] 
{uniq_name = "_QFnested_default_clause_testsEw"} : (!fir.ref) -> 
(!fir.ref, !fir.ref)
 !CHECK: %[[PRIVATE_INNER_X:.*]] = fir.alloca i32 {bindc_name = "x", pinned, 
uniq_name = "_QFnested_default_clause_testsEx"}
 !CHECK: %[[PRIVATE_INNER_X_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_INNER_X]] 
{uniq_name = "_QFnested_default_clause_testsEx"} : (!fir.ref) -> 
(!fir.ref, !fir.ref)
 !CHECK: %[[TEMP_1:.*]] = fir.load %[[PRIVATE_INNER_X_DECL]]#0 : !fir.ref
-!CHECK: %[[TEMP_2:.*]] = fir.load %[[PRIVATE_Z_DECL]]#0 : !fir.ref
+!CHECK: %[[TEMP_2:.*]] = fir.load %[[PRIVATE_INNER_Z_DECL]]#0 : !fir.ref
 !CHECK: %[[RESULT:.*]] = arith.addi %{{.*}}, %{{.*}} : i32
 !CHECK: hlfir.assign %[[RESULT]] to %[[PRIVATE_INNER_W_DECL]]#0 : i32, 
!fir.ref
 !CHECK: omp.terminator
diff --git a/flang/test/Lower/OpenMP/default-clause.f90 
b/flang/test/Lower/OpenMP/default-clause.f90
index 6f949785876f66..f69b5e607d3561 100644
--- a/flang/test/Lower/OpenMP/default-clause.f90
+++ b/flang/test/Lower/OpenMP/default-clause.f90
@@ -148,34 +148,33 @@ program default_clause_lowering
 
 end program default_clause_lowering
 
-subroutine nested_default_clause_tests
-integer :: x, y, z, w, k, a
-!CHECK: %[[K:.*]] = fir.alloca i32 {bindc_name = "k", uniq_name = 
"_QFnested_default_clause_testsEk"}
-!CHECK: %[[K_DECL:.*]]:2 = hlfir.declare %[[K]] {uniq_name = 
"_QFnested_default_clause_testsEk"} : (!fir.ref) -> (!fir.ref, 
!fir.ref)
-!CHECK: %[[W:.*]] = fir.alloca i32 {bindc_name = "w", uniq_name = 
"_QFnested_default_clause_testsEw"}
-!CHECK: %[[W_DECL:.*]]:2 = hlfir.declare %[[W]] {uniq_name = 
"_QFnested_default_clause_testsEw"} : (!fir.ref) -> (!fir.ref, 
!fir.ref)
-!CHECK: %[[X:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = 
"_QFnested_default_clause_testsEx"}
-!CHECK: %[[X_DECL:.*]]:2 = hlfir.declare %[[X]] {uniq_name = 
"_QFnested_default_clause_testsEx"} : (!fir.ref) -> (!fir.ref, 
!fir.ref)
-!CHECK: %[[Y:.*]] = fir.alloca i32 {bindc_name = "y", uniq_name = 
"_QFnested_default_clause_testsEy"}
-!CHECK: %[[Y_DECL:.*]]:2 = hlfir.declare %[[Y]] {uniq_name = 
"_QFnested_default_clause_testsEy"} : (!fir.ref) -> (!fir.ref, 
!fir.ref)
-!CHECK: %[[Z:.*]] = fir.alloca i32 {bindc_name = "z", uniq_name = 
"_QFnested_default_clause_testsEz"}
-!CHECK: %[[Z_DECL:.*]]:2 = hlfir.declare %[[Z]] {uniq_name = 
"_QFnested_default_clause_testsEz"} : (!fir.ref) -> (!fir.ref, 
!fir.ref)
+!CHECK-LABEL: func @_QPnested_default_clause_test1
+!CHECK: %[[K:.*]] = fir.alloc

[llvm-branch-commits] [flang] [flang][OpenMP] Refactor nested default clause tests (PR #85978)

2024-03-20 Thread Leandro Lupori via llvm-branch-commits

luporl wrote:

This PR depends on https://github.com/llvm/llvm-project/pull/72510.

https://github.com/llvm/llvm-project/pull/85978
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [flang][OpenMP] Support tasks' implicit firstprivate DSA (PR #85989)

2024-03-20 Thread Leandro Lupori via llvm-branch-commits

https://github.com/luporl created 
https://github.com/llvm/llvm-project/pull/85989

Handle implicit firstprivate DSAs on task generating constructs.

Fixes https://github.com/llvm/llvm-project/issues/64480


>From 94301e00239b789cf90d5291b1d733f0f2baab6c Mon Sep 17 00:00:00 2001
From: Leandro Lupori 
Date: Mon, 11 Mar 2024 16:47:47 -0300
Subject: [PATCH] [flang][OpenMP] Support tasks' implicit firstprivate DSA

Handle implicit firstprivate DSAs on task generating constructs.

Fixes https://github.com/llvm/llvm-project/issues/64480
---
 flang/include/flang/Semantics/symbol.h|   3 +-
 .../lib/Lower/OpenMP/DataSharingProcessor.cpp | 114 +++-
 flang/lib/Lower/OpenMP/DataSharingProcessor.h |  11 +-
 flang/lib/Semantics/resolve-directives.cpp|  85 +-
 .../test/Lower/OpenMP/FIR/default-clause.f90  |   3 +-
 .../Lower/OpenMP/default-clause-byref.f90 |   4 +-
 flang/test/Lower/OpenMP/default-clause.f90|   4 +-
 flang/test/Lower/OpenMP/implicit-dsa.f90  | 275 ++
 flang/test/Semantics/OpenMP/implicit-dsa.f90  | 158 ++
 flang/test/Semantics/OpenMP/symbol08.f90  |   2 +-
 10 files changed, 617 insertions(+), 42 deletions(-)
 create mode 100644 flang/test/Lower/OpenMP/implicit-dsa.f90
 create mode 100644 flang/test/Semantics/OpenMP/implicit-dsa.f90

diff --git a/flang/include/flang/Semantics/symbol.h 
b/flang/include/flang/Semantics/symbol.h
index 67153ffb3be9f6..34ac674614a695 100644
--- a/flang/include/flang/Semantics/symbol.h
+++ b/flang/include/flang/Semantics/symbol.h
@@ -740,7 +740,8 @@ class Symbol {
   OmpCommonBlock, OmpReduction, OmpAligned, OmpNontemporal, OmpAllocate,
   OmpDeclarativeAllocateDirective, OmpExecutableAllocateDirective,
   OmpDeclareSimd, OmpDeclareTarget, OmpThreadprivate, OmpDeclareReduction,
-  OmpFlushed, OmpCriticalLock, OmpIfSpecified, OmpNone, OmpPreDetermined);
+  OmpFlushed, OmpCriticalLock, OmpIfSpecified, OmpNone, OmpPreDetermined,
+  OmpImplicit);
   using Flags = common::EnumSet;
 
   const Scope &owner() const { return *owner_; }
diff --git a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp 
b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
index 90c7e46dd183e3..792b3341ef03cb 100644
--- a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
@@ -26,8 +26,10 @@ namespace omp {
 void DataSharingProcessor::processStep1() {
   collectSymbolsForPrivatization();
   collectDefaultSymbols();
+  collectImplicitSymbols();
   privatize();
   defaultPrivatize();
+  implicitPrivatize();
   insertBarrier();
 }
 
@@ -268,16 +270,94 @@ void 
DataSharingProcessor::insertLastPrivateCompare(mlir::Operation *op) {
   firOpBuilder.restoreInsertionPoint(localInsPt);
 }
 
+static const Fortran::parser::CharBlock *
+getSource(const Fortran::semantics::SemanticsContext &semaCtx,
+  const Fortran::lower::pft::Evaluation &eval) {
+  const Fortran::parser::CharBlock *source = nullptr;
+
+  auto ompConsVisit = [&](const Fortran::parser::OpenMPConstruct &x) {
+std::visit(Fortran::common::visitors{
+   [&](const Fortran::parser::OpenMPSectionsConstruct &x) {
+ source = &std::get<0>(x.t).source;
+   },
+   [&](const Fortran::parser::OpenMPLoopConstruct &x) {
+ source = &std::get<0>(x.t).source;
+   },
+   [&](const Fortran::parser::OpenMPBlockConstruct &x) {
+ source = &std::get<0>(x.t).source;
+   },
+   [&](const Fortran::parser::OpenMPCriticalConstruct &x) {
+ source = &std::get<0>(x.t).source;
+   },
+   [&](const Fortran::parser::OpenMPAtomicConstruct &x) {
+ std::visit([&](const auto &x) { source = &x.source; },
+x.u);
+   },
+   [&](const auto &x) { source = &x.source; },
+   },
+   x.u);
+  };
+
+  eval.visit(Fortran::common::visitors{
+  [&](const Fortran::parser::OpenMPConstruct &x) { ompConsVisit(x); },
+  [&](const Fortran::parser::OpenMPDeclarativeConstruct &x) {
+source = &x.source;
+  },
+  [&](const Fortran::parser::OmpEndLoopDirective &x) {
+source = &x.source;
+  },
+  [&](const auto &x) {},
+  });
+
+  return source;
+}
+
 void DataSharingProcessor::collectSymbols(
-Fortran::semantics::Symbol::Flag flag) {
-  converter.collectSymbolSet(eval, defaultSymbols, flag,
+Fortran::semantics::Symbol::Flag flag,
+llvm::SetVector &symbols) {
+  // Collect all scopes associated with 'eval'.
+  llvm::SetVector clauseScopes;
+  std::function collectScopes =
+  [&](const Fortran::semantics::Scope *scope) {
+clauseScopes.insert(scope);
+for (const Fortran::semantics::Scope &child : scope->children())
+  collectScopes(&child);
+  };
+  const Fortran::parser::

[llvm-branch-commits] [flang] [flang][OpenMP] Support tasks' implicit firstprivate DSA (PR #85989)

2024-03-20 Thread via llvm-branch-commits

llvmbot wrote:



@llvm/pr-subscribers-flang-semantics

@llvm/pr-subscribers-flang-openmp

Author: Leandro Lupori (luporl)


Changes

Handle implicit firstprivate DSAs on task generating constructs.

Fixes https://github.com/llvm/llvm-project/issues/64480


---

Patch is 42.19 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/85989.diff


10 Files Affected:

- (modified) flang/include/flang/Semantics/symbol.h (+2-1) 
- (modified) flang/lib/Lower/OpenMP/DataSharingProcessor.cpp (+101-13) 
- (modified) flang/lib/Lower/OpenMP/DataSharingProcessor.h (+8-3) 
- (modified) flang/lib/Semantics/resolve-directives.cpp (+69-16) 
- (modified) flang/test/Lower/OpenMP/FIR/default-clause.f90 (+1-2) 
- (modified) flang/test/Lower/OpenMP/default-clause-byref.f90 (+1-3) 
- (modified) flang/test/Lower/OpenMP/default-clause.f90 (+1-3) 
- (added) flang/test/Lower/OpenMP/implicit-dsa.f90 (+275) 
- (added) flang/test/Semantics/OpenMP/implicit-dsa.f90 (+158) 
- (modified) flang/test/Semantics/OpenMP/symbol08.f90 (+1-1) 


``diff
diff --git a/flang/include/flang/Semantics/symbol.h 
b/flang/include/flang/Semantics/symbol.h
index 67153ffb3be9f6..34ac674614a695 100644
--- a/flang/include/flang/Semantics/symbol.h
+++ b/flang/include/flang/Semantics/symbol.h
@@ -740,7 +740,8 @@ class Symbol {
   OmpCommonBlock, OmpReduction, OmpAligned, OmpNontemporal, OmpAllocate,
   OmpDeclarativeAllocateDirective, OmpExecutableAllocateDirective,
   OmpDeclareSimd, OmpDeclareTarget, OmpThreadprivate, OmpDeclareReduction,
-  OmpFlushed, OmpCriticalLock, OmpIfSpecified, OmpNone, OmpPreDetermined);
+  OmpFlushed, OmpCriticalLock, OmpIfSpecified, OmpNone, OmpPreDetermined,
+  OmpImplicit);
   using Flags = common::EnumSet;
 
   const Scope &owner() const { return *owner_; }
diff --git a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp 
b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
index 90c7e46dd183e3..792b3341ef03cb 100644
--- a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
@@ -26,8 +26,10 @@ namespace omp {
 void DataSharingProcessor::processStep1() {
   collectSymbolsForPrivatization();
   collectDefaultSymbols();
+  collectImplicitSymbols();
   privatize();
   defaultPrivatize();
+  implicitPrivatize();
   insertBarrier();
 }
 
@@ -268,16 +270,94 @@ void 
DataSharingProcessor::insertLastPrivateCompare(mlir::Operation *op) {
   firOpBuilder.restoreInsertionPoint(localInsPt);
 }
 
+static const Fortran::parser::CharBlock *
+getSource(const Fortran::semantics::SemanticsContext &semaCtx,
+  const Fortran::lower::pft::Evaluation &eval) {
+  const Fortran::parser::CharBlock *source = nullptr;
+
+  auto ompConsVisit = [&](const Fortran::parser::OpenMPConstruct &x) {
+std::visit(Fortran::common::visitors{
+   [&](const Fortran::parser::OpenMPSectionsConstruct &x) {
+ source = &std::get<0>(x.t).source;
+   },
+   [&](const Fortran::parser::OpenMPLoopConstruct &x) {
+ source = &std::get<0>(x.t).source;
+   },
+   [&](const Fortran::parser::OpenMPBlockConstruct &x) {
+ source = &std::get<0>(x.t).source;
+   },
+   [&](const Fortran::parser::OpenMPCriticalConstruct &x) {
+ source = &std::get<0>(x.t).source;
+   },
+   [&](const Fortran::parser::OpenMPAtomicConstruct &x) {
+ std::visit([&](const auto &x) { source = &x.source; },
+x.u);
+   },
+   [&](const auto &x) { source = &x.source; },
+   },
+   x.u);
+  };
+
+  eval.visit(Fortran::common::visitors{
+  [&](const Fortran::parser::OpenMPConstruct &x) { ompConsVisit(x); },
+  [&](const Fortran::parser::OpenMPDeclarativeConstruct &x) {
+source = &x.source;
+  },
+  [&](const Fortran::parser::OmpEndLoopDirective &x) {
+source = &x.source;
+  },
+  [&](const auto &x) {},
+  });
+
+  return source;
+}
+
 void DataSharingProcessor::collectSymbols(
-Fortran::semantics::Symbol::Flag flag) {
-  converter.collectSymbolSet(eval, defaultSymbols, flag,
+Fortran::semantics::Symbol::Flag flag,
+llvm::SetVector &symbols) {
+  // Collect all scopes associated with 'eval'.
+  llvm::SetVector clauseScopes;
+  std::function collectScopes =
+  [&](const Fortran::semantics::Scope *scope) {
+clauseScopes.insert(scope);
+for (const Fortran::semantics::Scope &child : scope->children())
+  collectScopes(&child);
+  };
+  const Fortran::parser::CharBlock *source =
+  clauses.empty() ? getSource(semaCtx, eval) : &clauses.front().source;
+  const Fortran::semantics::Scope *curScope = nullptr;
+  if (source && !source->empty()) {
+curScope = &semaCtx.FindScope(*source);
+colle

[llvm-branch-commits] [lld] [lld] Fix handling of RISCV TLSDESC relocations (PR #85817)

2024-03-20 Thread Paul Kirth via llvm-branch-commits

https://github.com/ilovepi updated 
https://github.com/llvm/llvm-project/pull/85817

>From 123c0bdd085169ce7d63c96fc3c62cf6c0bc6d45 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Tue, 19 Mar 2024 16:50:05 +
Subject: [PATCH] Remove unrelated whitespace change

Created using spr 1.3.4
---
 lld/ELF/Relocations.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 241a5b82d35f4a..0301041ed48ecc 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -1280,6 +1280,7 @@ static unsigned handleTlsRelocation(RelType type, Symbol 
&sym,
   if (config->emachine == EM_MIPS)
 return handleMipsTlsRelocation(type, sym, c, offset, addend, expr);
   bool isRISCV = config->emachine == EM_RISCV;
+
   if (oneof(expr) &&
   config->shared) {

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


[llvm-branch-commits] [lld] [lld] Fix handling of RISCV TLSDESC relocations (PR #85817)

2024-03-20 Thread Paul Kirth via llvm-branch-commits

https://github.com/ilovepi updated 
https://github.com/llvm/llvm-project/pull/85817

>From 123c0bdd085169ce7d63c96fc3c62cf6c0bc6d45 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Tue, 19 Mar 2024 16:50:05 +
Subject: [PATCH] Remove unrelated whitespace change

Created using spr 1.3.4
---
 lld/ELF/Relocations.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 241a5b82d35f4a..0301041ed48ecc 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -1280,6 +1280,7 @@ static unsigned handleTlsRelocation(RelType type, Symbol 
&sym,
   if (config->emachine == EM_MIPS)
 return handleMipsTlsRelocation(type, sym, c, offset, addend, expr);
   bool isRISCV = config->emachine == EM_RISCV;
+
   if (oneof(expr) &&
   config->shared) {

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


[llvm-branch-commits] [lld] [lld] Fix handling of RISCV TLSDESC relocations (PR #85817)

2024-03-20 Thread Paul Kirth via llvm-branch-commits

https://github.com/ilovepi updated 
https://github.com/llvm/llvm-project/pull/85817

>From 123c0bdd085169ce7d63c96fc3c62cf6c0bc6d45 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Tue, 19 Mar 2024 16:50:05 +
Subject: [PATCH] Remove unrelated whitespace change

Created using spr 1.3.4
---
 lld/ELF/Relocations.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 241a5b82d35f4a..0301041ed48ecc 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -1280,6 +1280,7 @@ static unsigned handleTlsRelocation(RelType type, Symbol 
&sym,
   if (config->emachine == EM_MIPS)
 return handleMipsTlsRelocation(type, sym, c, offset, addend, expr);
   bool isRISCV = config->emachine == EM_RISCV;
+
   if (oneof(expr) &&
   config->shared) {

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


[llvm-branch-commits] [BOLT][NFC] Simplify YAMLProfileWriter::convert (PR #82129)

2024-03-20 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/82129
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [BOLT][NFC] Expose YAMLProfileWriter::convert function (PR #76909)

2024-03-20 Thread Davide Italiano via llvm-branch-commits

https://github.com/dcci approved this pull request.


https://github.com/llvm/llvm-project/pull/76909
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [BOLT] Write and parse BF/BB hashes in BAT (PR #76907)

2024-03-20 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/76907


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


[llvm-branch-commits] [BOLT] Write and parse BF/BB hashes in BAT (PR #76907)

2024-03-20 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/76907


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


[llvm-branch-commits] [BOLT] Write and parse BF/BB hashes in BAT (PR #76907)

2024-03-20 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov ready_for_review 
https://github.com/llvm/llvm-project/pull/76907
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [BOLT] Write and parse BF/BB hashes in BAT (PR #76907)

2024-03-20 Thread Rafael Auler via llvm-branch-commits

https://github.com/rafaelauler approved this pull request.


https://github.com/llvm/llvm-project/pull/76907
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] release/17.x: [CompilerRT][ASan] Add new substitutions for tests while using lto to (#78523) (PR #86026)

2024-03-20 Thread via llvm-branch-commits

https://github.com/llvmbot created 
https://github.com/llvm/llvm-project/pull/86026

Backport 911289a

Requested by: @usama54321

>From 0a386241fa51a85618ba3a23b1d80d97efbeb319 Mon Sep 17 00:00:00 2001
From: Usama Hameed 
Date: Thu, 18 Jan 2024 11:13:56 -0800
Subject: [PATCH] [CompilerRT][ASan] Add new substitutions for tests while
 using lto to (#78523)

explicitly pass libLTO path. This fixes a failure in swift-ci where
libLTO was being picked from the system instead which was an older
version and caused issues.

rdar://117474861
(cherry picked from commit 911289a62be068e56a934e069e8e03112a804542)
---
 compiler-rt/test/asan/TestCases/Darwin/odr-lto.cpp |  2 +-
 compiler-rt/test/asan/lit.cfg.py   | 14 --
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/compiler-rt/test/asan/TestCases/Darwin/odr-lto.cpp 
b/compiler-rt/test/asan/TestCases/Darwin/odr-lto.cpp
index 55953d33940a8d..90c16776a63b13 100644
--- a/compiler-rt/test/asan/TestCases/Darwin/odr-lto.cpp
+++ b/compiler-rt/test/asan/TestCases/Darwin/odr-lto.cpp
@@ -5,7 +5,7 @@
 
 // RUN: %clangxx_asan -DPART=0 -c %s -o %t-1.o -flto -mllvm 
-asan-use-private-alias
 // RUN: %clangxx_asan -DPART=1 -c %s -o %t-2.o -flto -mllvm 
-asan-use-private-alias
-// RUN: %clangxx_asan %t-1.o %t-2.o -o %t -flto -mlinker-version=133
+// RUN: %clangxx_asan_lto %t-1.o %t-2.o -o %t -flto -mlinker-version=133
 // RUN: %run %t 2>&1 | FileCheck %s
 
 #include 
diff --git a/compiler-rt/test/asan/lit.cfg.py b/compiler-rt/test/asan/lit.cfg.py
index d9303466021250..83b3cbe789cacc 100644
--- a/compiler-rt/test/asan/lit.cfg.py
+++ b/compiler-rt/test/asan/lit.cfg.py
@@ -101,14 +101,24 @@ def get_required_attr(config, attr_name):
 config.available_features.add(win_runtime_feature)
 
 
-def build_invocation(compile_flags):
-return " " + " ".join([config.clang] + compile_flags) + " "
+def build_invocation(compile_flags, with_lto=False):
+lto_flags = []
+if with_lto and config.lto_supported:
+lto_flags += config.lto_flags
+
+return " " + " ".join([config.clang] + lto_flags + compile_flags) + " "
 
 
 config.substitutions.append(("%clang ", build_invocation(target_cflags)))
 config.substitutions.append(("%clangxx ", build_invocation(target_cxxflags)))
 config.substitutions.append(("%clang_asan ", 
build_invocation(clang_asan_cflags)))
 config.substitutions.append(("%clangxx_asan ", 
build_invocation(clang_asan_cxxflags)))
+config.substitutions.append(
+("%clang_asan_lto ", build_invocation(clang_asan_cflags, True))
+)
+config.substitutions.append(
+("%clangxx_asan_lto ", build_invocation(clang_asan_cxxflags, True))
+)
 if config.asan_dynamic:
 if config.host_os in ["Linux", "FreeBSD", "NetBSD", "SunOS"]:
 shared_libasan_path = os.path.join(

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


[llvm-branch-commits] [compiler-rt] release/17.x: [CompilerRT][ASan] Add new substitutions for tests while using lto to (#78523) (PR #86026)

2024-03-20 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/86026
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] release/17.x: [CompilerRT][ASan] Add new substitutions for tests while using lto to (#78523) (PR #86026)

2024-03-20 Thread via llvm-branch-commits

github-actions[bot] wrote:

This repository does not accept pull requests. Please follow 
http://llvm.org/docs/Contributing.html#how-to-submit-a-patch for contribution 
to LLVM.

https://github.com/llvm/llvm-project/pull/86026
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] release/17.x: [CompilerRT][ASan] Add new substitutions for tests while using lto to (#78523) (PR #86026)

2024-03-20 Thread via llvm-branch-commits

https://github.com/github-actions[bot] locked 
https://github.com/llvm/llvm-project/pull/86026
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] release/17.x: [CompilerRT][ASan] Add new substitutions for tests while using lto to (#78523) (PR #86026)

2024-03-20 Thread via llvm-branch-commits

https://github.com/github-actions[bot] closed 
https://github.com/llvm/llvm-project/pull/86026
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [BOLT] Output YAML profile in BAT mode (PR #76910)

2024-03-20 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/76910

>From b9173e3769ce2fefe846b0b65cef61631af94008 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Thu, 4 Jan 2024 09:52:26 -0800
Subject: [PATCH] Fix SaveProfile definition issue

Created using spr 1.3.4
---
 bolt/lib/Rewrite/RewriteInstance.cpp | 4 +---
 bolt/lib/Utils/CommandLineOpts.cpp   | 4 
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp 
b/bolt/lib/Rewrite/RewriteInstance.cpp
index c6f38db17f093d..06f28195bb08dd 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -199,9 +199,7 @@ static cl::opt RelocationMode(
 "relocs", cl::desc("use relocations in the binary (default=autodetect)"),
 cl::cat(BoltCategory));
 
-cl::opt SaveProfile("w",
- cl::desc("save recorded profile to a file"),
- cl::cat(BoltOutputCategory));
+extern cl::opt SaveProfile;
 
 static cl::list
 SkipFunctionNames("skip-funcs",
diff --git a/bolt/lib/Utils/CommandLineOpts.cpp 
b/bolt/lib/Utils/CommandLineOpts.cpp
index a1df5de2623402..4a980a67fca378 100644
--- a/bolt/lib/Utils/CommandLineOpts.cpp
+++ b/bolt/lib/Utils/CommandLineOpts.cpp
@@ -163,6 +163,10 @@ cl::opt ProfileFormat(
clEnumValN(PF_YAML, "yaml", "dense YAML representation")),
 cl::ZeroOrMore, cl::Hidden, cl::cat(BoltCategory));
 
+cl::opt SaveProfile("w",
+ cl::desc("save recorded profile to a file"),
+ cl::cat(BoltOutputCategory));
+
 cl::opt SplitEH("split-eh", cl::desc("split C++ exception handling 
code"),
   cl::Hidden, cl::cat(BoltOptCategory));
 

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


[llvm-branch-commits] [llvm] [BOLT] Output YAML profile in BAT mode (PR #76910)

2024-03-20 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/76910

>From b9173e3769ce2fefe846b0b65cef61631af94008 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Thu, 4 Jan 2024 09:52:26 -0800
Subject: [PATCH] Fix SaveProfile definition issue

Created using spr 1.3.4
---
 bolt/lib/Rewrite/RewriteInstance.cpp | 4 +---
 bolt/lib/Utils/CommandLineOpts.cpp   | 4 
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp 
b/bolt/lib/Rewrite/RewriteInstance.cpp
index c6f38db17f093d..06f28195bb08dd 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -199,9 +199,7 @@ static cl::opt RelocationMode(
 "relocs", cl::desc("use relocations in the binary (default=autodetect)"),
 cl::cat(BoltCategory));
 
-cl::opt SaveProfile("w",
- cl::desc("save recorded profile to a file"),
- cl::cat(BoltOutputCategory));
+extern cl::opt SaveProfile;
 
 static cl::list
 SkipFunctionNames("skip-funcs",
diff --git a/bolt/lib/Utils/CommandLineOpts.cpp 
b/bolt/lib/Utils/CommandLineOpts.cpp
index a1df5de2623402..4a980a67fca378 100644
--- a/bolt/lib/Utils/CommandLineOpts.cpp
+++ b/bolt/lib/Utils/CommandLineOpts.cpp
@@ -163,6 +163,10 @@ cl::opt ProfileFormat(
clEnumValN(PF_YAML, "yaml", "dense YAML representation")),
 cl::ZeroOrMore, cl::Hidden, cl::cat(BoltCategory));
 
+cl::opt SaveProfile("w",
+ cl::desc("save recorded profile to a file"),
+ cl::cat(BoltOutputCategory));
+
 cl::opt SplitEH("split-eh", cl::desc("split C++ exception handling 
code"),
   cl::Hidden, cl::cat(BoltOptCategory));
 

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


[llvm-branch-commits] [llvm] [BOLT] Output YAML profile in BAT mode (PR #76910)

2024-03-20 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/76910

>From b9173e3769ce2fefe846b0b65cef61631af94008 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Thu, 4 Jan 2024 09:52:26 -0800
Subject: [PATCH 1/2] Fix SaveProfile definition issue

Created using spr 1.3.4
---
 bolt/lib/Rewrite/RewriteInstance.cpp | 4 +---
 bolt/lib/Utils/CommandLineOpts.cpp   | 4 
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp 
b/bolt/lib/Rewrite/RewriteInstance.cpp
index c6f38db17f093d..06f28195bb08dd 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -199,9 +199,7 @@ static cl::opt RelocationMode(
 "relocs", cl::desc("use relocations in the binary (default=autodetect)"),
 cl::cat(BoltCategory));
 
-cl::opt SaveProfile("w",
- cl::desc("save recorded profile to a file"),
- cl::cat(BoltOutputCategory));
+extern cl::opt SaveProfile;
 
 static cl::list
 SkipFunctionNames("skip-funcs",
diff --git a/bolt/lib/Utils/CommandLineOpts.cpp 
b/bolt/lib/Utils/CommandLineOpts.cpp
index a1df5de2623402..4a980a67fca378 100644
--- a/bolt/lib/Utils/CommandLineOpts.cpp
+++ b/bolt/lib/Utils/CommandLineOpts.cpp
@@ -163,6 +163,10 @@ cl::opt ProfileFormat(
clEnumValN(PF_YAML, "yaml", "dense YAML representation")),
 cl::ZeroOrMore, cl::Hidden, cl::cat(BoltCategory));
 
+cl::opt SaveProfile("w",
+ cl::desc("save recorded profile to a file"),
+ cl::cat(BoltOutputCategory));
+
 cl::opt SplitEH("split-eh", cl::desc("split C++ exception handling 
code"),
   cl::Hidden, cl::cat(BoltOptCategory));
 

>From 8eb2cf8cd77244251595817c9d25d3721b2e0be2 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Wed, 20 Mar 2024 16:42:41 -0700
Subject: [PATCH 2/2] remove blarge.bat.preagg

Created using spr 1.3.4
---
 bolt/test/X86/Inputs/blarge.bat.preagg | 81 --
 1 file changed, 81 deletions(-)
 delete mode 100644 bolt/test/X86/Inputs/blarge.bat.preagg

diff --git a/bolt/test/X86/Inputs/blarge.bat.preagg 
b/bolt/test/X86/Inputs/blarge.bat.preagg
deleted file mode 100644
index 76b4003d977c26..00
--- a/bolt/test/X86/Inputs/blarge.bat.preagg
+++ /dev/null
@@ -1,81 +0,0 @@
-B 4005f0 X:7f49b808f200 804 12
-B 400610 X:7f49b806f430 175 8
-B 400620 X:7f49b839e260 26 1
-B 400630 X:7f49b83fa1c0 2 1
-B 400640 X:7f49b839d900 2 0
-B 400ad1 400e00 34 0
-B 400add 400610 12 0
-B 400b00 400610 19 0
-B 400b09 400aea 2 0
-B 400b10 4005f0 802 0
-B 400b2d 400aa8 29 0
-B 400b4b 400a90 4 0
-B 400ba1 401170 9 0
-B 400bb7 400610 15 0
-B 400bc3 400b99 7 0
-B 400bf3 400610 5 0
-B 400c37 400610 122 0
-B 400c56 400c0f 125 0
-B 400c8e 400610 3 0
-B 400cad 400c66 3 0
-B 400e82 800345 2 0
-B 400e88 8002a0 28 0
-B 40119a 4011a3 362 36
-B 4011a7 40117a 668 4
-B 4011ac 400ba6 13 0
-B 4011ac 400be1 5 0
-B X:7f49b806f4f6 400ae2 17 0
-B X:7f49b806f4f6 400b05 800 0
-B X:7f49b806f4f6 400bbc 7 1
-B X:7f49b806f4f6 400c3c 123 6
-B X:7f49b806f4f6 400c93 4 1
-B X:7f49b808f289 400b15 33 0
-B X:7f49b839e2b1 8002ed 12 0
-B X:7f49b83f8b53 80038a 1 0
-B X:7f49b83fa2ff 800495 1 0
-B 8002e8 400620 26 0
-B 80031f 800329 11 0
-B 800344 400ad6 10 0
-B 800385 400640 2 0
-B 8003d1 400630 1 0
-B 8004bb 400ad6 1 0
-F 4005f0 4005f0 802
-F 400610 400610 172
-F 400610 400c37 1
-F 400620 400620 26
-F 400630 400630 1
-F 400640 400640 2
-F 400a90 400ad1 4
-F 400aa8 400ad1 29
-F 400ad6 400add 11
-F 400ae2 400b00 17
-F 400aea 400b00 2
-F 400b05 400b09 2
-F 400b05 400b10 798
-F 400b15 400b2d 29
-F 400b15 400b4b 4
-F 400b99 400ba1 7
-F 400ba6 400bb7 13
-F 400bbc 400bc3 7
-F 400be1 400bf3 5
-F 400c0f 400c37 118
-F 400c3c 400c56 123
-F 400c66 400c8e 3
-F 400c93 400cad 3
-F 400e00 400e82 2
-F 400e00 400e88 28
-F 401170 400ba1 2
-F 401170 40119a 5
-F 40117a 40119a 343
-F 40117a 4011a7 301
-F 40117a 4011ac 5
-F 4011a3 40119a 1
-F 4011a3 4011a7 343
-F 4011a3 4011ac 13
-F X:7f49b806f430 400610 1
-F 8002a0 8002e8 26
-F 8002ed 80031f 11
-F 800329 800344 10
-F 800345 800385 2
-F 80038a 8003d1 1
-F 800495 8004bb 1

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


[llvm-branch-commits] [BOLT] Add BB index to BAT (PR #86044)

2024-03-20 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov created 
https://github.com/llvm/llvm-project/pull/86044

Increases BAT section size to:
- large binary: 39521512 bytes (1.02x original),
- medium binary: 3799988 bytes (0.64x),
- small binary: 920 bytes (0.64x).

Test Plan: Updated bolt-address-translation{,-yaml}.test



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


[llvm-branch-commits] [BOLT] Add number of basic blocks to BAT (PR #86045)

2024-03-20 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov created 
https://github.com/llvm/llvm-project/pull/86045

YAML profile reader checks the number of basic blocks in regular,
no-stale-matching mode. Add it to BAT.

This increases the size of BAT section to:
- large binary: 39583080 bytes (1.02x of the original),
- medium binary: 3816492 bytes (0.64x),
- small binary: 920 bytes (0.64x, no change due to alignment).

Test Plan: Updated bolt-address-translation-yaml.test



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


[llvm-branch-commits] [llvm] [BOLT] Output YAML profile in BAT mode (PR #76910)

2024-03-20 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/76910

>From b9173e3769ce2fefe846b0b65cef61631af94008 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Thu, 4 Jan 2024 09:52:26 -0800
Subject: [PATCH 1/3] Fix SaveProfile definition issue

Created using spr 1.3.4
---
 bolt/lib/Rewrite/RewriteInstance.cpp | 4 +---
 bolt/lib/Utils/CommandLineOpts.cpp   | 4 
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp 
b/bolt/lib/Rewrite/RewriteInstance.cpp
index c6f38db17f093d..06f28195bb08dd 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -199,9 +199,7 @@ static cl::opt RelocationMode(
 "relocs", cl::desc("use relocations in the binary (default=autodetect)"),
 cl::cat(BoltCategory));
 
-cl::opt SaveProfile("w",
- cl::desc("save recorded profile to a file"),
- cl::cat(BoltOutputCategory));
+extern cl::opt SaveProfile;
 
 static cl::list
 SkipFunctionNames("skip-funcs",
diff --git a/bolt/lib/Utils/CommandLineOpts.cpp 
b/bolt/lib/Utils/CommandLineOpts.cpp
index a1df5de2623402..4a980a67fca378 100644
--- a/bolt/lib/Utils/CommandLineOpts.cpp
+++ b/bolt/lib/Utils/CommandLineOpts.cpp
@@ -163,6 +163,10 @@ cl::opt ProfileFormat(
clEnumValN(PF_YAML, "yaml", "dense YAML representation")),
 cl::ZeroOrMore, cl::Hidden, cl::cat(BoltCategory));
 
+cl::opt SaveProfile("w",
+ cl::desc("save recorded profile to a file"),
+ cl::cat(BoltOutputCategory));
+
 cl::opt SplitEH("split-eh", cl::desc("split C++ exception handling 
code"),
   cl::Hidden, cl::cat(BoltOptCategory));
 

>From 8eb2cf8cd77244251595817c9d25d3721b2e0be2 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Wed, 20 Mar 2024 16:42:41 -0700
Subject: [PATCH 2/3] remove blarge.bat.preagg

Created using spr 1.3.4
---
 bolt/test/X86/Inputs/blarge.bat.preagg | 81 --
 1 file changed, 81 deletions(-)
 delete mode 100644 bolt/test/X86/Inputs/blarge.bat.preagg

diff --git a/bolt/test/X86/Inputs/blarge.bat.preagg 
b/bolt/test/X86/Inputs/blarge.bat.preagg
deleted file mode 100644
index 76b4003d977c26..00
--- a/bolt/test/X86/Inputs/blarge.bat.preagg
+++ /dev/null
@@ -1,81 +0,0 @@
-B 4005f0 X:7f49b808f200 804 12
-B 400610 X:7f49b806f430 175 8
-B 400620 X:7f49b839e260 26 1
-B 400630 X:7f49b83fa1c0 2 1
-B 400640 X:7f49b839d900 2 0
-B 400ad1 400e00 34 0
-B 400add 400610 12 0
-B 400b00 400610 19 0
-B 400b09 400aea 2 0
-B 400b10 4005f0 802 0
-B 400b2d 400aa8 29 0
-B 400b4b 400a90 4 0
-B 400ba1 401170 9 0
-B 400bb7 400610 15 0
-B 400bc3 400b99 7 0
-B 400bf3 400610 5 0
-B 400c37 400610 122 0
-B 400c56 400c0f 125 0
-B 400c8e 400610 3 0
-B 400cad 400c66 3 0
-B 400e82 800345 2 0
-B 400e88 8002a0 28 0
-B 40119a 4011a3 362 36
-B 4011a7 40117a 668 4
-B 4011ac 400ba6 13 0
-B 4011ac 400be1 5 0
-B X:7f49b806f4f6 400ae2 17 0
-B X:7f49b806f4f6 400b05 800 0
-B X:7f49b806f4f6 400bbc 7 1
-B X:7f49b806f4f6 400c3c 123 6
-B X:7f49b806f4f6 400c93 4 1
-B X:7f49b808f289 400b15 33 0
-B X:7f49b839e2b1 8002ed 12 0
-B X:7f49b83f8b53 80038a 1 0
-B X:7f49b83fa2ff 800495 1 0
-B 8002e8 400620 26 0
-B 80031f 800329 11 0
-B 800344 400ad6 10 0
-B 800385 400640 2 0
-B 8003d1 400630 1 0
-B 8004bb 400ad6 1 0
-F 4005f0 4005f0 802
-F 400610 400610 172
-F 400610 400c37 1
-F 400620 400620 26
-F 400630 400630 1
-F 400640 400640 2
-F 400a90 400ad1 4
-F 400aa8 400ad1 29
-F 400ad6 400add 11
-F 400ae2 400b00 17
-F 400aea 400b00 2
-F 400b05 400b09 2
-F 400b05 400b10 798
-F 400b15 400b2d 29
-F 400b15 400b4b 4
-F 400b99 400ba1 7
-F 400ba6 400bb7 13
-F 400bbc 400bc3 7
-F 400be1 400bf3 5
-F 400c0f 400c37 118
-F 400c3c 400c56 123
-F 400c66 400c8e 3
-F 400c93 400cad 3
-F 400e00 400e82 2
-F 400e00 400e88 28
-F 401170 400ba1 2
-F 401170 40119a 5
-F 40117a 40119a 343
-F 40117a 4011a7 301
-F 40117a 4011ac 5
-F 4011a3 40119a 1
-F 4011a3 4011a7 343
-F 4011a3 4011ac 13
-F X:7f49b806f430 400610 1
-F 8002a0 8002e8 26
-F 8002ed 80031f 11
-F 800329 800344 10
-F 800345 800385 2
-F 80038a 8003d1 1
-F 800495 8004bb 1

>From 84a82ddf4b8a59075d79956a4dc26ef07a3e03de Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Wed, 20 Mar 2024 17:02:42 -0700
Subject: [PATCH 3/3] Fix test

Created using spr 1.3.4
---
 bolt/test/X86/bolt-address-translation-yaml.test | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bolt/test/X86/bolt-address-translation-yaml.test 
b/bolt/test/X86/bolt-address-translation-yaml.test
index e265b5b9f0507e..25ff4e7fbfcc57 100644
--- a/bolt/test/X86/bolt-address-translation-yaml.test
+++ b/bolt/test/X86/bolt-address-translation-yaml.test
@@ -18,7 +18,7 @@ RUN:   | FileCheck --check-prefix CHECK-BOLT-YAML %s
 
 WRITE-BAT-CHECK: BOLT-INFO: Wrote 5 BAT maps
 WRITE-BAT-CHECK: BOLT-INFO: Wrote 4 function and 22 basic block hashes
-WRITE-BAT-CHECK: BOLT-INFO: BAT section size (bytes): 384
+WRIT

[llvm-branch-commits] [BOLT] Add BB index to BAT (PR #86044)

2024-03-20 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/86044


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


[llvm-branch-commits] [BOLT] Add BB index to BAT (PR #86044)

2024-03-20 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/86044


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


[llvm-branch-commits] [BOLT] Add number of basic blocks to BAT (PR #86045)

2024-03-20 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/86045


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


[llvm-branch-commits] [BOLT] Add number of basic blocks to BAT (PR #86045)

2024-03-20 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/86045


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


[llvm-branch-commits] [CodeGen] Add default lowering for llvm.allow.{runtime, ubsan}.check() (PR #86049)

2024-03-20 Thread via llvm-branch-commits

llvmbot wrote:



@llvm/pr-subscribers-backend-aarch64

@llvm/pr-subscribers-llvm-selectiondag

Author: Vitaly Buka (vitalybuka)


Changes

RFC: 
https://discourse.llvm.org/t/rfc-add-llvm-experimental-hot-intrinsic-or-llvm-hot/77641


---
Full diff: https://github.com/llvm/llvm-project/pull/86049.diff


10 Files Affected:

- (modified) llvm/lib/CodeGen/CodeGenPrepare.cpp (+3-1) 
- (modified) llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp (+5) 
- (modified) llvm/lib/CodeGen/IntrinsicLowering.cpp (+5) 
- (modified) llvm/lib/CodeGen/SelectionDAG/FastISel.cpp (+4) 
- (modified) llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (+5) 
- (added) llvm/test/CodeGen/AArch64/allow-check.ll (+30) 
- (added) llvm/test/CodeGen/AMDGPU/allow-check.ll (+30) 
- (added) llvm/test/CodeGen/Generic/allow-check.ll (+23) 
- (added) llvm/test/CodeGen/RISCV/allow-check.ll (+31) 
- (added) llvm/test/CodeGen/X86/allow-check.ll (+28) 


``diff
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp 
b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 9f99bb7e693f7e..e657872c382848 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -2462,8 +2462,10 @@ bool CodeGenPrepare::optimizeCallInst(CallInst *CI, 
ModifyDT &ModifiedDT) {
   break;
 case Intrinsic::assume:
   llvm_unreachable("llvm.assume should have been removed already");
+case Intrinsic::allow_runtime_check:
+case Intrinsic::allow_ubsan_check:
 case Intrinsic::experimental_widenable_condition: {
-  // Give up on future widening oppurtunties so that we can fold away dead
+  // Give up on future widening opportunities so that we can fold away dead
   // paths and merge blocks before going into block-local instruction
   // selection.
   if (II->use_empty()) {
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp 
b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index 757af3b1c4fe82..0811c565386654 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -2475,6 +2475,11 @@ bool IRTranslator::translateKnownIntrinsic(const 
CallInst &CI, Intrinsic::ID ID,
 Info.OrigRet = {Register(), Type::getVoidTy(CI.getContext()), 0};
 return CLI->lowerCall(MIRBuilder, Info);
   }
+  case Intrinsic::allow_runtime_check:
+  case Intrinsic::allow_ubsan_check:
+MIRBuilder.buildCopy(getOrCreateVReg(CI),
+ getOrCreateVReg(*ConstantInt::getTrue(CI.getType(;
+return true;
   case Intrinsic::amdgcn_cs_chain:
 return translateCallBase(CI, MIRBuilder);
   case Intrinsic::fptrunc_round: {
diff --git a/llvm/lib/CodeGen/IntrinsicLowering.cpp 
b/llvm/lib/CodeGen/IntrinsicLowering.cpp
index 09d282d12c5fb1..45fba4341ad007 100644
--- a/llvm/lib/CodeGen/IntrinsicLowering.cpp
+++ b/llvm/lib/CodeGen/IntrinsicLowering.cpp
@@ -243,6 +243,11 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
 break;
   }
 
+  case Intrinsic::allow_runtime_check:
+  case Intrinsic::allow_ubsan_check:
+CI->replaceAllUsesWith(ConstantInt::getTrue(CI->getType()));
+return;
+
   case Intrinsic::ctpop:
 CI->replaceAllUsesWith(LowerCTPOP(Context, CI->getArgOperand(0), CI));
 break;
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp 
b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index 27b8472ddb73d8..ce5a7ea09d476f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -1452,6 +1452,10 @@ bool FastISel::selectIntrinsicCall(const IntrinsicInst 
*II) {
   case Intrinsic::is_constant:
 llvm_unreachable("llvm.is.constant.* should have been lowered already");
 
+  case Intrinsic::allow_runtime_check:
+  case Intrinsic::allow_ubsan_check:
+llvm_unreachable("llvm.*.check should have been lowered already");
+
   case Intrinsic::launder_invariant_group:
   case Intrinsic::strip_invariant_group:
   case Intrinsic::expect: {
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp 
b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 2d63774c75e372..51c9af6d62d96b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -7322,6 +7322,11 @@ void SelectionDAGBuilder::visitIntrinsicCall(const 
CallInst &I,
 return;
   }
 
+  case Intrinsic::allow_runtime_check:
+  case Intrinsic::allow_ubsan_check:
+setValue(&I, getValue(ConstantInt::getTrue(I.getType(;
+return;
+
   case Intrinsic::uadd_with_overflow:
   case Intrinsic::sadd_with_overflow:
   case Intrinsic::usub_with_overflow:
diff --git a/llvm/test/CodeGen/AArch64/allow-check.ll 
b/llvm/test/CodeGen/AArch64/allow-check.ll
new file mode 100644
index 00..c315b216e222c0
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/allow-check.ll
@@ -0,0 +1,30 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 
UTC_ARGS: --version 4
+; RUN: llc < %s -mtriple=aarch64 | FileCheck %s
+; RUN: llc < %

[llvm-branch-commits] [CodeGen] Add default lowering for llvm.allow.{runtime, ubsan}.check() (PR #86049)

2024-03-20 Thread Vitaly Buka via llvm-branch-commits

https://github.com/vitalybuka created 
https://github.com/llvm/llvm-project/pull/86049

RFC: 
https://discourse.llvm.org/t/rfc-add-llvm-experimental-hot-intrinsic-or-llvm-hot/77641



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


[llvm-branch-commits] [CostModel] No cost for llvm.allow.{runtime, ubsan}.check() (PR #86064)

2024-03-20 Thread Vitaly Buka via llvm-branch-commits

https://github.com/vitalybuka created 
https://github.com/llvm/llvm-project/pull/86064

These intrinsics will not be lowered to code.

RFC: 
https://discourse.llvm.org/t/rfc-add-llvm-experimental-hot-intrinsic-or-llvm-hot/77641



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


[llvm-branch-commits] [Analysis] Exclude llvm.allow.{runtime, ubsan}.check() from AliasSetTracker (PR #86065)

2024-03-20 Thread Vitaly Buka via llvm-branch-commits

https://github.com/vitalybuka created 
https://github.com/llvm/llvm-project/pull/86065

RFC: 
https://discourse.llvm.org/t/rfc-add-llvm-experimental-hot-intrinsic-or-llvm-hot/77641



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


[llvm-branch-commits] [memoryssa] Exclude llvm.allow.{runtime, ubsan}.check() (PR #86066)

2024-03-20 Thread Vitaly Buka via llvm-branch-commits

https://github.com/vitalybuka created 
https://github.com/llvm/llvm-project/pull/86066

RFC: 
https://discourse.llvm.org/t/rfc-add-llvm-experimental-hot-intrinsic-or-llvm-hot/77641



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


[llvm-branch-commits] [CostModel] No cost for llvm.allow.{runtime, ubsan}.check() (PR #86064)

2024-03-20 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-llvm-analysis

Author: Vitaly Buka (vitalybuka)


Changes

These intrinsics will not be lowered to code.

RFC: 
https://discourse.llvm.org/t/rfc-add-llvm-experimental-hot-intrinsic-or-llvm-hot/77641


---
Full diff: https://github.com/llvm/llvm-project/pull/86064.diff


3 Files Affected:

- (modified) llvm/include/llvm/Analysis/TargetTransformInfoImpl.h (+2) 
- (modified) llvm/test/Analysis/CostModel/free-intrinsics-datalayout.ll (+6) 
- (modified) llvm/test/Analysis/CostModel/free-intrinsics-no_info.ll (+6) 


``diff
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h 
b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
index 7c47d3c2338a87..63c2ef8912b29c 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -714,6 +714,8 @@ class TargetTransformInfoImplBase {
 switch (ICA.getID()) {
 default:
   break;
+case Intrinsic::allow_runtime_check:
+case Intrinsic::allow_ubsan_check:
 case Intrinsic::annotation:
 case Intrinsic::assume:
 case Intrinsic::sideeffect:
diff --git a/llvm/test/Analysis/CostModel/free-intrinsics-datalayout.ll 
b/llvm/test/Analysis/CostModel/free-intrinsics-datalayout.ll
index 4ebb1e314ba183..09fbd68d95e920 100644
--- a/llvm/test/Analysis/CostModel/free-intrinsics-datalayout.ll
+++ b/llvm/test/Analysis/CostModel/free-intrinsics-datalayout.ll
@@ -25,6 +25,8 @@ define i32 @trivially_free() {
 ; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: 
call void @llvm.lifetime.end.p0(i64 1, ptr undef)
 ; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: 
%a5 = call i64 @llvm.objectsize.i64.p0(ptr undef, i1 true, i1 true, i1 true)
 ; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: 
%a6 = call ptr @llvm.ptr.annotation.p0.p0(ptr undef, ptr undef, ptr undef, i32 
undef, ptr undef)
+; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: 
%a7 = call i1 @llvm.allow.ubsan.check(i8 123)
+; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: 
%a8 = call i1 @llvm.allow.runtime.check(metadata !"test_check")
 ; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: 
call void @llvm.var.annotation.p0.p0(ptr undef, ptr undef, ptr undef, i32 
undef, ptr undef)
 ; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: 
ret i32 undef
 ;
@@ -45,6 +47,8 @@ define i32 @trivially_free() {
 ; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for 
instruction: call void @llvm.lifetime.end.p0(i64 1, ptr undef)
 ; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for 
instruction: %a5 = call i64 @llvm.objectsize.i64.p0(ptr undef, i1 true, i1 
true, i1 true)
 ; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for 
instruction: %a6 = call ptr @llvm.ptr.annotation.p0.p0(ptr undef, ptr undef, 
ptr undef, i32 undef, ptr undef)
+; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for 
instruction: %a7 = call i1 @llvm.allow.ubsan.check(i8 123)
+; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for 
instruction: %a8 = call i1 @llvm.allow.runtime.check(metadata !"test_check")
 ; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for 
instruction: call void @llvm.var.annotation.p0.p0(ptr undef, ptr undef, ptr 
undef, i32 undef, ptr undef)
 ; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 1 for 
instruction: ret i32 undef
 ;
@@ -65,6 +69,8 @@ define i32 @trivially_free() {
   call void @llvm.lifetime.end.p0(i64 1, ptr undef)
   %a5 = call i64 @llvm.objectsize.i64.p0(ptr undef, i1 1, i1 1, i1 1)
   %a6 = call ptr @llvm.ptr.annotation.p0(ptr undef, ptr undef, ptr undef, i32 
undef, ptr undef)
+  %a7 = call i1 @llvm.allow.ubsan.check(i8 123)
+  %a8 = call i1 @llvm.allow.runtime.check(metadata !"test_check")
   call void @llvm.var.annotation(ptr undef, ptr undef, ptr undef, i32 undef, 
ptr undef)
   ret i32 undef
 }
diff --git a/llvm/test/Analysis/CostModel/free-intrinsics-no_info.ll 
b/llvm/test/Analysis/CostModel/free-intrinsics-no_info.ll
index 5d47e48944271f..3e78c62a6fe255 100644
--- a/llvm/test/Analysis/CostModel/free-intrinsics-no_info.ll
+++ b/llvm/test/Analysis/CostModel/free-intrinsics-no_info.ll
@@ -24,6 +24,8 @@ define i32 @trivially_free() {
 ; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: 
%a5 = call i64 @llvm.objectsize.i64.p0(ptr undef, i1 true, i1 true, i1 true)
 ; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: 
%a6 = call ptr @llvm.ptr.annotation.p0.p0(ptr undef, ptr undef, ptr undef, i32 
undef, ptr undef)
 ; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: 
call void @llvm.var.annotation.p0.p0(ptr undef, ptr undef, ptr undef, i32 
undef, ptr undef)
+; CHECK-SIZE-NEXT:  Cost Model: Found an es

[llvm-branch-commits] [Analysis] Exclude llvm.allow.{runtime, ubsan}.check() from AliasSetTracker (PR #86065)

2024-03-20 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-llvm-analysis

Author: Vitaly Buka (vitalybuka)


Changes

RFC: 
https://discourse.llvm.org/t/rfc-add-llvm-experimental-hot-intrinsic-or-llvm-hot/77641


---
Full diff: https://github.com/llvm/llvm-project/pull/86065.diff


2 Files Affected:

- (modified) llvm/lib/Analysis/AliasSetTracker.cpp (+2) 
- (modified) llvm/test/Analysis/AliasSet/intrinsics.ll (+30) 


``diff
diff --git a/llvm/lib/Analysis/AliasSetTracker.cpp 
b/llvm/lib/Analysis/AliasSetTracker.cpp
index 59bb40cdba6e15..32e545daaf2269 100644
--- a/llvm/lib/Analysis/AliasSetTracker.cpp
+++ b/llvm/lib/Analysis/AliasSetTracker.cpp
@@ -354,6 +354,8 @@ void AliasSetTracker::addUnknown(Instruction *Inst) {
 default:
   break;
   // FIXME: Add lifetime/invariant intrinsics (See: PR30807).
+case Intrinsic::allow_runtime_check:
+case Intrinsic::allow_ubsan_check:
 case Intrinsic::assume:
 case Intrinsic::experimental_noalias_scope_decl:
 case Intrinsic::sideeffect:
diff --git a/llvm/test/Analysis/AliasSet/intrinsics.ll 
b/llvm/test/Analysis/AliasSet/intrinsics.ll
index 678d6d246e639c..0dc802ca7e0aaf 100644
--- a/llvm/test/Analysis/AliasSet/intrinsics.ll
+++ b/llvm/test/Analysis/AliasSet/intrinsics.ll
@@ -74,6 +74,36 @@ entry:
   ret void
 }
 
+; CHECK: Alias sets for function 'test_runtime':
+; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
+; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod   Memory 
locations: (ptr %a, LocationSize::precise(1))
+; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod   Memory 
locations: (ptr %b, LocationSize::precise(1))
+define i1 @test_runtime() local_unnamed_addr {
+entry:
+  %a = alloca i8, align 1
+  %b = alloca i8, align 1
+  store i8 1, ptr %a, align 1
+  %allow = call i1 @llvm.allow.runtime.check(metadata !"test_check")
+  store i8 1, ptr %b, align 1
+  ret i1 %allow
+}
+
+; CHECK: Alias sets for function 'test_ubsan':
+; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
+; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod   Memory 
locations: (ptr %a, LocationSize::precise(1))
+; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod   Memory 
locations: (ptr %b, LocationSize::precise(1))
+define i1 @test_ubsan() local_unnamed_addr {
+entry:
+  %a = alloca i8, align 1
+  %b = alloca i8, align 1
+  store i8 1, ptr %a, align 1
+  %allow = call i1 @llvm.allow.ubsan.check(i8 7)
+  store i8 1, ptr %b, align 1
+  ret i1 %allow
+}
+
+declare i1 @llvm.allow.ubsan.check(i8)
+declare i1 @llvm.allow.runtime.check(metadata)
 declare void @llvm.assume(i1)
 declare void @llvm.experimental.guard(i1, ...)
 declare void @llvm.experimental.noalias.scope.decl(metadata)

``




https://github.com/llvm/llvm-project/pull/86065
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [memoryssa] Exclude llvm.allow.{runtime, ubsan}.check() (PR #86066)

2024-03-20 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-llvm-analysis

Author: Vitaly Buka (vitalybuka)


Changes

RFC: 
https://discourse.llvm.org/t/rfc-add-llvm-experimental-hot-intrinsic-or-llvm-hot/77641


---
Full diff: https://github.com/llvm/llvm-project/pull/86066.diff


2 Files Affected:

- (modified) llvm/lib/Analysis/MemorySSA.cpp (+4) 
- (added) llvm/test/Analysis/MemorySSA/allow-check.ll (+29) 


``diff
diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp
index 82a6c470650cc9..49450d85d74225 100644
--- a/llvm/lib/Analysis/MemorySSA.cpp
+++ b/llvm/lib/Analysis/MemorySSA.cpp
@@ -292,6 +292,8 @@ instructionClobbersQuery(const MemoryDef *MD, const 
MemoryLocation &UseLoc,
 // clobbers where they don't really exist at all. Please see D43269 for
 // context.
 switch (II->getIntrinsicID()) {
+case Intrinsic::allow_runtime_check:
+case Intrinsic::allow_ubsan_check:
 case Intrinsic::invariant_start:
 case Intrinsic::invariant_end:
 case Intrinsic::assume:
@@ -1725,6 +1727,8 @@ MemoryUseOrDef *MemorySSA::createNewAccess(Instruction *I,
 switch (II->getIntrinsicID()) {
 default:
   break;
+case Intrinsic::allow_runtime_check:
+case Intrinsic::allow_ubsan_check:
 case Intrinsic::assume:
 case Intrinsic::experimental_noalias_scope_decl:
 case Intrinsic::pseudoprobe:
diff --git a/llvm/test/Analysis/MemorySSA/allow-check.ll 
b/llvm/test/Analysis/MemorySSA/allow-check.ll
new file mode 100644
index 00..dcdad001ca6f5b
--- /dev/null
+++ b/llvm/test/Analysis/MemorySSA/allow-check.ll
@@ -0,0 +1,29 @@
+; RUN: opt -aa-pipeline=basic-aa -passes='print,verify' 
-disable-output < %s 2>&1 | FileCheck %s --implicit-check-not=MemoryDef
+;
+; Ensures that allow.*.check are treated as not reading or writing memory.
+
+target triple = "aarch64-linux"
+
+define i1 @test_runtime(ptr %a) local_unnamed_addr {
+entry:
+; CHECK: 1 = MemoryDef(liveOnEntry)
+  store i32 4, ptr %a, align 4
+  %allow = call i1 @llvm.allow.runtime.check(metadata !"test_check")
+  %0 = load i32, ptr %a, align 4
+; CHECK: MemoryUse(1)
+  ret i1 %allow
+}
+
+declare i1 @llvm.allow.runtime.check(metadata)
+
+define i1 @test_ubsan(ptr %a) local_unnamed_addr {
+entry:
+; CHECK: 1 = MemoryDef(liveOnEntry)
+  store i32 4, ptr %a, align 4
+  %allow = call i1 @llvm.allow.ubsan.check(i8 7)
+  %0 = load i32, ptr %a, align 4
+; CHECK: MemoryUse(1)
+  ret i1 %allow
+}
+
+declare i1 @llvm.allow.ubsan.check(i8)

``




https://github.com/llvm/llvm-project/pull/86066
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [dse] Skip llvm.allow.{runtime, ubsan}.check() (PR #86067)

2024-03-20 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-llvm-transforms

Author: Vitaly Buka (vitalybuka)


Changes

Doing this because it's similar to `assume`, but I
can't see a difference neither for `assume` nor for
`allow`.

RFC: 
https://discourse.llvm.org/t/rfc-add-llvm-experimental-hot-intrinsic-or-llvm-hot/77641


---
Full diff: https://github.com/llvm/llvm-project/pull/86067.diff


2 Files Affected:

- (modified) llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp (+2) 
- (modified) llvm/test/Transforms/DeadStoreElimination/libcalls.ll (+17) 


``diff
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp 
b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index bfc8bd5970bf27..5a9ea420392f75 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -760,6 +760,8 @@ namespace {
 bool isNoopIntrinsic(Instruction *I) {
   if (const IntrinsicInst *II = dyn_cast(I)) {
 switch (II->getIntrinsicID()) {
+case Intrinsic::allow_runtime_check:
+case Intrinsic::allow_ubsan_check:
 case Intrinsic::lifetime_start:
 case Intrinsic::lifetime_end:
 case Intrinsic::invariant_end:
diff --git a/llvm/test/Transforms/DeadStoreElimination/libcalls.ll 
b/llvm/test/Transforms/DeadStoreElimination/libcalls.ll
index 4d9a767e08d490..7a4908d550a96a 100644
--- a/llvm/test/Transforms/DeadStoreElimination/libcalls.ll
+++ b/llvm/test/Transforms/DeadStoreElimination/libcalls.ll
@@ -487,3 +487,20 @@ define void @dse_strncpy_test6(ptr noalias %out1, ptr 
noalias %out2, ptr noalias
   %call = tail call ptr @strncpy(ptr %out2, ptr %in, i64 100)
   ret void
 }
+
+define i32 @test_strcat_with_allow_check(ptr %src) {
+; CHECK-LABEL: @test_strcat_with_allow_check(
+; CHECK-NEXT:[[ALLOW1:%.*]] = call i1 @llvm.allow.runtime.check(metadata 
!"test_check")
+; CHECK-NEXT:[[ALLOW2:%.*]] = call i1 @llvm.allow.ubsan.check(i8 7)
+; CHECK-NEXT:tail call void @llvm.memset.p0.i64(ptr [[B:%.*]], i8 44, i64 
16, i1 false)
+; CHECK-NEXT:[[RET:%.*]] = load i32, ptr [[B]], align 4
+; CHECK-NEXT:ret i32 [[RET]]
+;
+  tail call void @llvm.memset.p0.i64(ptr %src, i8 42, i64 16, i1 false)
+  %allow1 = call i1 @llvm.allow.runtime.check(metadata !"test_check")
+  tail call void @llvm.memset.p0.i64(ptr %src, i8 43, i64 16, i1 false)
+  %allow2 = call i1 @llvm.allow.ubsan.check(i8 7)
+  tail call void @llvm.memset.p0.i64(ptr %src, i8 44, i64 16, i1 false)
+  %ret = load i32, ptr %src, align 4
+  ret i32 %ret
+}

``




https://github.com/llvm/llvm-project/pull/86067
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [CodeGen] Add default lowering for llvm.allow.{runtime, ubsan}.check() (PR #86049)

2024-03-20 Thread Vitaly Buka via llvm-branch-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/86049


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


[llvm-branch-commits] [CodeGen] Add default lowering for llvm.allow.{runtime, ubsan}.check() (PR #86049)

2024-03-20 Thread Vitaly Buka via llvm-branch-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/86049


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


[llvm-branch-commits] [dse] Skip llvm.allow.{runtime, ubsan}.check() (PR #86067)

2024-03-20 Thread Vitaly Buka via llvm-branch-commits

https://github.com/vitalybuka created 
https://github.com/llvm/llvm-project/pull/86067

Doing this because it's similar to `assume`, but I
can't see a difference neither for `assume` nor for
`allow`.

RFC: 
https://discourse.llvm.org/t/rfc-add-llvm-experimental-hot-intrinsic-or-llvm-hot/77641



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


[llvm-branch-commits] [CIR][cmake] Add support for cmake variable CLANG_ENABLE_CIR (PR #86078)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza created https://github.com/llvm/llvm-project/pull/86078

Introduce a cmake variable that guards the inclusion of ClangIR into the
build of clang. Guard that we aren't trying to build without MLIR. Add
two subdirectories that, as of now, don't do anything.



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


[llvm-branch-commits] [CIR][cmake] Add support for cmake variable CLANG_ENABLE_CIR (PR #86078)

2024-03-20 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Nathan Lanza (lanza)


Changes

Introduce a cmake variable that guards the inclusion of ClangIR into the
build of clang. Guard that we aren't trying to build without MLIR. Add
two subdirectories that, as of now, don't do anything.


---
Full diff: https://github.com/llvm/llvm-project/pull/86078.diff


7 Files Affected:

- (modified) clang/CMakeLists.txt (+7) 
- (added) clang/include/clang/CIR/CMakeLists.txt () 
- (modified) clang/include/clang/CMakeLists.txt (+3) 
- (modified) clang/include/clang/Config/config.h.cmake (+3) 
- (added) clang/lib/CIR/CMakeLists.txt () 
- (modified) clang/lib/CMakeLists.txt (+4) 
- (modified) clang/test/CMakeLists.txt (+1) 


``diff
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 47fc2e4886cfc2..0e2e9dbf7b2528 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -164,6 +164,13 @@ if(CLANG_ENABLE_LIBXML2)
   endif()
 endif()
 
+if(CLANG_ENABLE_CIR)
+  if (NOT "${LLVM_ENABLE_PROJECTS}" MATCHES "MLIR|mlir")
+message(FATAL_ERROR
+  "Cannot build ClangIR without MLIR in LLVM_ENABLE_PROJECTS")
+  endif()
+endif()
+
 include(CheckIncludeFile)
 check_include_file(sys/resource.h CLANG_HAVE_RLIMITS)
 
diff --git a/clang/include/clang/CIR/CMakeLists.txt 
b/clang/include/clang/CIR/CMakeLists.txt
new file mode 100644
index 00..e69de29bb2d1d6
diff --git a/clang/include/clang/CMakeLists.txt 
b/clang/include/clang/CMakeLists.txt
index 0dc9ea5ed8ac8a..47ac70cd21690f 100644
--- a/clang/include/clang/CMakeLists.txt
+++ b/clang/include/clang/CMakeLists.txt
@@ -1,5 +1,8 @@
 add_subdirectory(AST)
 add_subdirectory(Basic)
+if(CLANG_ENABLE_CIR)
+  add_subdirectory(CIR)
+endif()
 add_subdirectory(Driver)
 add_subdirectory(Parse)
 add_subdirectory(Sema)
diff --git a/clang/include/clang/Config/config.h.cmake 
b/clang/include/clang/Config/config.h.cmake
index 4015ac8040861c..27ed69e21562bf 100644
--- a/clang/include/clang/Config/config.h.cmake
+++ b/clang/include/clang/Config/config.h.cmake
@@ -83,4 +83,7 @@
 /* Spawn a new process clang.exe for the CC1 tool invocation, when necessary */
 #cmakedefine01 CLANG_SPAWN_CC1
 
+/* Whether CIR is built into Clang */
+#cmakedefine01 CLANG_ENABLE_CIR
+
 #endif
diff --git a/clang/lib/CIR/CMakeLists.txt b/clang/lib/CIR/CMakeLists.txt
new file mode 100644
index 00..e69de29bb2d1d6
diff --git a/clang/lib/CMakeLists.txt b/clang/lib/CMakeLists.txt
index 0cac86451f39e4..14ba55360fe050 100644
--- a/clang/lib/CMakeLists.txt
+++ b/clang/lib/CMakeLists.txt
@@ -31,3 +31,7 @@ if(CLANG_INCLUDE_TESTS)
 endif()
 add_subdirectory(Interpreter)
 add_subdirectory(Support)
+
+if(CLANG_ENABLE_CIR)
+  add_subdirectory(CIR)
+endif()
diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt
index fcfca354f4a75f..df34a5707da33e 100644
--- a/clang/test/CMakeLists.txt
+++ b/clang/test/CMakeLists.txt
@@ -9,6 +9,7 @@ llvm_canonicalize_cmake_booleans(
   CLANG_ENABLE_STATIC_ANALYZER
   CLANG_PLUGIN_SUPPORT
   CLANG_SPAWN_CC1
+  CLANG_ENABLE_CIR
   ENABLE_BACKTRACES
   LLVM_ENABLE_ZLIB
   LLVM_ENABLE_ZSTD

``




https://github.com/llvm/llvm-project/pull/86078
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR][cmake] Add support for cmake variable CLANG_ENABLE_CIR (PR #86078)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86078

>From 0118187ba99172c6d892e4a05596085c0e637eb9 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 04:09:56 +
Subject: [PATCH] add lit usage

Created using spr 1.3.5
---
 clang/test/lit.site.cfg.py.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index ef75770a2c3c9a..6641811c588395 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -27,6 +27,7 @@ config.clang_default_pie_on_linux = 
@CLANG_DEFAULT_PIE_ON_LINUX@
 config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
 config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
 config.clang_staticanalyzer_z3 = @LLVM_WITH_Z3@
+config.clang_enable_cir = @CLANG_ENABLE_CIR@
 config.clang_examples = @CLANG_BUILD_EXAMPLES@
 config.enable_shared = @ENABLE_SHARED@
 config.enable_backtrace = @ENABLE_BACKTRACES@

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


[llvm-branch-commits] [clang] [CIR][Basic][NFC] Add the CIR language to the Language enum (PR #86072)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza edited https://github.com/llvm/llvm-project/pull/86072
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR][cmake] Add support for cmake variable CLANG_ENABLE_CIR (PR #86078)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86078

>From 0118187ba99172c6d892e4a05596085c0e637eb9 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 04:09:56 +
Subject: [PATCH] add lit usage

Created using spr 1.3.5
---
 clang/test/lit.site.cfg.py.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index ef75770a2c3c9a..6641811c588395 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -27,6 +27,7 @@ config.clang_default_pie_on_linux = 
@CLANG_DEFAULT_PIE_ON_LINUX@
 config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
 config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
 config.clang_staticanalyzer_z3 = @LLVM_WITH_Z3@
+config.clang_enable_cir = @CLANG_ENABLE_CIR@
 config.clang_examples = @CLANG_BUILD_EXAMPLES@
 config.enable_shared = @ENABLE_SHARED@
 config.enable_backtrace = @ENABLE_BACKTRACES@

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


[llvm-branch-commits] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza created https://github.com/llvm/llvm-project/pull/86080

This adds no real content, it just incrementally adds some scaffolding
necessary to enable a future patch to just add our first few ops.



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


[llvm-branch-commits] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)

2024-03-20 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Nathan Lanza (lanza)


Changes

This adds no real content, it just incrementally adds some scaffolding
necessary to enable a future patch to just add our first few ops.


---
Full diff: https://github.com/llvm/llvm-project/pull/86080.diff


9 Files Affected:

- (modified) clang/include/clang/CIR/CMakeLists.txt (+7) 
- (added) clang/include/clang/CIR/Dialect/CMakeLists.txt (+1) 
- (added) clang/include/clang/CIR/Dialect/IR/CIRDialect.h () 
- (added) clang/include/clang/CIR/Dialect/IR/CIROps.td () 
- (added) clang/include/clang/CIR/Dialect/IR/CMakeLists.txt (+16) 
- (modified) clang/lib/CIR/CMakeLists.txt (+4) 
- (added) clang/lib/CIR/Dialect/CMakeLists.txt (+1) 
- (added) clang/lib/CIR/Dialect/IR/CIRDialect.cpp () 
- (added) clang/lib/CIR/Dialect/IR/CMakeLists.txt () 


``diff
diff --git a/clang/include/clang/CIR/CMakeLists.txt 
b/clang/include/clang/CIR/CMakeLists.txt
index e69de29bb2d1d6..928dc6bf8a6fa4 100644
--- a/clang/include/clang/CIR/CMakeLists.txt
+++ b/clang/include/clang/CIR/CMakeLists.txt
@@ -0,0 +1,7 @@
+set(MLIR_MAIN_SRC_DIR ${LLVM_MAIN_SRC_DIR}/../mlir/include ) # --src-root
+set(MLIR_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/../mlir/include ) # --includedir
+set(MLIR_TABLEGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/tools/mlir/include)
+include_directories(SYSTEM ${MLIR_INCLUDE_DIR})
+include_directories(SYSTEM ${MLIR_TABLEGEN_OUTPUT_DIR})
+
+add_subdirectory(Dialect)
diff --git a/clang/include/clang/CIR/Dialect/CMakeLists.txt 
b/clang/include/clang/CIR/Dialect/CMakeLists.txt
new file mode 100644
index 00..f33061b2d87cff
--- /dev/null
+++ b/clang/include/clang/CIR/Dialect/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(IR)
diff --git a/clang/include/clang/CIR/Dialect/IR/CIRDialect.h 
b/clang/include/clang/CIR/Dialect/IR/CIRDialect.h
new file mode 100644
index 00..e69de29bb2d1d6
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td 
b/clang/include/clang/CIR/Dialect/IR/CIROps.td
new file mode 100644
index 00..e69de29bb2d1d6
diff --git a/clang/include/clang/CIR/Dialect/IR/CMakeLists.txt 
b/clang/include/clang/CIR/Dialect/IR/CMakeLists.txt
new file mode 100644
index 00..28ae30dab8dfb2
--- /dev/null
+++ b/clang/include/clang/CIR/Dialect/IR/CMakeLists.txt
@@ -0,0 +1,16 @@
+# This replicates part of the add_mlir_dialect cmake function from MLIR that
+# cannot be used here. This happens because it expects to be run inside MLIR
+# directory which is not the case for CIR (and also FIR, both have similar
+# workarounds).
+
+# Equivalent to add_mlir_dialect(CIROps cir)
+set(LLVM_TARGET_DEFINITIONS CIROps.td)
+mlir_tablegen(CIROps.h.inc -gen-op-decls)
+mlir_tablegen(CIROps.cpp.inc -gen-op-defs)
+mlir_tablegen(CIROpsTypes.h.inc -gen-typedef-decls)
+mlir_tablegen(CIROpsTypes.cpp.inc -gen-typedef-defs)
+mlir_tablegen(CIROpsDialect.h.inc -gen-dialect-decls)
+mlir_tablegen(CIROpsDialect.cpp.inc -gen-dialect-defs)
+add_public_tablegen_target(MLIRCIROpsIncGen)
+add_dependencies(mlir-headers MLIRCIROpsIncGen)
+
diff --git a/clang/lib/CIR/CMakeLists.txt b/clang/lib/CIR/CMakeLists.txt
index e69de29bb2d1d6..d2ff200e0da5f5 100644
--- a/clang/lib/CIR/CMakeLists.txt
+++ b/clang/lib/CIR/CMakeLists.txt
@@ -0,0 +1,4 @@
+include_directories(${LLVM_MAIN_SRC_DIR}/../mlir/include)
+include_directories(${CMAKE_BINARY_DIR}/tools/mlir/include)
+
+add_subdirectory(Dialect)
diff --git a/clang/lib/CIR/Dialect/CMakeLists.txt 
b/clang/lib/CIR/Dialect/CMakeLists.txt
new file mode 100644
index 00..f33061b2d87cff
--- /dev/null
+++ b/clang/lib/CIR/Dialect/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(IR)
diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp 
b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
new file mode 100644
index 00..e69de29bb2d1d6
diff --git a/clang/lib/CIR/Dialect/IR/CMakeLists.txt 
b/clang/lib/CIR/Dialect/IR/CMakeLists.txt
new file mode 100644
index 00..e69de29bb2d1d6

``




https://github.com/llvm/llvm-project/pull/86080
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86080

>From 435869501bb0788d8b22d847c3a870dbfbf94126 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 04:57:16 +
Subject: [PATCH] fix MLIRCIROpsIncGen

Created using spr 1.3.5
---
 .../clang/CIR/Dialect/IR/CIRDialect.td| 46 +++
 clang/include/clang/CIR/Dialect/IR/CIROps.td  | 18 
 2 files changed, 64 insertions(+)
 create mode 100644 clang/include/clang/CIR/Dialect/IR/CIRDialect.td

diff --git a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td 
b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
new file mode 100644
index 00..8f756fa422e5f3
--- /dev/null
+++ b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
@@ -0,0 +1,46 @@
+//===- CIRTypes.td - CIR dialect types -*- tablegen 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file declares the CIR dialect.
+//
+//===--===//
+
+#ifndef MLIR_CIR_DIALECT_CIR
+#define MLIR_CIR_DIALECT_CIR
+
+include "mlir/IR/OpBase.td"
+
+def CIR_Dialect : Dialect {
+  let name = "cir";
+
+  // A short one-line summary of our dialect.
+  let summary = "A high-level dialect for analyzing and optimizing Clang "
+"supported languages";
+
+  let cppNamespace = "::mlir::cir";
+
+  let useDefaultAttributePrinterParser = 0;
+  let useDefaultTypePrinterParser = 0;
+
+  let extraClassDeclaration = [{
+void registerAttributes();
+void registerTypes();
+
+::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override;
+void printType(::mlir::Type type,
+   ::mlir::DialectAsmPrinter &printer) const override;
+
+::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser,
+ ::mlir::Type type) const override;
+
+void printAttribute(::mlir::Attribute attr,
+::mlir::DialectAsmPrinter &os) const override;
+  }];
+}
+
+#endif // MLIR_CIR_DIALECT_CIR
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td 
b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index e69de29bb2d1d6..cfc62986b0b9d1 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -0,0 +1,18 @@
+//===-- CIROps.td - CIR dialect definition -*- tablegen 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file
+/// Definition of the CIR dialect
+///
+//===--===//
+
+#ifndef MLIR_CIR_DIALECT_CIR_OPS
+#define MLIR_CIR_DIALECT_CIR_OPS
+
+include "clang/CIR/Dialect/IR/CIRDialect.td"
+#endif // MLIR_CIR_DIALECT_CIR_OPS

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


[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza edited https://github.com/llvm/llvm-project/pull/86080
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR][Basic][NFC] Add the CIR language to the Language enum (PR #86072)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86072

>From 115f1dcca7b20dacdc5beef0e73819aef94f0ec1 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 03:24:54 +
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.5
---
 clang/include/clang/Basic/LangStandard.h|  1 +
 clang/include/clang/Driver/Types.def|  1 +
 clang/lib/Basic/LangStandards.cpp   |  3 +++
 .../Serialization/SymbolGraphSerializer.cpp |  1 +
 clang/lib/Frontend/CompilerInvocation.cpp   | 13 +++--
 clang/lib/Frontend/FrontendActions.cpp  |  1 +
 clang/lib/Frontend/FrontendOptions.cpp  |  1 +
 7 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/clang/include/clang/Basic/LangStandard.h 
b/clang/include/clang/Basic/LangStandard.h
index 199e24c6731603..ed9572672f0563 100644
--- a/clang/include/clang/Basic/LangStandard.h
+++ b/clang/include/clang/Basic/LangStandard.h
@@ -41,6 +41,7 @@ enum class Language : uint8_t {
   RenderScript,
   HIP,
   HLSL,
+  CIR,
   ///@}
 };
 StringRef languageToString(Language L);
diff --git a/clang/include/clang/Driver/Types.def 
b/clang/include/clang/Driver/Types.def
index f72c27e1ee7019..0e0cae5fb7068d 100644
--- a/clang/include/clang/Driver/Types.def
+++ b/clang/include/clang/Driver/Types.def
@@ -90,6 +90,7 @@ TYPE("ir",   LLVM_BC,  INVALID,   
  "bc", phases
 TYPE("lto-ir",   LTO_IR,   INVALID, "s",  
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 TYPE("lto-bc",   LTO_BC,   INVALID, "o",  
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 
+TYPE("cir",  CIR,  INVALID, "cir",
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 // Misc.
 TYPE("ast",  AST,  INVALID, "ast",
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 TYPE("ifs",  IFS,  INVALID, "ifs",
phases::IfsMerge)
diff --git a/clang/lib/Basic/LangStandards.cpp 
b/clang/lib/Basic/LangStandards.cpp
index cb2c0772349982..c8c9292abcb22b 100644
--- a/clang/lib/Basic/LangStandards.cpp
+++ b/clang/lib/Basic/LangStandards.cpp
@@ -21,6 +21,8 @@ StringRef clang::languageToString(Language L) {
 return "Asm";
   case Language::LLVM_IR:
 return "LLVM IR";
+  case Language::CIR:
+return "ClangIR";
   case Language::C:
 return "C";
   case Language::CXX:
@@ -92,6 +94,7 @@ LangStandard::Kind 
clang::getDefaultLanguageStandard(clang::Language Lang,
   switch (Lang) {
   case Language::Unknown:
   case Language::LLVM_IR:
+  case Language::CIR:
 llvm_unreachable("Invalid input kind!");
   case Language::OpenCL:
 return LangStandard::lang_opencl12;
diff --git a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp 
b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
index 349b93e2a2326f..545860acb7db80 100644
--- a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -208,6 +208,7 @@ StringRef getLanguageName(Language Lang) {
   case Language::Unknown:
   case Language::Asm:
   case Language::LLVM_IR:
+  case Language::CIR:
 llvm_unreachable("Unsupported language kind");
   }
 
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 0df6a82ccd8933..7bd91d4791ecf0 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -2757,6 +2757,9 @@ static void GenerateFrontendArgs(const FrontendOptions 
&Opts,
 case Language::HLSL:
   Lang = "hlsl";
   break;
+case Language::CIR:
+  Lang = "cir";
+  break;
 }
 
 GenerateArg(Consumer, OPT_x,
@@ -2958,6 +2961,7 @@ static bool ParseFrontendArgs(FrontendOptions &Opts, 
ArgList &Args,
   .Cases("ast", "pcm", "precompiled-header",
  InputKind(Language::Unknown, InputKind::Precompiled))
   .Case("ir", Language::LLVM_IR)
+  .Case("cir", Language::CIR)
   .Default(Language::Unknown);
 
 if (DashX.isUnknown())
@@ -3323,6 +3327,7 @@ static bool IsInputCompatibleWithStandard(InputKind IK,
   switch (IK.getLanguage()) {
   case Language::Unknown:
   case Language::LLVM_IR:
+  case Language::CIR:
 llvm_unreachable("should not parse language flags for this input");
 
   case Language::C:
@@ -3388,6 +3393,8 @@ static StringRef GetInputKindName(InputKind IK) {
 return "Asm";
   case Language::LLVM_IR:
 return "LLVM IR";
+  case Language::CIR:
+return "Clang IR";
 
   case Language::HLSL:
 return "HLSL"

[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)

2024-03-20 Thread Bruno Cardoso Lopes via llvm-branch-commits

https://github.com/bcardosolopes commented:

Maybe add the header for `CIRDialect.cpp` so that we don't land an empty file? 

https://github.com/llvm/llvm-project/pull/86080
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)

2024-03-20 Thread Bruno Cardoso Lopes via llvm-branch-commits

https://github.com/bcardosolopes edited 
https://github.com/llvm/llvm-project/pull/86080
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR][Basic][NFC] Add the CIR language to the Language enum (PR #86072)

2024-03-20 Thread Bruno Cardoso Lopes via llvm-branch-commits


@@ -41,6 +41,7 @@ enum class Language : uint8_t {
   RenderScript,
   HIP,
   HLSL,
+  CIR,

bcardosolopes wrote:

Should this come after `LLVM_IR` with its own / similar comment?

https://github.com/llvm/llvm-project/pull/86072
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR][cmake] Add support for cmake variable CLANG_ENABLE_CIR (PR #86078)

2024-03-20 Thread Bruno Cardoso Lopes via llvm-branch-commits

https://github.com/bcardosolopes approved this pull request.


https://github.com/llvm/llvm-project/pull/86078
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza edited https://github.com/llvm/llvm-project/pull/86080
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86080

>From 435869501bb0788d8b22d847c3a870dbfbf94126 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 04:57:16 +
Subject: [PATCH 1/2] fix MLIRCIROpsIncGen

Created using spr 1.3.5
---
 .../clang/CIR/Dialect/IR/CIRDialect.td| 46 +++
 clang/include/clang/CIR/Dialect/IR/CIROps.td  | 18 
 2 files changed, 64 insertions(+)
 create mode 100644 clang/include/clang/CIR/Dialect/IR/CIRDialect.td

diff --git a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td 
b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
new file mode 100644
index 00..8f756fa422e5f3
--- /dev/null
+++ b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
@@ -0,0 +1,46 @@
+//===- CIRTypes.td - CIR dialect types -*- tablegen 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file declares the CIR dialect.
+//
+//===--===//
+
+#ifndef MLIR_CIR_DIALECT_CIR
+#define MLIR_CIR_DIALECT_CIR
+
+include "mlir/IR/OpBase.td"
+
+def CIR_Dialect : Dialect {
+  let name = "cir";
+
+  // A short one-line summary of our dialect.
+  let summary = "A high-level dialect for analyzing and optimizing Clang "
+"supported languages";
+
+  let cppNamespace = "::mlir::cir";
+
+  let useDefaultAttributePrinterParser = 0;
+  let useDefaultTypePrinterParser = 0;
+
+  let extraClassDeclaration = [{
+void registerAttributes();
+void registerTypes();
+
+::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override;
+void printType(::mlir::Type type,
+   ::mlir::DialectAsmPrinter &printer) const override;
+
+::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser,
+ ::mlir::Type type) const override;
+
+void printAttribute(::mlir::Attribute attr,
+::mlir::DialectAsmPrinter &os) const override;
+  }];
+}
+
+#endif // MLIR_CIR_DIALECT_CIR
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td 
b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index e69de29bb2d1d6..cfc62986b0b9d1 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -0,0 +1,18 @@
+//===-- CIROps.td - CIR dialect definition -*- tablegen 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file
+/// Definition of the CIR dialect
+///
+//===--===//
+
+#ifndef MLIR_CIR_DIALECT_CIR_OPS
+#define MLIR_CIR_DIALECT_CIR_OPS
+
+include "clang/CIR/Dialect/IR/CIRDialect.td"
+#endif // MLIR_CIR_DIALECT_CIR_OPS

>From fe44284534be0752d95634251289a5c74c06afe7 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 05:12:26 +
Subject: [PATCH 2/2] add some guts to CIRDialect.cpp and MLIRCIR lib

Created using spr 1.3.5
---
 clang/lib/CIR/Dialect/IR/CIRDialect.cpp | 11 +++
 clang/lib/CIR/Dialect/IR/CMakeLists.txt |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp 
b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
index e69de29bb2d1d6..8abf39119e04f7 100644
--- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
+++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
@@ -0,0 +1,11 @@
+//===- CIRDialect.cpp - MLIR CIR ops implementation 
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file implements the CIR dialect and its operations.
+//
+//===--===//
diff --git a/clang/lib/CIR/Dialect/IR/CMakeLists.txt 
b/clang/lib/CIR/Dialect/IR/CMakeLists.txt
index e69de29bb2d1d6..0d7476b555705d 100644
--- a/clang/lib/CIR/Dialect/IR/CMakeLists.txt
+++ b/clang/lib/CIR/Dialect/IR/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_clang_library(MLIRCIR
+  CIRDialect.cpp
+  )

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


[llvm-branch-commits] [flang] [flang][OpenMP] Refactor nested default clause tests (PR #85978)

2024-03-20 Thread via llvm-branch-commits

https://github.com/NimishMishra approved this pull request.

LGTM! Thanks.

https://github.com/llvm/llvm-project/pull/85978
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR][Basic][NFC] Add the CIR language to the Language enum (PR #86072)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86072

>From 115f1dcca7b20dacdc5beef0e73819aef94f0ec1 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 03:24:54 +
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.5
---
 clang/include/clang/Basic/LangStandard.h|  1 +
 clang/include/clang/Driver/Types.def|  1 +
 clang/lib/Basic/LangStandards.cpp   |  3 +++
 .../Serialization/SymbolGraphSerializer.cpp |  1 +
 clang/lib/Frontend/CompilerInvocation.cpp   | 13 +++--
 clang/lib/Frontend/FrontendActions.cpp  |  1 +
 clang/lib/Frontend/FrontendOptions.cpp  |  1 +
 7 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/clang/include/clang/Basic/LangStandard.h 
b/clang/include/clang/Basic/LangStandard.h
index 199e24c6731603..ed9572672f0563 100644
--- a/clang/include/clang/Basic/LangStandard.h
+++ b/clang/include/clang/Basic/LangStandard.h
@@ -41,6 +41,7 @@ enum class Language : uint8_t {
   RenderScript,
   HIP,
   HLSL,
+  CIR,
   ///@}
 };
 StringRef languageToString(Language L);
diff --git a/clang/include/clang/Driver/Types.def 
b/clang/include/clang/Driver/Types.def
index f72c27e1ee7019..0e0cae5fb7068d 100644
--- a/clang/include/clang/Driver/Types.def
+++ b/clang/include/clang/Driver/Types.def
@@ -90,6 +90,7 @@ TYPE("ir",   LLVM_BC,  INVALID,   
  "bc", phases
 TYPE("lto-ir",   LTO_IR,   INVALID, "s",  
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 TYPE("lto-bc",   LTO_BC,   INVALID, "o",  
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 
+TYPE("cir",  CIR,  INVALID, "cir",
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 // Misc.
 TYPE("ast",  AST,  INVALID, "ast",
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 TYPE("ifs",  IFS,  INVALID, "ifs",
phases::IfsMerge)
diff --git a/clang/lib/Basic/LangStandards.cpp 
b/clang/lib/Basic/LangStandards.cpp
index cb2c0772349982..c8c9292abcb22b 100644
--- a/clang/lib/Basic/LangStandards.cpp
+++ b/clang/lib/Basic/LangStandards.cpp
@@ -21,6 +21,8 @@ StringRef clang::languageToString(Language L) {
 return "Asm";
   case Language::LLVM_IR:
 return "LLVM IR";
+  case Language::CIR:
+return "ClangIR";
   case Language::C:
 return "C";
   case Language::CXX:
@@ -92,6 +94,7 @@ LangStandard::Kind 
clang::getDefaultLanguageStandard(clang::Language Lang,
   switch (Lang) {
   case Language::Unknown:
   case Language::LLVM_IR:
+  case Language::CIR:
 llvm_unreachable("Invalid input kind!");
   case Language::OpenCL:
 return LangStandard::lang_opencl12;
diff --git a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp 
b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
index 349b93e2a2326f..545860acb7db80 100644
--- a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -208,6 +208,7 @@ StringRef getLanguageName(Language Lang) {
   case Language::Unknown:
   case Language::Asm:
   case Language::LLVM_IR:
+  case Language::CIR:
 llvm_unreachable("Unsupported language kind");
   }
 
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 0df6a82ccd8933..7bd91d4791ecf0 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -2757,6 +2757,9 @@ static void GenerateFrontendArgs(const FrontendOptions 
&Opts,
 case Language::HLSL:
   Lang = "hlsl";
   break;
+case Language::CIR:
+  Lang = "cir";
+  break;
 }
 
 GenerateArg(Consumer, OPT_x,
@@ -2958,6 +2961,7 @@ static bool ParseFrontendArgs(FrontendOptions &Opts, 
ArgList &Args,
   .Cases("ast", "pcm", "precompiled-header",
  InputKind(Language::Unknown, InputKind::Precompiled))
   .Case("ir", Language::LLVM_IR)
+  .Case("cir", Language::CIR)
   .Default(Language::Unknown);
 
 if (DashX.isUnknown())
@@ -3323,6 +3327,7 @@ static bool IsInputCompatibleWithStandard(InputKind IK,
   switch (IK.getLanguage()) {
   case Language::Unknown:
   case Language::LLVM_IR:
+  case Language::CIR:
 llvm_unreachable("should not parse language flags for this input");
 
   case Language::C:
@@ -3388,6 +3393,8 @@ static StringRef GetInputKindName(InputKind IK) {
 return "Asm";
   case Language::LLVM_IR:
 return "LLVM IR";
+  case Language::CIR:
+return "Clang IR";
 
   case Language::HLSL:
 return "H

[llvm-branch-commits] [clang] [CIR][cmake] Add support for cmake variable CLANG_ENABLE_CIR (PR #86078)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86078

>From 0118187ba99172c6d892e4a05596085c0e637eb9 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 04:09:56 +
Subject: [PATCH] add lit usage

Created using spr 1.3.5
---
 clang/test/lit.site.cfg.py.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index ef75770a2c3c9a..6641811c588395 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -27,6 +27,7 @@ config.clang_default_pie_on_linux = 
@CLANG_DEFAULT_PIE_ON_LINUX@
 config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
 config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
 config.clang_staticanalyzer_z3 = @LLVM_WITH_Z3@
+config.clang_enable_cir = @CLANG_ENABLE_CIR@
 config.clang_examples = @CLANG_BUILD_EXAMPLES@
 config.enable_shared = @ENABLE_SHARED@
 config.enable_backtrace = @ENABLE_BACKTRACES@

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


[llvm-branch-commits] [clang] [CIR][cmake] Add support for cmake variable CLANG_ENABLE_CIR (PR #86078)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86078

>From 0118187ba99172c6d892e4a05596085c0e637eb9 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 04:09:56 +
Subject: [PATCH] add lit usage

Created using spr 1.3.5
---
 clang/test/lit.site.cfg.py.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index ef75770a2c3c9a..6641811c588395 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -27,6 +27,7 @@ config.clang_default_pie_on_linux = 
@CLANG_DEFAULT_PIE_ON_LINUX@
 config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
 config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
 config.clang_staticanalyzer_z3 = @LLVM_WITH_Z3@
+config.clang_enable_cir = @CLANG_ENABLE_CIR@
 config.clang_examples = @CLANG_BUILD_EXAMPLES@
 config.enable_shared = @ENABLE_SHARED@
 config.enable_backtrace = @ENABLE_BACKTRACES@

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


[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86080

>From 435869501bb0788d8b22d847c3a870dbfbf94126 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 04:57:16 +
Subject: [PATCH 1/2] fix MLIRCIROpsIncGen

Created using spr 1.3.5
---
 .../clang/CIR/Dialect/IR/CIRDialect.td| 46 +++
 clang/include/clang/CIR/Dialect/IR/CIROps.td  | 18 
 2 files changed, 64 insertions(+)
 create mode 100644 clang/include/clang/CIR/Dialect/IR/CIRDialect.td

diff --git a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td 
b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
new file mode 100644
index 00..8f756fa422e5f3
--- /dev/null
+++ b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
@@ -0,0 +1,46 @@
+//===- CIRTypes.td - CIR dialect types -*- tablegen 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file declares the CIR dialect.
+//
+//===--===//
+
+#ifndef MLIR_CIR_DIALECT_CIR
+#define MLIR_CIR_DIALECT_CIR
+
+include "mlir/IR/OpBase.td"
+
+def CIR_Dialect : Dialect {
+  let name = "cir";
+
+  // A short one-line summary of our dialect.
+  let summary = "A high-level dialect for analyzing and optimizing Clang "
+"supported languages";
+
+  let cppNamespace = "::mlir::cir";
+
+  let useDefaultAttributePrinterParser = 0;
+  let useDefaultTypePrinterParser = 0;
+
+  let extraClassDeclaration = [{
+void registerAttributes();
+void registerTypes();
+
+::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override;
+void printType(::mlir::Type type,
+   ::mlir::DialectAsmPrinter &printer) const override;
+
+::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser,
+ ::mlir::Type type) const override;
+
+void printAttribute(::mlir::Attribute attr,
+::mlir::DialectAsmPrinter &os) const override;
+  }];
+}
+
+#endif // MLIR_CIR_DIALECT_CIR
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td 
b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index e69de29bb2d1d6..cfc62986b0b9d1 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -0,0 +1,18 @@
+//===-- CIROps.td - CIR dialect definition -*- tablegen 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file
+/// Definition of the CIR dialect
+///
+//===--===//
+
+#ifndef MLIR_CIR_DIALECT_CIR_OPS
+#define MLIR_CIR_DIALECT_CIR_OPS
+
+include "clang/CIR/Dialect/IR/CIRDialect.td"
+#endif // MLIR_CIR_DIALECT_CIR_OPS

>From fe44284534be0752d95634251289a5c74c06afe7 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 05:12:26 +
Subject: [PATCH 2/2] add some guts to CIRDialect.cpp and MLIRCIR lib

Created using spr 1.3.5
---
 clang/lib/CIR/Dialect/IR/CIRDialect.cpp | 11 +++
 clang/lib/CIR/Dialect/IR/CMakeLists.txt |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp 
b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
index e69de29bb2d1d6..8abf39119e04f7 100644
--- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
+++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
@@ -0,0 +1,11 @@
+//===- CIRDialect.cpp - MLIR CIR ops implementation 
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file implements the CIR dialect and its operations.
+//
+//===--===//
diff --git a/clang/lib/CIR/Dialect/IR/CMakeLists.txt 
b/clang/lib/CIR/Dialect/IR/CMakeLists.txt
index e69de29bb2d1d6..0d7476b555705d 100644
--- a/clang/lib/CIR/Dialect/IR/CMakeLists.txt
+++ b/clang/lib/CIR/Dialect/IR/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_clang_library(MLIRCIR
+  CIRDialect.cpp
+  )

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


[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86080

>From 435869501bb0788d8b22d847c3a870dbfbf94126 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 04:57:16 +
Subject: [PATCH 1/2] fix MLIRCIROpsIncGen

Created using spr 1.3.5
---
 .../clang/CIR/Dialect/IR/CIRDialect.td| 46 +++
 clang/include/clang/CIR/Dialect/IR/CIROps.td  | 18 
 2 files changed, 64 insertions(+)
 create mode 100644 clang/include/clang/CIR/Dialect/IR/CIRDialect.td

diff --git a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td 
b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
new file mode 100644
index 00..8f756fa422e5f3
--- /dev/null
+++ b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
@@ -0,0 +1,46 @@
+//===- CIRTypes.td - CIR dialect types -*- tablegen 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file declares the CIR dialect.
+//
+//===--===//
+
+#ifndef MLIR_CIR_DIALECT_CIR
+#define MLIR_CIR_DIALECT_CIR
+
+include "mlir/IR/OpBase.td"
+
+def CIR_Dialect : Dialect {
+  let name = "cir";
+
+  // A short one-line summary of our dialect.
+  let summary = "A high-level dialect for analyzing and optimizing Clang "
+"supported languages";
+
+  let cppNamespace = "::mlir::cir";
+
+  let useDefaultAttributePrinterParser = 0;
+  let useDefaultTypePrinterParser = 0;
+
+  let extraClassDeclaration = [{
+void registerAttributes();
+void registerTypes();
+
+::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override;
+void printType(::mlir::Type type,
+   ::mlir::DialectAsmPrinter &printer) const override;
+
+::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser,
+ ::mlir::Type type) const override;
+
+void printAttribute(::mlir::Attribute attr,
+::mlir::DialectAsmPrinter &os) const override;
+  }];
+}
+
+#endif // MLIR_CIR_DIALECT_CIR
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td 
b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index e69de29bb2d1d6..cfc62986b0b9d1 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -0,0 +1,18 @@
+//===-- CIROps.td - CIR dialect definition -*- tablegen 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file
+/// Definition of the CIR dialect
+///
+//===--===//
+
+#ifndef MLIR_CIR_DIALECT_CIR_OPS
+#define MLIR_CIR_DIALECT_CIR_OPS
+
+include "clang/CIR/Dialect/IR/CIRDialect.td"
+#endif // MLIR_CIR_DIALECT_CIR_OPS

>From fe44284534be0752d95634251289a5c74c06afe7 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 05:12:26 +
Subject: [PATCH 2/2] add some guts to CIRDialect.cpp and MLIRCIR lib

Created using spr 1.3.5
---
 clang/lib/CIR/Dialect/IR/CIRDialect.cpp | 11 +++
 clang/lib/CIR/Dialect/IR/CMakeLists.txt |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp 
b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
index e69de29bb2d1d6..8abf39119e04f7 100644
--- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
+++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
@@ -0,0 +1,11 @@
+//===- CIRDialect.cpp - MLIR CIR ops implementation 
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file implements the CIR dialect and its operations.
+//
+//===--===//
diff --git a/clang/lib/CIR/Dialect/IR/CMakeLists.txt 
b/clang/lib/CIR/Dialect/IR/CMakeLists.txt
index e69de29bb2d1d6..0d7476b555705d 100644
--- a/clang/lib/CIR/Dialect/IR/CMakeLists.txt
+++ b/clang/lib/CIR/Dialect/IR/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_clang_library(MLIRCIR
+  CIRDialect.cpp
+  )

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


[llvm-branch-commits] [clang] [CIR][Basic][NFC] Add the CIR language to the Language enum (PR #86072)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86072

>From 115f1dcca7b20dacdc5beef0e73819aef94f0ec1 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 03:24:54 +
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.5
---
 clang/include/clang/Basic/LangStandard.h|  1 +
 clang/include/clang/Driver/Types.def|  1 +
 clang/lib/Basic/LangStandards.cpp   |  3 +++
 .../Serialization/SymbolGraphSerializer.cpp |  1 +
 clang/lib/Frontend/CompilerInvocation.cpp   | 13 +++--
 clang/lib/Frontend/FrontendActions.cpp  |  1 +
 clang/lib/Frontend/FrontendOptions.cpp  |  1 +
 7 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/clang/include/clang/Basic/LangStandard.h 
b/clang/include/clang/Basic/LangStandard.h
index 199e24c6731603..ed9572672f0563 100644
--- a/clang/include/clang/Basic/LangStandard.h
+++ b/clang/include/clang/Basic/LangStandard.h
@@ -41,6 +41,7 @@ enum class Language : uint8_t {
   RenderScript,
   HIP,
   HLSL,
+  CIR,
   ///@}
 };
 StringRef languageToString(Language L);
diff --git a/clang/include/clang/Driver/Types.def 
b/clang/include/clang/Driver/Types.def
index f72c27e1ee7019..0e0cae5fb7068d 100644
--- a/clang/include/clang/Driver/Types.def
+++ b/clang/include/clang/Driver/Types.def
@@ -90,6 +90,7 @@ TYPE("ir",   LLVM_BC,  INVALID,   
  "bc", phases
 TYPE("lto-ir",   LTO_IR,   INVALID, "s",  
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 TYPE("lto-bc",   LTO_BC,   INVALID, "o",  
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 
+TYPE("cir",  CIR,  INVALID, "cir",
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 // Misc.
 TYPE("ast",  AST,  INVALID, "ast",
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 TYPE("ifs",  IFS,  INVALID, "ifs",
phases::IfsMerge)
diff --git a/clang/lib/Basic/LangStandards.cpp 
b/clang/lib/Basic/LangStandards.cpp
index cb2c0772349982..c8c9292abcb22b 100644
--- a/clang/lib/Basic/LangStandards.cpp
+++ b/clang/lib/Basic/LangStandards.cpp
@@ -21,6 +21,8 @@ StringRef clang::languageToString(Language L) {
 return "Asm";
   case Language::LLVM_IR:
 return "LLVM IR";
+  case Language::CIR:
+return "ClangIR";
   case Language::C:
 return "C";
   case Language::CXX:
@@ -92,6 +94,7 @@ LangStandard::Kind 
clang::getDefaultLanguageStandard(clang::Language Lang,
   switch (Lang) {
   case Language::Unknown:
   case Language::LLVM_IR:
+  case Language::CIR:
 llvm_unreachable("Invalid input kind!");
   case Language::OpenCL:
 return LangStandard::lang_opencl12;
diff --git a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp 
b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
index 349b93e2a2326f..545860acb7db80 100644
--- a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -208,6 +208,7 @@ StringRef getLanguageName(Language Lang) {
   case Language::Unknown:
   case Language::Asm:
   case Language::LLVM_IR:
+  case Language::CIR:
 llvm_unreachable("Unsupported language kind");
   }
 
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 0df6a82ccd8933..7bd91d4791ecf0 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -2757,6 +2757,9 @@ static void GenerateFrontendArgs(const FrontendOptions 
&Opts,
 case Language::HLSL:
   Lang = "hlsl";
   break;
+case Language::CIR:
+  Lang = "cir";
+  break;
 }
 
 GenerateArg(Consumer, OPT_x,
@@ -2958,6 +2961,7 @@ static bool ParseFrontendArgs(FrontendOptions &Opts, 
ArgList &Args,
   .Cases("ast", "pcm", "precompiled-header",
  InputKind(Language::Unknown, InputKind::Precompiled))
   .Case("ir", Language::LLVM_IR)
+  .Case("cir", Language::CIR)
   .Default(Language::Unknown);
 
 if (DashX.isUnknown())
@@ -3323,6 +3327,7 @@ static bool IsInputCompatibleWithStandard(InputKind IK,
   switch (IK.getLanguage()) {
   case Language::Unknown:
   case Language::LLVM_IR:
+  case Language::CIR:
 llvm_unreachable("should not parse language flags for this input");
 
   case Language::C:
@@ -3388,6 +3393,8 @@ static StringRef GetInputKindName(InputKind IK) {
 return "Asm";
   case Language::LLVM_IR:
 return "LLVM IR";
+  case Language::CIR:
+return "Clang IR";
 
   case Language::HLSL:
 return "H

[llvm-branch-commits] [clang] [CIR][Basic][NFC] Add the CIR language to the Language enum (PR #86072)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86072

>From 115f1dcca7b20dacdc5beef0e73819aef94f0ec1 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 03:24:54 +
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.5
---
 clang/include/clang/Basic/LangStandard.h|  1 +
 clang/include/clang/Driver/Types.def|  1 +
 clang/lib/Basic/LangStandards.cpp   |  3 +++
 .../Serialization/SymbolGraphSerializer.cpp |  1 +
 clang/lib/Frontend/CompilerInvocation.cpp   | 13 +++--
 clang/lib/Frontend/FrontendActions.cpp  |  1 +
 clang/lib/Frontend/FrontendOptions.cpp  |  1 +
 7 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/clang/include/clang/Basic/LangStandard.h 
b/clang/include/clang/Basic/LangStandard.h
index 199e24c6731603..ed9572672f0563 100644
--- a/clang/include/clang/Basic/LangStandard.h
+++ b/clang/include/clang/Basic/LangStandard.h
@@ -41,6 +41,7 @@ enum class Language : uint8_t {
   RenderScript,
   HIP,
   HLSL,
+  CIR,
   ///@}
 };
 StringRef languageToString(Language L);
diff --git a/clang/include/clang/Driver/Types.def 
b/clang/include/clang/Driver/Types.def
index f72c27e1ee7019..0e0cae5fb7068d 100644
--- a/clang/include/clang/Driver/Types.def
+++ b/clang/include/clang/Driver/Types.def
@@ -90,6 +90,7 @@ TYPE("ir",   LLVM_BC,  INVALID,   
  "bc", phases
 TYPE("lto-ir",   LTO_IR,   INVALID, "s",  
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 TYPE("lto-bc",   LTO_BC,   INVALID, "o",  
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 
+TYPE("cir",  CIR,  INVALID, "cir",
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 // Misc.
 TYPE("ast",  AST,  INVALID, "ast",
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 TYPE("ifs",  IFS,  INVALID, "ifs",
phases::IfsMerge)
diff --git a/clang/lib/Basic/LangStandards.cpp 
b/clang/lib/Basic/LangStandards.cpp
index cb2c0772349982..c8c9292abcb22b 100644
--- a/clang/lib/Basic/LangStandards.cpp
+++ b/clang/lib/Basic/LangStandards.cpp
@@ -21,6 +21,8 @@ StringRef clang::languageToString(Language L) {
 return "Asm";
   case Language::LLVM_IR:
 return "LLVM IR";
+  case Language::CIR:
+return "ClangIR";
   case Language::C:
 return "C";
   case Language::CXX:
@@ -92,6 +94,7 @@ LangStandard::Kind 
clang::getDefaultLanguageStandard(clang::Language Lang,
   switch (Lang) {
   case Language::Unknown:
   case Language::LLVM_IR:
+  case Language::CIR:
 llvm_unreachable("Invalid input kind!");
   case Language::OpenCL:
 return LangStandard::lang_opencl12;
diff --git a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp 
b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
index 349b93e2a2326f..545860acb7db80 100644
--- a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -208,6 +208,7 @@ StringRef getLanguageName(Language Lang) {
   case Language::Unknown:
   case Language::Asm:
   case Language::LLVM_IR:
+  case Language::CIR:
 llvm_unreachable("Unsupported language kind");
   }
 
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 0df6a82ccd8933..7bd91d4791ecf0 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -2757,6 +2757,9 @@ static void GenerateFrontendArgs(const FrontendOptions 
&Opts,
 case Language::HLSL:
   Lang = "hlsl";
   break;
+case Language::CIR:
+  Lang = "cir";
+  break;
 }
 
 GenerateArg(Consumer, OPT_x,
@@ -2958,6 +2961,7 @@ static bool ParseFrontendArgs(FrontendOptions &Opts, 
ArgList &Args,
   .Cases("ast", "pcm", "precompiled-header",
  InputKind(Language::Unknown, InputKind::Precompiled))
   .Case("ir", Language::LLVM_IR)
+  .Case("cir", Language::CIR)
   .Default(Language::Unknown);
 
 if (DashX.isUnknown())
@@ -3323,6 +3327,7 @@ static bool IsInputCompatibleWithStandard(InputKind IK,
   switch (IK.getLanguage()) {
   case Language::Unknown:
   case Language::LLVM_IR:
+  case Language::CIR:
 llvm_unreachable("should not parse language flags for this input");
 
   case Language::C:
@@ -3388,6 +3393,8 @@ static StringRef GetInputKindName(InputKind IK) {
 return "Asm";
   case Language::LLVM_IR:
 return "LLVM IR";
+  case Language::CIR:
+return "Clang IR";
 
   case Language::HLSL:
 return "H

[llvm-branch-commits] [clang] [CIR][cmake] Add support for cmake variable CLANG_ENABLE_CIR (PR #86078)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86078

>From 0118187ba99172c6d892e4a05596085c0e637eb9 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 04:09:56 +
Subject: [PATCH] add lit usage

Created using spr 1.3.5
---
 clang/test/lit.site.cfg.py.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index ef75770a2c3c9a..6641811c588395 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -27,6 +27,7 @@ config.clang_default_pie_on_linux = 
@CLANG_DEFAULT_PIE_ON_LINUX@
 config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
 config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
 config.clang_staticanalyzer_z3 = @LLVM_WITH_Z3@
+config.clang_enable_cir = @CLANG_ENABLE_CIR@
 config.clang_examples = @CLANG_BUILD_EXAMPLES@
 config.enable_shared = @ENABLE_SHARED@
 config.enable_backtrace = @ENABLE_BACKTRACES@

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


[llvm-branch-commits] [clang] [CIR][cmake] Add support for cmake variable CLANG_ENABLE_CIR (PR #86078)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86078

>From 0118187ba99172c6d892e4a05596085c0e637eb9 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 04:09:56 +
Subject: [PATCH] add lit usage

Created using spr 1.3.5
---
 clang/test/lit.site.cfg.py.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index ef75770a2c3c9a..6641811c588395 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -27,6 +27,7 @@ config.clang_default_pie_on_linux = 
@CLANG_DEFAULT_PIE_ON_LINUX@
 config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
 config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
 config.clang_staticanalyzer_z3 = @LLVM_WITH_Z3@
+config.clang_enable_cir = @CLANG_ENABLE_CIR@
 config.clang_examples = @CLANG_BUILD_EXAMPLES@
 config.enable_shared = @ENABLE_SHARED@
 config.enable_backtrace = @ENABLE_BACKTRACES@

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


[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86080

>From 435869501bb0788d8b22d847c3a870dbfbf94126 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 04:57:16 +
Subject: [PATCH 1/2] fix MLIRCIROpsIncGen

Created using spr 1.3.5
---
 .../clang/CIR/Dialect/IR/CIRDialect.td| 46 +++
 clang/include/clang/CIR/Dialect/IR/CIROps.td  | 18 
 2 files changed, 64 insertions(+)
 create mode 100644 clang/include/clang/CIR/Dialect/IR/CIRDialect.td

diff --git a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td 
b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
new file mode 100644
index 00..8f756fa422e5f3
--- /dev/null
+++ b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
@@ -0,0 +1,46 @@
+//===- CIRTypes.td - CIR dialect types -*- tablegen 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file declares the CIR dialect.
+//
+//===--===//
+
+#ifndef MLIR_CIR_DIALECT_CIR
+#define MLIR_CIR_DIALECT_CIR
+
+include "mlir/IR/OpBase.td"
+
+def CIR_Dialect : Dialect {
+  let name = "cir";
+
+  // A short one-line summary of our dialect.
+  let summary = "A high-level dialect for analyzing and optimizing Clang "
+"supported languages";
+
+  let cppNamespace = "::mlir::cir";
+
+  let useDefaultAttributePrinterParser = 0;
+  let useDefaultTypePrinterParser = 0;
+
+  let extraClassDeclaration = [{
+void registerAttributes();
+void registerTypes();
+
+::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override;
+void printType(::mlir::Type type,
+   ::mlir::DialectAsmPrinter &printer) const override;
+
+::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser,
+ ::mlir::Type type) const override;
+
+void printAttribute(::mlir::Attribute attr,
+::mlir::DialectAsmPrinter &os) const override;
+  }];
+}
+
+#endif // MLIR_CIR_DIALECT_CIR
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td 
b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index e69de29bb2d1d6..cfc62986b0b9d1 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -0,0 +1,18 @@
+//===-- CIROps.td - CIR dialect definition -*- tablegen 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file
+/// Definition of the CIR dialect
+///
+//===--===//
+
+#ifndef MLIR_CIR_DIALECT_CIR_OPS
+#define MLIR_CIR_DIALECT_CIR_OPS
+
+include "clang/CIR/Dialect/IR/CIRDialect.td"
+#endif // MLIR_CIR_DIALECT_CIR_OPS

>From fe44284534be0752d95634251289a5c74c06afe7 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 05:12:26 +
Subject: [PATCH 2/2] add some guts to CIRDialect.cpp and MLIRCIR lib

Created using spr 1.3.5
---
 clang/lib/CIR/Dialect/IR/CIRDialect.cpp | 11 +++
 clang/lib/CIR/Dialect/IR/CMakeLists.txt |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp 
b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
index e69de29bb2d1d6..8abf39119e04f7 100644
--- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
+++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
@@ -0,0 +1,11 @@
+//===- CIRDialect.cpp - MLIR CIR ops implementation 
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file implements the CIR dialect and its operations.
+//
+//===--===//
diff --git a/clang/lib/CIR/Dialect/IR/CMakeLists.txt 
b/clang/lib/CIR/Dialect/IR/CMakeLists.txt
index e69de29bb2d1d6..0d7476b555705d 100644
--- a/clang/lib/CIR/Dialect/IR/CMakeLists.txt
+++ b/clang/lib/CIR/Dialect/IR/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_clang_library(MLIRCIR
+  CIRDialect.cpp
+  )

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


[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)

2024-03-20 Thread Nathan Lanza via llvm-branch-commits

https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86080

>From 435869501bb0788d8b22d847c3a870dbfbf94126 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 04:57:16 +
Subject: [PATCH 1/2] fix MLIRCIROpsIncGen

Created using spr 1.3.5
---
 .../clang/CIR/Dialect/IR/CIRDialect.td| 46 +++
 clang/include/clang/CIR/Dialect/IR/CIROps.td  | 18 
 2 files changed, 64 insertions(+)
 create mode 100644 clang/include/clang/CIR/Dialect/IR/CIRDialect.td

diff --git a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td 
b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
new file mode 100644
index 00..8f756fa422e5f3
--- /dev/null
+++ b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
@@ -0,0 +1,46 @@
+//===- CIRTypes.td - CIR dialect types -*- tablegen 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file declares the CIR dialect.
+//
+//===--===//
+
+#ifndef MLIR_CIR_DIALECT_CIR
+#define MLIR_CIR_DIALECT_CIR
+
+include "mlir/IR/OpBase.td"
+
+def CIR_Dialect : Dialect {
+  let name = "cir";
+
+  // A short one-line summary of our dialect.
+  let summary = "A high-level dialect for analyzing and optimizing Clang "
+"supported languages";
+
+  let cppNamespace = "::mlir::cir";
+
+  let useDefaultAttributePrinterParser = 0;
+  let useDefaultTypePrinterParser = 0;
+
+  let extraClassDeclaration = [{
+void registerAttributes();
+void registerTypes();
+
+::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override;
+void printType(::mlir::Type type,
+   ::mlir::DialectAsmPrinter &printer) const override;
+
+::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser,
+ ::mlir::Type type) const override;
+
+void printAttribute(::mlir::Attribute attr,
+::mlir::DialectAsmPrinter &os) const override;
+  }];
+}
+
+#endif // MLIR_CIR_DIALECT_CIR
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td 
b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index e69de29bb2d1d6..cfc62986b0b9d1 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -0,0 +1,18 @@
+//===-- CIROps.td - CIR dialect definition -*- tablegen 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file
+/// Definition of the CIR dialect
+///
+//===--===//
+
+#ifndef MLIR_CIR_DIALECT_CIR_OPS
+#define MLIR_CIR_DIALECT_CIR_OPS
+
+include "clang/CIR/Dialect/IR/CIRDialect.td"
+#endif // MLIR_CIR_DIALECT_CIR_OPS

>From fe44284534be0752d95634251289a5c74c06afe7 Mon Sep 17 00:00:00 2001
From: Nathan Lanza 
Date: Thu, 21 Mar 2024 05:12:26 +
Subject: [PATCH 2/2] add some guts to CIRDialect.cpp and MLIRCIR lib

Created using spr 1.3.5
---
 clang/lib/CIR/Dialect/IR/CIRDialect.cpp | 11 +++
 clang/lib/CIR/Dialect/IR/CMakeLists.txt |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp 
b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
index e69de29bb2d1d6..8abf39119e04f7 100644
--- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
+++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
@@ -0,0 +1,11 @@
+//===- CIRDialect.cpp - MLIR CIR ops implementation 
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file implements the CIR dialect and its operations.
+//
+//===--===//
diff --git a/clang/lib/CIR/Dialect/IR/CMakeLists.txt 
b/clang/lib/CIR/Dialect/IR/CMakeLists.txt
index e69de29bb2d1d6..0d7476b555705d 100644
--- a/clang/lib/CIR/Dialect/IR/CMakeLists.txt
+++ b/clang/lib/CIR/Dialect/IR/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_clang_library(MLIRCIR
+  CIRDialect.cpp
+  )

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