[Lldb-commits] [lldb] [flang] [clang-tools-extra] [libcxx] [compiler-rt] [clang] [libc] [llvm] [RegAllocFast] Refactor dominates algorithm for large basic block (PR #72250)

2023-12-22 Thread via lldb-commits

https://github.com/HaohaiWen edited 
https://github.com/llvm/llvm-project/pull/72250
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [flang] [clang-tools-extra] [libcxx] [compiler-rt] [clang] [libc] [llvm] [RegAllocFast] Refactor dominates algorithm for large basic block (PR #72250)

2023-12-22 Thread via lldb-commits


@@ -62,6 +62,107 @@ static RegisterRegAlloc fastRegAlloc("fast", "fast register 
allocator",
 
 namespace {
 
+/// Assign ascending index for instructions in machine basic block. The index
+/// can be used to determine dominance between instructions in same MBB.
+class InstrPosIndexes {
+public:
+  void init(const MachineBasicBlock &MBB) {
+CurMBB = &MBB;
+Instr2PosIndex.clear();
+uint64_t LastIndex = 0;
+for (const MachineInstr &MI : MBB) {
+  LastIndex += InstrDist;
+  Instr2PosIndex[&MI] = LastIndex;
+}

HaohaiWen wrote:

#76275

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


[Lldb-commits] [flang] [clang] [lldb] [clang-tools-extra] [compiler-rt] [libcxx] [llvm] [libc] [RegAllocFast] Refactor dominates algorithm for large basic block (PR #72250)

2023-12-22 Thread Nikita Popov via lldb-commits


@@ -62,6 +62,107 @@ static RegisterRegAlloc fastRegAlloc("fast", "fast register 
allocator",
 
 namespace {
 
+/// Assign ascending index for instructions in machine basic block. The index
+/// can be used to determine dominance between instructions in same MBB.
+class InstrPosIndexes {
+public:
+  void init(const MachineBasicBlock &MBB) {
+CurMBB = &MBB;
+Instr2PosIndex.clear();
+uint64_t LastIndex = 0;
+for (const MachineInstr &MI : MBB) {
+  LastIndex += InstrDist;
+  Instr2PosIndex[&MI] = LastIndex;
+}

nikic wrote:

Can we do this lazily, on first query?

It looks like dominates() is actually only used in very rare situations (where 
a block branches back to itself), so populating this map is unnecessary for 
most blocks.



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


[Lldb-commits] [lldb] [lldb/win] Fix -Wmissing-field-initializers warnings after 54981bb75d374 (PR #76255)

2023-12-22 Thread via lldb-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff 04c473bea3e0f135432698fcaafab52e1fe1b5ec 
7bd8eade99bbf2408a35462f1f4f643d9649efb3 -- 
lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
``





View the diff from clang-format here.


``diff
diff --git 
a/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp 
b/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
index fee485b759..3d32a3d58c 100644
--- 
a/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
+++ 
b/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
@@ -25,43 +25,43 @@ using namespace lldb;
 using namespace lldb_private;
 
 #define DEFINE_GPR(reg, alt, generic)  
\
-{  
\
-  #reg, alt, 8, 0, eEncodingUint, eFormatHexUppercase, 
\
-  {dwarf_##reg##_x86_64, dwarf_##reg##_x86_64, generic,
\
-LLDB_INVALID_REGNUM, lldb_##reg##_x86_64 },
\
+  {
\
+#reg, alt, 8, 0, eEncodingUint, eFormatHexUppercase,   
\
+{dwarf_##reg##_x86_64, dwarf_##reg##_x86_64, generic,  
\
+ LLDB_INVALID_REGNUM, lldb_##reg##_x86_64},
\
 nullptr, nullptr, nullptr, 
\
-}
+  }
 
 #define DEFINE_GPR_BIN(reg, alt) #reg, alt, 8, 0, eEncodingUint, eFormatBinary
 #define DEFINE_FPU_XMM(reg)
\
   #reg, NULL, 16, 0, eEncodingUint, eFormatVectorOfUInt64, 
\
-  {dwarf_##reg##_x86_64, dwarf_##reg##_x86_64, LLDB_INVALID_REGNUM,
\
-   LLDB_INVALID_REGNUM, lldb_##reg##_x86_64},  
\
-  nullptr, nullptr, nullptr,
+  {dwarf_##reg##_x86_64, dwarf_##reg##_x86_64, LLDB_INVALID_REGNUM,
\
+   LLDB_INVALID_REGNUM, lldb_##reg##_x86_64},  
\
+  nullptr, nullptr, nullptr,
 
 #define DEFINE_GPR_PSEUDO_32(reg)  
\
-{  
\
-  #reg, nullptr, 4, 0, eEncodingUint, eFormatHexUppercase, 
\
-  {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,  
\
-LLDB_INVALID_REGNUM, lldb_##reg##_x86_64 },
\
+  {
\
+#reg, nullptr, 4, 0, eEncodingUint, eFormatHexUppercase,   
\
+{LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
\
+ LLDB_INVALID_REGNUM, lldb_##reg##_x86_64},
\
 nullptr, nullptr, nullptr, 
\
-}
+  }
 
 #define DEFINE_GPR_PSEUDO_16(reg)  
\
-{  
\
-  #reg, nullptr, 2, 0, eEncodingUint, eFormatHexUppercase, 
\
-  {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,  
\
-LLDB_INVALID_REGNUM, lldb_##reg##_x86_64 },
\
+  {
\
+#reg, nullptr, 2, 0, eEncodingUint, eFormatHexUppercase,   
\
+{LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
\
+ LLDB_INVALID_REGNUM, lldb_##reg##_x86_64},
\
 nullptr, nullptr, nullptr, 
\
-}
+  }
 
 #define DEFINE_GPR_PSEUDO_8(reg)   
\
-{  
\
-  #reg, nullptr, 1, 0, eEncodingUint, eFormatHexUppercase, 
\
-  {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,  
\
-LLDB_INVALID_REGNUM, lldb_##reg##_x86_64 },
\
+  {
\
+#reg, nullptr, 1, 0, eEncodingUint, eFormatHexUppercase,   
\
+{LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
\
+ LLDB_INVALID_REGNUM, lldb_##reg##_x86_64},
\
 nullptr, nullptr, nullptr, 
\
-}
+  }
 
 namespace {
 

``




https://github.com/llvm/llvm-project/pull/76255
_

[Lldb-commits] [lldb] [lldb/win] Fix -Wmissing-field-initializers warnings after 54981bb75d374 (PR #76255)

2023-12-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Nico Weber (nico)


Changes



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


1 Files Affected:

- (modified) 
lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp 
(+5-5) 


``diff
diff --git 
a/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp 
b/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
index 5c4f80b97009a3..fee485b7599ca0 100644
--- 
a/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
+++ 
b/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
@@ -29,7 +29,7 @@ using namespace lldb_private;
   #reg, alt, 8, 0, eEncodingUint, eFormatHexUppercase, 
\
   {dwarf_##reg##_x86_64, dwarf_##reg##_x86_64, generic,
\
 LLDB_INVALID_REGNUM, lldb_##reg##_x86_64 },
\
-nullptr, nullptr,  
\
+nullptr, nullptr, nullptr, 
\
 }
 
 #define DEFINE_GPR_BIN(reg, alt) #reg, alt, 8, 0, eEncodingUint, eFormatBinary
@@ -37,14 +37,14 @@ using namespace lldb_private;
   #reg, NULL, 16, 0, eEncodingUint, eFormatVectorOfUInt64, 
\
   {dwarf_##reg##_x86_64, dwarf_##reg##_x86_64, LLDB_INVALID_REGNUM,
\
LLDB_INVALID_REGNUM, lldb_##reg##_x86_64},  
\
-  nullptr, nullptr
+  nullptr, nullptr, nullptr,
 
 #define DEFINE_GPR_PSEUDO_32(reg)  
\
 {  
\
   #reg, nullptr, 4, 0, eEncodingUint, eFormatHexUppercase, 
\
   {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,  
\
 LLDB_INVALID_REGNUM, lldb_##reg##_x86_64 },
\
-nullptr, nullptr   
\
+nullptr, nullptr, nullptr, 
\
 }
 
 #define DEFINE_GPR_PSEUDO_16(reg)  
\
@@ -52,7 +52,7 @@ using namespace lldb_private;
   #reg, nullptr, 2, 0, eEncodingUint, eFormatHexUppercase, 
\
   {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,  
\
 LLDB_INVALID_REGNUM, lldb_##reg##_x86_64 },
\
-nullptr, nullptr   
\
+nullptr, nullptr, nullptr, 
\
 }
 
 #define DEFINE_GPR_PSEUDO_8(reg)   
\
@@ -60,7 +60,7 @@ using namespace lldb_private;
   #reg, nullptr, 1, 0, eEncodingUint, eFormatHexUppercase, 
\
   {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,  
\
 LLDB_INVALID_REGNUM, lldb_##reg##_x86_64 },
\
-nullptr, nullptr   
\
+nullptr, nullptr, nullptr, 
\
 }
 
 namespace {

``




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


[Lldb-commits] [lldb] [lldb/win] Fix -Wmissing-field-initializers warnings after 54981bb75d374 (PR #76255)

2023-12-22 Thread Nico Weber via lldb-commits

https://github.com/nico created https://github.com/llvm/llvm-project/pull/76255

None

>From 7bd8eade99bbf2408a35462f1f4f643d9649efb3 Mon Sep 17 00:00:00 2001
From: Nico Weber 
Date: Fri, 22 Dec 2023 12:18:34 -0500
Subject: [PATCH] [lldb/win] Fix -Wmissing-field-initializers warnings after
 54981bb75d374

---
 .../Windows/Common/x64/RegisterContextWindows_x64.cpp  | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp 
b/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
index 5c4f80b97009a3..fee485b7599ca0 100644
--- 
a/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
+++ 
b/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
@@ -29,7 +29,7 @@ using namespace lldb_private;
   #reg, alt, 8, 0, eEncodingUint, eFormatHexUppercase, 
\
   {dwarf_##reg##_x86_64, dwarf_##reg##_x86_64, generic,
\
 LLDB_INVALID_REGNUM, lldb_##reg##_x86_64 },
\
-nullptr, nullptr,  
\
+nullptr, nullptr, nullptr, 
\
 }
 
 #define DEFINE_GPR_BIN(reg, alt) #reg, alt, 8, 0, eEncodingUint, eFormatBinary
@@ -37,14 +37,14 @@ using namespace lldb_private;
   #reg, NULL, 16, 0, eEncodingUint, eFormatVectorOfUInt64, 
\
   {dwarf_##reg##_x86_64, dwarf_##reg##_x86_64, LLDB_INVALID_REGNUM,
\
LLDB_INVALID_REGNUM, lldb_##reg##_x86_64},  
\
-  nullptr, nullptr
+  nullptr, nullptr, nullptr,
 
 #define DEFINE_GPR_PSEUDO_32(reg)  
\
 {  
\
   #reg, nullptr, 4, 0, eEncodingUint, eFormatHexUppercase, 
\
   {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,  
\
 LLDB_INVALID_REGNUM, lldb_##reg##_x86_64 },
\
-nullptr, nullptr   
\
+nullptr, nullptr, nullptr, 
\
 }
 
 #define DEFINE_GPR_PSEUDO_16(reg)  
\
@@ -52,7 +52,7 @@ using namespace lldb_private;
   #reg, nullptr, 2, 0, eEncodingUint, eFormatHexUppercase, 
\
   {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,  
\
 LLDB_INVALID_REGNUM, lldb_##reg##_x86_64 },
\
-nullptr, nullptr   
\
+nullptr, nullptr, nullptr, 
\
 }
 
 #define DEFINE_GPR_PSEUDO_8(reg)   
\
@@ -60,7 +60,7 @@ using namespace lldb_private;
   #reg, nullptr, 1, 0, eEncodingUint, eFormatHexUppercase, 
\
   {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,  
\
 LLDB_INVALID_REGNUM, lldb_##reg##_x86_64 },
\
-nullptr, nullptr   
\
+nullptr, nullptr, nullptr, 
\
 }
 
 namespace {

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


[Lldb-commits] [lldb] 04c473b - [lldb] Fix two deprecation warnings

2023-12-22 Thread Nico Weber via lldb-commits

Author: Nico Weber
Date: 2023-12-22T12:11:07-05:00
New Revision: 04c473bea3e0f135432698fcaafab52e1fe1b5ec

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

LOG: [lldb] Fix two deprecation warnings

No behavior change.

Added: 


Modified: 
lldb/source/Host/linux/HostInfoLinux.cpp
lldb/source/Target/JITLoaderList.cpp

Removed: 




diff  --git a/lldb/source/Host/linux/HostInfoLinux.cpp 
b/lldb/source/Host/linux/HostInfoLinux.cpp
index c66f787db0cf95..723f0c2fb3fdc6 100644
--- a/lldb/source/Host/linux/HostInfoLinux.cpp
+++ b/lldb/source/Host/linux/HostInfoLinux.cpp
@@ -123,7 +123,7 @@ llvm::StringRef HostInfoLinux::GetDistributionId() {
 if (strstr(distribution_id, distributor_id_key)) {
   // strip newlines
   std::string id_string(distribution_id + strlen(distributor_id_key));
-  llvm::erase_value(id_string, '\n');
+  llvm::erase(id_string, '\n');
 
   // lower case it and convert whitespace to underscores
   std::transform(

diff  --git a/lldb/source/Target/JITLoaderList.cpp 
b/lldb/source/Target/JITLoaderList.cpp
index 9158d0a5e546c8..9fa070edd4b8db 100644
--- a/lldb/source/Target/JITLoaderList.cpp
+++ b/lldb/source/Target/JITLoaderList.cpp
@@ -24,7 +24,7 @@ void JITLoaderList::Append(const JITLoaderSP &jit_loader_sp) {
 
 void JITLoaderList::Remove(const JITLoaderSP &jit_loader_sp) {
   std::lock_guard guard(m_jit_loaders_mutex);
-  llvm::erase_value(m_jit_loaders_vec, jit_loader_sp);
+  llvm::erase(m_jit_loaders_vec, jit_loader_sp);
 }
 
 size_t JITLoaderList::GetSize() const { return m_jit_loaders_vec.size(); }



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


[Lldb-commits] [lldb] [mlir] [libunwind] [libcxx] [clang] [clang-tools-extra] [openmp] [lld] [libc] [llvm] [compiler-rt] [flang] [OpenMP] Improve omp offload profiler (PR #68016)

2023-12-22 Thread Felipe Cabarcas via lldb-commits

https://github.com/fel-cab updated 
https://github.com/llvm/llvm-project/pull/68016

>From dd44de067c26ba94b6561c5ed7fa4a5d812a3d1a Mon Sep 17 00:00:00 2001
From: Felipe Cabarcas 
Date: Mon, 18 Sep 2023 12:07:12 +
Subject: [PATCH 01/14] testing Profiler features

---
 openmp/libomptarget/src/interface.cpp | 5 -
 openmp/libomptarget/src/private.h | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/openmp/libomptarget/src/interface.cpp 
b/openmp/libomptarget/src/interface.cpp
index 5f21b16b3fbfb1..f64e1e268a3952 100644
--- a/openmp/libomptarget/src/interface.cpp
+++ b/openmp/libomptarget/src/interface.cpp
@@ -252,7 +252,10 @@ static inline int targetKernel(ident_t *Loc, int64_t 
DeviceId, int32_t NumTeams,
   static_assert(std::is_convertible_v,
 "Target AsyncInfoTy must be convertible to AsyncInfoTy.");
 
-  TIMESCOPE_WITH_IDENT(Loc);
+  //TIMESCOPE_WITH_IDENT(Loc);
+  TIMESCOPE();
+  //TIMESCOPE_WITH_NAME_AND_IDENT("Hello", Loc);
+  //TIMESCOPE_WITH_RTM_AND_IDENT("Hello", Loc);
 
   DP("Entering target region for device %" PRId64 " with entry point " DPxMOD
  "\n",
diff --git a/openmp/libomptarget/src/private.h 
b/openmp/libomptarget/src/private.h
index cbce15b63a3eba..dc6cd394423395 100644
--- a/openmp/libomptarget/src/private.h
+++ b/openmp/libomptarget/src/private.h
@@ -433,7 +433,8 @@ class ExponentialBackoff {
   SourceInfo SI(IDENT);
\
   std::string ProfileLocation = SI.getProfileLocation();   
\
   std::string RTM = RegionTypeMsg; 
\
-  llvm::TimeTraceScope TimeScope(__FUNCTION__, ProfileLocation + RTM)
+  llvm::TimeTraceScope TimeScope(ProfileLocation, ProfileLocation + RTM)
+  //llvm::TimeTraceScope TimeScope(__FUNCTION__, ProfileLocation + RTM)
 #else
 #define TIMESCOPE()
 #define TIMESCOPE_WITH_IDENT(IDENT)

>From 92586bca6364100c7511ad38a30f41b0f86dea9c Mon Sep 17 00:00:00 2001
From: Felipe Cabarcas 
Date: Tue, 19 Sep 2023 12:02:53 +
Subject: [PATCH 02/14] Improve Profiler 1

---
 llvm/lib/Support/TimeProfiler.cpp |  2 +-
 openmp/libomptarget/src/interface.cpp | 17 +
 openmp/libomptarget/src/omptarget.cpp | 10 +-
 openmp/libomptarget/src/private.h |  5 +++--
 4 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/llvm/lib/Support/TimeProfiler.cpp 
b/llvm/lib/Support/TimeProfiler.cpp
index 4d625b3eb5b170..e1458116f64ab4 100644
--- a/llvm/lib/Support/TimeProfiler.cpp
+++ b/llvm/lib/Support/TimeProfiler.cpp
@@ -227,7 +227,7 @@ struct llvm::TimeTraceProfiler {
 J.attribute("ph", "X");
 J.attribute("ts", 0);
 J.attribute("dur", DurUs);
-J.attribute("name", "Total " + Total.first);
+J.attribute("name", "Total: " + Total.first);
 J.attributeObject("args", [&] {
   J.attribute("count", int64_t(Count));
   J.attribute("avg ms", int64_t(DurUs / Count / 1000));
diff --git a/openmp/libomptarget/src/interface.cpp 
b/openmp/libomptarget/src/interface.cpp
index f64e1e268a3952..b8892cbe689107 100644
--- a/openmp/libomptarget/src/interface.cpp
+++ b/openmp/libomptarget/src/interface.cpp
@@ -33,14 +33,14 @@ using namespace llvm::omp::target::ompt;
 

 /// adds requires flags
 EXTERN void __tgt_register_requires(int64_t Flags) {
-  TIMESCOPE();
+  //TIMESCOPE();
   PM->RTLs.registerRequires(Flags);
 }
 
 

 /// adds a target shared library to the target execution image
 EXTERN void __tgt_register_lib(__tgt_bin_desc *Desc) {
-  TIMESCOPE();
+  //TIMESCOPE();
   if (PM->maybeDelayRegisterLib(Desc))
 return;
 
@@ -61,7 +61,7 @@ EXTERN void __tgt_init_all_rtls() { PM->RTLs.initAllRTLs(); }
 

 /// unloads a target shared library
 EXTERN void __tgt_unregister_lib(__tgt_bin_desc *Desc) {
-  TIMESCOPE();
+  //TIMESCOPE();
   PM->RTLs.unregisterLib(Desc);
   for (auto &RTL : PM->RTLs.UsedRTLs) {
 if (RTL->unregister_lib) {
@@ -82,7 +82,8 @@ targetData(ident_t *Loc, int64_t DeviceId, int32_t ArgNum, 
void **ArgsBase,
   static_assert(std::is_convertible_v,
 "TargetAsyncInfoTy must be convertible to AsyncInfoTy.");
 
-  TIMESCOPE_WITH_RTM_AND_IDENT(RegionTypeMsg, Loc);
+  //TIMESCOPE_WITH_RTM_AND_IDENT(RegionTypeMsg, Loc);
+  TIMESCOPE_WITH_RTM_AND_IDENT("targetData", Loc);
 
   DP("Entering data %s region for device %" PRId64 " with %d mappings\n",
  RegionName, DeviceId, ArgNum);
@@ -253,9 +254,9 @@ static inline int targetKernel(ident_t *Loc, int64_t 
DeviceId, int32_t NumTeams,
 "Target AsyncInfoTy must be convertible to AsyncInfoTy.");
 
   //TIMESCOPE_WITH_IDENT(Loc);
-  TIMESCOPE();
+  //TIMESCOPE();
   //TIMESCOPE_WITH_NAME_AND_IDENT("Hello", Loc);
-  //TIME

[Lldb-commits] [lldb] [libcxx] [clang] [clang-tools-extra] [libc] [llvm] [compiler-rt] [flang] [flang] FDATE extension implementation: get date and time in ctime format (PR #71222)

2023-12-22 Thread Yi Wu via lldb-commits

https://github.com/yi-wu-arm updated 
https://github.com/llvm/llvm-project/pull/71222

>From e0d99fb5baa4231ab351f7fd5abf0a1ffe589547 Mon Sep 17 00:00:00 2001
From: Yi Wu 
Date: Mon, 6 Nov 2023 19:55:06 +
Subject: [PATCH 01/17] FDATE extension implementation: get date and time in
 ctime format

reference to gfortran fdate https://gcc.gnu.org/onlinedocs/gfortran/FDATE.html
usage:
CHARACTER(32) :: time
CALL fdate(time)
WRITE(*,*) time
---
 flang/docs/Intrinsics.md |  2 +-
 flang/include/flang/Runtime/command.h|  5 +
 flang/include/flang/Runtime/extensions.h |  2 ++
 flang/runtime/command.cpp| 28 
 flang/runtime/extensions.cpp |  5 +
 flang/unittests/Runtime/CommandTest.cpp  | 14 
 6 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/flang/docs/Intrinsics.md b/flang/docs/Intrinsics.md
index ab0a940e53e553..982be820816429 100644
--- a/flang/docs/Intrinsics.md
+++ b/flang/docs/Intrinsics.md
@@ -751,7 +751,7 @@ This phase currently supports all the intrinsic procedures 
listed above but the
 | Object characteristic inquiry functions | ALLOCATED, ASSOCIATED, 
EXTENDS_TYPE_OF, IS_CONTIGUOUS, PRESENT, RANK, SAME_TYPE, STORAGE_SIZE |
 | Type inquiry intrinsic functions | BIT_SIZE, DIGITS, EPSILON, HUGE, KIND, 
MAXEXPONENT, MINEXPONENT, NEW_LINE, PRECISION, RADIX, RANGE, TINY|
 | Non-standard intrinsic functions | AND, OR, XOR, SHIFT, ZEXT, IZEXT, COSD, 
SIND, TAND, ACOSD, ASIND, ATAND, ATAN2D, COMPL, EQV, NEQV, INT8, JINT, JNINT, 
KNINT, QCMPLX, DREAL, DFLOAT, QEXT, QFLOAT, QREAL, DNUM, NUM, JNUM, KNUM, QNUM, 
RNUM, RAN, RANF, ILEN, SIZEOF, MCLOCK, SECNDS, COTAN, IBCHNG, ISHA, ISHC, ISHL, 
IXOR, IARG, IARGC, NARGS, NUMARG, BADDRESS, IADDR, CACHESIZE, EOF, FP_CLASS, 
INT_PTR_KIND, ISNAN, MALLOC |
-| Intrinsic subroutines |MVBITS (elemental), CPU_TIME, DATE_AND_TIME, 
EVENT_QUERY, EXECUTE_COMMAND_LINE, GET_COMMAND, GET_COMMAND_ARGUMENT, 
GET_ENVIRONMENT_VARIABLE, MOVE_ALLOC, RANDOM_INIT, RANDOM_NUMBER, RANDOM_SEED, 
SYSTEM_CLOCK |
+| Intrinsic subroutines |MVBITS (elemental), CPU_TIME, DATE_AND_TIME, 
EVENT_QUERY, EXECUTE_COMMAND_LINE, FDATE, GET_COMMAND, GET_COMMAND_ARGUMENT, 
GET_ENVIRONMENT_VARIABLE, MOVE_ALLOC, RANDOM_INIT, RANDOM_NUMBER, RANDOM_SEED, 
SYSTEM_CLOCK |
 | Atomic intrinsic subroutines | ATOMIC_ADD |
 | Collective intrinsic subroutines | CO_REDUCE |
 
diff --git a/flang/include/flang/Runtime/command.h 
b/flang/include/flang/Runtime/command.h
index ec628939054547..07f6d8e169ead6 100644
--- a/flang/include/flang/Runtime/command.h
+++ b/flang/include/flang/Runtime/command.h
@@ -23,6 +23,11 @@ extern "C" {
 // integer kind.
 std::int32_t RTNAME(ArgumentCount)();
 
+// Try to get the the current date (same format as CTIME: convert to a string)
+// Return a STATUS as described in the standard.
+std::int32_t RTNAME(FDate)(
+const Descriptor *argument = nullptr, const Descriptor *errmsg = nullptr);
+
 // 16.9.82 GET_COMMAND
 // Try to get the value of the whole command. All of the parameters are
 // optional.
diff --git a/flang/include/flang/Runtime/extensions.h 
b/flang/include/flang/Runtime/extensions.h
index ad592814e5acb7..92b9907860121a 100644
--- a/flang/include/flang/Runtime/extensions.h
+++ b/flang/include/flang/Runtime/extensions.h
@@ -24,6 +24,8 @@ void FORTRAN_PROCEDURE_NAME(flush)(const int &unit);
 // GNU Fortran 77 compatibility function IARGC.
 std::int32_t FORTRAN_PROCEDURE_NAME(iargc)();
 
+void FORTRAN_PROCEDURE_NAME(fdate)(std::int8_t *string, std::int64_t length);
+
 // GNU Fortran 77 compatibility subroutine GETARG(N, ARG).
 void FORTRAN_PROCEDURE_NAME(getarg)(
 std::int32_t &n, std::int8_t *arg, std::int64_t length);
diff --git a/flang/runtime/command.cpp b/flang/runtime/command.cpp
index b81a0791c5e571..da0803c39f49b6 100644
--- a/flang/runtime/command.cpp
+++ b/flang/runtime/command.cpp
@@ -14,6 +14,7 @@
 #include "flang/Runtime/descriptor.h"
 #include 
 #include 
+#include 
 
 namespace Fortran::runtime {
 std::int32_t RTNAME(ArgumentCount)() {
@@ -125,6 +126,33 @@ static bool FitsInDescriptor(
   kind, terminator, value);
 }
 
+void removeNewLine(char *str) {
+  char *newlinePos = strchr(str, '\n');
+  if (newlinePos != NULL) {
+*newlinePos = '\0'; // Replace with null terminator
+  }
+}
+
+std::int32_t RTNAME(FDate)(const Descriptor *value, const Descriptor *errmsg) {
+  FillWithSpaces(*value);
+
+  time_t current_time;
+  time(¤t_time);
+
+  char *time_string = ctime(¤t_time);
+  removeNewLine(time_string);
+  std::int64_t stringLen{StringLength(time_string)};
+  if (stringLen <= 0) {
+return ToErrmsg(errmsg, StatMissingArgument);
+  }
+
+  if (value) {
+return CopyToDescriptor(*value, time_string, stringLen, errmsg);
+  }
+
+  return StatOk;
+}
+
 std::int32_t RTNAME(GetCommandArgument)(std::int32_t n, const Descriptor 
*value,
 const Descriptor *length, const Descriptor *errmsg, const char *sourceFile,
 int line) {
diff --git a/flang/runtime/e

[Lldb-commits] [clang-tools-extra] [flang] [llvm] [compiler-rt] [clang] [lldb] [libc] [libcxx] [RegAllocFast] Refactor dominates algorithm for large basic block (PR #72250)

2023-12-22 Thread via lldb-commits

https://github.com/HaohaiWen closed 
https://github.com/llvm/llvm-project/pull/72250
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [flang] [lldb] [libc] [llvm] [clang-tools-extra] [compiler-rt] [libcxx] [clang] [flang] FDATE extension implementation: get date and time in ctime format (PR #71222)

2023-12-22 Thread Yi Wu via lldb-commits

https://github.com/yi-wu-arm updated 
https://github.com/llvm/llvm-project/pull/71222

>From e0d99fb5baa4231ab351f7fd5abf0a1ffe589547 Mon Sep 17 00:00:00 2001
From: Yi Wu 
Date: Mon, 6 Nov 2023 19:55:06 +
Subject: [PATCH 01/16] FDATE extension implementation: get date and time in
 ctime format

reference to gfortran fdate https://gcc.gnu.org/onlinedocs/gfortran/FDATE.html
usage:
CHARACTER(32) :: time
CALL fdate(time)
WRITE(*,*) time
---
 flang/docs/Intrinsics.md |  2 +-
 flang/include/flang/Runtime/command.h|  5 +
 flang/include/flang/Runtime/extensions.h |  2 ++
 flang/runtime/command.cpp| 28 
 flang/runtime/extensions.cpp |  5 +
 flang/unittests/Runtime/CommandTest.cpp  | 14 
 6 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/flang/docs/Intrinsics.md b/flang/docs/Intrinsics.md
index ab0a940e53e553..982be820816429 100644
--- a/flang/docs/Intrinsics.md
+++ b/flang/docs/Intrinsics.md
@@ -751,7 +751,7 @@ This phase currently supports all the intrinsic procedures 
listed above but the
 | Object characteristic inquiry functions | ALLOCATED, ASSOCIATED, 
EXTENDS_TYPE_OF, IS_CONTIGUOUS, PRESENT, RANK, SAME_TYPE, STORAGE_SIZE |
 | Type inquiry intrinsic functions | BIT_SIZE, DIGITS, EPSILON, HUGE, KIND, 
MAXEXPONENT, MINEXPONENT, NEW_LINE, PRECISION, RADIX, RANGE, TINY|
 | Non-standard intrinsic functions | AND, OR, XOR, SHIFT, ZEXT, IZEXT, COSD, 
SIND, TAND, ACOSD, ASIND, ATAND, ATAN2D, COMPL, EQV, NEQV, INT8, JINT, JNINT, 
KNINT, QCMPLX, DREAL, DFLOAT, QEXT, QFLOAT, QREAL, DNUM, NUM, JNUM, KNUM, QNUM, 
RNUM, RAN, RANF, ILEN, SIZEOF, MCLOCK, SECNDS, COTAN, IBCHNG, ISHA, ISHC, ISHL, 
IXOR, IARG, IARGC, NARGS, NUMARG, BADDRESS, IADDR, CACHESIZE, EOF, FP_CLASS, 
INT_PTR_KIND, ISNAN, MALLOC |
-| Intrinsic subroutines |MVBITS (elemental), CPU_TIME, DATE_AND_TIME, 
EVENT_QUERY, EXECUTE_COMMAND_LINE, GET_COMMAND, GET_COMMAND_ARGUMENT, 
GET_ENVIRONMENT_VARIABLE, MOVE_ALLOC, RANDOM_INIT, RANDOM_NUMBER, RANDOM_SEED, 
SYSTEM_CLOCK |
+| Intrinsic subroutines |MVBITS (elemental), CPU_TIME, DATE_AND_TIME, 
EVENT_QUERY, EXECUTE_COMMAND_LINE, FDATE, GET_COMMAND, GET_COMMAND_ARGUMENT, 
GET_ENVIRONMENT_VARIABLE, MOVE_ALLOC, RANDOM_INIT, RANDOM_NUMBER, RANDOM_SEED, 
SYSTEM_CLOCK |
 | Atomic intrinsic subroutines | ATOMIC_ADD |
 | Collective intrinsic subroutines | CO_REDUCE |
 
diff --git a/flang/include/flang/Runtime/command.h 
b/flang/include/flang/Runtime/command.h
index ec628939054547..07f6d8e169ead6 100644
--- a/flang/include/flang/Runtime/command.h
+++ b/flang/include/flang/Runtime/command.h
@@ -23,6 +23,11 @@ extern "C" {
 // integer kind.
 std::int32_t RTNAME(ArgumentCount)();
 
+// Try to get the the current date (same format as CTIME: convert to a string)
+// Return a STATUS as described in the standard.
+std::int32_t RTNAME(FDate)(
+const Descriptor *argument = nullptr, const Descriptor *errmsg = nullptr);
+
 // 16.9.82 GET_COMMAND
 // Try to get the value of the whole command. All of the parameters are
 // optional.
diff --git a/flang/include/flang/Runtime/extensions.h 
b/flang/include/flang/Runtime/extensions.h
index ad592814e5acb7..92b9907860121a 100644
--- a/flang/include/flang/Runtime/extensions.h
+++ b/flang/include/flang/Runtime/extensions.h
@@ -24,6 +24,8 @@ void FORTRAN_PROCEDURE_NAME(flush)(const int &unit);
 // GNU Fortran 77 compatibility function IARGC.
 std::int32_t FORTRAN_PROCEDURE_NAME(iargc)();
 
+void FORTRAN_PROCEDURE_NAME(fdate)(std::int8_t *string, std::int64_t length);
+
 // GNU Fortran 77 compatibility subroutine GETARG(N, ARG).
 void FORTRAN_PROCEDURE_NAME(getarg)(
 std::int32_t &n, std::int8_t *arg, std::int64_t length);
diff --git a/flang/runtime/command.cpp b/flang/runtime/command.cpp
index b81a0791c5e571..da0803c39f49b6 100644
--- a/flang/runtime/command.cpp
+++ b/flang/runtime/command.cpp
@@ -14,6 +14,7 @@
 #include "flang/Runtime/descriptor.h"
 #include 
 #include 
+#include 
 
 namespace Fortran::runtime {
 std::int32_t RTNAME(ArgumentCount)() {
@@ -125,6 +126,33 @@ static bool FitsInDescriptor(
   kind, terminator, value);
 }
 
+void removeNewLine(char *str) {
+  char *newlinePos = strchr(str, '\n');
+  if (newlinePos != NULL) {
+*newlinePos = '\0'; // Replace with null terminator
+  }
+}
+
+std::int32_t RTNAME(FDate)(const Descriptor *value, const Descriptor *errmsg) {
+  FillWithSpaces(*value);
+
+  time_t current_time;
+  time(¤t_time);
+
+  char *time_string = ctime(¤t_time);
+  removeNewLine(time_string);
+  std::int64_t stringLen{StringLength(time_string)};
+  if (stringLen <= 0) {
+return ToErrmsg(errmsg, StatMissingArgument);
+  }
+
+  if (value) {
+return CopyToDescriptor(*value, time_string, stringLen, errmsg);
+  }
+
+  return StatOk;
+}
+
 std::int32_t RTNAME(GetCommandArgument)(std::int32_t n, const Descriptor 
*value,
 const Descriptor *length, const Descriptor *errmsg, const char *sourceFile,
 int line) {
diff --git a/flang/runtime/e

[Lldb-commits] [llvm] [clang] [clang-tools-extra] [compiler-rt] [lldb] [flang] [libcxx] [libc] [flang] FDATE extension implementation: get date and time in ctime format (PR #71222)

2023-12-22 Thread Yi Wu via lldb-commits

https://github.com/yi-wu-arm updated 
https://github.com/llvm/llvm-project/pull/71222

>From e0d99fb5baa4231ab351f7fd5abf0a1ffe589547 Mon Sep 17 00:00:00 2001
From: Yi Wu 
Date: Mon, 6 Nov 2023 19:55:06 +
Subject: [PATCH 01/15] FDATE extension implementation: get date and time in
 ctime format

reference to gfortran fdate https://gcc.gnu.org/onlinedocs/gfortran/FDATE.html
usage:
CHARACTER(32) :: time
CALL fdate(time)
WRITE(*,*) time
---
 flang/docs/Intrinsics.md |  2 +-
 flang/include/flang/Runtime/command.h|  5 +
 flang/include/flang/Runtime/extensions.h |  2 ++
 flang/runtime/command.cpp| 28 
 flang/runtime/extensions.cpp |  5 +
 flang/unittests/Runtime/CommandTest.cpp  | 14 
 6 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/flang/docs/Intrinsics.md b/flang/docs/Intrinsics.md
index ab0a940e53e553..982be820816429 100644
--- a/flang/docs/Intrinsics.md
+++ b/flang/docs/Intrinsics.md
@@ -751,7 +751,7 @@ This phase currently supports all the intrinsic procedures 
listed above but the
 | Object characteristic inquiry functions | ALLOCATED, ASSOCIATED, 
EXTENDS_TYPE_OF, IS_CONTIGUOUS, PRESENT, RANK, SAME_TYPE, STORAGE_SIZE |
 | Type inquiry intrinsic functions | BIT_SIZE, DIGITS, EPSILON, HUGE, KIND, 
MAXEXPONENT, MINEXPONENT, NEW_LINE, PRECISION, RADIX, RANGE, TINY|
 | Non-standard intrinsic functions | AND, OR, XOR, SHIFT, ZEXT, IZEXT, COSD, 
SIND, TAND, ACOSD, ASIND, ATAND, ATAN2D, COMPL, EQV, NEQV, INT8, JINT, JNINT, 
KNINT, QCMPLX, DREAL, DFLOAT, QEXT, QFLOAT, QREAL, DNUM, NUM, JNUM, KNUM, QNUM, 
RNUM, RAN, RANF, ILEN, SIZEOF, MCLOCK, SECNDS, COTAN, IBCHNG, ISHA, ISHC, ISHL, 
IXOR, IARG, IARGC, NARGS, NUMARG, BADDRESS, IADDR, CACHESIZE, EOF, FP_CLASS, 
INT_PTR_KIND, ISNAN, MALLOC |
-| Intrinsic subroutines |MVBITS (elemental), CPU_TIME, DATE_AND_TIME, 
EVENT_QUERY, EXECUTE_COMMAND_LINE, GET_COMMAND, GET_COMMAND_ARGUMENT, 
GET_ENVIRONMENT_VARIABLE, MOVE_ALLOC, RANDOM_INIT, RANDOM_NUMBER, RANDOM_SEED, 
SYSTEM_CLOCK |
+| Intrinsic subroutines |MVBITS (elemental), CPU_TIME, DATE_AND_TIME, 
EVENT_QUERY, EXECUTE_COMMAND_LINE, FDATE, GET_COMMAND, GET_COMMAND_ARGUMENT, 
GET_ENVIRONMENT_VARIABLE, MOVE_ALLOC, RANDOM_INIT, RANDOM_NUMBER, RANDOM_SEED, 
SYSTEM_CLOCK |
 | Atomic intrinsic subroutines | ATOMIC_ADD |
 | Collective intrinsic subroutines | CO_REDUCE |
 
diff --git a/flang/include/flang/Runtime/command.h 
b/flang/include/flang/Runtime/command.h
index ec628939054547..07f6d8e169ead6 100644
--- a/flang/include/flang/Runtime/command.h
+++ b/flang/include/flang/Runtime/command.h
@@ -23,6 +23,11 @@ extern "C" {
 // integer kind.
 std::int32_t RTNAME(ArgumentCount)();
 
+// Try to get the the current date (same format as CTIME: convert to a string)
+// Return a STATUS as described in the standard.
+std::int32_t RTNAME(FDate)(
+const Descriptor *argument = nullptr, const Descriptor *errmsg = nullptr);
+
 // 16.9.82 GET_COMMAND
 // Try to get the value of the whole command. All of the parameters are
 // optional.
diff --git a/flang/include/flang/Runtime/extensions.h 
b/flang/include/flang/Runtime/extensions.h
index ad592814e5acb7..92b9907860121a 100644
--- a/flang/include/flang/Runtime/extensions.h
+++ b/flang/include/flang/Runtime/extensions.h
@@ -24,6 +24,8 @@ void FORTRAN_PROCEDURE_NAME(flush)(const int &unit);
 // GNU Fortran 77 compatibility function IARGC.
 std::int32_t FORTRAN_PROCEDURE_NAME(iargc)();
 
+void FORTRAN_PROCEDURE_NAME(fdate)(std::int8_t *string, std::int64_t length);
+
 // GNU Fortran 77 compatibility subroutine GETARG(N, ARG).
 void FORTRAN_PROCEDURE_NAME(getarg)(
 std::int32_t &n, std::int8_t *arg, std::int64_t length);
diff --git a/flang/runtime/command.cpp b/flang/runtime/command.cpp
index b81a0791c5e571..da0803c39f49b6 100644
--- a/flang/runtime/command.cpp
+++ b/flang/runtime/command.cpp
@@ -14,6 +14,7 @@
 #include "flang/Runtime/descriptor.h"
 #include 
 #include 
+#include 
 
 namespace Fortran::runtime {
 std::int32_t RTNAME(ArgumentCount)() {
@@ -125,6 +126,33 @@ static bool FitsInDescriptor(
   kind, terminator, value);
 }
 
+void removeNewLine(char *str) {
+  char *newlinePos = strchr(str, '\n');
+  if (newlinePos != NULL) {
+*newlinePos = '\0'; // Replace with null terminator
+  }
+}
+
+std::int32_t RTNAME(FDate)(const Descriptor *value, const Descriptor *errmsg) {
+  FillWithSpaces(*value);
+
+  time_t current_time;
+  time(¤t_time);
+
+  char *time_string = ctime(¤t_time);
+  removeNewLine(time_string);
+  std::int64_t stringLen{StringLength(time_string)};
+  if (stringLen <= 0) {
+return ToErrmsg(errmsg, StatMissingArgument);
+  }
+
+  if (value) {
+return CopyToDescriptor(*value, time_string, stringLen, errmsg);
+  }
+
+  return StatOk;
+}
+
 std::int32_t RTNAME(GetCommandArgument)(std::int32_t n, const Descriptor 
*value,
 const Descriptor *length, const Descriptor *errmsg, const char *sourceFile,
 int line) {
diff --git a/flang/runtime/e

[Lldb-commits] [flang] [libc] [llvm] [clang] [libcxx] [lldb] [compiler-rt] [clang-tools-extra] [RegAllocFast] Refactor dominates algorithm for large basic block (PR #72250)

2023-12-22 Thread Wei Xiao via lldb-commits

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


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


[Lldb-commits] [flang] [lldb] [clang-tools-extra] [compiler-rt] [libc] [llvm] [clang] [libcxx] [RegAllocFast] Refactor dominates algorithm for large basic block (PR #72250)

2023-12-22 Thread via lldb-commits

https://github.com/yubingex007-a11y approved this pull request.

LGTM

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


[Lldb-commits] [flang] [lldb] [openmp] [mlir] [clang] [libc] [libcxx] [compiler-rt] [llvm] [hwasan] Classify stack overflow, and use after scope (PR #76133)

2023-12-22 Thread antoine moynault via lldb-commits

antmox wrote:

Hi, looks like patch broke 2 aarch64 bots:
https://lab.llvm.org/buildbot/#/builders/185/builds/5675
https://lab.llvm.org/buildbot/#/builders/179/builds/8880
Could you please look at this?

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