[llvm-branch-commits] [llvm] release/18.x: [AMDGPU] Fix GFX12 encoding of s_wait_event export_ready (#89622) (PR #91034)

2024-05-10 Thread Jay Foad via llvm-branch-commits

jayfoad wrote:

> Fixed encoding of AMDGPU instructions

I don't think the release notes should say that. It makes it sound like all 
encodings were wrong.

https://github.com/llvm/llvm-project/pull/91034
___
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] [llvm] release/18.x: [RISCV][lld] Set the type of TLSDESC relocation's referenced local symbol to STT_NOTYPE (PR #91678)

2024-05-10 Thread Fangrui Song via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/91678
___
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] [llvm] release/18.x: [llvm][lld] Pre-commit tests for RISCV TLSDESC symbols (PR #91632)

2024-05-10 Thread Fangrui Song via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/91632
___
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] Use disambiguated local names in BAT YAML (PR #91773)

2024-05-10 Thread Amir Ayupov via llvm-branch-commits

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

Align BAT YAML to fdata profile.

Test Plan: updated register-fragments-bolt-symbols.s



___
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] Use disambiguated local names in BAT YAML (PR #91773)

2024-05-10 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-bolt

Author: Amir Ayupov (aaupov)


Changes

Align BAT YAML to fdata profile.

Test Plan: updated register-fragments-bolt-symbols.s


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


2 Files Affected:

- (modified) bolt/lib/Profile/DataAggregator.cpp (+1-1) 
- (modified) bolt/test/X86/register-fragments-bolt-symbols.s (+5) 


``diff
diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index 4ca6ef633e7db..afbab6ffceece 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2333,7 +2333,7 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
 continue;
   BinaryFunction *BF = BC.getBinaryFunctionAtAddress(FuncAddress);
   assert(BF);
-  YamlBF.Name = FuncName.str();
+  YamlBF.Name = getLocationName(*BF);
   YamlBF.Id = BF->getFunctionNumber();
   YamlBF.Hash = BAT->getBFHash(FuncAddress);
   YamlBF.ExecCount = BF->getKnownExecutionCount();
diff --git a/bolt/test/X86/register-fragments-bolt-symbols.s 
b/bolt/test/X86/register-fragments-bolt-symbols.s
index fa9b70e0b2d89..6478adf19372b 100644
--- a/bolt/test/X86/register-fragments-bolt-symbols.s
+++ b/bolt/test/X86/register-fragments-bolt-symbols.s
@@ -15,6 +15,8 @@
 # PREAGG: B X:0 #chain.cold.0# 1 0
 # RUN: perf2bolt %t.bolt -p %t.preagg --pa -o %t.bat.fdata -w %t.bat.yaml -v=1 
\
 # RUN:   | FileCheck %s --check-prefix=CHECK-REGISTER
+# RUN: FileCheck --input-file %t.bat.fdata --check-prefix=CHECK-FDATA %s
+# RUN: FileCheck --input-file %t.bat.yaml --check-prefix=CHECK-YAML %s
 
 # CHECK-SYMS: l df *ABS*  [[#]] chain.s
 # CHECK-SYMS: l  F .bolt.org.text [[#]] chain
@@ -24,6 +26,9 @@
 
 # CHECK-REGISTER: BOLT-INFO: marking chain.cold.0/1(*2) as a fragment of 
chain/2(*2)
 
+# CHECK-FDATA: 0 [unknown] 0 1 chain/chain.s/2 10 0 1
+# CHECK-YAML: - name: 'chain/chain.s/2'
+
 .file "chain.s"
 .text
 .type   chain, @function

``




https://github.com/llvm/llvm-project/pull/91773
___
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: [AArc64][GlobalISel] Fix legalizer assert for G_INSERT_VECTOR_ELT - manual merge (PR #91672)

2024-05-10 Thread Amara Emerson via llvm-branch-commits

aemerson wrote:

@tstellar could we merge this now?

https://github.com/llvm/llvm-project/pull/91672
___
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] Set entry counts in BAT YAML profile (PR #91775)

2024-05-10 Thread Amir Ayupov via llvm-branch-commits

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

Align with DataReader::readProfile that sets entry block counts from
FuncBranchData->EntryData.

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] Set entry counts in BAT YAML profile (PR #91775)

2024-05-10 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-bolt

Author: Amir Ayupov (aaupov)


Changes

Align with DataReader::readProfile that sets entry block counts from
FuncBranchData->EntryData.

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


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


2 Files Affected:

- (modified) bolt/lib/Profile/DataAggregator.cpp (+11) 
- (modified) bolt/test/X86/bolt-address-translation-yaml.test (+4) 


``diff
diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index afbab6ffceece..e5fdf487b6d93 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2385,6 +2385,17 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
   addIndex(Branches.IntraIndex);
   addIndex(Branches.InterIndex);
 
+  // Set entry counts, similar to DataReader::readProfile.
+  for (const llvm::bolt::BranchInfo &BI : Branches.EntryData) {
+if (!BlockMap.isInputBlock(BI.To.Offset)) {
+  if (opts::Verbosity >= 1)
+errs() << "BOLT-WARNING: Unexpected EntryData in " << FuncName
+   << " at 0x" << Twine::utohexstr(BI.To.Offset) << '\n';
+  continue;
+}
+const unsigned BlockIndex = BlockMap.getBBIndex(BI.To.Offset);
+YamlBF.Blocks[BlockIndex].ExecCount += BI.Branches;
+  }
   // Drop blocks without a hash, won't be useful for stale matching.
   llvm::erase_if(YamlBF.Blocks,
  [](const yaml::bolt::BinaryBasicBlockProfile &YamlBB) {
diff --git a/bolt/test/X86/bolt-address-translation-yaml.test 
b/bolt/test/X86/bolt-address-translation-yaml.test
index c7927f92c9dd9..e21513b7dfe59 100644
--- a/bolt/test/X86/bolt-address-translation-yaml.test
+++ b/bolt/test/X86/bolt-address-translation-yaml.test
@@ -70,6 +70,10 @@ YAML-BAT-CHECK-NEXT:   hash:0x6AF7E61EA3966722
 YAML-BAT-CHECK-NEXT:   exec:25
 YAML-BAT-CHECK-NEXT:   nblocks: 15
 YAML-BAT-CHECK-NEXT:   blocks:
+YAML-BAT-CHECK-NEXT:   - bid:   0
+YAML-BAT-CHECK-NEXT: insns: [[#]]
+YAML-BAT-CHECK-NEXT: hash:  0x700F19D2460
+YAML-BAT-CHECK-NEXT: exec:  25
 YAML-BAT-CHECK:- bid:   3
 YAML-BAT-CHECK-NEXT: insns: [[#]]
 YAML-BAT-CHECK-NEXT: hash:  0xDDA1DC5F69F900AC

``




https://github.com/llvm/llvm-project/pull/91775
___
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][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)

2024-05-10 Thread via llvm-branch-commits

https://github.com/agozillon updated 
https://github.com/llvm/llvm-project/pull/82851


___
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][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)

2024-05-10 Thread via llvm-branch-commits

https://github.com/agozillon updated 
https://github.com/llvm/llvm-project/pull/82851


___
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][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-05-10 Thread via llvm-branch-commits

https://github.com/agozillon updated 
https://github.com/llvm/llvm-project/pull/82852


___
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][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-05-10 Thread via llvm-branch-commits

https://github.com/agozillon updated 
https://github.com/llvm/llvm-project/pull/82852


___
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][MLIR] Initial derived type member map support (PR #82853)

2024-05-10 Thread via llvm-branch-commits

https://github.com/agozillon updated 
https://github.com/llvm/llvm-project/pull/82853

>From 21b05eee943e4f1ad20fcd8f30bd14a0a3317db6 Mon Sep 17 00:00:00 2001
From: Andrew Gozillon 
Date: Fri, 15 Mar 2024 14:13:30 -0500
Subject: [PATCH] update with minor tidying up

Created using spr 1.3.4
---
 flang/lib/Lower/OpenMP/Utils.cpp  | 2 +-
 flang/lib/Lower/OpenMP/Utils.h| 2 --
 flang/lib/Optimizer/Transforms/CMakeLists.txt | 2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/flang/lib/Lower/OpenMP/Utils.cpp b/flang/lib/Lower/OpenMP/Utils.cpp
index 60aea9f5b70ab..18728e2c4c1b0 100644
--- a/flang/lib/Lower/OpenMP/Utils.cpp
+++ b/flang/lib/Lower/OpenMP/Utils.cpp
@@ -13,7 +13,6 @@
 #include "Utils.h"
 #include "Clauses.h"
 
-#include 
 #include 
 #include 
 #include 
@@ -22,6 +21,7 @@
 #include 
 #include 
 
+#include 
 #include 
 
 llvm::cl::opt treatIndexAsSection(
diff --git a/flang/lib/Lower/OpenMP/Utils.h b/flang/lib/Lower/OpenMP/Utils.h
index f45e4490c2abe..942dd4c12d87b 100644
--- a/flang/lib/Lower/OpenMP/Utils.h
+++ b/flang/lib/Lower/OpenMP/Utils.h
@@ -14,7 +14,6 @@
 #include "mlir/IR/Location.h"
 #include "mlir/IR/Value.h"
 #include "llvm/Support/CommandLine.h"
-#include 
 
 extern llvm::cl::opt treatIndexAsSection;
 extern llvm::cl::opt enableDelayedPrivatization;
@@ -36,7 +35,6 @@ class Symbol;
 namespace parser {
 struct OmpObject;
 struct OmpObjectList;
-struct Designator;
 } // namespace parser
 
 namespace lower {
diff --git a/flang/lib/Optimizer/Transforms/CMakeLists.txt 
b/flang/lib/Optimizer/Transforms/CMakeLists.txt
index ce5ce3ed1bc48..63fbe2a0658d8 100644
--- a/flang/lib/Optimizer/Transforms/CMakeLists.txt
+++ b/flang/lib/Optimizer/Transforms/CMakeLists.txt
@@ -17,8 +17,8 @@ add_flang_library(FIRTransforms
   AddDebugFoundation.cpp
   PolymorphicOpConversion.cpp
   LoopVersioning.cpp
-  OMPMapInfoFinalization.cpp
   OMPFunctionFiltering.cpp
+  OMPMapInfoFinalization.cpp
   OMPMarkDeclareTarget.cpp
   VScaleAttr.cpp
   FunctionAttr.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][MLIR] Initial derived type member map support (PR #82853)

2024-05-10 Thread via llvm-branch-commits

https://github.com/agozillon updated 
https://github.com/llvm/llvm-project/pull/82853

>From 21b05eee943e4f1ad20fcd8f30bd14a0a3317db6 Mon Sep 17 00:00:00 2001
From: Andrew Gozillon 
Date: Fri, 15 Mar 2024 14:13:30 -0500
Subject: [PATCH] update with minor tidying up

Created using spr 1.3.4
---
 flang/lib/Lower/OpenMP/Utils.cpp  | 2 +-
 flang/lib/Lower/OpenMP/Utils.h| 2 --
 flang/lib/Optimizer/Transforms/CMakeLists.txt | 2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/flang/lib/Lower/OpenMP/Utils.cpp b/flang/lib/Lower/OpenMP/Utils.cpp
index 60aea9f5b70ab..18728e2c4c1b0 100644
--- a/flang/lib/Lower/OpenMP/Utils.cpp
+++ b/flang/lib/Lower/OpenMP/Utils.cpp
@@ -13,7 +13,6 @@
 #include "Utils.h"
 #include "Clauses.h"
 
-#include 
 #include 
 #include 
 #include 
@@ -22,6 +21,7 @@
 #include 
 #include 
 
+#include 
 #include 
 
 llvm::cl::opt treatIndexAsSection(
diff --git a/flang/lib/Lower/OpenMP/Utils.h b/flang/lib/Lower/OpenMP/Utils.h
index f45e4490c2abe..942dd4c12d87b 100644
--- a/flang/lib/Lower/OpenMP/Utils.h
+++ b/flang/lib/Lower/OpenMP/Utils.h
@@ -14,7 +14,6 @@
 #include "mlir/IR/Location.h"
 #include "mlir/IR/Value.h"
 #include "llvm/Support/CommandLine.h"
-#include 
 
 extern llvm::cl::opt treatIndexAsSection;
 extern llvm::cl::opt enableDelayedPrivatization;
@@ -36,7 +35,6 @@ class Symbol;
 namespace parser {
 struct OmpObject;
 struct OmpObjectList;
-struct Designator;
 } // namespace parser
 
 namespace lower {
diff --git a/flang/lib/Optimizer/Transforms/CMakeLists.txt 
b/flang/lib/Optimizer/Transforms/CMakeLists.txt
index ce5ce3ed1bc48..63fbe2a0658d8 100644
--- a/flang/lib/Optimizer/Transforms/CMakeLists.txt
+++ b/flang/lib/Optimizer/Transforms/CMakeLists.txt
@@ -17,8 +17,8 @@ add_flang_library(FIRTransforms
   AddDebugFoundation.cpp
   PolymorphicOpConversion.cpp
   LoopVersioning.cpp
-  OMPMapInfoFinalization.cpp
   OMPFunctionFiltering.cpp
+  OMPMapInfoFinalization.cpp
   OMPMarkDeclareTarget.cpp
   VScaleAttr.cpp
   FunctionAttr.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] [libc] f22c705 - address CR

2024-05-10 Thread Schrodinger ZHU Yifan via llvm-branch-commits

Author: Schrodinger ZHU Yifan
Date: 2024-05-10T14:00:06-04:00
New Revision: f22c705484a0c4af5810803ee62b47beb44dc73c

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

LOG: address CR

Added: 


Modified: 
libc/src/__support/time/CMakeLists.txt
libc/src/time/linux/CMakeLists.txt
libc/src/time/linux/clock.cpp
libc/src/time/linux/clock_gettime.cpp
libc/src/time/linux/gettimeofday.cpp
libc/src/time/linux/time.cpp

Removed: 
libc/src/__support/time/clock_gettime.h



diff  --git a/libc/src/__support/time/CMakeLists.txt 
b/libc/src/__support/time/CMakeLists.txt
index e934ef7b9224a..89ddffb099388 100644
--- a/libc/src/__support/time/CMakeLists.txt
+++ b/libc/src/__support/time/CMakeLists.txt
@@ -2,14 +2,6 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
   add_subdirectory(${LIBC_TARGET_OS})
 endif()
 
-add_header_library(
-  clock_gettime
-  HDRS
-clock_gettime.h
-  DEPENDS
-.${LIBC_TARGET_OS}.clock_gettime
-)
-
 add_header_library(
   units
   HDRS

diff  --git a/libc/src/__support/time/clock_gettime.h 
b/libc/src/__support/time/clock_gettime.h
deleted file mode 100644
index ef99339a4805e..0
--- a/libc/src/__support/time/clock_gettime.h
+++ /dev/null
@@ -1,18 +0,0 @@
-//===--- clock_gettime internal implementation --*- C++ 
-*-===//
-//
-// 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
-//
-//===--===//
-
-#ifndef LLVM_LIBC_SRC___SUPPORT_TIME_CLOCK_GETTIME_H
-#define LLVM_LIBC_SRC___SUPPORT_TIME_CLOCK_GETTIME_H
-
-#ifdef __linux__
-#include "src/__support/time/linux/clock_gettime.h"
-#else
-#error "clock_gettime is not supported on this platform"
-#endif
-
-#endif // LLVM_LIBC_SRC___SUPPORT_TIME_CLOCK_GETTIME_H

diff  --git a/libc/src/time/linux/CMakeLists.txt 
b/libc/src/time/linux/CMakeLists.txt
index 8a0e6b04b66e6..c15fb44ad5d12 100644
--- a/libc/src/time/linux/CMakeLists.txt
+++ b/libc/src/time/linux/CMakeLists.txt
@@ -7,7 +7,7 @@ add_entrypoint_object(
   DEPENDS
 libc.hdr.time_macros
 libc.hdr.types.time_t
-libc.src.__support.time.clock_gettime
+libc.src.__support.time.linux.clock_gettime
 libc.src.errno.errno
 )
 
@@ -21,7 +21,7 @@ add_entrypoint_object(
 libc.hdr.time_macros
 libc.hdr.types.clock_t
 libc.src.__support.time.units
-libc.src.__support.time.clock_gettime
+libc.src.__support.time.linux.clock_gettime
 libc.src.__support.CPP.limits
 libc.src.errno.errno
 )
@@ -49,7 +49,7 @@ add_entrypoint_object(
   DEPENDS
 libc.hdr.types.clockid_t
 libc.hdr.types.struct_timespec
-libc.src.__support.time.clock_gettime
+libc.src.__support.time.linux.clock_gettime
 libc.src.errno.errno
 )
 
@@ -62,7 +62,7 @@ add_entrypoint_object(
   DEPENDS
 libc.hdr.time_macros
 libc.hdr.types.suseconds_t
-libc.src.__support.time.clock_gettime
+libc.src.__support.time.linux.clock_gettime
 libc.src.__support.time.units
 libc.src.errno.errno
 )

diff  --git a/libc/src/time/linux/clock.cpp b/libc/src/time/linux/clock.cpp
index fc48e2792747d..2c1eee8e5d60a 100644
--- a/libc/src/time/linux/clock.cpp
+++ b/libc/src/time/linux/clock.cpp
@@ -10,7 +10,7 @@
 #include "hdr/time_macros.h"
 #include "src/__support/CPP/limits.h"
 #include "src/__support/common.h"
-#include "src/__support/time/clock_gettime.h"
+#include "src/__support/time/linux/clock_gettime.h"
 #include "src/__support/time/units.h"
 #include "src/errno/libc_errno.h"
 

diff  --git a/libc/src/time/linux/clock_gettime.cpp 
b/libc/src/time/linux/clock_gettime.cpp
index 920363e85e06c..d7b8cfd245bc4 100644
--- a/libc/src/time/linux/clock_gettime.cpp
+++ b/libc/src/time/linux/clock_gettime.cpp
@@ -8,7 +8,7 @@
 
 #include "src/time/clock_gettime.h"
 #include "src/__support/common.h"
-#include "src/__support/time/clock_gettime.h"
+#include "src/__support/time/linux/clock_gettime.h"
 #include "src/errno/libc_errno.h"
 
 namespace LIBC_NAMESPACE {

diff  --git a/libc/src/time/linux/gettimeofday.cpp 
b/libc/src/time/linux/gettimeofday.cpp
index c7bcd45e01fa9..f868f5ff4d4b3 100644
--- a/libc/src/time/linux/gettimeofday.cpp
+++ b/libc/src/time/linux/gettimeofday.cpp
@@ -10,7 +10,7 @@
 #include "hdr/time_macros.h"
 #include "hdr/types/suseconds_t.h"
 #include "src/__support/common.h"
-#include "src/__support/time/clock_gettime.h"
+#include "src/__support/time/linux/clock_gettime.h"
 #include "src/__support/time/units.h"
 #include "src/errno/libc_errno.h"
 

diff  --git a/libc/src/time/linux/time.cpp b/libc/src/time/linux/time.cpp
index 93d5d73627642..32f531efb6d15 100644
--- a/libc/

[llvm-branch-commits] [OpenMP][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)

2024-05-10 Thread via llvm-branch-commits

https://github.com/agozillon closed 
https://github.com/llvm/llvm-project/pull/82851
___
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][MLIR] Initial derived type member map support (PR #82853)

2024-05-10 Thread via llvm-branch-commits

https://github.com/agozillon closed 
https://github.com/llvm/llvm-project/pull/82853
___
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][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-05-10 Thread via llvm-branch-commits

https://github.com/agozillon closed 
https://github.com/llvm/llvm-project/pull/82852
___
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] f5cec3a - Revert "[DirectX] Fix DXIL part header version encoding (#91506)"

2024-05-10 Thread via llvm-branch-commits

Author: Justin Bogner
Date: 2024-05-10T12:41:18-06:00
New Revision: f5cec3acf9d2664c2209f24cc8ea0c5f3ed7fec6

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

LOG: Revert "[DirectX] Fix DXIL part header version encoding (#91506)"

This reverts commit 195d8ac26d91ca798733c3a5f58d67992d43503d.

Added: 


Modified: 
llvm/include/llvm/BinaryFormat/DXContainer.h
llvm/include/llvm/TargetParser/Triple.h
llvm/lib/MC/MCDXContainerWriter.cpp
llvm/lib/TargetParser/Triple.cpp
llvm/test/CodeGen/DirectX/embed-dxil.ll
llvm/unittests/Object/DXContainerTest.cpp

Removed: 




diff  --git a/llvm/include/llvm/BinaryFormat/DXContainer.h 
b/llvm/include/llvm/BinaryFormat/DXContainer.h
index e5fcda63910d4..e8d03f806715f 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainer.h
+++ b/llvm/include/llvm/BinaryFormat/DXContainer.h
@@ -103,8 +103,8 @@ struct PartHeader {
 
 struct BitcodeHeader {
   uint8_t Magic[4]; // ACSII "DXIL".
-  uint8_t MinorVersion; // DXIL version.
   uint8_t MajorVersion; // DXIL version.
+  uint8_t MinorVersion; // DXIL version.
   uint16_t Unused;
   uint32_t Offset; // Offset to LLVM bitcode (from start of header).
   uint32_t Size;   // Size of LLVM bitcode (in bytes).

diff  --git a/llvm/include/llvm/TargetParser/Triple.h 
b/llvm/include/llvm/TargetParser/Triple.h
index b3bb354b38ff5..8f9d99816931a 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -429,7 +429,7 @@ class Triple {
   /// (SubArch).  This should only be called with Vulkan SPIR-V triples.
   VersionTuple getVulkanVersion() const;
 
-  /// Parse the DXIL version number from the OSVersion and DXIL version
+  /// Parse the DXIL version number from the DXIL version
   /// (SubArch).  This should only be called with DXIL triples.
   VersionTuple getDXILVersion() const;
 

diff  --git a/llvm/lib/MC/MCDXContainerWriter.cpp 
b/llvm/lib/MC/MCDXContainerWriter.cpp
index 015899278f379..0580dc7e42826 100644
--- a/llvm/lib/MC/MCDXContainerWriter.cpp
+++ b/llvm/lib/MC/MCDXContainerWriter.cpp
@@ -127,9 +127,6 @@ uint64_t DXContainerObjectWriter::writeObject(MCAssembler 
&Asm,
   // The program header's size field is in 32-bit words.
   Header.Size = (SectionSize + sizeof(dxbc::ProgramHeader) + 3) / 4;
   memcpy(Header.Bitcode.Magic, "DXIL", 4);
-  VersionTuple DXILVersion = TT.getDXILVersion();
-  Header.Bitcode.MajorVersion = DXILVersion.getMajor();
-  Header.Bitcode.MinorVersion = DXILVersion.getMinor().value_or(0);
   Header.Bitcode.Offset = sizeof(dxbc::BitcodeHeader);
   Header.Bitcode.Size = SectionSize;
   if (sys::IsBigEndianHost)

diff  --git a/llvm/lib/TargetParser/Triple.cpp 
b/llvm/lib/TargetParser/Triple.cpp
index 4fc1ff5aaa051..f8269a51dc0bb 100644
--- a/llvm/lib/TargetParser/Triple.cpp
+++ b/llvm/lib/TargetParser/Triple.cpp
@@ -1510,8 +1510,6 @@ VersionTuple Triple::getDXILVersion() const {
   if (getArch() != dxil || getOS() != ShaderModel)
 llvm_unreachable("invalid DXIL triple");
   StringRef Arch = getArchName();
-  if (getSubArch() == NoSubArch)
-Arch = getDXILArchNameFromShaderModel(getOSName());
   Arch.consume_front("dxilv");
   VersionTuple DXILVersion = parseVersionFromName(Arch);
   // FIXME: validate DXIL version against Shader Model version.

diff  --git a/llvm/test/CodeGen/DirectX/embed-dxil.ll 
b/llvm/test/CodeGen/DirectX/embed-dxil.ll
index 9f4fb19d86fa0..306e5c385b5a3 100644
--- a/llvm/test/CodeGen/DirectX/embed-dxil.ll
+++ b/llvm/test/CodeGen/DirectX/embed-dxil.ll
@@ -42,8 +42,8 @@ define i32 @add(i32 %a, i32 %b) {
 ; DXC-NEXT:   MinorVersion:5
 ; DXC-NEXT:   ShaderKind:  6
 ; DXC-NEXT:   Size:[[#div(SIZE,4)]]
-; DXC-NEXT:   DXILMajorVersion: 1
-; DXC-NEXT:   DXILMinorVersion: 5
+; DXC-NEXT:   DXILMajorVersion: [[#]]
+; DXC-NEXT:   DXILMinorVersion: [[#]]
 ; DXC-NEXT:   DXILSize:[[#SIZE - 24]]
 ; DXC-NEXT:   DXIL:[ 0x42, 0x43, 0xC0, 0xDE,
 ; DXC:  - Name:SFI0

diff  --git a/llvm/unittests/Object/DXContainerTest.cpp 
b/llvm/unittests/Object/DXContainerTest.cpp
index 098da331ab568..da640225617d4 100644
--- a/llvm/unittests/Object/DXContainerTest.cpp
+++ b/llvm/unittests/Object/DXContainerTest.cpp
@@ -126,51 +126,6 @@ TEST(DXCFile, ParseOverlappingParts) {
   "Part offset for part 1 begins before the previous part ends"));
 }
 
-// This test verify DXILMajorVersion and DXILMinorVersion are correctly parsed.
-// This test is based on the binary output constructed from this yaml.
-// --- !dxcontainer
-// Header:
-//   Hash:[ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-//  0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ]
-//   Version:
-// Major:   

[llvm-branch-commits] [llvm] release/18.x: [AArc64][GlobalISel] Fix legalizer assert for G_INSERT_VECTOR_ELT - manual merge (PR #91672)

2024-05-10 Thread Tom Stellard via llvm-branch-commits

https://github.com/tstellar updated 
https://github.com/llvm/llvm-project/pull/91672

>From 7dbd266e89a70e96a747d8dd4aa5c6abfde15b2c Mon Sep 17 00:00:00 2001
From: Amara Emerson 
Date: Thu, 7 Mar 2024 15:38:33 -0800
Subject: [PATCH] [AArc64][GlobalISel] Fix legalizer assert for
 G_INSERT_VECTOR_ELT

We should moreElements <3 x s1> to <4 x s1> before we try to widen the element,
otherwise we end up with a <3 x s21> nonsense type.

(cherry picked from commit a01e9ce86f4c1bc9af819902db9f287b6d23f54f)

Test has been changed from original commit due to a fallback in a G_BITCAST.
Added abort=2 so we can see partial legalization and check no crash.
---
 .../AArch64/GISel/AArch64LegalizerInfo.cpp|  1 +
 .../GlobalISel/legalize-insert-vector-elt.mir | 69 ++-
 2 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp 
b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
index 4b9d549e79114..de3c89e925a2a 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
@@ -877,6 +877,7 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const 
AArch64Subtarget &ST)
 
   getActionDefinitionsBuilder(G_INSERT_VECTOR_ELT)
   .legalIf(typeInSet(0, {v16s8, v8s8, v8s16, v4s16, v4s32, v2s32, v2s64}))
+  .moreElementsToNextPow2(0)
   .widenVectorEltsToVectorMinSize(0, 64);
 
   getActionDefinitionsBuilder(G_BUILD_VECTOR)
diff --git 
a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-insert-vector-elt.mir 
b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-insert-vector-elt.mir
index 6f6cf2cc165b9..563d3d3e26edf 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-insert-vector-elt.mir
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-insert-vector-elt.mir
@@ -1,5 +1,5 @@
 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
-# RUN: llc -mtriple=aarch64-linux-gnu -O0 -run-pass=legalizer %s -o - 
-global-isel-abort=1 | FileCheck %s
+# RUN: llc -mtriple=aarch64-linux-gnu -O0 -run-pass=legalizer %s -o - 
-global-isel-abort=2 | FileCheck %s
 ---
 name:pr63826_v2s16
 body: |
@@ -216,3 +216,70 @@ body: |
 $q0 = COPY %2(<2 x s64>)
 RET_ReallyLR
 ...
+---
+name:v3s8_crash
+body: |
+  ; CHECK-LABEL: name: v3s8_crash
+  ; CHECK: bb.0:
+  ; CHECK-NEXT:   successors: %bb.1(0x8000)
+  ; CHECK-NEXT:   liveins: $w1, $w2, $w3, $x0
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:_(p0) = COPY $x0
+  ; CHECK-NEXT:   [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
+  ; CHECK-NEXT:   [[COPY2:%[0-9]+]]:_(s32) = COPY $w2
+  ; CHECK-NEXT:   [[COPY3:%[0-9]+]]:_(s32) = COPY $w3
+  ; CHECK-NEXT:   [[BUILD_VECTOR:%[0-9]+]]:_(<3 x s32>) = G_BUILD_VECTOR 
[[COPY1]](s32), [[COPY2]](s32), [[COPY3]](s32)
+  ; CHECK-NEXT:   [[TRUNC:%[0-9]+]]:_(<3 x s8>) = G_TRUNC [[BUILD_VECTOR]](<3 
x s32>)
+  ; CHECK-NEXT:   [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
+  ; CHECK-NEXT:   [[DEF:%[0-9]+]]:_(s8) = G_IMPLICIT_DEF
+  ; CHECK-NEXT:   [[C1:%[0-9]+]]:_(s8) = G_CONSTANT i8 0
+  ; CHECK-NEXT:   [[BUILD_VECTOR1:%[0-9]+]]:_(<3 x s8>) = G_BUILD_VECTOR 
[[C1]](s8), [[DEF]](s8), [[DEF]](s8)
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT: bb.1:
+  ; CHECK-NEXT:   successors: %bb.1(0x8000)
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
+  ; CHECK-NEXT:   [[C3:%[0-9]+]]:_(s8) = G_CONSTANT i8 0
+  ; CHECK-NEXT:   [[IVEC:%[0-9]+]]:_(<3 x s8>) = G_INSERT_VECTOR_ELT 
[[TRUNC]], [[C3]](s8), [[C2]](s64)
+  ; CHECK-NEXT:   [[SHUF:%[0-9]+]]:_(<12 x s8>) = G_SHUFFLE_VECTOR [[IVEC]](<3 
x s8>), [[BUILD_VECTOR1]], shufflemask(0, 3, 3, 3, 1, 3, 3, 3, 2, 3, 3, 3)
+  ; CHECK-NEXT:   [[BITCAST:%[0-9]+]]:_(<3 x s32>) = G_BITCAST [[SHUF]](<12 x 
s8>)
+  ; CHECK-NEXT:   [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32), 
[[UV2:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[BITCAST]](<3 x s32>)
+  ; CHECK-NEXT:   [[DEF1:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
+  ; CHECK-NEXT:   [[BUILD_VECTOR2:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR 
[[UV]](s32), [[UV1]](s32), [[UV2]](s32), [[DEF1]](s32)
+  ; CHECK-NEXT:   [[UITOFP:%[0-9]+]]:_(<4 x s32>) = G_UITOFP 
[[BUILD_VECTOR2]](<4 x s32>)
+  ; CHECK-NEXT:   [[UV3:%[0-9]+]]:_(s32), [[UV4:%[0-9]+]]:_(s32), 
[[UV5:%[0-9]+]]:_(s32), [[UV6:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[UITOFP]](<4 
x s32>)
+  ; CHECK-NEXT:   [[BUILD_VECTOR3:%[0-9]+]]:_(<3 x s32>) = G_BUILD_VECTOR 
[[UV3]](s32), [[UV4]](s32), [[UV5]](s32)
+  ; CHECK-NEXT:   [[UV7:%[0-9]+]]:_(s32), [[UV8:%[0-9]+]]:_(s32), 
[[UV9:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[BUILD_VECTOR3]](<3 x s32>)
+  ; CHECK-NEXT:   G_STORE [[UV7]](s32), [[COPY]](p0) :: (store (s32), align 16)
+  ; CHECK-NEXT:   [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
+  ; CHECK-NEXT:   [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C4]](s64)
+  ; CHECK-NEXT:   G_STORE [[UV8]](s32), [[PTR_ADD]](p0) :: (store (s32) into 
unknown-address + 4)
+  ; CHECK-NEXT:   [[C5:%[0-9]+]]:_(s64) = G_CON

[llvm-branch-commits] [llvm] 7dbd266 - [AArc64][GlobalISel] Fix legalizer assert for G_INSERT_VECTOR_ELT

2024-05-10 Thread Tom Stellard via llvm-branch-commits

Author: Amara Emerson
Date: 2024-05-10T11:50:51-07:00
New Revision: 7dbd266e89a70e96a747d8dd4aa5c6abfde15b2c

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

LOG: [AArc64][GlobalISel] Fix legalizer assert for G_INSERT_VECTOR_ELT

We should moreElements <3 x s1> to <4 x s1> before we try to widen the element,
otherwise we end up with a <3 x s21> nonsense type.

(cherry picked from commit a01e9ce86f4c1bc9af819902db9f287b6d23f54f)

Test has been changed from original commit due to a fallback in a G_BITCAST.
Added abort=2 so we can see partial legalization and check no crash.

Added: 


Modified: 
llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
llvm/test/CodeGen/AArch64/GlobalISel/legalize-insert-vector-elt.mir

Removed: 




diff  --git a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp 
b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
index 4b9d549e79114..de3c89e925a2a 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
@@ -877,6 +877,7 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const 
AArch64Subtarget &ST)
 
   getActionDefinitionsBuilder(G_INSERT_VECTOR_ELT)
   .legalIf(typeInSet(0, {v16s8, v8s8, v8s16, v4s16, v4s32, v2s32, v2s64}))
+  .moreElementsToNextPow2(0)
   .widenVectorEltsToVectorMinSize(0, 64);
 
   getActionDefinitionsBuilder(G_BUILD_VECTOR)

diff  --git 
a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-insert-vector-elt.mir 
b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-insert-vector-elt.mir
index 6f6cf2cc165b9..563d3d3e26edf 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-insert-vector-elt.mir
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-insert-vector-elt.mir
@@ -1,5 +1,5 @@
 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
-# RUN: llc -mtriple=aarch64-linux-gnu -O0 -run-pass=legalizer %s -o - 
-global-isel-abort=1 | FileCheck %s
+# RUN: llc -mtriple=aarch64-linux-gnu -O0 -run-pass=legalizer %s -o - 
-global-isel-abort=2 | FileCheck %s
 ---
 name:pr63826_v2s16
 body: |
@@ -216,3 +216,70 @@ body: |
 $q0 = COPY %2(<2 x s64>)
 RET_ReallyLR
 ...
+---
+name:v3s8_crash
+body: |
+  ; CHECK-LABEL: name: v3s8_crash
+  ; CHECK: bb.0:
+  ; CHECK-NEXT:   successors: %bb.1(0x8000)
+  ; CHECK-NEXT:   liveins: $w1, $w2, $w3, $x0
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:_(p0) = COPY $x0
+  ; CHECK-NEXT:   [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
+  ; CHECK-NEXT:   [[COPY2:%[0-9]+]]:_(s32) = COPY $w2
+  ; CHECK-NEXT:   [[COPY3:%[0-9]+]]:_(s32) = COPY $w3
+  ; CHECK-NEXT:   [[BUILD_VECTOR:%[0-9]+]]:_(<3 x s32>) = G_BUILD_VECTOR 
[[COPY1]](s32), [[COPY2]](s32), [[COPY3]](s32)
+  ; CHECK-NEXT:   [[TRUNC:%[0-9]+]]:_(<3 x s8>) = G_TRUNC [[BUILD_VECTOR]](<3 
x s32>)
+  ; CHECK-NEXT:   [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
+  ; CHECK-NEXT:   [[DEF:%[0-9]+]]:_(s8) = G_IMPLICIT_DEF
+  ; CHECK-NEXT:   [[C1:%[0-9]+]]:_(s8) = G_CONSTANT i8 0
+  ; CHECK-NEXT:   [[BUILD_VECTOR1:%[0-9]+]]:_(<3 x s8>) = G_BUILD_VECTOR 
[[C1]](s8), [[DEF]](s8), [[DEF]](s8)
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT: bb.1:
+  ; CHECK-NEXT:   successors: %bb.1(0x8000)
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
+  ; CHECK-NEXT:   [[C3:%[0-9]+]]:_(s8) = G_CONSTANT i8 0
+  ; CHECK-NEXT:   [[IVEC:%[0-9]+]]:_(<3 x s8>) = G_INSERT_VECTOR_ELT 
[[TRUNC]], [[C3]](s8), [[C2]](s64)
+  ; CHECK-NEXT:   [[SHUF:%[0-9]+]]:_(<12 x s8>) = G_SHUFFLE_VECTOR [[IVEC]](<3 
x s8>), [[BUILD_VECTOR1]], shufflemask(0, 3, 3, 3, 1, 3, 3, 3, 2, 3, 3, 3)
+  ; CHECK-NEXT:   [[BITCAST:%[0-9]+]]:_(<3 x s32>) = G_BITCAST [[SHUF]](<12 x 
s8>)
+  ; CHECK-NEXT:   [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32), 
[[UV2:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[BITCAST]](<3 x s32>)
+  ; CHECK-NEXT:   [[DEF1:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
+  ; CHECK-NEXT:   [[BUILD_VECTOR2:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR 
[[UV]](s32), [[UV1]](s32), [[UV2]](s32), [[DEF1]](s32)
+  ; CHECK-NEXT:   [[UITOFP:%[0-9]+]]:_(<4 x s32>) = G_UITOFP 
[[BUILD_VECTOR2]](<4 x s32>)
+  ; CHECK-NEXT:   [[UV3:%[0-9]+]]:_(s32), [[UV4:%[0-9]+]]:_(s32), 
[[UV5:%[0-9]+]]:_(s32), [[UV6:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[UITOFP]](<4 
x s32>)
+  ; CHECK-NEXT:   [[BUILD_VECTOR3:%[0-9]+]]:_(<3 x s32>) = G_BUILD_VECTOR 
[[UV3]](s32), [[UV4]](s32), [[UV5]](s32)
+  ; CHECK-NEXT:   [[UV7:%[0-9]+]]:_(s32), [[UV8:%[0-9]+]]:_(s32), 
[[UV9:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[BUILD_VECTOR3]](<3 x s32>)
+  ; CHECK-NEXT:   G_STORE [[UV7]](s32), [[COPY]](p0) :: (store (s32), align 16)
+  ; CHECK-NEXT:   [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
+  ; CHECK-NEXT:   [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C4]](s64)

[llvm-branch-commits] [llvm] release/18.x: [AArc64][GlobalISel] Fix legalizer assert for G_INSERT_VECTOR_ELT - manual merge (PR #91672)

2024-05-10 Thread Tom Stellard via llvm-branch-commits

https://github.com/tstellar closed 
https://github.com/llvm/llvm-project/pull/91672
___
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] [llvm] release/18.x: [llvm][lld] Pre-commit tests for RISCV TLSDESC symbols (PR #91632)

2024-05-10 Thread Tom Stellard via llvm-branch-commits

https://github.com/tstellar updated 
https://github.com/llvm/llvm-project/pull/91632

>From 5c77c1d31d14e04df4aa7e36a3e17d03834f4fa4 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Wed, 20 Mar 2024 13:39:39 -0700
Subject: [PATCH] [llvm][lld] Pre-commit tests for RISCV TLSDESC symbols

Currently, we mistakenly mark the local labels used in RISC-V TLSDESC as
TLS symbols, when they should not be. This patch adds tests with the
current incorrect behavior, and subsequent patches will address the
issue.

Reviewers: MaskRay, topperc

Reviewed By: MaskRay

Pull Request: https://github.com/llvm/llvm-project/pull/85816

(cherry picked from commit f6f474c4ef9694a4ca8f08d59fd112c250fb9c73)
---
 lld/test/ELF/riscv-tlsdesc.s  | 25 +++
 llvm/test/CodeGen/RISCV/tlsdesc-symbol.ll | 24 ++
 2 files changed, 49 insertions(+)
 create mode 100644 llvm/test/CodeGen/RISCV/tlsdesc-symbol.ll

diff --git a/lld/test/ELF/riscv-tlsdesc.s b/lld/test/ELF/riscv-tlsdesc.s
index 1738f86256caa..c583e15cf30ce 100644
--- a/lld/test/ELF/riscv-tlsdesc.s
+++ b/lld/test/ELF/riscv-tlsdesc.s
@@ -29,6 +29,12 @@
 # RUN: ld.lld -e 0 -z now a.32.o c.32.so -o a.32.ie
 # RUN: llvm-objdump --no-show-raw-insn -M no-aliases -h -d a.32.ie | FileCheck 
%s --check-prefix=IE32
 
+# RUN: llvm-mc -triple=riscv64 -filetype=obj d.s -o d.64.o
+# RUN: not ld.lld -shared -soname=d.64.so -o d.64.so d.64.o 2>&1 | FileCheck 
%s --check-prefix=BADTLSLABEL
+
+# RUN: llvm-mc -triple=riscv32 -filetype=obj d.s -o d.32.o --defsym ELF32=1
+# RUN: not ld.lld -shared -soname=d.32.so -o d.32.so d.32.o 2>&1 | FileCheck 
%s --check-prefix=BADTLSLABEL
+
 # GD64-RELA:  .rela.dyn {
 # GD64-RELA-NEXT:   0x2408 R_RISCV_TLSDESC - 0x7FF
 # GD64-RELA-NEXT:   0x23E8 R_RISCV_TLSDESC a 0x0
@@ -150,6 +156,9 @@
 # IE32-NEXT: lw  a0, 0x80(a0)
 # IE32-NEXT: add a0, a0, tp
 
+## FIXME This should not pass, but the code MC layer needs a fix to prevent 
this.
+# BADTLSLABEL: error: d.{{.*}}.o has an STT_TLS symbol but doesn't have an 
SHF_TLS section
+
 #--- a.s
 .macro load dst, src
 .ifdef ELF32
@@ -192,3 +201,19 @@ b:
 .tbss
 .globl c
 c: .zero 4
+
+#--- d.s
+.macro load dst, src
+.ifdef ELF32
+lw \dst, \src
+.else
+ld \dst, \src
+.endif
+.endm
+
+.Ltlsdesc_hi0:
+  auipca0, %tlsdesc_hi(foo)
+  load a1, %tlsdesc_load_lo(.Ltlsdesc_hi0)(a0)
+  addi a0, a0, %tlsdesc_add_lo(.Ltlsdesc_hi0)
+  jalr t0, 0(a1), %tlsdesc_call(.Ltlsdesc_hi0)
+  add  a1, a0, tp
diff --git a/llvm/test/CodeGen/RISCV/tlsdesc-symbol.ll 
b/llvm/test/CodeGen/RISCV/tlsdesc-symbol.ll
new file mode 100644
index 0..23ba2ffb1ad76
--- /dev/null
+++ b/llvm/test/CodeGen/RISCV/tlsdesc-symbol.ll
@@ -0,0 +1,24 @@
+;; The test in this file do not appear in tls-models.ll because
+;; they are not auto-generated.
+; RUN: llc -mtriple=riscv64 -relocation-model=pic -enable-tlsdesc < %s \
+; RUN: | llvm-mc -triple=riscv64 -filetype=obj -o - \
+; RUN: | llvm-readelf --symbols - \
+; RUN: | FileCheck %s
+
+; RUN: llc -mtriple=riscv32 -relocation-model=pic -enable-tlsdesc < %s \
+; RUN: | llvm-mc -triple=riscv32 -filetype=obj -o - \
+; RUN: | llvm-readelf --symbols - \
+; RUN: | FileCheck %s
+
+; Check that TLS symbols are lowered correctly based on the specified
+; model. Make sure they're external to avoid them all being optimised to Local
+; Exec for the executable.
+
+@unspecified = external thread_local global i32
+
+define ptr @f1() nounwind {
+entry:
+  ret ptr @unspecified
+  ; CHECK: Symbol table '.symtab' contains 7 entries:
+  ; CHECK: TLS {{.*}} unspecified
+}

___
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] 5c77c1d - [llvm][lld] Pre-commit tests for RISCV TLSDESC symbols

2024-05-10 Thread Tom Stellard via llvm-branch-commits

Author: Paul Kirth
Date: 2024-05-10T12:15:56-07:00
New Revision: 5c77c1d31d14e04df4aa7e36a3e17d03834f4fa4

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

LOG: [llvm][lld] Pre-commit tests for RISCV TLSDESC symbols

Currently, we mistakenly mark the local labels used in RISC-V TLSDESC as
TLS symbols, when they should not be. This patch adds tests with the
current incorrect behavior, and subsequent patches will address the
issue.

Reviewers: MaskRay, topperc

Reviewed By: MaskRay

Pull Request: https://github.com/llvm/llvm-project/pull/85816

(cherry picked from commit f6f474c4ef9694a4ca8f08d59fd112c250fb9c73)

Added: 
llvm/test/CodeGen/RISCV/tlsdesc-symbol.ll

Modified: 
lld/test/ELF/riscv-tlsdesc.s

Removed: 




diff  --git a/lld/test/ELF/riscv-tlsdesc.s b/lld/test/ELF/riscv-tlsdesc.s
index 1738f86256caa..c583e15cf30ce 100644
--- a/lld/test/ELF/riscv-tlsdesc.s
+++ b/lld/test/ELF/riscv-tlsdesc.s
@@ -29,6 +29,12 @@
 # RUN: ld.lld -e 0 -z now a.32.o c.32.so -o a.32.ie
 # RUN: llvm-objdump --no-show-raw-insn -M no-aliases -h -d a.32.ie | FileCheck 
%s --check-prefix=IE32
 
+# RUN: llvm-mc -triple=riscv64 -filetype=obj d.s -o d.64.o
+# RUN: not ld.lld -shared -soname=d.64.so -o d.64.so d.64.o 2>&1 | FileCheck 
%s --check-prefix=BADTLSLABEL
+
+# RUN: llvm-mc -triple=riscv32 -filetype=obj d.s -o d.32.o --defsym ELF32=1
+# RUN: not ld.lld -shared -soname=d.32.so -o d.32.so d.32.o 2>&1 | FileCheck 
%s --check-prefix=BADTLSLABEL
+
 # GD64-RELA:  .rela.dyn {
 # GD64-RELA-NEXT:   0x2408 R_RISCV_TLSDESC - 0x7FF
 # GD64-RELA-NEXT:   0x23E8 R_RISCV_TLSDESC a 0x0
@@ -150,6 +156,9 @@
 # IE32-NEXT: lw  a0, 0x80(a0)
 # IE32-NEXT: add a0, a0, tp
 
+## FIXME This should not pass, but the code MC layer needs a fix to prevent 
this.
+# BADTLSLABEL: error: d.{{.*}}.o has an STT_TLS symbol but doesn't have an 
SHF_TLS section
+
 #--- a.s
 .macro load dst, src
 .ifdef ELF32
@@ -192,3 +201,19 @@ b:
 .tbss
 .globl c
 c: .zero 4
+
+#--- d.s
+.macro load dst, src
+.ifdef ELF32
+lw \dst, \src
+.else
+ld \dst, \src
+.endif
+.endm
+
+.Ltlsdesc_hi0:
+  auipca0, %tlsdesc_hi(foo)
+  load a1, %tlsdesc_load_lo(.Ltlsdesc_hi0)(a0)
+  addi a0, a0, %tlsdesc_add_lo(.Ltlsdesc_hi0)
+  jalr t0, 0(a1), %tlsdesc_call(.Ltlsdesc_hi0)
+  add  a1, a0, tp

diff  --git a/llvm/test/CodeGen/RISCV/tlsdesc-symbol.ll 
b/llvm/test/CodeGen/RISCV/tlsdesc-symbol.ll
new file mode 100644
index 0..23ba2ffb1ad76
--- /dev/null
+++ b/llvm/test/CodeGen/RISCV/tlsdesc-symbol.ll
@@ -0,0 +1,24 @@
+;; The test in this file do not appear in tls-models.ll because
+;; they are not auto-generated.
+; RUN: llc -mtriple=riscv64 -relocation-model=pic -enable-tlsdesc < %s \
+; RUN: | llvm-mc -triple=riscv64 -filetype=obj -o - \
+; RUN: | llvm-readelf --symbols - \
+; RUN: | FileCheck %s
+
+; RUN: llc -mtriple=riscv32 -relocation-model=pic -enable-tlsdesc < %s \
+; RUN: | llvm-mc -triple=riscv32 -filetype=obj -o - \
+; RUN: | llvm-readelf --symbols - \
+; RUN: | FileCheck %s
+
+; Check that TLS symbols are lowered correctly based on the specified
+; model. Make sure they're external to avoid them all being optimised to Local
+; Exec for the executable.
+
+@unspecified = external thread_local global i32
+
+define ptr @f1() nounwind {
+entry:
+  ret ptr @unspecified
+  ; CHECK: Symbol table '.symtab' contains 7 entries:
+  ; CHECK: TLS {{.*}} unspecified
+}



___
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] [llvm] release/18.x: [llvm][lld] Pre-commit tests for RISCV TLSDESC symbols (PR #91632)

2024-05-10 Thread Tom Stellard via llvm-branch-commits

https://github.com/tstellar closed 
https://github.com/llvm/llvm-project/pull/91632
___
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] [llvm] release/18.x: [llvm][lld] Pre-commit tests for RISCV TLSDESC symbols (PR #91632)

2024-05-10 Thread Tom Stellard via llvm-branch-commits

tstellar wrote:

@MaskRay (or anyone else). If you would like to add a note about this fix in 
the release notes (completely optional). Please reply to this comment with a 
one or two sentence description of the fix.  When you are done, please add the 
release:note label to this PR.

https://github.com/llvm/llvm-project/pull/91632
___
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: [AArc64][GlobalISel] Fix legalizer assert for G_INSERT_VECTOR_ELT - manual merge (PR #91672)

2024-05-10 Thread Tom Stellard via llvm-branch-commits

tstellar wrote:

@aemerson (or anyone else). If you would like to add a note about this fix in 
the release notes (completely optional). Please reply to this comment with a 
one or two sentence description of the fix.  When you are done, please add the 
release:note label to this PR.

https://github.com/llvm/llvm-project/pull/91672
___
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][MLIR] Initial derived type member map support (PR #82853)

2024-05-10 Thread via llvm-branch-commits

agozillon wrote:

I made a bit of a mistake not using SPR to land this PR series, so i've ended 
up having to directly commit the PR, the associated commit for this PR can be 
found here: 
https://github.com/llvm/llvm-project/commit/435e850ba97ab567a14b6c84d2b27cadb771cb27

https://github.com/llvm/llvm-project/pull/82853
___
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][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-05-10 Thread via llvm-branch-commits

agozillon wrote:

I made a bit of a mistake not using SPR to land this PR series, so i've ended 
up having to directly commit the PR, the associated commit for this PR can be 
found here: 
https://github.com/llvm/llvm-project/commit/462435f089b7ca67ed1eed60f369e16b71e76b74
 

https://github.com/llvm/llvm-project/pull/82852
___
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][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)

2024-05-10 Thread via llvm-branch-commits

agozillon wrote:

I made a bit of a mistake not using SPR to land this PR series, so i've ended 
up having to directly commit the PR, the associated commit for this PR can be 
found here: 
https://github.com/llvm/llvm-project/commit/50df0ff515697090983b3cb951c48377bcfb6ddf

https://github.com/llvm/llvm-project/pull/82851
___
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] release/18.x: [OpenMP] Fix child processes to use affinity_none (#91391) (PR #91479)

2024-05-10 Thread Jonathan Peyton via llvm-branch-commits

jpeyton52 wrote:

@jhuber6 , Sorry, I'm not used to backporting. Are you the right person for 
this?

https://github.com/llvm/llvm-project/pull/91479
___
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] release/18.x: [OpenMP] Fix child processes to use affinity_none (#91391) (PR #91479)

2024-05-10 Thread Joseph Huber via llvm-branch-commits

jhuber6 wrote:

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

This PR should be merged.

> @jhuber6 , Sorry, I'm not used to backporting. Are you the right person for 
> this?

AFAIK the bot asking is automated and then a human pushes the button.

https://github.com/llvm/llvm-project/pull/91479
___
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] [llvm] release/18.x: [RISCV][lld] Set the type of TLSDESC relocation's referenced local symbol to STT_NOTYPE (PR #91678)

2024-05-10 Thread Tom Stellard via llvm-branch-commits

tstellar wrote:

This branch needs to be rebased.

https://github.com/llvm/llvm-project/pull/91678
___
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] release/18.x: [OpenMP] Fix child processes to use affinity_none (#91391) (PR #91479)

2024-05-10 Thread Tom Stellard via llvm-branch-commits

https://github.com/tstellar updated 
https://github.com/llvm/llvm-project/pull/91479

>From 09615ce869b08f897ab9a444646f609a5604492a Mon Sep 17 00:00:00 2001
From: Jonathan Peyton 
Date: Wed, 8 May 2024 09:23:50 -0500
Subject: [PATCH] [OpenMP] Fix child processes to use affinity_none (#91391)

When a child process is forked with OpenMP already initialized, the
child process resets its affinity mask and sets proc-bind-var to false
so that the entire original affinity mask is used. This patch corrects
an issue with the affinity initialization code setting affinity to
compact instead of none for this special case of forked children.

The test trying to catch this only testing explicit setting of
KMP_AFFINITY=none. Add test run for no KMP_AFFINITY setting.

Fixes: #91098
(cherry picked from commit 73bb8d9d92f689863c94d48517e89d35dae0ebcf)
---
 openmp/runtime/src/kmp_settings.cpp | 2 ++
 openmp/runtime/test/affinity/redetect.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/openmp/runtime/src/kmp_settings.cpp 
b/openmp/runtime/src/kmp_settings.cpp
index ec86ee07472c1..58f19ea5b8ab7 100644
--- a/openmp/runtime/src/kmp_settings.cpp
+++ b/openmp/runtime/src/kmp_settings.cpp
@@ -6426,6 +6426,8 @@ void __kmp_env_initialize(char const *string) {
 }
 if ((__kmp_nested_proc_bind.bind_types[0] != proc_bind_intel) &&
 (__kmp_nested_proc_bind.bind_types[0] != proc_bind_default)) {
+  if (__kmp_nested_proc_bind.bind_types[0] == proc_bind_false)
+__kmp_affinity.type = affinity_none;
   if (__kmp_affinity.type == affinity_default) {
 __kmp_affinity.type = affinity_compact;
 __kmp_affinity.flags.dups = FALSE;
diff --git a/openmp/runtime/test/affinity/redetect.c 
b/openmp/runtime/test/affinity/redetect.c
index dba83b72cc42e..4b96d1bd92ee7 100644
--- a/openmp/runtime/test/affinity/redetect.c
+++ b/openmp/runtime/test/affinity/redetect.c
@@ -1,4 +1,5 @@
 // RUN: %libomp-compile
+// RUN: %libomp-run
 // RUN: env KMP_AFFINITY=none %libomp-run
 // REQUIRES: linux
 

___
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] 09615ce - [OpenMP] Fix child processes to use affinity_none (#91391)

2024-05-10 Thread Tom Stellard via llvm-branch-commits

Author: Jonathan Peyton
Date: 2024-05-10T13:56:18-07:00
New Revision: 09615ce869b08f897ab9a444646f609a5604492a

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

LOG: [OpenMP] Fix child processes to use affinity_none (#91391)

When a child process is forked with OpenMP already initialized, the
child process resets its affinity mask and sets proc-bind-var to false
so that the entire original affinity mask is used. This patch corrects
an issue with the affinity initialization code setting affinity to
compact instead of none for this special case of forked children.

The test trying to catch this only testing explicit setting of
KMP_AFFINITY=none. Add test run for no KMP_AFFINITY setting.

Fixes: #91098
(cherry picked from commit 73bb8d9d92f689863c94d48517e89d35dae0ebcf)

Added: 


Modified: 
openmp/runtime/src/kmp_settings.cpp
openmp/runtime/test/affinity/redetect.c

Removed: 




diff  --git a/openmp/runtime/src/kmp_settings.cpp 
b/openmp/runtime/src/kmp_settings.cpp
index ec86ee07472c1..58f19ea5b8ab7 100644
--- a/openmp/runtime/src/kmp_settings.cpp
+++ b/openmp/runtime/src/kmp_settings.cpp
@@ -6426,6 +6426,8 @@ void __kmp_env_initialize(char const *string) {
 }
 if ((__kmp_nested_proc_bind.bind_types[0] != proc_bind_intel) &&
 (__kmp_nested_proc_bind.bind_types[0] != proc_bind_default)) {
+  if (__kmp_nested_proc_bind.bind_types[0] == proc_bind_false)
+__kmp_affinity.type = affinity_none;
   if (__kmp_affinity.type == affinity_default) {
 __kmp_affinity.type = affinity_compact;
 __kmp_affinity.flags.dups = FALSE;

diff  --git a/openmp/runtime/test/affinity/redetect.c 
b/openmp/runtime/test/affinity/redetect.c
index dba83b72cc42e..4b96d1bd92ee7 100644
--- a/openmp/runtime/test/affinity/redetect.c
+++ b/openmp/runtime/test/affinity/redetect.c
@@ -1,4 +1,5 @@
 // RUN: %libomp-compile
+// RUN: %libomp-run
 // RUN: env KMP_AFFINITY=none %libomp-run
 // REQUIRES: linux
 



___
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] release/18.x: [OpenMP] Fix child processes to use affinity_none (#91391) (PR #91479)

2024-05-10 Thread Tom Stellard via llvm-branch-commits

https://github.com/tstellar closed 
https://github.com/llvm/llvm-project/pull/91479
___
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] release/18.x: [OpenMP] Fix child processes to use affinity_none (#91391) (PR #91479)

2024-05-10 Thread Tom Stellard via llvm-branch-commits

tstellar wrote:

Hi @jpeyton52  (or anyone else). If you would like to add a note about this fix 
in the release notes (completely optional). Please reply to this comment with a 
one or two sentence description of the fix.  When you are done, please add the 
release:note label to this PR.

https://github.com/llvm/llvm-project/pull/91479
___
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] 0f59bd6 - Revert "[flang][cuda] Implicitly load cudadevice module in device/global subp…"

2024-05-10 Thread via llvm-branch-commits

Author: Valentin Clement (バレンタイン クレメン)
Date: 2024-05-10T17:43:59-07:00
New Revision: 0f59bd6878dd97db4210ccfd9dd193ddfe7a50c6

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

LOG: Revert "[flang][cuda] Implicitly load cudadevice module in device/global 
subp…"

This reverts commit f32f6d199ac36e0c45433a648691f5165893deec.

Added: 


Modified: 
flang/include/flang/Semantics/semantics.h
flang/lib/Semantics/check-cuda.cpp
flang/lib/Semantics/resolve-names.cpp
flang/lib/Semantics/semantics.cpp
flang/tools/f18/CMakeLists.txt

Removed: 
flang/module/__cuda_device_builtins.f90
flang/module/cudadevice.f90
flang/test/Semantics/cuf-device-procedures01.cuf
flang/test/Semantics/cuf-device-procedures02.cuf



diff  --git a/flang/include/flang/Semantics/semantics.h 
b/flang/include/flang/Semantics/semantics.h
index 167e613816394..e6ba71d53e92b 100644
--- a/flang/include/flang/Semantics/semantics.h
+++ b/flang/include/flang/Semantics/semantics.h
@@ -215,10 +215,8 @@ class SemanticsContext {
   void UseFortranBuiltinsModule();
   const Scope *GetBuiltinsScope() const { return builtinsScope_; }
 
-  const Scope &GetCUDABuiltinsScope();
-  const Scope &GetCUDADeviceScope();
-
   void UsePPCBuiltinTypesModule();
+  const Scope &GetCUDABuiltinsScope();
   void UsePPCBuiltinsModule();
   Scope *GetPPCBuiltinTypesScope() { return ppcBuiltinTypesScope_; }
   const Scope *GetPPCBuiltinsScope() const { return ppcBuiltinsScope_; }
@@ -294,7 +292,6 @@ class SemanticsContext {
   const Scope *builtinsScope_{nullptr}; // module __Fortran_builtins
   Scope *ppcBuiltinTypesScope_{nullptr}; // module __Fortran_PPC_types
   std::optional cudaBuiltinsScope_; // module __CUDA_builtins
-  std::optional cudaDeviceScope_; // module cudadevice
   const Scope *ppcBuiltinsScope_{nullptr}; // module __ppc_intrinsics
   std::list modFileParseTrees_;
   std::unique_ptr commonBlockMap_;

diff  --git a/flang/lib/Semantics/check-cuda.cpp 
b/flang/lib/Semantics/check-cuda.cpp
index 2830d5f0be6ea..96ab902392633 100644
--- a/flang/lib/Semantics/check-cuda.cpp
+++ b/flang/lib/Semantics/check-cuda.cpp
@@ -82,11 +82,6 @@ struct DeviceExprChecker
   }
 }
   }
-  if (sym->owner().IsModule() &&
-  sym->owner().parent().IsIntrinsicModules() &&
-  DEREF(sym->owner().symbol()).name() == "__cuda_device_builtins") {
-return {};
-  }
 } else if (x.GetSpecificIntrinsic()) {
   // TODO(CUDA): Check for unsupported intrinsics here
   return {};

diff  --git a/flang/lib/Semantics/resolve-names.cpp 
b/flang/lib/Semantics/resolve-names.cpp
index 7cb0c6af937cc..e2875081b732c 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -3797,19 +3797,6 @@ bool SubprogramVisitor::Pre(const 
parser::PrefixSpec::Attributes &attrs) {
 subp->set_cudaSubprogramAttrs(attr);
   }
 }
-if (auto attrs{subp->cudaSubprogramAttrs()}) {
-  if (*attrs == common::CUDASubprogramAttrs::Global ||
-  *attrs == common::CUDASubprogramAttrs::Device) {
-// Implicitly USE the cudadevice module by copying its symbols in the
-// current scope.
-const Scope &scope{context().GetCUDADeviceScope()};
-for (auto sym : scope.GetSymbols()) {
-  if (!currScope().FindSymbol(sym->name())) {
-currScope().CopySymbol(sym);
-  }
-}
-  }
-}
   }
   return false;
 }

diff  --git a/flang/lib/Semantics/semantics.cpp 
b/flang/lib/Semantics/semantics.cpp
index d51cc62d804e8..6ccd915c4dcbf 100644
--- a/flang/lib/Semantics/semantics.cpp
+++ b/flang/lib/Semantics/semantics.cpp
@@ -543,14 +543,6 @@ const Scope &SemanticsContext::GetCUDABuiltinsScope() {
   return **cudaBuiltinsScope_;
 }
 
-const Scope &SemanticsContext::GetCUDADeviceScope() {
-  if (!cudaDeviceScope_) {
-cudaDeviceScope_ = GetBuiltinModule("cudadevice");
-CHECK(cudaDeviceScope_.value() != nullptr);
-  }
-  return **cudaDeviceScope_;
-}
-
 void SemanticsContext::UsePPCBuiltinsModule() {
   if (ppcBuiltinsScope_ == nullptr) {
 ppcBuiltinsScope_ = GetBuiltinModule("__ppc_intrinsics");

diff  --git a/flang/module/__cuda_device_builtins.f90 
b/flang/module/__cuda_device_builtins.f90
deleted file mode 100644
index 738dc97242f2b..0
--- a/flang/module/__cuda_device_builtins.f90
+++ /dev/null
@@ -1,74 +0,0 @@
-!===-- module/__cuda_device_builtins.f90 
---===!
-!
-! 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
-!
-!======!
-
-! CUD

[llvm-branch-commits] [llvm] [BOLT] Map branch source address to the containing basic block in BAT YAML (PR #91273)

2024-05-10 Thread Maksim Panchenko via llvm-branch-commits


@@ -2378,21 +2378,24 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
 return CSI;
   };
 
+  // Lookup containing basic block offset and index
+  auto getBlock = [&BlockMap](uint32_t Offset) {
+auto BlockIt = BlockMap.upper_bound(Offset);
+assert(BlockIt != BlockMap.begin());
+--BlockIt;
+return std::pair(BlockIt->first, BlockIt->second.getBBIndex());
+  };
+
   for (const auto &[FromOffset, SuccKV] : Branches.IntraIndex) {
-if (!BlockMap.isInputBlock(FromOffset))
-  continue;
-const unsigned Index = BlockMap.getBBIndex(FromOffset);
+const auto &[_, Index] = getBlock(FromOffset);

maksfb wrote:

Do we expect `getBlock()` to always return a good value? There's no chance for 
malformed input to trigger the assertion above?

https://github.com/llvm/llvm-project/pull/91273
___
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] Map branch source address to the containing basic block in BAT YAML (PR #91273)

2024-05-10 Thread Amir Ayupov via llvm-branch-commits


@@ -2378,21 +2378,24 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext &BC,
 return CSI;
   };
 
+  // Lookup containing basic block offset and index
+  auto getBlock = [&BlockMap](uint32_t Offset) {
+auto BlockIt = BlockMap.upper_bound(Offset);
+assert(BlockIt != BlockMap.begin());
+--BlockIt;
+return std::pair(BlockIt->first, BlockIt->second.getBBIndex());
+  };
+
   for (const auto &[FromOffset, SuccKV] : Branches.IntraIndex) {
-if (!BlockMap.isInputBlock(FromOffset))
-  continue;
-const unsigned Index = BlockMap.getBBIndex(FromOffset);
+const auto &[_, Index] = getBlock(FromOffset);

aaupov wrote:

> Do we expect getBlock() to always return a good value? 

Yes. It performs an `upper_bound` lookup with an unsigned value against a 
BlockMap which should contain a zero key (entry basic block). As long as the 
function has it, we're good. If not, it's worth looking why do we have such a 
function in BAT.

> There's no chance for malformed input to trigger the assertion above?

No, any offset in the profile is >=0.

https://github.com/llvm/llvm-project/pull/91273
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-10 Thread Ahmed Bougacha via llvm-branch-commits

ahmedbougacha wrote:

ping

https://github.com/llvm/llvm-project/pull/85736
___
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] [clang-tools-extra] [llvm] [mlir] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-10 Thread Ahmed Bougacha via llvm-branch-commits

https://github.com/ahmedbougacha updated 
https://github.com/llvm/llvm-project/pull/85736

error: too big or took too long to generate
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-10 Thread Ahmed Bougacha via llvm-branch-commits

https://github.com/ahmedbougacha edited 
https://github.com/llvm/llvm-project/pull/85736
___
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] Revert "[BOLT] Sort BranchData in DataAggregator" (PR #91289)

2024-05-10 Thread Amir Ayupov via llvm-branch-commits

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


___
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] Revert "[BOLT] Sort BranchData in DataAggregator" (PR #91289)

2024-05-10 Thread Amir Ayupov via llvm-branch-commits

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


___
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] Use FuncBranchData Data in writeBATYAML (PR #91289)

2024-05-10 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/91289
___
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] Unify Intra/InterIndex handling in writeBATYAML (PR #91278)

2024-05-10 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov closed https://github.com/llvm/llvm-project/pull/91278
___
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] Unify Intra/InterIndex handling in writeBATYAML (PR #91278)

2024-05-10 Thread Amir Ayupov via llvm-branch-commits

aaupov wrote:

Folded into https://github.com/llvm/llvm-project/pull/91289

https://github.com/llvm/llvm-project/pull/91278
___
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] Use aggregated FuncBranchData in writeBATYAML (PR #91289)

2024-05-10 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/91289
___
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] Use disambiguated local names in BAT YAML (PR #91773)

2024-05-10 Thread Davide Italiano via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/91773
___
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] Use aggregated FuncBranchData in writeBATYAML (PR #91289)

2024-05-10 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/91289
___
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] Set entry counts in BAT YAML profile (PR #91775)

2024-05-10 Thread Davide Italiano via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/91775
___
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] Use aggregated FuncBranchData in writeBATYAML (PR #91289)

2024-05-10 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/91289
___
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] Revert "[clang] Revert default behavior change of P0522R0 implementation (#91811)" (PR #91837)

2024-05-10 Thread Matheus Izvekov via llvm-branch-commits

https://github.com/mizvekov created 
https://github.com/llvm/llvm-project/pull/91837

With blocking issues fixed, re-enable relaxed template template argument 
matching by reverting these commits.

This reverts commit 4198aebc96cb0236fc63e29a92d886e6a2e3fedb. This reverts 
commit 2d5634a4b39d8e5497b6a67caa54049b3cfade8e.

>From 3a4489465d921b1ce98fc4339f491343f466c918 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov 
Date: Sat, 11 May 2024 00:42:27 -0300
Subject: [PATCH] Revert "[clang] Revert default behavior change of P0522R0
 implementation (#91811)"

With blocking issues fixed, re-enable relaxed template template argument 
matching
by reverting these commits.

This reverts commit 4198aebc96cb0236fc63e29a92d886e6a2e3fedb.
This reverts commit 2d5634a4b39d8e5497b6a67caa54049b3cfade8e.
---
 clang/lib/Driver/ToolChains/Clang.cpp  | 14 +++---
 .../Driver/frelaxed-template-template-args.cpp |  6 +++---
 clang/test/Driver/rewrite-legacy-objc.m|  6 +++---
 clang/test/Driver/rewrite-objc.m   |  2 +-
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index f0cc018b6668f..42feb1650574e 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -7249,15 +7249,15 @@ void Clang::ConstructJob(Compilation &C, const 
JobAction &JA,
   Args.addOptOutFlag(CmdArgs, options::OPT_fassume_unique_vtables,
  options::OPT_fno_assume_unique_vtables);
 
-  // -fno-relaxed-template-template-args is deprecated.
-  if (Arg *A = Args.getLastArg(options::OPT_frelaxed_template_template_args,
-   
options::OPT_fno_relaxed_template_template_args);
-  A &&
-  A->getOption().matches(options::OPT_fno_relaxed_template_template_args))
+  // -frelaxed-template-template-args is deprecated.
+  if (Arg *A =
+  Args.getLastArg(options::OPT_frelaxed_template_template_args,
+  options::OPT_fno_relaxed_template_template_args)) {
 D.Diag(diag::warn_drv_deprecated_arg)
 << A->getAsString(Args) << /*hasReplacement=*/false;
-  else
-CmdArgs.push_back("-fno-relaxed-template-template-args");
+if 
(A->getOption().matches(options::OPT_fno_relaxed_template_template_args))
+  CmdArgs.push_back("-fno-relaxed-template-template-args");
+  }
 
   // -fsized-deallocation is off by default, as it is an ABI-breaking change 
for
   // most platforms.
diff --git a/clang/test/Driver/frelaxed-template-template-args.cpp 
b/clang/test/Driver/frelaxed-template-template-args.cpp
index 136c360276a15..57fc4e3da6e5d 100644
--- a/clang/test/Driver/frelaxed-template-template-args.cpp
+++ b/clang/test/Driver/frelaxed-template-template-args.cpp
@@ -1,7 +1,7 @@
 // RUN: %clang -fsyntax-only -### %s 2>&1 | FileCheck --check-prefix=CHECK-DEF 
%s
-// RUN: %clang -fsyntax-only -frelaxed-template-template-args %s 2>&1 | 
FileCheck --check-prefix=CHECK-ON --allow-empty %s
+// RUN: %clang -fsyntax-only -frelaxed-template-template-args %s 2>&1 | 
FileCheck --check-prefix=CHECK-ON %s
 // RUN: %clang -fsyntax-only -fno-relaxed-template-template-args %s 2>&1 | 
FileCheck --check-prefix=CHECK-OFF %s
 
-// CHECK-DEF: "-cc1"{{.*}} "-fno-relaxed-template-template-args"
-// CHECK-ON-NOT: warning: argument '-frelaxed-template-template-args' is 
deprecated [-Wdeprecated]
+// CHECK-DEF-NOT: "-cc1"{{.*}} "-fno-relaxed-template-template-args"
+// CHECK-ON:  warning: argument '-frelaxed-template-template-args' is 
deprecated [-Wdeprecated]
 // CHECK-OFF: warning: argument '-fno-relaxed-template-template-args' is 
deprecated [-Wdeprecated]
diff --git a/clang/test/Driver/rewrite-legacy-objc.m 
b/clang/test/Driver/rewrite-legacy-objc.m
index d45fb8c405c52..413a7a7a61f05 100644
--- a/clang/test/Driver/rewrite-legacy-objc.m
+++ b/clang/test/Driver/rewrite-legacy-objc.m
@@ -3,11 +3,11 @@
 // TEST0: "-cc1"
 // TEST0: "-rewrite-objc"
 // FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check adjacency 
instead.
-// TEST0: "-stack-protector" "1" "-fblocks" 
"-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" 
"-fgnuc-version=4.2.1"{{.*}} "-fobjc-runtime=macosx-fragile" 
"-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" 
"-fno-relaxed-template-template-args" "-fmax-type-align=16"
+// TEST0: "-stack-protector" "1" "-fblocks" 
"-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" 
"-fgnuc-version=4.2.1"{{.*}} "-fobjc-runtime=macosx-fragile" 
"-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" 
"-fmax-type-align=16"
 // TEST0: rewrite-legacy-objc.m"
 // RUN: %clang --target=i386-apple-macosx10.9.0 -rewrite-legacy-objc %s -o - 
-### 2>&1 | \
 // RUN:   FileCheck -check-prefix=TEST1 %s
 // RUN: %clang --target=i386-apple-macosx10.6.0 -rewrite-legacy-objc %s -o - 
-### 2>&1 | \
 // RUN:   FileCheck -check-prefix=TEST2 %s
-// TEST1: "-sta

[llvm-branch-commits] [clang] Revert "[clang] Revert default behavior change of P0522R0 implementation (#91811)" (PR #91837)

2024-05-10 Thread Matheus Izvekov via llvm-branch-commits

https://github.com/mizvekov edited 
https://github.com/llvm/llvm-project/pull/91837
___
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] Use disambiguated local names in BAT YAML (PR #91773)

2024-05-10 Thread Amir Ayupov via llvm-branch-commits

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


___
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] Use disambiguated local names in BAT YAML (PR #91773)

2024-05-10 Thread Amir Ayupov via llvm-branch-commits

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


___
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] Set entry counts in BAT YAML profile (PR #91775)

2024-05-10 Thread Amir Ayupov via llvm-branch-commits

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


___
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] Set entry counts in BAT YAML profile (PR #91775)

2024-05-10 Thread Amir Ayupov via llvm-branch-commits

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


___
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] release/18.x: [clang-format] Fix a crash with AlignArrayOfStructures option (#86420) (PR #91049)

2024-05-10 Thread Owen Pan via llvm-branch-commits

owenca wrote:

@HazardyKnusperkeks can you approve it too?

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