[llvm-branch-commits] [llvm] DAG: Avoid forming shufflevector from a single extract_vector_elt (PR #122672)

2025-01-13 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/122672

>From b9ec5619f55edec45875f3dc97d2d02ac8a0f16c Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Fri, 10 Jan 2025 21:13:09 +0700
Subject: [PATCH] DAG: Avoid forming shufflevector from a single
 extract_vector_elt

This avoids regressions in a future AMDGPU commit. Previously we
would have a build_vector (extract_vector_elt x), undef with free
access to the elements bloated into a shuffle of one element + undef,
which has much worse combine support than the extract.

Alternatively could check aggressivelyPreferBuildVectorSources, but
I'm not sure it's really different than isExtractVecEltCheap.
---
 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp |  25 ++-
 .../CodeGen/AMDGPU/insert_vector_dynelt.ll|  10 +-
 llvm/test/CodeGen/X86/avx512-build-vector.ll  |   8 +-
 .../X86/avx512-shuffles/partial_permute.ll| 157 ++
 .../CodeGen/X86/insertelement-duplicates.ll   |  10 +-
 llvm/test/CodeGen/X86/sse-align-12.ll |   4 +-
 6 files changed, 123 insertions(+), 91 deletions(-)

diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp 
b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 712e52ee8fc921..49ad0b526602eb 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -23799,6 +23799,10 @@ SDValue DAGCombiner::reduceBuildVecToShuffle(SDNode 
*N) {
   SmallVector VecIn;
   VecIn.push_back(SDValue());
 
+  // If we have a single extract_element with a constant index, track the index
+  // value.
+  unsigned OneConstExtractIndex = ~0u;
+
   for (unsigned i = 0; i != NumElems; ++i) {
 SDValue Op = N->getOperand(i);
 
@@ -23816,16 +23820,18 @@ SDValue DAGCombiner::reduceBuildVecToShuffle(SDNode 
*N) {
 
 // Not an undef or zero. If the input is something other than an
 // EXTRACT_VECTOR_ELT with an in-range constant index, bail out.
-if (Op.getOpcode() != ISD::EXTRACT_VECTOR_ELT ||
-!isa(Op.getOperand(1)))
+if (Op.getOpcode() != ISD::EXTRACT_VECTOR_ELT)
   return SDValue();
-SDValue ExtractedFromVec = Op.getOperand(0);
 
+SDValue ExtractedFromVec = Op.getOperand(0);
 if (ExtractedFromVec.getValueType().isScalableVector())
   return SDValue();
+auto *ExtractIdx = dyn_cast(Op.getOperand(1));
+if (!ExtractIdx)
+  return SDValue();
 
-const APInt &ExtractIdx = Op.getConstantOperandAPInt(1);
-if (ExtractIdx.uge(ExtractedFromVec.getValueType().getVectorNumElements()))
+if (ExtractIdx->getAsAPIntVal().uge(
+ExtractedFromVec.getValueType().getVectorNumElements()))
   return SDValue();
 
 // All inputs must have the same element type as the output.
@@ -23833,6 +23839,8 @@ SDValue DAGCombiner::reduceBuildVecToShuffle(SDNode *N) 
{
 ExtractedFromVec.getValueType().getVectorElementType())
   return SDValue();
 
+OneConstExtractIndex = ExtractIdx->getZExtValue();
+
 // Have we seen this input vector before?
 // The vectors are expected to be tiny (usually 1 or 2 elements), so using
 // a map back from SDValues to numbers isn't worth it.
@@ -23855,6 +23863,13 @@ SDValue DAGCombiner::reduceBuildVecToShuffle(SDNode 
*N) {
   // VecIn accordingly.
   bool DidSplitVec = false;
   if (VecIn.size() == 2) {
+// If we only found a single constant indexed extract_vector_elt feeding 
the
+// build_vector, do not produce a more complicated shuffle if the extract 
is
+// cheap.
+if (TLI.isOperationLegalOrCustom(ISD::EXTRACT_VECTOR_ELT, VT) &&
+TLI.isExtractVecEltCheap(VT, OneConstExtractIndex))
+  return SDValue();
+
 unsigned MaxIndex = 0;
 unsigned NearestPow2 = 0;
 SDValue Vec = VecIn.back();
diff --git a/llvm/test/CodeGen/AMDGPU/insert_vector_dynelt.ll 
b/llvm/test/CodeGen/AMDGPU/insert_vector_dynelt.ll
index 7912d1cf8dc0d1..add8c0f75bf335 100644
--- a/llvm/test/CodeGen/AMDGPU/insert_vector_dynelt.ll
+++ b/llvm/test/CodeGen/AMDGPU/insert_vector_dynelt.ll
@@ -452,11 +452,11 @@ define amdgpu_kernel void @byte8_inselt(ptr addrspace(1) 
%out, <8 x i8> %vec, i3
 ; GCN-NEXT:s_and_b32 s6, s4, 0x1010101
 ; GCN-NEXT:s_andn2_b64 s[2:3], s[2:3], s[4:5]
 ; GCN-NEXT:s_or_b64 s[2:3], s[6:7], s[2:3]
-; GCN-NEXT:v_mov_b32_e32 v3, s1
-; GCN-NEXT:v_mov_b32_e32 v0, s2
-; GCN-NEXT:v_mov_b32_e32 v1, s3
-; GCN-NEXT:v_mov_b32_e32 v2, s0
-; GCN-NEXT:flat_store_dwordx2 v[2:3], v[0:1]
+; GCN-NEXT:v_mov_b32_e32 v0, s0
+; GCN-NEXT:v_mov_b32_e32 v2, s2
+; GCN-NEXT:v_mov_b32_e32 v1, s1
+; GCN-NEXT:v_mov_b32_e32 v3, s3
+; GCN-NEXT:flat_store_dwordx2 v[0:1], v[2:3]
 ; GCN-NEXT:s_endpgm
 entry:
   %v = insertelement <8 x i8> %vec, i8 1, i32 %sel
diff --git a/llvm/test/CodeGen/X86/avx512-build-vector.ll 
b/llvm/test/CodeGen/X86/avx512-build-vector.ll
index b21a0c4e36c2bd..27cb3eb406e9e8 100644
--- a/llvm/test/CodeGen/X86/avx512-build-vector.ll
+++ b/llvm/test/CodeGen/X86/avx512-build-

[llvm-branch-commits] [clang] [Driver] Change linker job in Baremetal toolchain object accomodate GCCInstallation.(2/3) (PR #121830)

2025-01-13 Thread Garvit Gupta via llvm-branch-commits

quic-garvgupt wrote:

Gentle Ping!


https://github.com/llvm/llvm-project/pull/121830
___
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] [Driver][RISCV] Integrate RISCV target in baremetal toolchain object and deprecate RISCVToolchain object.(3/3) (PR #121831)

2025-01-13 Thread Garvit Gupta via llvm-branch-commits

quic-garvgupt wrote:

Gentle Ping!

https://github.com/llvm/llvm-project/pull/121831
___
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] DAG: Fold bitcast of scalar_to_vector to anyext (PR #122660)

2025-01-13 Thread Matt Arsenault via llvm-branch-commits

arsenm wrote:

### Merge activity

* **Jan 13, 7:31 AM EST**: A user started a stack merge that includes this pull 
request via 
[Graphite](https://app.graphite.dev/github/pr/llvm/llvm-project/122660).


https://github.com/llvm/llvm-project/pull/122660
___
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] DAG: Fold bitcast of scalar_to_vector to anyext (PR #122660)

2025-01-13 Thread Simon Pilgrim via llvm-branch-commits

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

LGTM - cheers

https://github.com/llvm/llvm-project/pull/122660
___
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] DAG: Handle load in SimplifyDemandedVectorElts (PR #122671)

2025-01-13 Thread Simon Pilgrim via llvm-branch-commits

RKSimon wrote:

X86TargetLowering::shouldReduceLoadWidth is a mess, resulting in a lot of 
duplicate aliasaed loads that make very little sense - we're seeing something 
similar on #122485, but it might take some time to unravel.

https://github.com/llvm/llvm-project/pull/122671
___
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] ad6c95a - Revert "[Multilib] Custom flags YAML parsing (#110657)"

2025-01-13 Thread via llvm-branch-commits

Author: Victor Campos
Date: 2025-01-13T15:07:18Z
New Revision: ad6c95a7c6e5e8d376225b42a3a71d5663aa7942

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

LOG: Revert "[Multilib] Custom flags YAML parsing (#110657)"

This reverts commit d98ced1a9d641539d5bbb287bd16378ba3f5dba9.

Added: 


Modified: 
clang/include/clang/Driver/Multilib.h
clang/lib/Driver/Multilib.cpp

Removed: 
clang/test/Driver/baremetal-multilib-custom-flags-parsing.yaml



diff  --git a/clang/include/clang/Driver/Multilib.h 
b/clang/include/clang/Driver/Multilib.h
index 1dab45c062aeec..dbed70f4f9008f 100644
--- a/clang/include/clang/Driver/Multilib.h
+++ b/clang/include/clang/Driver/Multilib.h
@@ -101,25 +101,6 @@ class Multilib {
 
 raw_ostream &operator<<(raw_ostream &OS, const Multilib &M);
 
-namespace custom_flag {
-struct Declaration;
-using DeclarationPtr = std::shared_ptr;
-
-struct ValueDetail {
-  std::string Name;
-  std::optional> MacroDefines;
-  DeclarationPtr Decl;
-};
-
-struct Declaration {
-  std::string Name;
-  SmallVector ValueList;
-  std::optional DefaultValueIdx;
-};
-
-static constexpr StringRef Prefix = "-fmultilib-flag=";
-} // namespace custom_flag
-
 /// See also MultilibSetBuilder for combining multilibs into a set.
 class MultilibSet {
 public:
@@ -139,18 +120,15 @@ class MultilibSet {
 
 private:
   multilib_list Multilibs;
-  SmallVector FlagMatchers;
-  SmallVector CustomFlagDecls;
+  std::vector FlagMatchers;
   IncludeDirsFunc IncludeCallback;
   IncludeDirsFunc FilePathsCallback;
 
 public:
   MultilibSet() = default;
   MultilibSet(multilib_list &&Multilibs,
-  SmallVector &&FlagMatchers = {},
-  SmallVector &&CustomFlagDecls = {})
-  : Multilibs(std::move(Multilibs)), FlagMatchers(std::move(FlagMatchers)),
-CustomFlagDecls(std::move(CustomFlagDecls)) {}
+  std::vector &&FlagMatchers = {})
+  : Multilibs(Multilibs), FlagMatchers(FlagMatchers) {}
 
   const multilib_list &getMultilibs() { return Multilibs; }
 

diff  --git a/clang/lib/Driver/Multilib.cpp b/clang/lib/Driver/Multilib.cpp
index b4b5dbd1bdb5e3..0207e0f2eb2ded 100644
--- a/clang/lib/Driver/Multilib.cpp
+++ b/clang/lib/Driver/Multilib.cpp
@@ -10,7 +10,6 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Driver/Driver.h"
 #include "llvm/ADT/DenseSet.h"
-#include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -202,20 +201,13 @@ struct MultilibGroupSerialization {
 
 struct MultilibSetSerialization {
   llvm::VersionTuple MultilibVersion;
-  SmallVector Groups;
-  SmallVector Multilibs;
-  SmallVector FlagMatchers;
-  SmallVector CustomFlagDeclarations;
+  std::vector Groups;
+  std::vector Multilibs;
+  std::vector FlagMatchers;
 };
 
 } // end anonymous namespace
 
-LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibSerialization)
-LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibGroupSerialization)
-LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibSet::FlagMatcher)
-LLVM_YAML_IS_SEQUENCE_VECTOR(custom_flag::ValueDetail)
-LLVM_YAML_IS_SEQUENCE_VECTOR(custom_flag::DeclarationPtr)
-
 template <> struct llvm::yaml::MappingTraits {
   static void mapping(llvm::yaml::IO &io, MultilibSerialization &V) {
 io.mapOptional("Dir", V.Dir);
@@ -263,63 +255,11 @@ template <> struct 
llvm::yaml::MappingTraits {
   }
 };
 
-template <>
-struct llvm::yaml::MappingContextTraits> {
-  static void mapping(llvm::yaml::IO &io, custom_flag::ValueDetail &V,
-  llvm::SmallSet &) {
-io.mapRequired("Name", V.Name);
-io.mapOptional("MacroDefines", V.MacroDefines);
-  }
-  static std::string validate(IO &io, custom_flag::ValueDetail &V,
-  llvm::SmallSet &NameSet) {
-if (V.Name.empty())
-  return "custom flag value requires a name";
-if (!NameSet.insert(V.Name).second)
-  return "duplicate custom flag value name: \"" + V.Name + "\"";
-return {};
-  }
-};
-
-template <>
-struct llvm::yaml::MappingContextTraits> {
-  static void mapping(llvm::yaml::IO &io, custom_flag::DeclarationPtr &V,
-  llvm::SmallSet &NameSet) {
-assert(!V);
-V = std::make_shared();
-io.mapRequired("Name", V->Name);
-io.mapRequired("Values", V->ValueList, NameSet);
-std::string DefaultValueName;
-io.mapRequired("Default", DefaultValueName);
-
-for (auto [Idx, Value] : llvm::enumerate(V->ValueList)) {
-  Value.Decl = V;
-  if (Value.Name == DefaultValueName) {
-assert(!V->DefaultValueIdx);
-V->DefaultValueIdx = Idx;
-  }
-}
-  }
-  static std::string validate(IO &io, custom_flag::DeclarationPtr &V,
-  llvm::SmallSet &) {
-if (V->Name.empty())
-  return "custom flag requires a n

[llvm-branch-commits] [clang] release/19.x: Fix print module manifest file for macos (#122370) (PR #122844)

2025-01-13 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/122844
___
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/19.x: Fix print module manifest file for macos (#122370) (PR #122844)

2025-01-13 Thread via llvm-branch-commits

llvmbot wrote:

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

https://github.com/llvm/llvm-project/pull/122844
___
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/19.x: Fix print module manifest file for macos (#122370) (PR #122844)

2025-01-13 Thread via llvm-branch-commits

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

Backport acbd822879f7727127926c25e1b47f5017f962c5

Requested by: @ChuanqiXu9

>From 29dea13773e19d12d21542ee87ed97d98b629c59 Mon Sep 17 00:00:00 2001
From: Bill Hoffman 
Date: Sun, 12 Jan 2025 21:20:20 -0500
Subject: [PATCH] Fix print module manifest file for macos (#122370)

This commit fixes -print-library-module-manifest-path on macos.
Currently, this only works on linux systems. This is because on macos
systems the library and header files are installed in a different
location. The module manifest is next to the libraries and the search
function was not looking in both places. There is also a test included.

(cherry picked from commit acbd822879f7727127926c25e1b47f5017f962c5)
---
 clang/lib/Driver/Driver.cpp   |  5 
 ...les-print-library-module-manifest-path.cpp | 26 +++
 2 files changed, 31 insertions(+)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index ecae475f75da00..f9dc8ab24fa9d7 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -6189,6 +6189,11 @@ std::string Driver::GetFilePath(StringRef Name, const 
ToolChain &TC) const {
   if (auto P = SearchPaths(TC.getFilePaths()))
 return *P;
 
+  SmallString<128> R2(ResourceDir);
+  llvm::sys::path::append(R2, "..", "..", Name);
+  if (llvm::sys::fs::exists(Twine(R2)))
+return std::string(R2);
+
   return std::string(Name);
 }
 
diff --git a/clang/test/Driver/modules-print-library-module-manifest-path.cpp 
b/clang/test/Driver/modules-print-library-module-manifest-path.cpp
index 3ba2709ad95cc8..8d17fe1549e34b 100644
--- a/clang/test/Driver/modules-print-library-module-manifest-path.cpp
+++ b/clang/test/Driver/modules-print-library-module-manifest-path.cpp
@@ -18,6 +18,28 @@
 // RUN: --target=x86_64-linux-gnu 2>&1 \
 // RUN:   | FileCheck libcxx.cpp
 
+// for macos there is a different directory structure
+// where the library and libc++.modules.json file are in lib
+// directly but headers are in clang/ver directory which
+// is the resource directory
+// RUN: mkdir -p %t/Inputs/usr/lib/clang/20
+// RUN: touch %t/Inputs/usr/lib/libc++.so
+// RUN: touch %t/Inputs/usr/lib/libc++.modules.json
+// RUN: %clang -print-library-module-manifest-path \
+// RUN: -stdlib=libc++ \
+// RUN: -resource-dir=%t/Inputs/usr/lib/clang/20 \
+// RUN: --target=arm64-apple-darwin24.1.0 2>&1 \
+// RUN:   | FileCheck libcxx.cpp.macos
+
+// RUN: rm %t/Inputs/usr/lib/libc++.so
+// RUN: touch %t/Inputs/usr/lib/libc++.a
+// RUN: touch %t/Inputs/usr/lib/libc++.modules.json
+// RUN: %clang -print-library-module-manifest-path \
+// RUN: -stdlib=libc++ \
+// RUN: -resource-dir=%t/Inputs/usr/lib/clang/20 \
+// RUN: --target=arm64-apple-darwin24.1.0 2>&1 \
+// RUN:   | FileCheck libcxx.cpp.macos
+
 // RUN: rm %t/Inputs/usr/lib/x86_64-linux-gnu/libc++.so
 // RUN: touch %t/Inputs/usr/lib/x86_64-linux-gnu/libc++.a
 // RUN: %clang -print-library-module-manifest-path \
@@ -40,6 +62,10 @@
 
 // CHECK: {{.*}}/Inputs/usr/lib/x86_64-linux-gnu{{/|\\}}libc++.modules.json
 
+//--- libcxx.cpp.macos
+
+// CHECK: {{.*}}libc++.modules.json
+
 //--- libcxx-no-shared-lib.cpp
 
 // Note this might find a different path depending whether search path

___
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/19.x: Fix print module manifest file for macos (#122370) (PR #122844)

2025-01-13 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-driver

Author: None (llvmbot)


Changes

Backport acbd822879f7727127926c25e1b47f5017f962c5

Requested by: @ChuanqiXu9

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


2 Files Affected:

- (modified) clang/lib/Driver/Driver.cpp (+5) 
- (modified) clang/test/Driver/modules-print-library-module-manifest-path.cpp 
(+26) 


``diff
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index ecae475f75da00..f9dc8ab24fa9d7 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -6189,6 +6189,11 @@ std::string Driver::GetFilePath(StringRef Name, const 
ToolChain &TC) const {
   if (auto P = SearchPaths(TC.getFilePaths()))
 return *P;
 
+  SmallString<128> R2(ResourceDir);
+  llvm::sys::path::append(R2, "..", "..", Name);
+  if (llvm::sys::fs::exists(Twine(R2)))
+return std::string(R2);
+
   return std::string(Name);
 }
 
diff --git a/clang/test/Driver/modules-print-library-module-manifest-path.cpp 
b/clang/test/Driver/modules-print-library-module-manifest-path.cpp
index 3ba2709ad95cc8..8d17fe1549e34b 100644
--- a/clang/test/Driver/modules-print-library-module-manifest-path.cpp
+++ b/clang/test/Driver/modules-print-library-module-manifest-path.cpp
@@ -18,6 +18,28 @@
 // RUN: --target=x86_64-linux-gnu 2>&1 \
 // RUN:   | FileCheck libcxx.cpp
 
+// for macos there is a different directory structure
+// where the library and libc++.modules.json file are in lib
+// directly but headers are in clang/ver directory which
+// is the resource directory
+// RUN: mkdir -p %t/Inputs/usr/lib/clang/20
+// RUN: touch %t/Inputs/usr/lib/libc++.so
+// RUN: touch %t/Inputs/usr/lib/libc++.modules.json
+// RUN: %clang -print-library-module-manifest-path \
+// RUN: -stdlib=libc++ \
+// RUN: -resource-dir=%t/Inputs/usr/lib/clang/20 \
+// RUN: --target=arm64-apple-darwin24.1.0 2>&1 \
+// RUN:   | FileCheck libcxx.cpp.macos
+
+// RUN: rm %t/Inputs/usr/lib/libc++.so
+// RUN: touch %t/Inputs/usr/lib/libc++.a
+// RUN: touch %t/Inputs/usr/lib/libc++.modules.json
+// RUN: %clang -print-library-module-manifest-path \
+// RUN: -stdlib=libc++ \
+// RUN: -resource-dir=%t/Inputs/usr/lib/clang/20 \
+// RUN: --target=arm64-apple-darwin24.1.0 2>&1 \
+// RUN:   | FileCheck libcxx.cpp.macos
+
 // RUN: rm %t/Inputs/usr/lib/x86_64-linux-gnu/libc++.so
 // RUN: touch %t/Inputs/usr/lib/x86_64-linux-gnu/libc++.a
 // RUN: %clang -print-library-module-manifest-path \
@@ -40,6 +62,10 @@
 
 // CHECK: {{.*}}/Inputs/usr/lib/x86_64-linux-gnu{{/|\\}}libc++.modules.json
 
+//--- libcxx.cpp.macos
+
+// CHECK: {{.*}}libc++.modules.json
+
 //--- libcxx-no-shared-lib.cpp
 
 // Note this might find a different path depending whether search path

``




https://github.com/llvm/llvm-project/pull/122844
___
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] DAG: Avoid forming shufflevector from a single extract_vector_elt (PR #122672)

2025-01-13 Thread Simon Pilgrim via llvm-branch-commits


@@ -23855,6 +23863,13 @@ SDValue DAGCombiner::reduceBuildVecToShuffle(SDNode 
*N) {
   // VecIn accordingly.
   bool DidSplitVec = false;
   if (VecIn.size() == 2) {

RKSimon wrote:

Doesn't this just check for 2 vector sources, not that there is a single 
extraction index?

https://github.com/llvm/llvm-project/pull/122672
___
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] AMDGPU/GlobalISel: RegBankLegalize rules for load (PR #112882)

2025-01-13 Thread Petar Avramovic via llvm-branch-commits

https://github.com/petar-avramovic updated 
https://github.com/llvm/llvm-project/pull/112882

>From 23bb343f473f02b014efb83c5ec4aee9fc41c611 Mon Sep 17 00:00:00 2001
From: Petar Avramovic 
Date: Wed, 30 Oct 2024 15:37:59 +0100
Subject: [PATCH] AMDGPU/GlobalISel: RegBankLegalize rules for load

Add IDs for bit width that cover multiple LLTs: B32 B64 etc.
"Predicate" wrapper class for bool predicate functions used to
write pretty rules. Predicates can be combined using &&, || and !.
Lowering for splitting and widening loads.
Write rules for loads to not change existing mir tests from old
regbankselect.
---
 .../AMDGPU/AMDGPURegBankLegalizeHelper.cpp| 288 +++-
 .../AMDGPU/AMDGPURegBankLegalizeHelper.h  |   5 +
 .../AMDGPU/AMDGPURegBankLegalizeRules.cpp | 278 ++-
 .../AMDGPU/AMDGPURegBankLegalizeRules.h   |  65 +++-
 .../AMDGPU/GlobalISel/regbankselect-load.mir  | 320 +++---
 .../GlobalISel/regbankselect-zextload.mir |   9 +-
 6 files changed, 900 insertions(+), 65 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/AMDGPURegBankLegalizeHelper.cpp 
b/llvm/lib/Target/AMDGPU/AMDGPURegBankLegalizeHelper.cpp
index 066aa9ad89b2ba..ab308017b9937b 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPURegBankLegalizeHelper.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPURegBankLegalizeHelper.cpp
@@ -39,6 +39,83 @@ void 
RegBankLegalizeHelper::findRuleAndApplyMapping(MachineInstr &MI) {
   lower(MI, Mapping, WaterfallSgprs);
 }
 
+void RegBankLegalizeHelper::splitLoad(MachineInstr &MI,
+  ArrayRef LLTBreakdown, LLT MergeTy) 
{
+  MachineFunction &MF = B.getMF();
+  assert(MI.getNumMemOperands() == 1);
+  MachineMemOperand &BaseMMO = **MI.memoperands_begin();
+  Register Dst = MI.getOperand(0).getReg();
+  const RegisterBank *DstRB = MRI.getRegBankOrNull(Dst);
+  Register Base = MI.getOperand(1).getReg();
+  LLT PtrTy = MRI.getType(Base);
+  const RegisterBank *PtrRB = MRI.getRegBankOrNull(Base);
+  LLT OffsetTy = LLT::scalar(PtrTy.getSizeInBits());
+  SmallVector LoadPartRegs;
+
+  unsigned ByteOffset = 0;
+  for (LLT PartTy : LLTBreakdown) {
+Register BasePlusOffset;
+if (ByteOffset == 0) {
+  BasePlusOffset = Base;
+} else {
+  auto Offset = B.buildConstant({PtrRB, OffsetTy}, ByteOffset);
+  BasePlusOffset = B.buildPtrAdd({PtrRB, PtrTy}, Base, Offset).getReg(0);
+}
+auto *OffsetMMO = MF.getMachineMemOperand(&BaseMMO, ByteOffset, PartTy);
+auto LoadPart = B.buildLoad({DstRB, PartTy}, BasePlusOffset, *OffsetMMO);
+LoadPartRegs.push_back(LoadPart.getReg(0));
+ByteOffset += PartTy.getSizeInBytes();
+  }
+
+  if (!MergeTy.isValid()) {
+// Loads are of same size, concat or merge them together.
+B.buildMergeLikeInstr(Dst, LoadPartRegs);
+  } else {
+// Loads are not all of same size, need to unmerge them to smaller pieces
+// of MergeTy type, then merge pieces to Dst.
+SmallVector MergeTyParts;
+for (Register Reg : LoadPartRegs) {
+  if (MRI.getType(Reg) == MergeTy) {
+MergeTyParts.push_back(Reg);
+  } else {
+auto Unmerge = B.buildUnmerge({DstRB, MergeTy}, Reg);
+for (unsigned i = 0; i < Unmerge->getNumOperands() - 1; ++i)
+  MergeTyParts.push_back(Unmerge.getReg(i));
+  }
+}
+B.buildMergeLikeInstr(Dst, MergeTyParts);
+  }
+  MI.eraseFromParent();
+}
+
+void RegBankLegalizeHelper::widenLoad(MachineInstr &MI, LLT WideTy,
+  LLT MergeTy) {
+  MachineFunction &MF = B.getMF();
+  assert(MI.getNumMemOperands() == 1);
+  MachineMemOperand &BaseMMO = **MI.memoperands_begin();
+  Register Dst = MI.getOperand(0).getReg();
+  const RegisterBank *DstRB = MRI.getRegBankOrNull(Dst);
+  Register Base = MI.getOperand(1).getReg();
+
+  MachineMemOperand *WideMMO = MF.getMachineMemOperand(&BaseMMO, 0, WideTy);
+  auto WideLoad = B.buildLoad({DstRB, WideTy}, Base, *WideMMO);
+
+  if (WideTy.isScalar()) {
+B.buildTrunc(Dst, WideLoad);
+  } else {
+SmallVector MergeTyParts;
+auto Unmerge = B.buildUnmerge({DstRB, MergeTy}, WideLoad);
+
+LLT DstTy = MRI.getType(Dst);
+unsigned NumElts = DstTy.getSizeInBits() / MergeTy.getSizeInBits();
+for (unsigned i = 0; i < NumElts; ++i) {
+  MergeTyParts.push_back(Unmerge.getReg(i));
+}
+B.buildMergeLikeInstr(Dst, MergeTyParts);
+  }
+  MI.eraseFromParent();
+}
+
 void RegBankLegalizeHelper::lower(MachineInstr &MI,
   const RegBankLLTMapping &Mapping,
   SmallSet &WaterfallSgprs) {
@@ -117,6 +194,54 @@ void RegBankLegalizeHelper::lower(MachineInstr &MI,
 MI.eraseFromParent();
 break;
   }
+  case SplitLoad: {
+LLT DstTy = MRI.getType(MI.getOperand(0).getReg());
+unsigned Size = DstTy.getSizeInBits();
+// Even split to 128-bit loads
+if (Size > 128) {
+  LLT B128;
+  if (DstTy.isVector()) {
+LLT EltTy = DstTy.getElementType();
+B128 = LLT::f

[llvm-branch-commits] [llvm] release/19.x: [cmake] Extend zstd.dll finding logic from MSVC to Clang (#121437) (PR #121755)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits
=?utf-8?q?Michał_Górny?= 
Message-ID:
In-Reply-To: 


https://github.com/tru updated https://github.com/llvm/llvm-project/pull/121755

>From e2bc201fd8367a6196035c4264df9e2d21113644 Mon Sep 17 00:00:00 2001
From: Vassil Vassilev 
Date: Thu, 22 Aug 2024 13:04:33 +0200
Subject: [PATCH 1/2] [cmake] Include GNUInstallDirs before using variables
 defined by it. (#83807)

This fixes an odd problem with the regex when `CMAKE_INSTALL_LIBDIR` is
not defined:

`string sub-command REGEX, mode REPLACE: regex "$" matched an empty
string.`

Fixes llvm/llvm-project#83802

(cherry picked from commit 5bbd5984306ab0bdd89a2e81cd4965e5ae51c3fb)
---
 llvm/cmake/modules/Findzstd.cmake | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/cmake/modules/Findzstd.cmake 
b/llvm/cmake/modules/Findzstd.cmake
index 4bc0b793e51c9a..86b6d48b6ec6b6 100644
--- a/llvm/cmake/modules/Findzstd.cmake
+++ b/llvm/cmake/modules/Findzstd.cmake
@@ -34,6 +34,7 @@ if(zstd_FOUND)
   elseif (NOT TARGET zstd::libzstd_shared)
 add_library(zstd::libzstd_shared SHARED IMPORTED)
 if(MSVC)
+  include(GNUInstallDirs) # For CMAKE_INSTALL_LIBDIR and friends.
   # IMPORTED_LOCATION is the path to the DLL and IMPORTED_IMPLIB is the 
"library".
   get_filename_component(zstd_DIRNAME "${zstd_LIBRARY}" DIRECTORY)
   if(NOT "${CMAKE_INSTALL_LIBDIR}" STREQUAL "" AND NOT 
"${CMAKE_INSTALL_BINDIR}" STREQUAL "")

>From 5c3cc355b975ccf8b330f0feea3eca0d8ef619fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= 
Date: Thu, 2 Jan 2025 15:43:45 +
Subject: [PATCH 2/2] [cmake] Extend zstd.dll finding logic from MSVC to Clang
 (#121437)

Extend the special logic for finding `zstd.dll` in `Findzstd` to apply
to all MSVC-compatible configurations such as Clang targeting MSVC.

Fixes #121345

(cherry picked from commit 62d0aff3eb934439acac47348e2385f0751a1444)
---
 llvm/cmake/modules/Findzstd.cmake | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/cmake/modules/Findzstd.cmake 
b/llvm/cmake/modules/Findzstd.cmake
index 86b6d48b6ec6b6..f6ca5d1ebe546b 100644
--- a/llvm/cmake/modules/Findzstd.cmake
+++ b/llvm/cmake/modules/Findzstd.cmake
@@ -10,7 +10,7 @@
 # zstd::libzstd_shared
 # zstd::libzstd_static
 
-if(MSVC)
+if(MSVC OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
   set(zstd_STATIC_LIBRARY_SUFFIX "_static\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")
 else()
   set(zstd_STATIC_LIBRARY_SUFFIX "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")
@@ -33,7 +33,7 @@ if(zstd_FOUND)
 set(zstd_STATIC_LIBRARY "${zstd_LIBRARY}")
   elseif (NOT TARGET zstd::libzstd_shared)
 add_library(zstd::libzstd_shared SHARED IMPORTED)
-if(MSVC)
+if(MSVC OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
   include(GNUInstallDirs) # For CMAKE_INSTALL_LIBDIR and friends.
   # IMPORTED_LOCATION is the path to the DLL and IMPORTED_IMPLIB is the 
"library".
   get_filename_component(zstd_DIRNAME "${zstd_LIBRARY}" DIRECTORY)

___
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/19.x: [RISCV] Don't create BuildPairF64 or SplitF64 nodes without D or Zdinx. (#116159) (PR #121501)

2025-01-13 Thread via llvm-branch-commits

github-actions[bot] wrote:

@topperc (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/121501
___
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/19.x: [cmake] Extend zstd.dll finding logic from MSVC to Clang (#121437) (PR #121755)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits
=?utf-8?q?Micha=C5=82_G=C3=B3rny?= 
Message-ID:
In-Reply-To: 


tru wrote:

Some failing tests here. Can someone check? (not the version check one).

https://github.com/llvm/llvm-project/pull/121755
___
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/19.x: [DAG] Allow AssertZExt to scalarize. (#122463) (PR #122617)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/122617

>From 55ee4aad8aae2b6c0fe8028bde1d75105a929723 Mon Sep 17 00:00:00 2001
From: David Green 
Date: Sat, 11 Jan 2025 16:29:06 +
Subject: [PATCH] [DAG] Allow AssertZExt to scalarize. (#122463)

With range and undef metadata on a call we can have vector AssertZExt
generated on a target with no vector operations. The AssertZExt needs to
scalarize to a normal `AssertZext tin, ValueType`. I have added
AssertSext too, although I do not have a test case.

Fixes #110374

(cherry picked from commit ab9a80a3ad78f611fd06cd6f7215bd828809310c)
---
 llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h |  2 +-
 .../SelectionDAG/LegalizeVectorTypes.cpp  |  8 +++-
 .../test/CodeGen/ARM/scalarize-assert-zext.ll | 46 +++
 3 files changed, 53 insertions(+), 3 deletions(-)
 create mode 100644 llvm/test/CodeGen/ARM/scalarize-assert-zext.ll

diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h 
b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
index d4e61c85889012..d74896772bf53b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
@@ -838,7 +838,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
   SDValue ScalarizeVecRes_BUILD_VECTOR(SDNode *N);
   SDValue ScalarizeVecRes_EXTRACT_SUBVECTOR(SDNode *N);
   SDValue ScalarizeVecRes_FP_ROUND(SDNode *N);
-  SDValue ScalarizeVecRes_ExpOp(SDNode *N);
+  SDValue ScalarizeVecRes_UnaryOpWithExtraInput(SDNode *N);
   SDValue ScalarizeVecRes_INSERT_VECTOR_ELT(SDNode *N);
   SDValue ScalarizeVecRes_LOAD(LoadSDNode *N);
   SDValue ScalarizeVecRes_SCALAR_TO_VECTOR(SDNode *N);
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp 
b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
index 92b62ccdc27552..ea95aaef8a1e87 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
@@ -58,7 +58,11 @@ void DAGTypeLegalizer::ScalarizeVectorResult(SDNode *N, 
unsigned ResNo) {
   case ISD::BUILD_VECTOR:  R = ScalarizeVecRes_BUILD_VECTOR(N); break;
   case ISD::EXTRACT_SUBVECTOR: R = ScalarizeVecRes_EXTRACT_SUBVECTOR(N); break;
   case ISD::FP_ROUND:  R = ScalarizeVecRes_FP_ROUND(N); break;
-  case ISD::FPOWI: R = ScalarizeVecRes_ExpOp(N); break;
+  case ISD::AssertZext:
+  case ISD::AssertSext:
+  case ISD::FPOWI:
+R = ScalarizeVecRes_UnaryOpWithExtraInput(N);
+break;
   case ISD::INSERT_VECTOR_ELT: R = ScalarizeVecRes_INSERT_VECTOR_ELT(N); break;
   case ISD::LOAD:   R = 
ScalarizeVecRes_LOAD(cast(N));break;
   case ISD::SCALAR_TO_VECTOR:  R = ScalarizeVecRes_SCALAR_TO_VECTOR(N); break;
@@ -426,7 +430,7 @@ SDValue DAGTypeLegalizer::ScalarizeVecRes_FP_ROUND(SDNode 
*N) {
  N->getOperand(1));
 }
 
-SDValue DAGTypeLegalizer::ScalarizeVecRes_ExpOp(SDNode *N) {
+SDValue DAGTypeLegalizer::ScalarizeVecRes_UnaryOpWithExtraInput(SDNode *N) {
   SDValue Op = GetScalarizedVector(N->getOperand(0));
   return DAG.getNode(N->getOpcode(), SDLoc(N), Op.getValueType(), Op,
  N->getOperand(1));
diff --git a/llvm/test/CodeGen/ARM/scalarize-assert-zext.ll 
b/llvm/test/CodeGen/ARM/scalarize-assert-zext.ll
new file mode 100644
index 00..5638bb4a398803
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/scalarize-assert-zext.ll
@@ -0,0 +1,46 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 
UTC_ARGS: --version 5
+; RUN: llc -mtriple=armv7-unknown-linux-musleabihf -mattr=-neon %s -o - | 
FileCheck %s
+
+declare fastcc noundef range(i16 0, 256) <4 x i16> @other()
+
+define void @test(ptr %0) #0 {
+; CHECK-LABEL: test:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:.save {r4, lr}
+; CHECK-NEXT:push {r4, lr}
+; CHECK-NEXT:mov r4, r0
+; CHECK-NEXT:bl other
+; CHECK-NEXT:uxth r3, r3
+; CHECK-NEXT:uxth r2, r2
+; CHECK-NEXT:uxth r1, r1
+; CHECK-NEXT:uxth r0, r0
+; CHECK-NEXT:strb r3, [r4, #3]
+; CHECK-NEXT:strb r2, [r4, #2]
+; CHECK-NEXT:strb r1, [r4, #1]
+; CHECK-NEXT:strb r0, [r4]
+; CHECK-NEXT:pop {r4, pc}
+entry:
+  %call = call fastcc <4 x i16> @other()
+  %t = trunc <4 x i16> %call to <4 x i8>
+  store <4 x i8> %t, ptr %0, align 1
+  ret void
+}
+
+define <4 x i16> @test2() #0 {
+; CHECK-LABEL: test2:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:.save {r11, lr}
+; CHECK-NEXT:push {r11, lr}
+; CHECK-NEXT:bl other
+; CHECK-NEXT:movw r1, #65408
+; CHECK-NEXT:and r0, r0, r1
+; CHECK-NEXT:and r2, r2, r1
+; CHECK-NEXT:mov r1, #0
+; CHECK-NEXT:mov r3, #0
+; CHECK-NEXT:pop {r11, pc}
+entry:
+  %call = call fastcc <4 x i16> @other()
+  %a = and <4 x i16> %call, 
+  ret <4 x i16> %a
+}
+

___
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] MachineUniformityAnalysis: Improve isConstantOrUndefValuePhi (PR #112866)

2025-01-13 Thread Petar Avramovic via llvm-branch-commits

https://github.com/petar-avramovic updated 
https://github.com/llvm/llvm-project/pull/112866

>From 45cec5fb9bb567d759b71963b9109c770c222a89 Mon Sep 17 00:00:00 2001
From: Petar Avramovic 
Date: Thu, 31 Oct 2024 14:10:57 +0100
Subject: [PATCH] MachineUniformityAnalysis: Improve isConstantOrUndefValuePhi

Change existing code for G_PHI to match what LLVM-IR version is doing
via PHINode::hasConstantOrUndefValue. This is not safe for regular PHI
since it may appear with an undef operand and getVRegDef can fail.
Most notably this improves number of values that can be allocated
to sgpr register bank in AMDGPURegBankSelect.
Common case here are phis that appear in structurize-cfg lowering
for cycles with multiple exits:
Undef incoming value is coming from block that reached cycle exit
condition, if other incoming is uniform keep the phi uniform despite
the fact it is joining values from pair of blocks that are entered
via divergent condition branch.
---
 llvm/lib/CodeGen/MachineSSAContext.cpp| 27 +-
 .../AMDGPU/MIR/hidden-diverge-gmir.mir| 28 +++
 .../AMDGPU/MIR/hidden-loop-diverge.mir|  4 +-
 .../AMDGPU/MIR/uses-value-from-cycle.mir  |  8 +-
 .../GlobalISel/divergence-structurizer.mir| 80 --
 .../regbankselect-mui-regbanklegalize.mir | 69 ---
 .../regbankselect-mui-regbankselect.mir   | 18 ++--
 .../AMDGPU/GlobalISel/regbankselect-mui.ll| 84 ++-
 .../AMDGPU/GlobalISel/regbankselect-mui.mir   | 51 ++-
 9 files changed, 191 insertions(+), 178 deletions(-)

diff --git a/llvm/lib/CodeGen/MachineSSAContext.cpp 
b/llvm/lib/CodeGen/MachineSSAContext.cpp
index e384187b6e8593..8e13c0916dd9e1 100644
--- a/llvm/lib/CodeGen/MachineSSAContext.cpp
+++ b/llvm/lib/CodeGen/MachineSSAContext.cpp
@@ -54,9 +54,34 @@ const MachineBasicBlock 
*MachineSSAContext::getDefBlock(Register value) const {
   return F->getRegInfo().getVRegDef(value)->getParent();
 }
 
+static bool isUndef(const MachineInstr &MI) {
+  return MI.getOpcode() == TargetOpcode::G_IMPLICIT_DEF ||
+ MI.getOpcode() == TargetOpcode::IMPLICIT_DEF;
+}
+
+/// MachineInstr equivalent of PHINode::hasConstantOrUndefValue() for G_PHI.
 template <>
 bool MachineSSAContext::isConstantOrUndefValuePhi(const MachineInstr &Phi) {
-  return Phi.isConstantValuePHI();
+  if (!Phi.isPHI())
+return false;
+
+  // In later passes PHI may appear with an undef operand, getVRegDef can fail.
+  if (Phi.getOpcode() == TargetOpcode::PHI)
+return Phi.isConstantValuePHI();
+
+  // For G_PHI we do equivalent of PHINode::hasConstantOrUndefValue().
+  const MachineRegisterInfo &MRI = Phi.getMF()->getRegInfo();
+  Register This = Phi.getOperand(0).getReg();
+  Register ConstantValue;
+  for (unsigned i = 1, e = Phi.getNumOperands(); i < e; i += 2) {
+Register Incoming = Phi.getOperand(i).getReg();
+if (Incoming != This && !isUndef(*MRI.getVRegDef(Incoming))) {
+  if (ConstantValue && ConstantValue != Incoming)
+return false;
+  ConstantValue = Incoming;
+}
+  }
+  return true;
 }
 
 template <>
diff --git 
a/llvm/test/Analysis/UniformityAnalysis/AMDGPU/MIR/hidden-diverge-gmir.mir 
b/llvm/test/Analysis/UniformityAnalysis/AMDGPU/MIR/hidden-diverge-gmir.mir
index ce00edf3363f77..9694a340b5e906 100644
--- a/llvm/test/Analysis/UniformityAnalysis/AMDGPU/MIR/hidden-diverge-gmir.mir
+++ b/llvm/test/Analysis/UniformityAnalysis/AMDGPU/MIR/hidden-diverge-gmir.mir
@@ -1,24 +1,24 @@
 # RUN: llc -mtriple=amdgcn-- -run-pass=print-machine-uniformity -o - %s 2>&1 | 
FileCheck %s
 # CHECK-LABEL: MachineUniformityInfo for function: hidden_diverge
 # CHECK-LABEL: BLOCK bb.0
-# CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s32) = G_INTRINSIC 
intrinsic(@llvm.amdgcn.workitem.id.x)
-# CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s1) = G_ICMP intpred(slt)
-# CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s1) = G_XOR %{{[0-9]*}}:_, 
%{{[0-9]*}}:_
-# CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s1), %{{[0-9]*}}:_(s64) = 
G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if)
-# CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s1), %{{[0-9]*}}:_(s64) = 
G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if)
-# CHECK: DIVERGENT: G_BRCOND %{{[0-9]*}}:_(s1), %bb.1
-# CHECK: DIVERGENT: G_BR %bb.2
+# CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s32) = G_INTRINSIC 
intrinsic(@llvm.amdgcn.workitem.id.x)
+# CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s1) = G_ICMP intpred(slt)
+# CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s1) = G_XOR %{{[0-9]*}}:_, 
%{{[0-9]*}}:_
+# CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s1), %{{[0-9]*}}:_(s64) = 
G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if)
+# CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s1), %{{[0-9]*}}:_(s64) = 
G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if)
+# CHECK: DIVERGENT: G_BRCOND %{{[0-9]*}}:_(s1), %bb.1
+# CHECK: DIVERGENT: G_BR %bb.2
 # CHECK-LABEL: BLOCK bb.1
 # CHECK-LABEL: BLOCK bb.2
-# CHECK: D

[llvm-branch-commits] [clang] [llvm] [mlir] [OMPIRBuilder] Introduce struct to hold default kernel teams/threads (PR #116050)

2025-01-13 Thread Jan Leyonberg via llvm-branch-commits

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

LGTM

https://github.com/llvm/llvm-project/pull/116050
___
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] DAG: Avoid forming shufflevector from a single extract_vector_elt (PR #122672)

2025-01-13 Thread Simon Pilgrim via llvm-branch-commits

https://github.com/RKSimon edited 
https://github.com/llvm/llvm-project/pull/122672
___
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] DAG: Avoid forming shufflevector from a single extract_vector_elt (PR #122672)

2025-01-13 Thread Simon Pilgrim via llvm-branch-commits

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

LGTM

https://github.com/llvm/llvm-project/pull/122672
___
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] DAG: Avoid forming shufflevector from a single extract_vector_elt (PR #122672)

2025-01-13 Thread Simon Pilgrim via llvm-branch-commits


@@ -23855,6 +23863,13 @@ SDValue DAGCombiner::reduceBuildVecToShuffle(SDNode 
*N) {
   // VecIn accordingly.
   bool DidSplitVec = false;
   if (VecIn.size() == 2) {

RKSimon wrote:

Thanks - it's been a while since I touched this code :)

https://github.com/llvm/llvm-project/pull/122672
___
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/19.x: [Github] Fix LLVM Project Tests Workflow on Linux (#122221) (PR #122814)

2025-01-13 Thread via llvm-branch-commits

llvmbot wrote:

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

https://github.com/llvm/llvm-project/pull/122814
___
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/19.x: [Github] Fix LLVM Project Tests Workflow on Linux (#122221) (PR #122814)

2025-01-13 Thread via llvm-branch-commits

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

Backport a75917679549109fcbf92cb63ef61638517713d6

Requested by: @boomanaiden154

>From 510be2370fc9c205d285424c2d1231274f2a8ae1 Mon Sep 17 00:00:00 2001
From: Aiden Grossman 
Date: Thu, 9 Jan 2025 07:58:38 -0800
Subject: [PATCH] [Github] Fix LLVM Project Tests Workflow on Linux (#11)

This patch fixes the LLVM project tests workflow on Linux. Two changes
were needed. Firstly, some commands need to be performed with sudo now
that the container executes as a non-root user. Second, we needed to
change from `ubuntu-latest` to `ubuntu-22.04` as `ubuntu-latest` not
defaults to `ubuntu-24.04` which causes `setup-python` to install a
python executable linked against a newer version of glibc that is not
found on ubuntu 22.04, which causes failures when CMake cannot execute
the python interpreter that it finds.

(cherry picked from commit a75917679549109fcbf92cb63ef61638517713d6)
---
 .github/workflows/libclang-python-tests.yml |  2 +-
 .github/workflows/llvm-project-tests.yml| 10 --
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/libclang-python-tests.yml 
b/.github/workflows/libclang-python-tests.yml
index 43ded0af3ac21c..33d6c2174dca47 100644
--- a/.github/workflows/libclang-python-tests.yml
+++ b/.github/workflows/libclang-python-tests.yml
@@ -43,5 +43,5 @@ jobs:
   projects: clang
   # There is an issue running on "windows-2019".
   # See 
https://github.com/llvm/llvm-project/issues/76601#issuecomment-1873049082.
-  os_list: '["ubuntu-latest"]'
+  os_list: '["ubuntu-22.04"]'
   python_version: ${{ matrix.python-version }}
diff --git a/.github/workflows/llvm-project-tests.yml 
b/.github/workflows/llvm-project-tests.yml
index 17a54be16badc1..fa11f6b9b45696 100644
--- a/.github/workflows/llvm-project-tests.yml
+++ b/.github/workflows/llvm-project-tests.yml
@@ -39,7 +39,12 @@ on:
 type: string
 # Use windows-2019 due to:
 # 
https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317
-default: '["ubuntu-latest", "windows-2019", "macOS-13"]'
+# Use ubuntu-22.04 rather than ubuntu-latest to match the ubuntu
+# version in the CI container. Without this, setup-python tries
+# to install a python version linked against a newer version of glibc.
+# TODO(boomanaiden154): Bump the Ubuntu version once the version in the
+# container is bumped.
+default: '["ubuntu-22.04", "windows-2019", "macOS-13"]'
 
   python_version:
 required: false
@@ -113,7 +118,8 @@ jobs:
 run: |
   if [ "${{ runner.os }}" == "Linux" ]; then
 builddir="/mnt/build/"
-mkdir -p $builddir
+sudo mkdir -p $builddir
+sudo chown gha $builddir
 extra_cmake_args="-DCMAKE_CXX_COMPILER=clang++ 
-DCMAKE_C_COMPILER=clang"
   else
 builddir="$(pwd)"/build

___
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/19.x: [Github] Fix LLVM Project Tests Workflow on Linux (#122221) (PR #122814)

2025-01-13 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-github-workflow

Author: None (llvmbot)


Changes

Backport a75917679549109fcbf92cb63ef61638517713d6

Requested by: @boomanaiden154

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


2 Files Affected:

- (modified) .github/workflows/libclang-python-tests.yml (+1-1) 
- (modified) .github/workflows/llvm-project-tests.yml (+8-2) 


``diff
diff --git a/.github/workflows/libclang-python-tests.yml 
b/.github/workflows/libclang-python-tests.yml
index 43ded0af3ac21c..33d6c2174dca47 100644
--- a/.github/workflows/libclang-python-tests.yml
+++ b/.github/workflows/libclang-python-tests.yml
@@ -43,5 +43,5 @@ jobs:
   projects: clang
   # There is an issue running on "windows-2019".
   # See 
https://github.com/llvm/llvm-project/issues/76601#issuecomment-1873049082.
-  os_list: '["ubuntu-latest"]'
+  os_list: '["ubuntu-22.04"]'
   python_version: ${{ matrix.python-version }}
diff --git a/.github/workflows/llvm-project-tests.yml 
b/.github/workflows/llvm-project-tests.yml
index 17a54be16badc1..fa11f6b9b45696 100644
--- a/.github/workflows/llvm-project-tests.yml
+++ b/.github/workflows/llvm-project-tests.yml
@@ -39,7 +39,12 @@ on:
 type: string
 # Use windows-2019 due to:
 # 
https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317
-default: '["ubuntu-latest", "windows-2019", "macOS-13"]'
+# Use ubuntu-22.04 rather than ubuntu-latest to match the ubuntu
+# version in the CI container. Without this, setup-python tries
+# to install a python version linked against a newer version of glibc.
+# TODO(boomanaiden154): Bump the Ubuntu version once the version in the
+# container is bumped.
+default: '["ubuntu-22.04", "windows-2019", "macOS-13"]'
 
   python_version:
 required: false
@@ -113,7 +118,8 @@ jobs:
 run: |
   if [ "${{ runner.os }}" == "Linux" ]; then
 builddir="/mnt/build/"
-mkdir -p $builddir
+sudo mkdir -p $builddir
+sudo chown gha $builddir
 extra_cmake_args="-DCMAKE_CXX_COMPILER=clang++ 
-DCMAKE_C_COMPILER=clang"
   else
 builddir="$(pwd)"/build

``




https://github.com/llvm/llvm-project/pull/122814
___
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/19.x: [Github] Fix LLVM Project Tests Workflow on Linux (#122221) (PR #122814)

2025-01-13 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/122814
___
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-tools-extra] [clang-tidy] fix wrong float to float conversion check when floating point type is not standard type (PR #122637)

2025-01-13 Thread Piotr Zegar via llvm-branch-commits

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

LGTM

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


[llvm-branch-commits] [compiler-rt] 8ef2858 - [NFC][sanitizer] Commit test for #106912 (#108289)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

Author: Vitaly Buka
Date: 2025-01-13T11:53:16+01:00
New Revision: 8ef2858421dbea9d80ce62679bc7095f6d76898a

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

LOG: [NFC][sanitizer] Commit test for #106912 (#108289)

Almost all sanitizers already support the test.
* Tsan does not use DlsymAlloc yet.
* Lsan will support with #106912.

memprof,rtsan,nsan are not tested as part of
sanitizer_common, but we should keep them here to
show up when it happen.

-

Co-authored-by: Xiaofeng Tian <110771974+txf...@users.noreply.github.com>
(cherry picked from commit 1797174ea6adab08474658f9c9748991d172321c)

Added: 
compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c

Modified: 


Removed: 




diff  --git a/compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c 
b/compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c
new file mode 100644
index 00..3905ac40ae2dc7
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c
@@ -0,0 +1,61 @@
+// RUN: %clang -O0 %s -o %t && %run %t
+
+// FIXME: TSAN does not use DlsymAlloc.
+// UNSUPPORTED: tsan
+
+// FIXME: https://github.com/llvm/llvm-project/pull/106912
+// XFAIL: lsan
+
+#include 
+
+const char *test() __attribute__((disable_sanitizer_instrumentation)) {
+  void *volatile p = malloc(3);
+  p = realloc(p, 7);
+  free(p);
+
+  p = calloc(3, 7);
+  free(p);
+
+  free(NULL);
+
+  return "";
+}
+
+const char *__asan_default_options()
+__attribute__((disable_sanitizer_instrumentation)) {
+  return test();
+}
+const char *__hwasan_default_options()
+__attribute__((disable_sanitizer_instrumentation)) {
+  return test();
+}
+const char *__lsan_default_options()
+__attribute__((disable_sanitizer_instrumentation)) {
+  return test();
+}
+const char *__memprof_default_options()
+__attribute__((disable_sanitizer_instrumentation)) {
+  return test();
+}
+const char *__msan_default_options()
+__attribute__((disable_sanitizer_instrumentation)) {
+  return test();
+}
+const char *__nsan_default_options()
+__attribute__((disable_sanitizer_instrumentation)) {
+  return test();
+}
+const char *__rtsan_default_options()
+__attribute__((disable_sanitizer_instrumentation)) {
+  return test();
+}
+const char *__tsan_default_options()
+__attribute__((disable_sanitizer_instrumentation)) {
+  return test();
+}
+const char *__ubsan_default_options()
+__attribute__((disable_sanitizer_instrumentation)) {
+  return test();
+}
+
+int main(int argc, char **argv) { return 0; }



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


[llvm-branch-commits] [compiler-rt] 2e10af6 - [lsan] Fix free(NULL) interception during initialization (#106912)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

Author: tmiasko
Date: 2025-01-13T11:53:16+01:00
New Revision: 2e10af6e59258da02167fc66e5e6ecd0549da62a

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

LOG: [lsan] Fix free(NULL) interception during initialization (#106912)

Previously an attempt to free a null pointer during initialization would
fail on ENSURE_LSAN_INITED assertion (since a null pointer is not owned
by DlsymAlloc).

(cherry picked from commit ae0ed3d58600da9ec266bf86d0084775f561ba3a)

Added: 


Modified: 
compiler-rt/lib/lsan/lsan_interceptors.cpp
compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c

Removed: 




diff  --git a/compiler-rt/lib/lsan/lsan_interceptors.cpp 
b/compiler-rt/lib/lsan/lsan_interceptors.cpp
index b569c337e97641..efbf2fdfb0ab3f 100644
--- a/compiler-rt/lib/lsan/lsan_interceptors.cpp
+++ b/compiler-rt/lib/lsan/lsan_interceptors.cpp
@@ -77,6 +77,8 @@ INTERCEPTOR(void*, malloc, uptr size) {
 }
 
 INTERCEPTOR(void, free, void *p) {
+  if (UNLIKELY(!p))
+return;
   if (DlsymAlloc::PointerIsMine(p))
 return DlsymAlloc::Free(p);
   ENSURE_LSAN_INITED;

diff  --git a/compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c 
b/compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c
index 3905ac40ae2dc7..0228c3bc50dbd9 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c
+++ b/compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c
@@ -3,9 +3,6 @@
 // FIXME: TSAN does not use DlsymAlloc.
 // UNSUPPORTED: tsan
 
-// FIXME: https://github.com/llvm/llvm-project/pull/106912
-// XFAIL: lsan
-
 #include 
 
 const char *test() __attribute__((disable_sanitizer_instrumentation)) {



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


[llvm-branch-commits] [compiler-rt] 07b4f63 - [test][compiler-rt] Mark dlsym_alloc.c as unsupported on macos (#108439)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

Author: Arthur Eubanks
Date: 2025-01-13T11:53:16+01:00
New Revision: 07b4f631ee430337f1534f76c7102359c024212a

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

LOG: [test][compiler-rt] Mark dlsym_alloc.c as unsupported on macos (#108439)

With #106912, the test now fails on macos, e.g.

https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-RA/2058/.
(cherry picked from commit d9ed8b018df725faec4076a3efdfcbd7a24c99f0)

Added: 


Modified: 
compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c

Removed: 




diff  --git a/compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c 
b/compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c
index 0228c3bc50dbd9..7b5b9cf34a90f9 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c
+++ b/compiler-rt/test/sanitizer_common/TestCases/dlsym_alloc.c
@@ -2,6 +2,8 @@
 
 // FIXME: TSAN does not use DlsymAlloc.
 // UNSUPPORTED: tsan
+// FIXME: investigate why this fails on macos
+// UNSUPPORTED: darwin
 
 #include 
 



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


[llvm-branch-commits] [compiler-rt] release/19.x: Build SanitizerCommon if ctx_profile enabled (#105495) (PR #121035)

2025-01-13 Thread via llvm-branch-commits

github-actions[bot] wrote:

@mgorny (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/121035
___
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] 61c9f97 - [RISCV] Don't create BuildPairF64 or SplitF64 nodes without D or Zdinx. (#116159)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

Author: Craig Topper
Date: 2025-01-13T11:54:44+01:00
New Revision: 61c9f970b88710c8292cc32b92c1db723fcfff22

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

LOG: [RISCV] Don't create BuildPairF64 or SplitF64 nodes without D or Zdinx. 
(#116159)

The fix in ReplaceNodeResults is the only one really required for the
known crash.

I couldn't hit the case in LowerOperation because that requires (f64
(bitcast i64)), but the result type is softened before the input so we
don't get a chance to legalize the input.

The change to the setOperationAction call was an observation that a
i64<->vector cast should not be custom legalized on RV32. The custom
code already calls isTypeLegal on the scalar type.

Added: 
llvm/test/CodeGen/RISCV/rvv/rv32-zve-bitcast-crash.ll

Modified: 
llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Removed: 




diff  --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp 
b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 823fb428472ef34..badbb4259974476 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -1396,8 +1396,9 @@ RISCVTargetLowering::RISCVTargetLowering(const 
TargetMachine &TM,
   }
 
   // Custom-legalize bitcasts from fixed-length vectors to scalar types.
-  setOperationAction(ISD::BITCAST, {MVT::i8, MVT::i16, MVT::i32, MVT::i64},
- Custom);
+  setOperationAction(ISD::BITCAST, {MVT::i8, MVT::i16, MVT::i32}, Custom);
+  if (Subtarget.is64Bit())
+setOperationAction(ISD::BITCAST, MVT::i64, Custom);
   if (Subtarget.hasStdExtZfhminOrZhinxmin())
 setOperationAction(ISD::BITCAST, MVT::f16, Custom);
   if (Subtarget.hasStdExtFOrZfinx())
@@ -6317,7 +6318,8 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op,
   DAG.getNode(RISCVISD::FMV_W_X_RV64, DL, MVT::f32, NewOp0);
   return FPConv;
 }
-if (VT == MVT::f64 && Op0VT == MVT::i64 && XLenVT == MVT::i32) {
+if (VT == MVT::f64 && Op0VT == MVT::i64 && !Subtarget.is64Bit() &&
+Subtarget.hasStdExtDOrZdinx()) {
   SDValue Lo, Hi;
   std::tie(Lo, Hi) = DAG.SplitScalar(Op0, DL, MVT::i32, MVT::i32);
   SDValue RetReg =
@@ -12616,7 +12618,8 @@ void RISCVTargetLowering::ReplaceNodeResults(SDNode *N,
   SDValue FPConv =
   DAG.getNode(RISCVISD::FMV_X_ANYEXTW_RV64, DL, MVT::i64, Op0);
   Results.push_back(DAG.getNode(ISD::TRUNCATE, DL, MVT::i32, FPConv));
-} else if (VT == MVT::i64 && Op0VT == MVT::f64 && XLenVT == MVT::i32) {
+} else if (VT == MVT::i64 && Op0VT == MVT::f64 && !Subtarget.is64Bit() &&
+   Subtarget.hasStdExtDOrZdinx()) {
   SDValue NewReg = DAG.getNode(RISCVISD::SplitF64, DL,
DAG.getVTList(MVT::i32, MVT::i32), Op0);
   SDValue RetReg = DAG.getNode(ISD::BUILD_PAIR, DL, MVT::i64,

diff  --git a/llvm/test/CodeGen/RISCV/rvv/rv32-zve-bitcast-crash.ll 
b/llvm/test/CodeGen/RISCV/rvv/rv32-zve-bitcast-crash.ll
new file mode 100644
index 000..d6612c9d025afab
--- /dev/null
+++ b/llvm/test/CodeGen/RISCV/rvv/rv32-zve-bitcast-crash.ll
@@ -0,0 +1,22 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 
UTC_ARGS: --version 4
+; RUN: llc < %s -mtriple=riscv32 -mattr=+zve32f,+zvl128b | FileCheck %s
+
+; This bitcast previously incorrectly produce a SplitF64 node.
+
+define i64 @foo(double %x) {
+; CHECK-LABEL: foo:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:addi sp, sp, -16
+; CHECK-NEXT:.cfi_def_cfa_offset 16
+; CHECK-NEXT:sw ra, 12(sp) # 4-byte Folded Spill
+; CHECK-NEXT:.cfi_offset ra, -4
+; CHECK-NEXT:lui a3, 261888
+; CHECK-NEXT:li a2, 0
+; CHECK-NEXT:call __adddf3
+; CHECK-NEXT:lw ra, 12(sp) # 4-byte Folded Reload
+; CHECK-NEXT:addi sp, sp, 16
+; CHECK-NEXT:ret
+  %a = fadd double %x, 1.0
+  %b = bitcast double %a to i64
+  ret i64 %b
+}



___
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/19.x: [RISCV] Don't create BuildPairF64 or SplitF64 nodes without D or Zdinx. (#116159) (PR #121501)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/121501

>From 61c9f970b88710c8292cc32b92c1db723fcfff22 Mon Sep 17 00:00:00 2001
From: Craig Topper 
Date: Thu, 14 Nov 2024 09:54:33 -0800
Subject: [PATCH] [RISCV] Don't create BuildPairF64 or SplitF64 nodes without D
 or Zdinx. (#116159)

The fix in ReplaceNodeResults is the only one really required for the
known crash.

I couldn't hit the case in LowerOperation because that requires (f64
(bitcast i64)), but the result type is softened before the input so we
don't get a chance to legalize the input.

The change to the setOperationAction call was an observation that a
i64<->vector cast should not be custom legalized on RV32. The custom
code already calls isTypeLegal on the scalar type.
---
 llvm/lib/Target/RISCV/RISCVISelLowering.cpp   | 11 ++
 .../RISCV/rvv/rv32-zve-bitcast-crash.ll   | 22 +++
 2 files changed, 29 insertions(+), 4 deletions(-)
 create mode 100644 llvm/test/CodeGen/RISCV/rvv/rv32-zve-bitcast-crash.ll

diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp 
b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 823fb428472ef34..badbb4259974476 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -1396,8 +1396,9 @@ RISCVTargetLowering::RISCVTargetLowering(const 
TargetMachine &TM,
   }
 
   // Custom-legalize bitcasts from fixed-length vectors to scalar types.
-  setOperationAction(ISD::BITCAST, {MVT::i8, MVT::i16, MVT::i32, MVT::i64},
- Custom);
+  setOperationAction(ISD::BITCAST, {MVT::i8, MVT::i16, MVT::i32}, Custom);
+  if (Subtarget.is64Bit())
+setOperationAction(ISD::BITCAST, MVT::i64, Custom);
   if (Subtarget.hasStdExtZfhminOrZhinxmin())
 setOperationAction(ISD::BITCAST, MVT::f16, Custom);
   if (Subtarget.hasStdExtFOrZfinx())
@@ -6317,7 +6318,8 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op,
   DAG.getNode(RISCVISD::FMV_W_X_RV64, DL, MVT::f32, NewOp0);
   return FPConv;
 }
-if (VT == MVT::f64 && Op0VT == MVT::i64 && XLenVT == MVT::i32) {
+if (VT == MVT::f64 && Op0VT == MVT::i64 && !Subtarget.is64Bit() &&
+Subtarget.hasStdExtDOrZdinx()) {
   SDValue Lo, Hi;
   std::tie(Lo, Hi) = DAG.SplitScalar(Op0, DL, MVT::i32, MVT::i32);
   SDValue RetReg =
@@ -12616,7 +12618,8 @@ void RISCVTargetLowering::ReplaceNodeResults(SDNode *N,
   SDValue FPConv =
   DAG.getNode(RISCVISD::FMV_X_ANYEXTW_RV64, DL, MVT::i64, Op0);
   Results.push_back(DAG.getNode(ISD::TRUNCATE, DL, MVT::i32, FPConv));
-} else if (VT == MVT::i64 && Op0VT == MVT::f64 && XLenVT == MVT::i32) {
+} else if (VT == MVT::i64 && Op0VT == MVT::f64 && !Subtarget.is64Bit() &&
+   Subtarget.hasStdExtDOrZdinx()) {
   SDValue NewReg = DAG.getNode(RISCVISD::SplitF64, DL,
DAG.getVTList(MVT::i32, MVT::i32), Op0);
   SDValue RetReg = DAG.getNode(ISD::BUILD_PAIR, DL, MVT::i64,
diff --git a/llvm/test/CodeGen/RISCV/rvv/rv32-zve-bitcast-crash.ll 
b/llvm/test/CodeGen/RISCV/rvv/rv32-zve-bitcast-crash.ll
new file mode 100644
index 000..d6612c9d025afab
--- /dev/null
+++ b/llvm/test/CodeGen/RISCV/rvv/rv32-zve-bitcast-crash.ll
@@ -0,0 +1,22 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 
UTC_ARGS: --version 4
+; RUN: llc < %s -mtriple=riscv32 -mattr=+zve32f,+zvl128b | FileCheck %s
+
+; This bitcast previously incorrectly produce a SplitF64 node.
+
+define i64 @foo(double %x) {
+; CHECK-LABEL: foo:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:addi sp, sp, -16
+; CHECK-NEXT:.cfi_def_cfa_offset 16
+; CHECK-NEXT:sw ra, 12(sp) # 4-byte Folded Spill
+; CHECK-NEXT:.cfi_offset ra, -4
+; CHECK-NEXT:lui a3, 261888
+; CHECK-NEXT:li a2, 0
+; CHECK-NEXT:call __adddf3
+; CHECK-NEXT:lw ra, 12(sp) # 4-byte Folded Reload
+; CHECK-NEXT:addi sp, sp, 16
+; CHECK-NEXT:ret
+  %a = fadd double %x, 1.0
+  %b = bitcast double %a to i64
+  ret i64 %b
+}

___
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/19.x: [RISCV] Don't create BuildPairF64 or SplitF64 nodes without D or Zdinx. (#116159) (PR #121501)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/121501
___
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] Fix std::initializer_list recognition if it's exported out of a module (PR #121739)

2025-01-13 Thread Chuanqi Xu via llvm-branch-commits

ChuanqiXu9 wrote:

CC @jijjijj 

https://github.com/llvm/llvm-project/pull/121739
___
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] Fix std::initializer_list recognition if it's exported out of a module (PR #121739)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/121739

>From 97821138eec6d9691bdf28f4f982e21ea6321ef6 Mon Sep 17 00:00:00 2001
From: Artsiom Drapun 
Date: Sat, 7 Dec 2024 19:24:29 +0300
Subject: [PATCH] Fix std::initializer_list recognition if it's exported out of
 a module

- Add implementation
- Add a regression test
- Add release notes
---
 clang/docs/ReleaseNotes.rst   |  3 +-
 clang/lib/Sema/SemaDeclCXX.cpp|  2 +-
 ...hrough-export-and-linkage-issue-118218.cpp | 39 +++
 3 files changed, 42 insertions(+), 2 deletions(-)
 create mode 100644 
clang/test/Modules/initializer-list-recognition-through-export-and-linkage-issue-118218.cpp

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 8c7a6ba70acd28..1e9845b9b9c5b2 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -1123,7 +1123,8 @@ Bug Fixes to C++ Support
 - Fixed assertion failure by skipping the analysis of an invalid field 
declaration. (#GH99868)
 - Fix an issue with dependent source location expressions (#GH106428), 
(#GH81155), (#GH80210), (#GH85373)
 - Fix handling of ``_`` as the name of a lambda's init capture variable. 
(#GH107024)
-
+- Fixed recognition of ``std::initializer_list`` when it's surrounded with 
``extern "C++"`` and exported
+  out of a module (which is the case e.g. in MSVC's implementation of ``std`` 
module). (#GH118218)
 
 Bug Fixes to AST Handling
 ^
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 4e4f91de8cd5a5..18262993af283a 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -11919,7 +11919,7 @@ bool Sema::isStdInitializerList(QualType Ty, QualType 
*Element) {
 if (TemplateClass->getIdentifier() !=
 &PP.getIdentifierTable().get("initializer_list") ||
 !getStdNamespace()->InEnclosingNamespaceSetOf(
-TemplateClass->getDeclContext()))
+TemplateClass->getNonTransparentDeclContext()))
   return false;
 // This is a template called std::initializer_list, but is it the right
 // template?
diff --git 
a/clang/test/Modules/initializer-list-recognition-through-export-and-linkage-issue-118218.cpp
 
b/clang/test/Modules/initializer-list-recognition-through-export-and-linkage-issue-118218.cpp
new file mode 100644
index 00..e2c796fb103f6c
--- /dev/null
+++ 
b/clang/test/Modules/initializer-list-recognition-through-export-and-linkage-issue-118218.cpp
@@ -0,0 +1,39 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+//
+// RUN: %clang_cc1 -std=c++20 %t/std.cppm -emit-module-interface -o %t/std.pcm
+// RUN: %clang_cc1 -std=c++20 %t/mod.cppm -fprebuilt-module-path=%t 
-emit-module-interface -o %t/mod.pcm
+// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -verify %t/main.cpp
+
+//--- std.cppm
+export module std;
+
+extern "C++" {
+  namespace std {
+  export template 
+  class initializer_list {
+const E* _1;
+const E* _2;
+  };
+  }
+}
+
+//--- mod.cppm
+export module mod;
+
+import std;
+
+export struct A {
+  void func(std::initializer_list) {}
+};
+
+//--- main.cpp
+// expected-no-diagnostics
+import std;
+import mod;
+
+int main() {
+  A{}.func({1,1});
+  return 0;
+}

___
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] Fix std::initializer_list recognition if it's exported out of a module (PR #121739)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

tru wrote:

Some failing Libc++ tests here. I will not merge until it's cleared up.

https://github.com/llvm/llvm-project/pull/121739
___
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] a0dfd3d - [RISCV] Add missing hasPostISelHook = 1 to vector pseudos that might read FRM. (#114186)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

Author: Craig Topper
Date: 2025-01-13T11:43:27+01:00
New Revision: a0dfd3d04e28b831bc99c06c8cfef5563eaf4c63

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

LOG: [RISCV] Add missing hasPostISelHook = 1 to vector pseudos that might read 
FRM. (#114186)

We need an implicit FRM read operand anytime the rounding mode is
dynamic. The post isel hook is responsible for this when isel creates an
instruction with dynamic rounding mode.

Add a MachineVerifier check to verify the operand is present.

(cherry picked from commit 71b6f6b8a1cd9a63b9d382fe15f40bbb427939b9)

Added: 


Modified: 
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td

Removed: 




diff  --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp 
b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
index 6c0cbeadebf4311..7f4bbe7861087e1 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -2536,6 +2536,13 @@ bool RISCVInstrInfo::verifyInstruction(const 
MachineInstr &MI,
 }
   }
 
+  if (int Idx = RISCVII::getFRMOpNum(Desc);
+  Idx >= 0 && MI.getOperand(Idx).getImm() == RISCVFPRndMode::DYN &&
+  !MI.readsRegister(RISCV::FRM, /*TRI=*/nullptr)) {
+ErrInfo = "dynamic rounding mode should read FRM";
+return false;
+  }
+
   return true;
 }
 

diff  --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td 
b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
index b860273d639ee51..93fd0b2aada35a9 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
@@ -6471,7 +6471,7 @@ defm PseudoVFRDIV : VPseudoVFRDIV_VF_RM;
 
//===--===//
 // 13.5. Vector Widening Floating-Point Multiply
 
//===--===//
-let mayRaiseFPException = true, hasSideEffects = 0 in {
+let mayRaiseFPException = true, hasSideEffects = 0, hasPostISelHook = 1 in {
 defm PseudoVFWMUL : VPseudoVWMUL_VV_VF_RM;
 }
 
@@ -6504,7 +6504,7 @@ defm PseudoVFWMACCBF16  : VPseudoVWMAC_VV_VF_BF_RM;
 
//===--===//
 // 13.8. Vector Floating-Point Square-Root Instruction
 
//===--===//
-let mayRaiseFPException = true, hasSideEffects = 0 in
+let mayRaiseFPException = true, hasSideEffects = 0, hasPostISelHook = 1 in
 defm PseudoVFSQRT : VPseudoVSQR_V_RM;
 
 
//===--===//
@@ -6516,7 +6516,7 @@ defm PseudoVFRSQRT7 : VPseudoVRCP_V;
 
//===--===//
 // 13.10. Vector Floating-Point Reciprocal Estimate Instruction
 
//===--===//
-let mayRaiseFPException = true, hasSideEffects = 0 in
+let mayRaiseFPException = true, hasSideEffects = 0, hasPostISelHook = 1 in
 defm PseudoVFREC7 : VPseudoVRCP_V_RM;
 
 
//===--===//
@@ -6627,9 +6627,10 @@ defm PseudoVFNCVT_F_X  : VPseudoVNCVTF_W_RM;
 defm PseudoVFNCVT_RM_F_XU  : VPseudoVNCVTF_RM_W;
 defm PseudoVFNCVT_RM_F_X   : VPseudoVNCVTF_RM_W;
 
-let hasSideEffects = 0, hasPostISelHook = 1 in
+let hasSideEffects = 0, hasPostISelHook = 1 in {
 defm PseudoVFNCVT_F_F  : VPseudoVNCVTD_W_RM;
 defm PseudoVFNCVTBF16_F_F :  VPseudoVNCVTD_W_RM;
+}
 
 defm PseudoVFNCVT_ROD_F_F  : VPseudoVNCVTD_W;
 } // mayRaiseFPException = true
@@ -6665,8 +,7 @@ let Predicates = [HasVInstructionsAnyF] in {
 
//===--===//
 // 14.3. Vector Single-Width Floating-Point Reduction Instructions
 
//===--===//
-let mayRaiseFPException = true,
-hasSideEffects = 0 in {
+let mayRaiseFPException = true, hasSideEffects = 0, hasPostISelHook = 1 in {
 defm PseudoVFREDOSUM : VPseudoVFREDO_VS_RM;
 defm PseudoVFREDUSUM : VPseudoVFRED_VS_RM;
 }
@@ -6678,9 +6678,8 @@ defm PseudoVFREDMAX  : VPseudoVFREDMINMAX_VS;
 
//===--===//
 // 14.4. Vector Widening Floating-Point Reduction Instructions
 
//===--===//
-let IsRVVWideningReduction = 1,
-hasSideEffects = 0,
-mayRaiseFPException = true in {
+let IsRVVWideningReduction = 1, hasSideEffects = 0, mayRaiseFPException = true,
+hasPostISelHook = 1 in {
 defm PseudoVFWREDUSUM  : VPseudoVFWRED_VS_RM;
 defm PseudoVFWREDOSUM  : VPseudoVFWREDO_VS_RM;
 }



__

[llvm-branch-commits] [llvm] release/19.x: [RISCV] Add hasPostISelHook to sf.vfnrclip pseudo instructions. (#114274) (PR #117948)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/117948
___
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/19.x: [RISCV] Add hasPostISelHook to sf.vfnrclip pseudo instructions. (#114274) (PR #117948)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/117948

>From a0dfd3d04e28b831bc99c06c8cfef5563eaf4c63 Mon Sep 17 00:00:00 2001
From: Craig Topper 
Date: Wed, 30 Oct 2024 11:47:40 -0700
Subject: [PATCH 1/2] [RISCV] Add missing hasPostISelHook = 1 to vector pseudos
 that might read FRM. (#114186)

We need an implicit FRM read operand anytime the rounding mode is
dynamic. The post isel hook is responsible for this when isel creates an
instruction with dynamic rounding mode.

Add a MachineVerifier check to verify the operand is present.

(cherry picked from commit 71b6f6b8a1cd9a63b9d382fe15f40bbb427939b9)
---
 llvm/lib/Target/RISCV/RISCVInstrInfo.cpp|  7 +++
 llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td | 17 -
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp 
b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
index 6c0cbeadebf4311..7f4bbe7861087e1 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -2536,6 +2536,13 @@ bool RISCVInstrInfo::verifyInstruction(const 
MachineInstr &MI,
 }
   }
 
+  if (int Idx = RISCVII::getFRMOpNum(Desc);
+  Idx >= 0 && MI.getOperand(Idx).getImm() == RISCVFPRndMode::DYN &&
+  !MI.readsRegister(RISCV::FRM, /*TRI=*/nullptr)) {
+ErrInfo = "dynamic rounding mode should read FRM";
+return false;
+  }
+
   return true;
 }
 
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td 
b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
index b860273d639ee51..93fd0b2aada35a9 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
@@ -6471,7 +6471,7 @@ defm PseudoVFRDIV : VPseudoVFRDIV_VF_RM;
 
//===--===//
 // 13.5. Vector Widening Floating-Point Multiply
 
//===--===//
-let mayRaiseFPException = true, hasSideEffects = 0 in {
+let mayRaiseFPException = true, hasSideEffects = 0, hasPostISelHook = 1 in {
 defm PseudoVFWMUL : VPseudoVWMUL_VV_VF_RM;
 }
 
@@ -6504,7 +6504,7 @@ defm PseudoVFWMACCBF16  : VPseudoVWMAC_VV_VF_BF_RM;
 
//===--===//
 // 13.8. Vector Floating-Point Square-Root Instruction
 
//===--===//
-let mayRaiseFPException = true, hasSideEffects = 0 in
+let mayRaiseFPException = true, hasSideEffects = 0, hasPostISelHook = 1 in
 defm PseudoVFSQRT : VPseudoVSQR_V_RM;
 
 
//===--===//
@@ -6516,7 +6516,7 @@ defm PseudoVFRSQRT7 : VPseudoVRCP_V;
 
//===--===//
 // 13.10. Vector Floating-Point Reciprocal Estimate Instruction
 
//===--===//
-let mayRaiseFPException = true, hasSideEffects = 0 in
+let mayRaiseFPException = true, hasSideEffects = 0, hasPostISelHook = 1 in
 defm PseudoVFREC7 : VPseudoVRCP_V_RM;
 
 
//===--===//
@@ -6627,9 +6627,10 @@ defm PseudoVFNCVT_F_X  : VPseudoVNCVTF_W_RM;
 defm PseudoVFNCVT_RM_F_XU  : VPseudoVNCVTF_RM_W;
 defm PseudoVFNCVT_RM_F_X   : VPseudoVNCVTF_RM_W;
 
-let hasSideEffects = 0, hasPostISelHook = 1 in
+let hasSideEffects = 0, hasPostISelHook = 1 in {
 defm PseudoVFNCVT_F_F  : VPseudoVNCVTD_W_RM;
 defm PseudoVFNCVTBF16_F_F :  VPseudoVNCVTD_W_RM;
+}
 
 defm PseudoVFNCVT_ROD_F_F  : VPseudoVNCVTD_W;
 } // mayRaiseFPException = true
@@ -6665,8 +,7 @@ let Predicates = [HasVInstructionsAnyF] in {
 
//===--===//
 // 14.3. Vector Single-Width Floating-Point Reduction Instructions
 
//===--===//
-let mayRaiseFPException = true,
-hasSideEffects = 0 in {
+let mayRaiseFPException = true, hasSideEffects = 0, hasPostISelHook = 1 in {
 defm PseudoVFREDOSUM : VPseudoVFREDO_VS_RM;
 defm PseudoVFREDUSUM : VPseudoVFRED_VS_RM;
 }
@@ -6678,9 +6678,8 @@ defm PseudoVFREDMAX  : VPseudoVFREDMINMAX_VS;
 
//===--===//
 // 14.4. Vector Widening Floating-Point Reduction Instructions
 
//===--===//
-let IsRVVWideningReduction = 1,
-hasSideEffects = 0,
-mayRaiseFPException = true in {
+let IsRVVWideningReduction = 1, hasSideEffects = 0, mayRaiseFPException = true,
+hasPostISelHook = 1 in {
 defm PseudoVFWREDUSUM  : VPseudoVFWRED_VS_RM;
 defm PseudoVFWREDOSUM  : VPseudoVFWREDO_VS_RM;
 }

>From d749beb59e72ec1dad2990a4a5ed624ab5ebe5c5 Mon Sep 17 00:00:00 2001
From: Craig Topper 
Date: Wed, 30 Oct 2024 11:52:49 -0700
Subject:

[llvm-branch-commits] [llvm] d749beb - [RISCV] Add hasPostISelHook to sf.vfnrclip pseudo instructions. (#114274)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

Author: Craig Topper
Date: 2025-01-13T11:43:28+01:00
New Revision: d749beb59e72ec1dad2990a4a5ed624ab5ebe5c5

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

LOG: [RISCV] Add hasPostISelHook to sf.vfnrclip pseudo instructions. (#114274)

Add Uses = [FRM] to the underlying MC instructions.

Tweak a couple test cases so the MachineVerifier would have caught this.

(cherry picked from commit 408c84f35b8b0338b630a6ee313c14238e62b5e6)

Added: 


Modified: 
llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td
llvm/test/CodeGen/RISCV/rvv/sf_vfnrclip_x_f_qf.ll
llvm/test/CodeGen/RISCV/rvv/sf_vfnrclip_xu_f_qf.ll

Removed: 




diff  --git a/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td 
b/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td
index 71aa1f19e089a98..eacc75b9a6c4453 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td
@@ -217,7 +217,8 @@ let Predicates = [HasVendorXSfvfwmaccqqq], DecoderNamespace 
= "XSfvfwmaccqqq" in
   def VFWMACC_4x4x4 : CustomSiFiveVMACC<0b00, OPFVV, "sf.vfwmacc.4x4x4">;
 }
 
-let Predicates = [HasVendorXSfvfnrclipxfqf], DecoderNamespace = 
"XSfvfnrclipxfqf" in {
+let Predicates = [HasVendorXSfvfnrclipxfqf], DecoderNamespace = 
"XSfvfnrclipxfqf",
+Uses = [FRM] in {
   def VFNRCLIP_XU_F_QF : CustomSiFiveVFNRCLIP<0b100010, OPFVF, 
"sf.vfnrclip.xu.f.qf">;
   def VFNRCLIP_X_F_QF : CustomSiFiveVFNRCLIP<0b100011, OPFVF, 
"sf.vfnrclip.x.f.qf">;
 }
@@ -399,7 +400,7 @@ multiclass VPseudoSiFiveVFWMACC {
 
 multiclass VPseudoSiFiveVFNRCLIP {
   foreach i = 0-4 in
-let hasSideEffects = 0 in
+let hasSideEffects = 0, hasPostISelHook = 1 in
   defm "Pseudo" # NAME : VPseudoBinaryRoundingMode 
@llvm.riscv.sf.vfnrclip.x.f.qf.nxv1i8.nxv1f32.iXLen(
 define  @intrinsic_sf_vfnrclip_x_f_qf_nxv1i8_nxv1f32( %0, float %1, iXLen %2) nounwind {
 ; CHECK-LABEL: intrinsic_sf_vfnrclip_x_f_qf_nxv1i8_nxv1f32:
 ; CHECK:   # %bb.0: # %entry
-; CHECK-NEXT:fsrmi a1, 0
 ; CHECK-NEXT:vsetvli zero, a0, e8, mf8, ta, ma
 ; CHECK-NEXT:sf.vfnrclip.x.f.qf v9, v8, fa0
-; CHECK-NEXT:fsrm a1
 ; CHECK-NEXT:vmv1r.v v8, v9
 ; CHECK-NEXT:ret
 entry:
@@ -24,7 +22,7 @@ entry:
  undef,
  %0,
 float %1,
-iXLen 0, iXLen %2)
+iXLen 7, iXLen %2)
 
   ret  %a
 }

diff  --git a/llvm/test/CodeGen/RISCV/rvv/sf_vfnrclip_xu_f_qf.ll 
b/llvm/test/CodeGen/RISCV/rvv/sf_vfnrclip_xu_f_qf.ll
index dbcee311c6e35fb..dfb0ccd982e845e 100644
--- a/llvm/test/CodeGen/RISCV/rvv/sf_vfnrclip_xu_f_qf.ll
+++ b/llvm/test/CodeGen/RISCV/rvv/sf_vfnrclip_xu_f_qf.ll
@@ -13,10 +13,8 @@ declare  
@llvm.riscv.sf.vfnrclip.xu.f.qf.nxv1i8.nxv1f32.iXLen(
 define  @intrinsic_sf_vfnrclip_xu_f_qf_nxv1i8_nxv1f32( %0, float %1, iXLen %2) nounwind {
 ; CHECK-LABEL: intrinsic_sf_vfnrclip_xu_f_qf_nxv1i8_nxv1f32:
 ; CHECK:   # %bb.0: # %entry
-; CHECK-NEXT:fsrmi a1, 0
 ; CHECK-NEXT:vsetvli zero, a0, e8, mf8, ta, ma
 ; CHECK-NEXT:sf.vfnrclip.xu.f.qf v9, v8, fa0
-; CHECK-NEXT:fsrm a1
 ; CHECK-NEXT:vmv1r.v v8, v9
 ; CHECK-NEXT:ret
 entry:
@@ -24,7 +22,7 @@ entry:
  undef,
  %0,
 float %1,
-iXLen 0, iXLen %2)
+iXLen 7, iXLen %2)
 
   ret  %a
 }



___
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/19.x: [RISCV] Add hasPostISelHook to sf.vfnrclip pseudo instructions. (#114274) (PR #117948)

2025-01-13 Thread via llvm-branch-commits

github-actions[bot] wrote:

@topperc (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/117948
___
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] Fix std::initializer_list recognition if it's exported out of a module (PR #121739)

2025-01-13 Thread via llvm-branch-commits

jijjijj wrote:

> Some failing Libc++ tests here. I will not merge until it's cleared up.

Are you talking about this?

![image](https://github.com/user-attachments/assets/39f1adf5-db74-4f56-a521-93b8e967bf79)

Because it seems like an issue with the pipeline or something

https://github.com/llvm/llvm-project/pull/121739
___
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] [mlir] [OMPIRBuilder][MLIR] Add support for target 'if' clause (PR #122478)

2025-01-13 Thread Kareem Ergawy via llvm-branch-commits

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

Thanks, Sergio! LGTM

https://github.com/llvm/llvm-project/pull/122478
___
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] AMDGPU/GlobalISel: AMDGPURegBankLegalize (PR #112864)

2025-01-13 Thread Petar Avramovic via llvm-branch-commits


@@ -9,7 +9,11 @@
 #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUGLOBALISELUTILS_H
 #define LLVM_LIB_TARGET_AMDGPU_AMDGPUGLOBALISELUTILS_H
 
+#include "AMDGPURegisterBankInfo.h"
+#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
 #include "llvm/ADT/DenseSet.h"
+#include "llvm/CodeGen/GlobalISel/MIPatternMatch.h"
+#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"

petar-avramovic wrote:

Updated. Are we ready to merge the whole stack? This commit is still missing 
approval.

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


[llvm-branch-commits] [libcxx] 6553889 - Bump version to 19.1.7

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

Author: Tobias Hieta
Date: 2025-01-13T11:48:09+01:00
New Revision: 6553889987aec49242e370a5e0a9e271d9f04ddb

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

LOG: Bump version to 19.1.7

Added: 


Modified: 
cmake/Modules/LLVMVersion.cmake
libcxx/include/__config
llvm/utils/gn/secondary/llvm/version.gni
llvm/utils/lit/lit/__init__.py
llvm/utils/mlgo-utils/mlgo/__init__.py

Removed: 




diff  --git a/cmake/Modules/LLVMVersion.cmake b/cmake/Modules/LLVMVersion.cmake
index 93d36736439b18..2e68562ddf0c63 100644
--- a/cmake/Modules/LLVMVersion.cmake
+++ b/cmake/Modules/LLVMVersion.cmake
@@ -7,7 +7,7 @@ if(NOT DEFINED LLVM_VERSION_MINOR)
   set(LLVM_VERSION_MINOR 1)
 endif()
 if(NOT DEFINED LLVM_VERSION_PATCH)
-  set(LLVM_VERSION_PATCH 6)
+  set(LLVM_VERSION_PATCH 7)
 endif()
 if(NOT DEFINED LLVM_VERSION_SUFFIX)
   set(LLVM_VERSION_SUFFIX)

diff  --git a/libcxx/include/__config b/libcxx/include/__config
index e97669bca411e5..52660bc0b2d162 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -27,7 +27,7 @@
 // _LIBCPP_VERSION represents the version of libc++, which matches the version 
of LLVM.
 // Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 17.0.1 == 17.00.01), 
_LIBCPP_VERSION is
 // defined to XXYYZZ.
-#  define _LIBCPP_VERSION 190106
+#  define _LIBCPP_VERSION 190107
 
 #  define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y
 #  define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y)

diff  --git a/llvm/utils/gn/secondary/llvm/version.gni 
b/llvm/utils/gn/secondary/llvm/version.gni
index c46d2abdb8ef2d..3ff567c97523df 100644
--- a/llvm/utils/gn/secondary/llvm/version.gni
+++ b/llvm/utils/gn/secondary/llvm/version.gni
@@ -1,4 +1,4 @@
 llvm_version_major = 19
 llvm_version_minor = 1
-llvm_version_patch = 6
+llvm_version_patch = 7
 llvm_version = "$llvm_version_major.$llvm_version_minor.$llvm_version_patch"

diff  --git a/llvm/utils/lit/lit/__init__.py b/llvm/utils/lit/lit/__init__.py
index ee0a3b2240e1e9..f7c2c5fdf4360f 100644
--- a/llvm/utils/lit/lit/__init__.py
+++ b/llvm/utils/lit/lit/__init__.py
@@ -2,7 +2,7 @@
 
 __author__ = "Daniel Dunbar"
 __email__ = "dan...@minormatter.com"
-__versioninfo__ = (19, 1, 6)
+__versioninfo__ = (19, 1, 7)
 __version__ = ".".join(str(v) for v in __versioninfo__) + "dev"
 
 __all__ = []

diff  --git a/llvm/utils/mlgo-utils/mlgo/__init__.py 
b/llvm/utils/mlgo-utils/mlgo/__init__.py
index cec9ca8b2f648b..cff2825280a105 100644
--- a/llvm/utils/mlgo-utils/mlgo/__init__.py
+++ b/llvm/utils/mlgo-utils/mlgo/__init__.py
@@ -4,7 +4,7 @@
 
 from datetime import timezone, datetime
 
-__versioninfo__ = (19, 1, 6)
+__versioninfo__ = (19, 1, 7)
 __version__ = (
 ".".join(str(v) for v in __versioninfo__)
 + "dev"



___
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] 97a1cb9 - [clang] hexagon: fix link order for libc/builtins (#117057)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

Author: Brian Cain
Date: 2025-01-13T11:49:33+01:00
New Revision: 97a1cb9a3fc4c23cfa62c5a47b3c6a59d0dbb857

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

LOG: [clang] hexagon: fix link order for libc/builtins (#117057)

When linking programs with `eld`, we get a link error like below:

Error:
/inst/clang+llvm-19.1.0-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/bin/../target/hexagon-unknown-linux-musl//usr/lib/libc.a(scalbn.lo)(.text.scalbn+0x3c):
undefined reference to `__hexagon_muldf3'

libc has references to the clang_rt builtins library, so the order of
the libraries should be reversed.

(cherry picked from commit 9cc2502c048b1403ba8ba5cc5a655d867c329d12)

Added: 


Modified: 
clang/lib/Driver/ToolChains/Hexagon.cpp
clang/test/Driver/hexagon-toolchain-linux.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Hexagon.cpp 
b/clang/lib/Driver/ToolChains/Hexagon.cpp
index be7851adecea66..76cedf312d68a1 100644
--- a/clang/lib/Driver/ToolChains/Hexagon.cpp
+++ b/clang/lib/Driver/ToolChains/Hexagon.cpp
@@ -379,9 +379,9 @@ constructHexagonLinkArgs(Compilation &C, const JobAction 
&JA,
   if (NeedsXRayDeps)
 linkXRayRuntimeDeps(HTC, Args, CmdArgs);
 
-  CmdArgs.push_back("-lclang_rt.builtins-hexagon");
   if (!Args.hasArg(options::OPT_nolibc))
 CmdArgs.push_back("-lc");
+  CmdArgs.push_back("-lclang_rt.builtins-hexagon");
 }
 if (D.CCCIsCXX()) {
   if (HTC.ShouldLinkCXXStdlib(Args))

diff  --git a/clang/test/Driver/hexagon-toolchain-linux.c 
b/clang/test/Driver/hexagon-toolchain-linux.c
index 86cc9a30e932c6..6f7f3b20f9141f 100644
--- a/clang/test/Driver/hexagon-toolchain-linux.c
+++ b/clang/test/Driver/hexagon-toolchain-linux.c
@@ -11,7 +11,7 @@
 // CHECK000-NOT:  
{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crti.o
 // CHECK000:  "-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1"
 // CHECK000:  
"{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o"
-// CHECK000:  "-lclang_rt.builtins-hexagon" "-lc"
+// CHECK000:  "-lc" "-lclang_rt.builtins-hexagon"
 // 
-
 // Passing --musl --shared
 // 
-
@@ -21,7 +21,7 @@
 // RUN:   --sysroot=%S/Inputs/basic_linux_libcxx_tree -shared %s 2>&1 | 
FileCheck -check-prefix=CHECK001 %s
 // CHECK001-NOT:-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1
 // CHECK001:
"{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crti.o"
-// CHECK001:"-lclang_rt.builtins-hexagon" "-lc"
+// CHECK001:"-lc" "-lclang_rt.builtins-hexagon"
 // CHECK001-NOT:
{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o
 // 
-
 // Passing --musl -nostdlib
@@ -33,8 +33,8 @@
 // CHECK002:   
"-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1"
 // CHECK002-NOT:   
{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crti.o
 // CHECK002-NOT:   
{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o
-// CHECK002-NOT:   "-lclang_rt.builtins-hexagon"
 // CHECK002-NOT:   "-lc"
+// CHECK002-NOT:   "-lclang_rt.builtins-hexagon"
 // 
-
 // Passing --musl -nostartfiles
 // 
-
@@ -45,7 +45,7 @@
 // CHECK003:   
"-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1"
 // CHECK003-NOT:   
{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}Scrt1.o
 // CHECK003-NOT:   
{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o
-// CHECK003:   "-lclang_rt.builtins-hexagon" "-lc"
+// CHECK003:   "-lc" "-lclang_rt.builtins-hexagon"
 // 
-
 // Passing --musl -nodefaultlibs
 // 
-
@@ -55,8 +55,8 @@
 // RUN:   --sysroot=%S/Inputs/basic_linux_libcxx_tree -nodefaultlibs %s 2>&1 | 
FileCheck -check-prefix=CHECK004 %s
 // CHECK004:   
"-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1"
 // CHECK004:   
"{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o"
-// CHECK004-NOT:   "-lclang_rt.builtins-hexagon"
 // CHECK004-NOT:   "-lc"
+// CHECK004-NOT:   "-lclang_rt.builtins-hexagon"
 // 
-
 // Passing --musl -nolibc
 // 
-

[llvm-branch-commits] [clang] release/19.x: [clang] hexagon: fix link order for libc/builtins (#117057) (PR #117968)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/117968

>From 97a1cb9a3fc4c23cfa62c5a47b3c6a59d0dbb857 Mon Sep 17 00:00:00 2001
From: Brian Cain 
Date: Mon, 25 Nov 2024 11:35:45 -0600
Subject: [PATCH] [clang] hexagon: fix link order for libc/builtins (#117057)

When linking programs with `eld`, we get a link error like below:

Error:
/inst/clang+llvm-19.1.0-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/bin/../target/hexagon-unknown-linux-musl//usr/lib/libc.a(scalbn.lo)(.text.scalbn+0x3c):
undefined reference to `__hexagon_muldf3'

libc has references to the clang_rt builtins library, so the order of
the libraries should be reversed.

(cherry picked from commit 9cc2502c048b1403ba8ba5cc5a655d867c329d12)
---
 clang/lib/Driver/ToolChains/Hexagon.cpp |  2 +-
 clang/test/Driver/hexagon-toolchain-linux.c | 10 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp 
b/clang/lib/Driver/ToolChains/Hexagon.cpp
index be7851adecea66..76cedf312d68a1 100644
--- a/clang/lib/Driver/ToolChains/Hexagon.cpp
+++ b/clang/lib/Driver/ToolChains/Hexagon.cpp
@@ -379,9 +379,9 @@ constructHexagonLinkArgs(Compilation &C, const JobAction 
&JA,
   if (NeedsXRayDeps)
 linkXRayRuntimeDeps(HTC, Args, CmdArgs);
 
-  CmdArgs.push_back("-lclang_rt.builtins-hexagon");
   if (!Args.hasArg(options::OPT_nolibc))
 CmdArgs.push_back("-lc");
+  CmdArgs.push_back("-lclang_rt.builtins-hexagon");
 }
 if (D.CCCIsCXX()) {
   if (HTC.ShouldLinkCXXStdlib(Args))
diff --git a/clang/test/Driver/hexagon-toolchain-linux.c 
b/clang/test/Driver/hexagon-toolchain-linux.c
index 86cc9a30e932c6..6f7f3b20f9141f 100644
--- a/clang/test/Driver/hexagon-toolchain-linux.c
+++ b/clang/test/Driver/hexagon-toolchain-linux.c
@@ -11,7 +11,7 @@
 // CHECK000-NOT:  
{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crti.o
 // CHECK000:  "-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1"
 // CHECK000:  
"{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o"
-// CHECK000:  "-lclang_rt.builtins-hexagon" "-lc"
+// CHECK000:  "-lc" "-lclang_rt.builtins-hexagon"
 // 
-
 // Passing --musl --shared
 // 
-
@@ -21,7 +21,7 @@
 // RUN:   --sysroot=%S/Inputs/basic_linux_libcxx_tree -shared %s 2>&1 | 
FileCheck -check-prefix=CHECK001 %s
 // CHECK001-NOT:-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1
 // CHECK001:
"{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crti.o"
-// CHECK001:"-lclang_rt.builtins-hexagon" "-lc"
+// CHECK001:"-lc" "-lclang_rt.builtins-hexagon"
 // CHECK001-NOT:
{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o
 // 
-
 // Passing --musl -nostdlib
@@ -33,8 +33,8 @@
 // CHECK002:   
"-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1"
 // CHECK002-NOT:   
{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crti.o
 // CHECK002-NOT:   
{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o
-// CHECK002-NOT:   "-lclang_rt.builtins-hexagon"
 // CHECK002-NOT:   "-lc"
+// CHECK002-NOT:   "-lclang_rt.builtins-hexagon"
 // 
-
 // Passing --musl -nostartfiles
 // 
-
@@ -45,7 +45,7 @@
 // CHECK003:   
"-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1"
 // CHECK003-NOT:   
{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}Scrt1.o
 // CHECK003-NOT:   
{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o
-// CHECK003:   "-lclang_rt.builtins-hexagon" "-lc"
+// CHECK003:   "-lc" "-lclang_rt.builtins-hexagon"
 // 
-
 // Passing --musl -nodefaultlibs
 // 
-
@@ -55,8 +55,8 @@
 // RUN:   --sysroot=%S/Inputs/basic_linux_libcxx_tree -nodefaultlibs %s 2>&1 | 
FileCheck -check-prefix=CHECK004 %s
 // CHECK004:   
"-dynamic-linker={{/|}}lib{{/|}}ld-musl-hexagon.so.1"
 // CHECK004:   
"{{.*}}basic_linux_libcxx_tree{{/|}}usr{{/|}}lib{{/|}}crt1.o"
-// CHECK004-NOT:   "-lclang_rt.builtins-hexagon"
 // CHECK004-NOT:   "-lc"
+// CHECK004-NOT:   "-lclang_rt.builtins-hexagon"
 // 
-
 // Passing --musl -nolibc
 // 
-

___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
http

[llvm-branch-commits] [clang] release/19.x: [clang] hexagon: fix link order for libc/builtins (#117057) (PR #117968)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/117968
___
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/19.x: [clang-format] Fix idempotent format of hash in macro body (#118513) (PR #119503)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/119503
___
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/19.x: [clang-format] Fix idempotent format of hash in macro body (#118513) (PR #119503)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/119503

>From 1414560a9c16039a2037de3e9d7dde8003f2b591 Mon Sep 17 00:00:00 2001
From: Owen Pan 
Date: Tue, 10 Dec 2024 16:47:21 -0800
Subject: [PATCH] [clang-format] Fix idempotent format of hash in macro body
 (#118513)

Fixes #118334.

(cherry picked from commit 54ca1c4212e7ff3df880adb1a04dc3d41c033681)
---
 clang/lib/Format/UnwrappedLineParser.cpp  |  2 +-
 clang/unittests/Format/FormatTest.cpp | 18 ++
 clang/unittests/Format/TokenAnnotatorTest.cpp | 19 +++
 3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Format/UnwrappedLineParser.cpp 
b/clang/lib/Format/UnwrappedLineParser.cpp
index bfb592ae074938..e3fb976ee1cc44 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -512,7 +512,7 @@ void UnwrappedLineParser::calculateBraceTypes(bool 
ExpectClassBody) {
   break;
 do {
   NextTok = Tokens->getNextToken();
-} while (NextTok->NewlinesBefore == 0 && NextTok->isNot(tok::eof));
+} while (!NextTok->HasUnescapedNewline && NextTok->isNot(tok::eof));
 
 while (NextTok->is(tok::comment))
   NextTok = Tokens->getNextToken();
diff --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index b7d8fc8ea72c6c..7b2947acea4a2e 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -5724,6 +5724,24 @@ TEST_F(FormatTest, HashInMacroDefinition) {
getLLVMStyleWithColumns(22));
 
   verifyFormat("#define A void # ## #", getLLVMStyleWithColumns(22));
+
+#if 0
+  // FIXME: The correct format is:
+  verifyFormat("{\n"
+   "  {\n"
+   "#define GEN_ID(_x) char *_x{#_x}\n"
+   "GEN_ID(one);\n"
+   "  }\n"
+   "}");
+#endif
+  verifyFormat("{\n"
+   "  {\n"
+   "#define GEN_ID(_x) \\\n"
+   "  char *_x { #_x }\n"
+   "GEN_ID(one);\n"
+   "  }\n"
+   "}",
+   getGoogleStyle());
 }
 
 TEST_F(FormatTest, RespectWhitespaceInMacroDefinitions) {
diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp 
b/clang/unittests/Format/TokenAnnotatorTest.cpp
index 07999116ab0cf0..7d4ff3dfa32490 100644
--- a/clang/unittests/Format/TokenAnnotatorTest.cpp
+++ b/clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -3203,6 +3203,25 @@ TEST_F(TokenAnnotatorTest, BraceKind) {
   EXPECT_BRACE_KIND(Tokens[11], BK_BracedInit);
   EXPECT_BRACE_KIND(Tokens[13], BK_Block);
 
+  Tokens = annotate("{\n"
+"  {\n"
+"#define GEN_ID(_x) char *_x{#_x}\n"
+"GEN_ID(one);\n"
+"  }\n"
+"}");
+  ASSERT_EQ(Tokens.size(), 23u) << Tokens;
+  EXPECT_TOKEN(Tokens[0], tok::l_brace, TT_BlockLBrace);
+  EXPECT_BRACE_KIND(Tokens[0], BK_Block);
+  EXPECT_TOKEN(Tokens[1], tok::l_brace, TT_BlockLBrace);
+  EXPECT_BRACE_KIND(Tokens[1], BK_Block);
+#if 0
+  // FIXME:
+  EXPECT_BRACE_KIND(Tokens[11], BK_BracedInit);
+  EXPECT_BRACE_KIND(Tokens[14], BK_BracedInit);
+#endif
+  EXPECT_BRACE_KIND(Tokens[20], BK_Block);
+  EXPECT_BRACE_KIND(Tokens[21], BK_Block);
+
   Tokens = annotate("a = class extends goog.a {};",
 getGoogleStyle(FormatStyle::LK_JavaScript));
   ASSERT_EQ(Tokens.size(), 11u) << Tokens;

___
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/19.x: [RISCV] Fix typo in CV_SH_rr_inc pattern (#120246) (PR #120296)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/120296

>From 9969e7f8783102e2b2b4ec478bb4a8aaeb6f41a2 Mon Sep 17 00:00:00 2001
From: Philipp van Kempen 
Date: Tue, 17 Dec 2024 21:20:17 +0100
Subject: [PATCH] [RISCV] Fix typo in CV_SH_rr_inc pattern (#120246)

This typo in
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/RISCV/RISCVInstrInfoXCV.td#L701:L701
caused a compiler crash in 'RISC-V Assembly Printer' because
CV_SH_ri_inc was selected, leading to `getImmOpValue` being called for a
register operand.

This bug did not affect the Assembler output and therefore does not
trigger any existing unit tests, but is visible by examining the final
MIR function.

(cherry picked from commit e8ce6c4e69745b1b2cd6f7479c48fbae44622cb3)
---
 llvm/lib/Target/RISCV/RISCVInstrInfoXCV.td | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoXCV.td 
b/llvm/lib/Target/RISCV/RISCVInstrInfoXCV.td
index 3bd6da28682863..99485981701479 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoXCV.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoXCV.td
@@ -694,7 +694,7 @@ let Predicates = [HasVendorXCVmem, IsRV32], AddedComplexity 
= 1 in {
   def : CVStriPat;
 
   def : CVStrriPat;
-  def : CVStrriPat;
+  def : CVStrriPat;
   def : CVStrriPat;
 
   def : CVStrrPat;

___
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/19.x: [clang-format] Fix idempotent format of hash in macro body (#118513) (PR #119503)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

tru wrote:

Sorry - usually I am looking for a review not by the same person that requests 
it. It just makes it a bit more sensible to me. Merging it for .7 now.

https://github.com/llvm/llvm-project/pull/119503
___
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] 9969e7f - [RISCV] Fix typo in CV_SH_rr_inc pattern (#120246)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

Author: Philipp van Kempen
Date: 2025-01-13T11:50:27+01:00
New Revision: 9969e7f8783102e2b2b4ec478bb4a8aaeb6f41a2

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

LOG: [RISCV] Fix typo in CV_SH_rr_inc pattern (#120246)

This typo in
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/RISCV/RISCVInstrInfoXCV.td#L701:L701
caused a compiler crash in 'RISC-V Assembly Printer' because
CV_SH_ri_inc was selected, leading to `getImmOpValue` being called for a
register operand.

This bug did not affect the Assembler output and therefore does not
trigger any existing unit tests, but is visible by examining the final
MIR function.

(cherry picked from commit e8ce6c4e69745b1b2cd6f7479c48fbae44622cb3)

Added: 


Modified: 
llvm/lib/Target/RISCV/RISCVInstrInfoXCV.td

Removed: 




diff  --git a/llvm/lib/Target/RISCV/RISCVInstrInfoXCV.td 
b/llvm/lib/Target/RISCV/RISCVInstrInfoXCV.td
index 3bd6da28682863..99485981701479 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoXCV.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoXCV.td
@@ -694,7 +694,7 @@ let Predicates = [HasVendorXCVmem, IsRV32], AddedComplexity 
= 1 in {
   def : CVStriPat;
 
   def : CVStrriPat;
-  def : CVStrriPat;
+  def : CVStrriPat;
   def : CVStrriPat;
 
   def : CVStrrPat;



___
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/19.x: [RISCV] Fix typo in CV_SH_rr_inc pattern (#120246) (PR #120296)

2025-01-13 Thread via llvm-branch-commits

github-actions[bot] wrote:

@topperc (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/120296
___
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/19.x: [RISCV] Fix typo in CV_SH_rr_inc pattern (#120246) (PR #120296)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/120296
___
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/19.x: [Hexagon] Only handle simple types memory accesses (#120654) (PR #121061)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/121061

>From be46324c97a263c5c6a837317b91d818bf469266 Mon Sep 17 00:00:00 2001
From: Ikhlas Ajbar 
Date: Fri, 20 Dec 2024 09:41:30 -0600
Subject: [PATCH] [Hexagon] Only handle simple types memory accesses (#120654)

The code was asserting because allowsMemoryAccess() was called with
Extended Value Type INVALID_SIMPLE_VALUE_TYPE in
HexagonISelLowering.cpp.
Fixes https://github.com/llvm/llvm-project/issues/118881

(cherry picked from commit 8177bf5022c6dfc48d236082fa02076feedd60df)
---
 .../Target/Hexagon/HexagonISelLowering.cpp|  4 
 llvm/test/CodeGen/Hexagon/simple-types-mem.ll | 22 +++
 2 files changed, 26 insertions(+)
 create mode 100644 llvm/test/CodeGen/Hexagon/simple-types-mem.ll

diff --git a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp 
b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
index 7aeaebc584c64c..995c5143e0a52a 100644
--- a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
@@ -3796,6 +3796,8 @@ EVT HexagonTargetLowering::getOptimalMemOpType(
 bool HexagonTargetLowering::allowsMemoryAccess(
 LLVMContext &Context, const DataLayout &DL, EVT VT, unsigned AddrSpace,
 Align Alignment, MachineMemOperand::Flags Flags, unsigned *Fast) const {
+  if (!VT.isSimple())
+return false;
   MVT SVT = VT.getSimpleVT();
   if (Subtarget.isHVXVectorType(SVT, true))
 return allowsHvxMemoryAccess(SVT, Flags, Fast);
@@ -3806,6 +3808,8 @@ bool HexagonTargetLowering::allowsMemoryAccess(
 bool HexagonTargetLowering::allowsMisalignedMemoryAccesses(
 EVT VT, unsigned AddrSpace, Align Alignment, MachineMemOperand::Flags 
Flags,
 unsigned *Fast) const {
+  if (!VT.isSimple())
+return false;
   MVT SVT = VT.getSimpleVT();
   if (Subtarget.isHVXVectorType(SVT, true))
 return allowsHvxMisalignedMemoryAccesses(SVT, Flags, Fast);
diff --git a/llvm/test/CodeGen/Hexagon/simple-types-mem.ll 
b/llvm/test/CodeGen/Hexagon/simple-types-mem.ll
new file mode 100644
index 00..01baa65a593531
--- /dev/null
+++ b/llvm/test/CodeGen/Hexagon/simple-types-mem.ll
@@ -0,0 +1,22 @@
+; RUN: llc -march=hexagon < %s
+; REQUIRES: asserts
+
+; Only simple types memory accesses are handled.
+
+target triple = "hexagon"
+
+%struct.hoge = type { i320 }
+
+define dso_local void @widget() {
+bb:
+  %tmp = alloca %struct.hoge, align 1
+  %tmp1 = bitcast %struct.hoge* %tmp to i320*
+  %tmp2 = load i320, i320* %tmp1, align 1
+  %tmp3 = and i320 %tmp2, -18446744073709551616
+  %tmp4 = or i320 %tmp3, 0
+  store i320 %tmp4, i320* %tmp1, align 1
+  call void @llvm.trap()
+  unreachable
+}
+
+declare void @llvm.trap()

___
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] be46324 - [Hexagon] Only handle simple types memory accesses (#120654)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

Author: Ikhlas Ajbar
Date: 2025-01-13T11:52:22+01:00
New Revision: be46324c97a263c5c6a837317b91d818bf469266

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

LOG: [Hexagon] Only handle simple types memory accesses (#120654)

The code was asserting because allowsMemoryAccess() was called with
Extended Value Type INVALID_SIMPLE_VALUE_TYPE in
HexagonISelLowering.cpp.
Fixes https://github.com/llvm/llvm-project/issues/118881

(cherry picked from commit 8177bf5022c6dfc48d236082fa02076feedd60df)

Added: 
llvm/test/CodeGen/Hexagon/simple-types-mem.ll

Modified: 
llvm/lib/Target/Hexagon/HexagonISelLowering.cpp

Removed: 




diff  --git a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp 
b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
index 7aeaebc584c64c..995c5143e0a52a 100644
--- a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
@@ -3796,6 +3796,8 @@ EVT HexagonTargetLowering::getOptimalMemOpType(
 bool HexagonTargetLowering::allowsMemoryAccess(
 LLVMContext &Context, const DataLayout &DL, EVT VT, unsigned AddrSpace,
 Align Alignment, MachineMemOperand::Flags Flags, unsigned *Fast) const {
+  if (!VT.isSimple())
+return false;
   MVT SVT = VT.getSimpleVT();
   if (Subtarget.isHVXVectorType(SVT, true))
 return allowsHvxMemoryAccess(SVT, Flags, Fast);
@@ -3806,6 +3808,8 @@ bool HexagonTargetLowering::allowsMemoryAccess(
 bool HexagonTargetLowering::allowsMisalignedMemoryAccesses(
 EVT VT, unsigned AddrSpace, Align Alignment, MachineMemOperand::Flags 
Flags,
 unsigned *Fast) const {
+  if (!VT.isSimple())
+return false;
   MVT SVT = VT.getSimpleVT();
   if (Subtarget.isHVXVectorType(SVT, true))
 return allowsHvxMisalignedMemoryAccesses(SVT, Flags, Fast);

diff  --git a/llvm/test/CodeGen/Hexagon/simple-types-mem.ll 
b/llvm/test/CodeGen/Hexagon/simple-types-mem.ll
new file mode 100644
index 00..01baa65a593531
--- /dev/null
+++ b/llvm/test/CodeGen/Hexagon/simple-types-mem.ll
@@ -0,0 +1,22 @@
+; RUN: llc -march=hexagon < %s
+; REQUIRES: asserts
+
+; Only simple types memory accesses are handled.
+
+target triple = "hexagon"
+
+%struct.hoge = type { i320 }
+
+define dso_local void @widget() {
+bb:
+  %tmp = alloca %struct.hoge, align 1
+  %tmp1 = bitcast %struct.hoge* %tmp to i320*
+  %tmp2 = load i320, i320* %tmp1, align 1
+  %tmp3 = and i320 %tmp2, -18446744073709551616
+  %tmp4 = or i320 %tmp3, 0
+  store i320 %tmp4, i320* %tmp1, align 1
+  call void @llvm.trap()
+  unreachable
+}
+
+declare void @llvm.trap()



___
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/19.x: [Hexagon] Only handle simple types memory accesses (#120654) (PR #121061)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/121061
___
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] 1414560 - [clang-format] Fix idempotent format of hash in macro body (#118513)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

Author: Owen Pan
Date: 2025-01-13T11:51:26+01:00
New Revision: 1414560a9c16039a2037de3e9d7dde8003f2b591

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

LOG: [clang-format] Fix idempotent format of hash in macro body (#118513)

Fixes #118334.

(cherry picked from commit 54ca1c4212e7ff3df880adb1a04dc3d41c033681)

Added: 


Modified: 
clang/lib/Format/UnwrappedLineParser.cpp
clang/unittests/Format/FormatTest.cpp
clang/unittests/Format/TokenAnnotatorTest.cpp

Removed: 




diff  --git a/clang/lib/Format/UnwrappedLineParser.cpp 
b/clang/lib/Format/UnwrappedLineParser.cpp
index bfb592ae074938..e3fb976ee1cc44 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -512,7 +512,7 @@ void UnwrappedLineParser::calculateBraceTypes(bool 
ExpectClassBody) {
   break;
 do {
   NextTok = Tokens->getNextToken();
-} while (NextTok->NewlinesBefore == 0 && NextTok->isNot(tok::eof));
+} while (!NextTok->HasUnescapedNewline && NextTok->isNot(tok::eof));
 
 while (NextTok->is(tok::comment))
   NextTok = Tokens->getNextToken();

diff  --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index b7d8fc8ea72c6c..7b2947acea4a2e 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -5724,6 +5724,24 @@ TEST_F(FormatTest, HashInMacroDefinition) {
getLLVMStyleWithColumns(22));
 
   verifyFormat("#define A void # ## #", getLLVMStyleWithColumns(22));
+
+#if 0
+  // FIXME: The correct format is:
+  verifyFormat("{\n"
+   "  {\n"
+   "#define GEN_ID(_x) char *_x{#_x}\n"
+   "GEN_ID(one);\n"
+   "  }\n"
+   "}");
+#endif
+  verifyFormat("{\n"
+   "  {\n"
+   "#define GEN_ID(_x) \\\n"
+   "  char *_x { #_x }\n"
+   "GEN_ID(one);\n"
+   "  }\n"
+   "}",
+   getGoogleStyle());
 }
 
 TEST_F(FormatTest, RespectWhitespaceInMacroDefinitions) {

diff  --git a/clang/unittests/Format/TokenAnnotatorTest.cpp 
b/clang/unittests/Format/TokenAnnotatorTest.cpp
index 07999116ab0cf0..7d4ff3dfa32490 100644
--- a/clang/unittests/Format/TokenAnnotatorTest.cpp
+++ b/clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -3203,6 +3203,25 @@ TEST_F(TokenAnnotatorTest, BraceKind) {
   EXPECT_BRACE_KIND(Tokens[11], BK_BracedInit);
   EXPECT_BRACE_KIND(Tokens[13], BK_Block);
 
+  Tokens = annotate("{\n"
+"  {\n"
+"#define GEN_ID(_x) char *_x{#_x}\n"
+"GEN_ID(one);\n"
+"  }\n"
+"}");
+  ASSERT_EQ(Tokens.size(), 23u) << Tokens;
+  EXPECT_TOKEN(Tokens[0], tok::l_brace, TT_BlockLBrace);
+  EXPECT_BRACE_KIND(Tokens[0], BK_Block);
+  EXPECT_TOKEN(Tokens[1], tok::l_brace, TT_BlockLBrace);
+  EXPECT_BRACE_KIND(Tokens[1], BK_Block);
+#if 0
+  // FIXME:
+  EXPECT_BRACE_KIND(Tokens[11], BK_BracedInit);
+  EXPECT_BRACE_KIND(Tokens[14], BK_BracedInit);
+#endif
+  EXPECT_BRACE_KIND(Tokens[20], BK_Block);
+  EXPECT_BRACE_KIND(Tokens[21], BK_Block);
+
   Tokens = annotate("a = class extends goog.a {};",
 getGoogleStyle(FormatStyle::LK_JavaScript));
   ASSERT_EQ(Tokens.size(), 11u) << Tokens;



___
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/19.x: [clang-format] Fix idempotent format of hash in macro body (#118513) (PR #119503)

2025-01-13 Thread via llvm-branch-commits

github-actions[bot] wrote:

@owenca (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/119503
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] 5998cd3 - Build SanitizerCommon if ctx_profile enabled (#105495)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

Author: Nikita Popov
Date: 2025-01-13T11:51:53+01:00
New Revision: 5998cd3b38dc45717f4aac8fe6e568d1b6facef7

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

LOG: Build SanitizerCommon if ctx_profile enabled (#105495)

ctx_profile has a dependency on SanitizerCommon, so make sure it is
built even if we otherwise disable sanitizers.

(cherry picked from commit e3389365b5d62bc9781dc9a23b14d72e333018d7)

Added: 


Modified: 
compiler-rt/lib/CMakeLists.txt

Removed: 




diff  --git a/compiler-rt/lib/CMakeLists.txt b/compiler-rt/lib/CMakeLists.txt
index 22f9b3ea8a0c35..e6158ec4088951 100644
--- a/compiler-rt/lib/CMakeLists.txt
+++ b/compiler-rt/lib/CMakeLists.txt
@@ -9,7 +9,7 @@ include(SanitizerUtils)
 #
 #TODO: Refactor sanitizer_common into smaller pieces (e.g. flag parsing, 
utils).
 if (COMPILER_RT_HAS_SANITIZER_COMMON AND
-(COMPILER_RT_BUILD_SANITIZERS OR COMPILER_RT_BUILD_XRAY OR 
COMPILER_RT_BUILD_MEMPROF))
+(COMPILER_RT_BUILD_SANITIZERS OR COMPILER_RT_BUILD_XRAY OR 
COMPILER_RT_BUILD_MEMPROF OR COMPILER_RT_BUILD_CTX_PROFILE))
   add_subdirectory(sanitizer_common)
 endif()
 



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


[llvm-branch-commits] [compiler-rt] release/19.x: Build SanitizerCommon if ctx_profile enabled (#105495) (PR #121035)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/121035

>From 5998cd3b38dc45717f4aac8fe6e568d1b6facef7 Mon Sep 17 00:00:00 2001
From: Nikita Popov 
Date: Thu, 22 Aug 2024 09:48:05 +0200
Subject: [PATCH] Build SanitizerCommon if ctx_profile enabled (#105495)

ctx_profile has a dependency on SanitizerCommon, so make sure it is
built even if we otherwise disable sanitizers.

(cherry picked from commit e3389365b5d62bc9781dc9a23b14d72e333018d7)
---
 compiler-rt/lib/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler-rt/lib/CMakeLists.txt b/compiler-rt/lib/CMakeLists.txt
index 22f9b3ea8a0c35..e6158ec4088951 100644
--- a/compiler-rt/lib/CMakeLists.txt
+++ b/compiler-rt/lib/CMakeLists.txt
@@ -9,7 +9,7 @@ include(SanitizerUtils)
 #
 #TODO: Refactor sanitizer_common into smaller pieces (e.g. flag parsing, 
utils).
 if (COMPILER_RT_HAS_SANITIZER_COMMON AND
-(COMPILER_RT_BUILD_SANITIZERS OR COMPILER_RT_BUILD_XRAY OR 
COMPILER_RT_BUILD_MEMPROF))
+(COMPILER_RT_BUILD_SANITIZERS OR COMPILER_RT_BUILD_XRAY OR 
COMPILER_RT_BUILD_MEMPROF OR COMPILER_RT_BUILD_CTX_PROFILE))
   add_subdirectory(sanitizer_common)
 endif()
 

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


[llvm-branch-commits] [compiler-rt] release/19.x: Build SanitizerCommon if ctx_profile enabled (#105495) (PR #121035)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/121035
___
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/19.x: [Hexagon] Only handle simple types memory accesses (#120654) (PR #121061)

2025-01-13 Thread via llvm-branch-commits

github-actions[bot] wrote:

@androm3da (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/121061
___
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] DAG: Avoid forming shufflevector from a single extract_vector_elt (PR #122672)

2025-01-13 Thread Matt Arsenault via llvm-branch-commits


@@ -23855,6 +23863,13 @@ SDValue DAGCombiner::reduceBuildVecToShuffle(SDNode 
*N) {
   // VecIn accordingly.
   bool DidSplitVec = false;
   if (VecIn.size() == 2) {

arsenm wrote:

This code places a null SDValue in the first entry of the array, so the first 
found extract element is the second element 

https://github.com/llvm/llvm-project/pull/122672
___
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/19.x: [DAG] Allow AssertZExt to scalarize. (#122463) (PR #122617)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/122617

>From 6d1f0e603cbe88188704ad84c6bff9a7208136cf Mon Sep 17 00:00:00 2001
From: David Green 
Date: Sat, 11 Jan 2025 16:29:06 +
Subject: [PATCH] [DAG] Allow AssertZExt to scalarize. (#122463)

With range and undef metadata on a call we can have vector AssertZExt
generated on a target with no vector operations. The AssertZExt needs to
scalarize to a normal `AssertZext tin, ValueType`. I have added
AssertSext too, although I do not have a test case.

Fixes #110374

(cherry picked from commit ab9a80a3ad78f611fd06cd6f7215bd828809310c)
---
 llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h |  2 +-
 .../SelectionDAG/LegalizeVectorTypes.cpp  |  8 +++-
 .../test/CodeGen/ARM/scalarize-assert-zext.ll | 46 +++
 3 files changed, 53 insertions(+), 3 deletions(-)
 create mode 100644 llvm/test/CodeGen/ARM/scalarize-assert-zext.ll

diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h 
b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
index d4e61c85889012..d74896772bf53b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
@@ -838,7 +838,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
   SDValue ScalarizeVecRes_BUILD_VECTOR(SDNode *N);
   SDValue ScalarizeVecRes_EXTRACT_SUBVECTOR(SDNode *N);
   SDValue ScalarizeVecRes_FP_ROUND(SDNode *N);
-  SDValue ScalarizeVecRes_ExpOp(SDNode *N);
+  SDValue ScalarizeVecRes_UnaryOpWithExtraInput(SDNode *N);
   SDValue ScalarizeVecRes_INSERT_VECTOR_ELT(SDNode *N);
   SDValue ScalarizeVecRes_LOAD(LoadSDNode *N);
   SDValue ScalarizeVecRes_SCALAR_TO_VECTOR(SDNode *N);
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp 
b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
index 92b62ccdc27552..ea95aaef8a1e87 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
@@ -58,7 +58,11 @@ void DAGTypeLegalizer::ScalarizeVectorResult(SDNode *N, 
unsigned ResNo) {
   case ISD::BUILD_VECTOR:  R = ScalarizeVecRes_BUILD_VECTOR(N); break;
   case ISD::EXTRACT_SUBVECTOR: R = ScalarizeVecRes_EXTRACT_SUBVECTOR(N); break;
   case ISD::FP_ROUND:  R = ScalarizeVecRes_FP_ROUND(N); break;
-  case ISD::FPOWI: R = ScalarizeVecRes_ExpOp(N); break;
+  case ISD::AssertZext:
+  case ISD::AssertSext:
+  case ISD::FPOWI:
+R = ScalarizeVecRes_UnaryOpWithExtraInput(N);
+break;
   case ISD::INSERT_VECTOR_ELT: R = ScalarizeVecRes_INSERT_VECTOR_ELT(N); break;
   case ISD::LOAD:   R = 
ScalarizeVecRes_LOAD(cast(N));break;
   case ISD::SCALAR_TO_VECTOR:  R = ScalarizeVecRes_SCALAR_TO_VECTOR(N); break;
@@ -426,7 +430,7 @@ SDValue DAGTypeLegalizer::ScalarizeVecRes_FP_ROUND(SDNode 
*N) {
  N->getOperand(1));
 }
 
-SDValue DAGTypeLegalizer::ScalarizeVecRes_ExpOp(SDNode *N) {
+SDValue DAGTypeLegalizer::ScalarizeVecRes_UnaryOpWithExtraInput(SDNode *N) {
   SDValue Op = GetScalarizedVector(N->getOperand(0));
   return DAG.getNode(N->getOpcode(), SDLoc(N), Op.getValueType(), Op,
  N->getOperand(1));
diff --git a/llvm/test/CodeGen/ARM/scalarize-assert-zext.ll 
b/llvm/test/CodeGen/ARM/scalarize-assert-zext.ll
new file mode 100644
index 00..5638bb4a398803
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/scalarize-assert-zext.ll
@@ -0,0 +1,46 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 
UTC_ARGS: --version 5
+; RUN: llc -mtriple=armv7-unknown-linux-musleabihf -mattr=-neon %s -o - | 
FileCheck %s
+
+declare fastcc noundef range(i16 0, 256) <4 x i16> @other()
+
+define void @test(ptr %0) #0 {
+; CHECK-LABEL: test:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:.save {r4, lr}
+; CHECK-NEXT:push {r4, lr}
+; CHECK-NEXT:mov r4, r0
+; CHECK-NEXT:bl other
+; CHECK-NEXT:uxth r3, r3
+; CHECK-NEXT:uxth r2, r2
+; CHECK-NEXT:uxth r1, r1
+; CHECK-NEXT:uxth r0, r0
+; CHECK-NEXT:strb r3, [r4, #3]
+; CHECK-NEXT:strb r2, [r4, #2]
+; CHECK-NEXT:strb r1, [r4, #1]
+; CHECK-NEXT:strb r0, [r4]
+; CHECK-NEXT:pop {r4, pc}
+entry:
+  %call = call fastcc <4 x i16> @other()
+  %t = trunc <4 x i16> %call to <4 x i8>
+  store <4 x i8> %t, ptr %0, align 1
+  ret void
+}
+
+define <4 x i16> @test2() #0 {
+; CHECK-LABEL: test2:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:.save {r11, lr}
+; CHECK-NEXT:push {r11, lr}
+; CHECK-NEXT:bl other
+; CHECK-NEXT:movw r1, #65408
+; CHECK-NEXT:and r0, r0, r1
+; CHECK-NEXT:and r2, r2, r1
+; CHECK-NEXT:mov r1, #0
+; CHECK-NEXT:mov r3, #0
+; CHECK-NEXT:pop {r11, pc}
+entry:
+  %call = call fastcc <4 x i16> @other()
+  %a = and <4 x i16> %call, 
+  ret <4 x i16> %a
+}
+

___
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/19.x: [cmake] Extend zstd.dll finding logic from MSVC to Clang (#121437) (PR #121755)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits
=?utf-8?q?Michał_Górny?= 
Message-ID:
In-Reply-To: 


https://github.com/tru updated https://github.com/llvm/llvm-project/pull/121755

>From ed93afd1619982d9a22b169cac8094e3ba2f6c3d Mon Sep 17 00:00:00 2001
From: Vassil Vassilev 
Date: Thu, 22 Aug 2024 13:04:33 +0200
Subject: [PATCH 1/2] [cmake] Include GNUInstallDirs before using variables
 defined by it. (#83807)

This fixes an odd problem with the regex when `CMAKE_INSTALL_LIBDIR` is
not defined:

`string sub-command REGEX, mode REPLACE: regex "$" matched an empty
string.`

Fixes llvm/llvm-project#83802

(cherry picked from commit 5bbd5984306ab0bdd89a2e81cd4965e5ae51c3fb)
---
 llvm/cmake/modules/Findzstd.cmake | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/cmake/modules/Findzstd.cmake 
b/llvm/cmake/modules/Findzstd.cmake
index 4bc0b793e51c9a..86b6d48b6ec6b6 100644
--- a/llvm/cmake/modules/Findzstd.cmake
+++ b/llvm/cmake/modules/Findzstd.cmake
@@ -34,6 +34,7 @@ if(zstd_FOUND)
   elseif (NOT TARGET zstd::libzstd_shared)
 add_library(zstd::libzstd_shared SHARED IMPORTED)
 if(MSVC)
+  include(GNUInstallDirs) # For CMAKE_INSTALL_LIBDIR and friends.
   # IMPORTED_LOCATION is the path to the DLL and IMPORTED_IMPLIB is the 
"library".
   get_filename_component(zstd_DIRNAME "${zstd_LIBRARY}" DIRECTORY)
   if(NOT "${CMAKE_INSTALL_LIBDIR}" STREQUAL "" AND NOT 
"${CMAKE_INSTALL_BINDIR}" STREQUAL "")

>From 4725466801390d47c8d987dbd6d4671e02ab85a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= 
Date: Thu, 2 Jan 2025 15:43:45 +
Subject: [PATCH 2/2] [cmake] Extend zstd.dll finding logic from MSVC to Clang
 (#121437)

Extend the special logic for finding `zstd.dll` in `Findzstd` to apply
to all MSVC-compatible configurations such as Clang targeting MSVC.

Fixes #121345

(cherry picked from commit 62d0aff3eb934439acac47348e2385f0751a1444)
---
 llvm/cmake/modules/Findzstd.cmake | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/cmake/modules/Findzstd.cmake 
b/llvm/cmake/modules/Findzstd.cmake
index 86b6d48b6ec6b6..f6ca5d1ebe546b 100644
--- a/llvm/cmake/modules/Findzstd.cmake
+++ b/llvm/cmake/modules/Findzstd.cmake
@@ -10,7 +10,7 @@
 # zstd::libzstd_shared
 # zstd::libzstd_static
 
-if(MSVC)
+if(MSVC OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
   set(zstd_STATIC_LIBRARY_SUFFIX "_static\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")
 else()
   set(zstd_STATIC_LIBRARY_SUFFIX "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")
@@ -33,7 +33,7 @@ if(zstd_FOUND)
 set(zstd_STATIC_LIBRARY "${zstd_LIBRARY}")
   elseif (NOT TARGET zstd::libzstd_shared)
 add_library(zstd::libzstd_shared SHARED IMPORTED)
-if(MSVC)
+if(MSVC OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
   include(GNUInstallDirs) # For CMAKE_INSTALL_LIBDIR and friends.
   # IMPORTED_LOCATION is the path to the DLL and IMPORTED_IMPLIB is the 
"library".
   get_filename_component(zstd_DIRNAME "${zstd_LIBRARY}" DIRECTORY)

___
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/19.x: Fix print module manifest file for macos (#122370) (PR #122844)

2025-01-13 Thread Chuanqi Xu via llvm-branch-commits

ChuanqiXu9 wrote:

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

It is necessary for using std module on MacOS with CMake. I think it is 
important.

https://github.com/llvm/llvm-project/pull/122844
___
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/19.x: [Github] Fix LLVM Project Tests Workflow on Linux (#122221) (PR #122814)

2025-01-13 Thread via llvm-branch-commits

github-actions[bot] wrote:

@boomanaiden154 (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/122814
___
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/19.x: [Github] Fix LLVM Project Tests Workflow on Linux (#122221) (PR #122814)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/122814
___
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] Fix std::initializer_list recognition if it's exported out of a module (PR #121739)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/121739

>From f1b37b6665b5ea2b8962f11fb6d034f77a7bbd36 Mon Sep 17 00:00:00 2001
From: Artsiom Drapun 
Date: Sat, 7 Dec 2024 19:24:29 +0300
Subject: [PATCH] Fix std::initializer_list recognition if it's exported out of
 a module

- Add implementation
- Add a regression test
- Add release notes
---
 clang/docs/ReleaseNotes.rst   |  3 +-
 clang/lib/Sema/SemaDeclCXX.cpp|  2 +-
 ...hrough-export-and-linkage-issue-118218.cpp | 39 +++
 3 files changed, 42 insertions(+), 2 deletions(-)
 create mode 100644 
clang/test/Modules/initializer-list-recognition-through-export-and-linkage-issue-118218.cpp

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 8c7a6ba70acd28..1e9845b9b9c5b2 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -1123,7 +1123,8 @@ Bug Fixes to C++ Support
 - Fixed assertion failure by skipping the analysis of an invalid field 
declaration. (#GH99868)
 - Fix an issue with dependent source location expressions (#GH106428), 
(#GH81155), (#GH80210), (#GH85373)
 - Fix handling of ``_`` as the name of a lambda's init capture variable. 
(#GH107024)
-
+- Fixed recognition of ``std::initializer_list`` when it's surrounded with 
``extern "C++"`` and exported
+  out of a module (which is the case e.g. in MSVC's implementation of ``std`` 
module). (#GH118218)
 
 Bug Fixes to AST Handling
 ^
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 4e4f91de8cd5a5..18262993af283a 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -11919,7 +11919,7 @@ bool Sema::isStdInitializerList(QualType Ty, QualType 
*Element) {
 if (TemplateClass->getIdentifier() !=
 &PP.getIdentifierTable().get("initializer_list") ||
 !getStdNamespace()->InEnclosingNamespaceSetOf(
-TemplateClass->getDeclContext()))
+TemplateClass->getNonTransparentDeclContext()))
   return false;
 // This is a template called std::initializer_list, but is it the right
 // template?
diff --git 
a/clang/test/Modules/initializer-list-recognition-through-export-and-linkage-issue-118218.cpp
 
b/clang/test/Modules/initializer-list-recognition-through-export-and-linkage-issue-118218.cpp
new file mode 100644
index 00..e2c796fb103f6c
--- /dev/null
+++ 
b/clang/test/Modules/initializer-list-recognition-through-export-and-linkage-issue-118218.cpp
@@ -0,0 +1,39 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+//
+// RUN: %clang_cc1 -std=c++20 %t/std.cppm -emit-module-interface -o %t/std.pcm
+// RUN: %clang_cc1 -std=c++20 %t/mod.cppm -fprebuilt-module-path=%t 
-emit-module-interface -o %t/mod.pcm
+// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -verify %t/main.cpp
+
+//--- std.cppm
+export module std;
+
+extern "C++" {
+  namespace std {
+  export template 
+  class initializer_list {
+const E* _1;
+const E* _2;
+  };
+  }
+}
+
+//--- mod.cppm
+export module mod;
+
+import std;
+
+export struct A {
+  void func(std::initializer_list) {}
+};
+
+//--- main.cpp
+// expected-no-diagnostics
+import std;
+import mod;
+
+int main() {
+  A{}.func({1,1});
+  return 0;
+}

___
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] [SLP] Check if instructions exist after vectorization (#120434) (PR #120505)

2025-01-13 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/120505

>From 75d46f6a30f8c9f34111332a2fe63d539548a2c8 Mon Sep 17 00:00:00 2001
From: DianQK 
Date: Thu, 19 Dec 2024 06:21:57 +0800
Subject: [PATCH] [SLP] Check if instructions exist after vectorization
 (#120434)

Fixes #120433.

(cherry picked from commit e7a4d78ad328d02bf515b2fa4af8b2c188a6a636)
---
 .../Transforms/Vectorize/SLPVectorizer.cpp|  5 +-
 .../SLPVectorizer/slp-deleted-inst.ll | 51 +++
 2 files changed, 55 insertions(+), 1 deletion(-)
 create mode 100644 llvm/test/Transforms/SLPVectorizer/slp-deleted-inst.ll

diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp 
b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 746ba51a981fe0..fd08d5d9d7556a 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -18596,8 +18596,11 @@ bool 
SLPVectorizerPass::vectorizeCmpInsts(iterator_range CmpInsts,
 if (R.isDeleted(I))
   continue;
 for (Value *Op : I->operands())
-  if (auto *RootOp = dyn_cast(Op))
+  if (auto *RootOp = dyn_cast(Op)) {
 Changed |= vectorizeRootInstruction(nullptr, RootOp, BB, R, TTI);
+if (R.isDeleted(I))
+  break;
+  }
   }
   // Try to vectorize operands as vector bundles.
   for (CmpInst *I : CmpInsts) {
diff --git a/llvm/test/Transforms/SLPVectorizer/slp-deleted-inst.ll 
b/llvm/test/Transforms/SLPVectorizer/slp-deleted-inst.ll
new file mode 100644
index 00..d3995f1bb7f85d
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/slp-deleted-inst.ll
@@ -0,0 +1,51 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 5
+; RUN: opt -S -passes=slp-vectorizer < %s | FileCheck %s
+
+define void @foo() {
+; CHECK-LABEL: define void @foo() {
+; CHECK-NEXT:  [[BB:.*]]:
+; CHECK-NEXT:br label %[[BB1:.*]]
+; CHECK:   [[BB1]]:
+; CHECK-NEXT:[[TMP0:%.*]] = phi <2 x i32> [ [[TMP11:%.*]], %[[BB3:.*]] ], 
[ zeroinitializer, %[[BB]] ]
+; CHECK-NEXT:br label %[[BB3]]
+; CHECK:   [[BB3]]:
+; CHECK-NEXT:[[TMP1:%.*]] = trunc <2 x i32> [[TMP0]] to <2 x i1>
+; CHECK-NEXT:[[TMP2:%.*]] = mul <2 x i1> [[TMP1]], zeroinitializer
+; CHECK-NEXT:[[TMP3:%.*]] = or <2 x i1> zeroinitializer, [[TMP2]]
+; CHECK-NEXT:[[TMP4:%.*]] = and <2 x i1> [[TMP3]], zeroinitializer
+; CHECK-NEXT:[[TMP5:%.*]] = extractelement <2 x i1> [[TMP4]], i32 0
+; CHECK-NEXT:[[TMP6:%.*]] = zext i1 [[TMP5]] to i32
+; CHECK-NEXT:[[TMP7:%.*]] = extractelement <2 x i1> [[TMP4]], i32 1
+; CHECK-NEXT:[[TMP8:%.*]] = zext i1 [[TMP7]] to i32
+; CHECK-NEXT:[[I22:%.*]] = or i32 [[TMP6]], [[TMP8]]
+; CHECK-NEXT:[[TMP9:%.*]] = insertelement <2 x i32> , 
i32 [[I22]], i32 0
+; CHECK-NEXT:[[TMP10:%.*]] = icmp ult <2 x i32> [[TMP9]], zeroinitializer
+; CHECK-NEXT:[[TMP11]] = select <2 x i1> [[TMP10]], <2 x i32> 
zeroinitializer, <2 x i32> zeroinitializer
+; CHECK-NEXT:br label %[[BB1]]
+;
+bb:
+  br label %bb1
+
+bb1:  ; preds = %bb3, %bb
+  %i = phi i32 [ %i26, %bb3 ], [ 0, %bb ]
+  %i2 = phi i32 [ %i24, %bb3 ], [ 0, %bb ]
+  br label %bb3
+
+bb3:  ; preds = %bb1
+  %i4 = zext i32 %i2 to i64
+  %i5 = mul i64 %i4, 0
+  %i10 = or i64 0, %i5
+  %i11 = trunc i64 %i10 to i32
+  %i12 = and i32 %i11, 0
+  %i13 = zext i32 %i to i64
+  %i14 = mul i64 %i13, 0
+  %i19 = or i64 0, %i14
+  %i20 = trunc i64 %i19 to i32
+  %i21 = and i32 %i20, 0
+  %i22 = or i32 %i12, %i21
+  %i23 = icmp ult i32 %i22, 0
+  %i24 = select i1 %i23, i32 0, i32 0
+  %i25 = icmp ult i32 0, 0
+  %i26 = select i1 %i25, i32 0, i32 0
+  br label %bb1
+}

___
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] [Driver] Change linker job in Baremetal toolchain object accomodate GCCInstallation.(2/3) (PR #121830)

2025-01-13 Thread Craig Topper via llvm-branch-commits


@@ -36,6 +36,7 @@ class LLVM_LIBRARY_VISIBILITY BareMetal : public Generic_ELF {
   Tool *buildStaticLibTool() const override;
 
 public:
+  virtual bool isUsingLD() const { return UseLD || GCCInstallation.isValid(); }

topperc wrote:

Does this need to be virtual?

https://github.com/llvm/llvm-project/pull/121830
___
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-tools-extra] [clang-doc] Make `--repository` change the HTML output (PR #122566)

2025-01-13 Thread Paul Kirth via llvm-branch-commits

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

>From 9fa0ada93071d5b91bb36b676baad7fa8057200d Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Sat, 11 Jan 2025 01:21:54 +
Subject: [PATCH] [clang-doc] Make `--repository` change the HTML output

The current check in writeFileDefinition() is incorrect, and prevents us
from ever emitting the URL from the clang-doc tool. The unit tests do
test this, but call the API directly circumventing the check.

This is the first step towards addressing #59814.
---
 clang-tools-extra/clang-doc/HTMLGenerator.cpp |  17 +-
 .../Inputs/basic-project/src/Circle.cpp   |   3 +-
 .../test/clang-doc/basic-project.test | 295 +++---
 .../unittests/clang-doc/HTMLGeneratorTest.cpp |   7 +-
 4 files changed, 197 insertions(+), 125 deletions(-)

diff --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp 
b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
index e3532559a32fcc..e008a03159e6aa 100644
--- a/clang-tools-extra/clang-doc/HTMLGenerator.cpp
+++ b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
@@ -494,18 +494,31 @@ genReferencesBlock(const std::vector 
&References,
 static std::unique_ptr
 writeFileDefinition(const Location &L,
 std::optional RepositoryUrl = std::nullopt) {
-  if (!L.IsFileInRootDir || !RepositoryUrl)
+  if (!L.IsFileInRootDir && !RepositoryUrl)
 return std::make_unique(
 HTMLTag::TAG_P, "Defined at line " + std::to_string(L.LineNumber) +
 " of file " + L.Filename);
   SmallString<128> FileURL(*RepositoryUrl);
-  llvm::sys::path::append(FileURL, llvm::sys::path::Style::posix, L.Filename);
+  llvm::sys::path::append(
+  FileURL, llvm::sys::path::Style::posix,
+  // If we're on windows, the file name will be in the wrong format, and
+  // append won't convert the full path being appended to the correct
+  // format, so we need to do that here.
+  llvm::sys::path::convert_to_slash(
+  L.Filename,
+  // The style here is the current style of the path, not the one we're
+  // targeting. If the string is already in the posix style, it will do
+  // nothing.
+  llvm::sys::path::Style::windows));
   auto Node = std::make_unique(HTMLTag::TAG_P);
   Node->Children.emplace_back(std::make_unique("Defined at line "));
   auto LocNumberNode =
   std::make_unique(HTMLTag::TAG_A, std::to_string(L.LineNumber));
   // The links to a specific line in the source code use the github /
   // googlesource notation so it won't work for all hosting pages.
+  // FIXME: we probably should have a configuration setting for line number
+  // rendering in the HTML. For example, GitHub uses #L22, while googlesource
+  // uses #22 for line numbers.
   LocNumberNode->Attributes.emplace_back(
   "href", (FileURL + "#" + std::to_string(L.LineNumber)).str());
   Node->Children.emplace_back(std::move(LocNumberNode));
diff --git 
a/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Circle.cpp 
b/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Circle.cpp
index 823384a4d97e86..3ddb2fd9ff563e 100644
--- a/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Circle.cpp
+++ b/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Circle.cpp
@@ -8,4 +8,5 @@ double Circle::area() const {
 
 double Circle::perimeter() const {
 return 3.141 * radius_;
-}
\ No newline at end of file
+}
+
diff --git a/clang-tools-extra/test/clang-doc/basic-project.test 
b/clang-tools-extra/test/clang-doc/basic-project.test
index b6b43bb82bb15d..1f5ba8bdc0703d 100644
--- a/clang-tools-extra/test/clang-doc/basic-project.test
+++ b/clang-tools-extra/test/clang-doc/basic-project.test
@@ -54,130 +54,183 @@
 // JSON-INDEX-NEXT: };
 // JSON-INDEX-NEXT: }
 
-// HTML-SHAPE: class Shape
-// HTML-SHAPE: Defined at line 8 of file {{.*}}Shape.h
-// HTML-SHAPE: brief
-// HTML-SHAPE:  Abstract base class for shapes.
-// HTML-SHAPE:  Provides a common interface for different types of 
shapes.
-// HTML-SHAPE: Functions
-// HTML-SHAPE: area
-// HTML-SHAPE: public double area()
-// HTML-SHAPE: brief
-// HTML-SHAPE:  Calculates the area of the shape.
-// HTML-SHAPE: perimeter
-// HTML-SHAPE: public double perimeter()
-// HTML-SHAPE: brief
-// HTML-SHAPE:  Calculates the perimeter of the shape.
-// HTML-SHAPE: return
-// HTML-SHAPE:  double The perimeter of the shape.
-// HTML-SHAPE: ~Shape
-// HTML-SHAPE: public void ~Shape()
-// HTML-SHAPE: Defined at line 13 of file {{.*}}Shape.h
-// HTML-SHAPE: brief
-// HTML-SHAPE:  Virtual destructor.
+//  HTML-SHAPE: class Shape
+// HTML-SHAPE-NEXT: 
+// HTML-SHAPE-NEXT: Defined at line
+// HTML-SHAPE-NEXT: https://repository.com/./include/Shape.h#8";>8
+// HTML-SHAPE-NEXT: of file
+// HTML-SHAPE-NEXT: https://repository.com/./include/Shape.h";>Shape.h
+// HTML-SHAPE-NEXT: 
+//  HTML-SHAPE: brief
+//  HTML-SHAPE:  Abstract base class for shapes.
+//  HTML-SHAPE:  Provides a com