[llvm-branch-commits] [libcxx] [libc++][TZDB] Implements zoned_traits. (PR #91059)

2024-05-04 Thread Mark de Wever via llvm-branch-commits

https://github.com/mordante created 
https://github.com/llvm/llvm-project/pull/91059

Implements parts of:
- P0355 Extending chrono to Calendars and Time Zones

>From 0a602d2268923936a62034faaaf10f2401457d99 Mon Sep 17 00:00:00 2001
From: Mark de Wever 
Date: Wed, 17 Apr 2024 21:00:22 +0200
Subject: [PATCH] [libc++][TZDB] Implements zoned_traits.

Implements parts of:
- P0355 Extending chrono to Calendars and Time Zones
---
 libcxx/include/CMakeLists.txt |  1 +
 libcxx/include/__chrono/zoned_time.h  | 55 +++
 libcxx/include/chrono |  4 ++
 libcxx/include/module.modulemap   |  1 +
 libcxx/modules/std/chrono.inc |  3 +-
 .../diagnostics/chrono.nodiscard.verify.cpp   |  6 ++
 .../const_time_zone_default_zone.pass.cpp | 36 
 .../const_time_zone_locate_zone.pass.cpp  | 45 +++
 .../types.compile.pass.cpp| 32 +++
 9 files changed, 181 insertions(+), 2 deletions(-)
 create mode 100644 libcxx/include/__chrono/zoned_time.h
 create mode 100644 
libcxx/test/std/time/time.zone/time.zone.zonedtraits/const_time_zone_default_zone.pass.cpp
 create mode 100644 
libcxx/test/std/time/time.zone/time.zone.zonedtraits/const_time_zone_locate_zone.pass.cpp
 create mode 100644 
libcxx/test/std/time/time.zone/time.zone.zonedtraits/types.compile.pass.cpp

diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 386bd967eed7ab..919f1ae39390a8 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -291,6 +291,7 @@ set(files
   __chrono/year_month.h
   __chrono/year_month_day.h
   __chrono/year_month_weekday.h
+  __chrono/zoned_time.h
   __compare/common_comparison_category.h
   __compare/compare_partial_order_fallback.h
   __compare/compare_strong_order_fallback.h
diff --git a/libcxx/include/__chrono/zoned_time.h 
b/libcxx/include/__chrono/zoned_time.h
new file mode 100644
index 00..c6084426ad72b4
--- /dev/null
+++ b/libcxx/include/__chrono/zoned_time.h
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
+
+#ifndef _LIBCPP___CHRONO_ZONED_TIME_H
+#define _LIBCPP___CHRONO_ZONED_TIME_H
+
+#include 
+// Enable the contents of the header only when libc++ was built with 
experimental features enabled.
+#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
+
+#  include <__chrono/time_zone.h>
+#  include <__chrono/tzdb_list.h>
+#  include <__config>
+#  include <__fwd/string_view.h>
+
+#  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#  endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#  if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && 
!defined(_LIBCPP_HAS_NO_FILESYSTEM) &&   \
+  !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+
+namespace chrono {
+
+template 
+struct zoned_traits {};
+
+template <>
+struct zoned_traits {
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static const time_zone* default_zone() { 
return chrono::locate_zone("UTC"); }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static const time_zone* 
locate_zone(string_view __name) {
+return chrono::locate_zone(__name);
+  }
+};
+
+} // namespace chrono
+
+#  endif // _LIBCPP_STD_VER >= 20 && 
!defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && 
!defined(_LIBCPP_HAS_NO_FILESYSTEM)
+ // && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
+
+#endif // _LIBCPP___CHRONO_ZONED_TIME_H
diff --git a/libcxx/include/chrono b/libcxx/include/chrono
index d6b889cdde73c4..7d341823755ffb 100644
--- a/libcxx/include/chrono
+++ b/libcxx/include/chrono
@@ -786,6 +786,9 @@ class time_zone {
 bool operator==(const time_zone& x, const time_zone& y) noexcept;  
  // C++20
 strong_ordering operator<=>(const time_zone& x, const time_zone& y) noexcept;  
  // C++20
 
+// [time.zone.zonedtraits], class template zoned_traits
+template struct zoned_traits; 
  // C++20
+
 // [time.zone.leap], leap second support
 class leap_second {
  // C++20
 public:
@@ -959,6 +962,7 @@ constexpr chrono::year  
operator ""y(unsigned lo
 #include <__chrono/time_zone_link.h>
 #include <__chrono/tzdb.h>
 #include <__chrono/tzdb_list.h>
+#include <__chrono/zoned_time.h>
 #  endif
 
 #endif
diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap
index e4c154d99602b8..5c0da3e8172571 100644
--- a/libcxx/in

[llvm-branch-commits] [clang] release/18.x: [clang-format] Fix a crash with AlignArrayOfStructures option (#86420) (PR #91049)

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

llvmbot wrote:




@llvm/pr-subscribers-clang-format

Author: None (llvmbot)


Changes

Backport cceedc939a43

Requested by: @owenca

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


2 Files Affected:

- (modified) clang/lib/Format/WhitespaceManager.cpp (+1-1) 
- (modified) clang/unittests/Format/FormatTest.cpp (+16-2) 


``diff
diff --git a/clang/lib/Format/WhitespaceManager.cpp 
b/clang/lib/Format/WhitespaceManager.cpp
index df84f97a8e8ac1..7525e6ee650b62 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -1466,7 +1466,7 @@ WhitespaceManager::CellDescriptions 
WhitespaceManager::getCells(unsigned Start,
 : Cell);
 // Go to the next non-comment and ensure there is a break in front
 const auto *NextNonComment = C.Tok->getNextNonComment();
-while (NextNonComment->is(tok::comma))
+while (NextNonComment && NextNonComment->is(tok::comma))
   NextNonComment = NextNonComment->getNextNonComment();
 auto j = i;
 while (Changes[j].Tok != NextNonComment && j < End)
diff --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index 88877e53d014c6..b43c16a026de3a 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -20955,7 +20955,14 @@ TEST_F(FormatTest, 
CatchAlignArrayOfStructuresRightAlignment) {
 "[0] = {1, 1},\n"
 "[1] { 1, 1, },\n"
 "[2] { 1, 1, },\n"
-"};");
+"};",
+Style);
+  verifyNoCrash("test arr[] = {\n"
+"#define FOO(i) {i, i},\n"
+"SOME_GENERATOR(FOO)\n"
+"{2, 2}\n"
+"};",
+Style);
 
   verifyFormat("return GradForUnaryCwise(g, {\n"
"{{\"sign\"}, \"Sign\",  "
@@ -21208,7 +21215,14 @@ TEST_F(FormatTest, 
CatchAlignArrayOfStructuresLeftAlignment) {
 "[0] = {1, 1},\n"
 "[1] { 1, 1, },\n"
 "[2] { 1, 1, },\n"
-"};");
+"};",
+Style);
+  verifyNoCrash("test arr[] = {\n"
+"#define FOO(i) {i, i},\n"
+"SOME_GENERATOR(FOO)\n"
+"{2, 2}\n"
+"};",
+Style);
 
   verifyFormat("return GradForUnaryCwise(g, {\n"
"{{\"sign\"}, \"Sign\", {\"x\", 
"

``




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


[llvm-branch-commits] [llvm] be1ad4d - Revert "llvm/lib/CodeGen/TargetSchedule.cpp:132:12: warning: Assert statement…"

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

Author: David Blaikie
Date: 2024-05-04T11:41:26-07:00
New Revision: be1ad4df38e6136cb1bef7d8b9b53a43451771eb

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

LOG: Revert "llvm/lib/CodeGen/TargetSchedule.cpp:132:12: warning: Assert 
statement…"

This reverts commit 18d1df4633c3964e12ec46f3fa92e60ab21842fd.

Added: 


Modified: 
llvm/lib/CodeGen/TargetSchedule.cpp

Removed: 




diff  --git a/llvm/lib/CodeGen/TargetSchedule.cpp 
b/llvm/lib/CodeGen/TargetSchedule.cpp
index b5db2a671f7d04..ce59b096992d8e 100644
--- a/llvm/lib/CodeGen/TargetSchedule.cpp
+++ b/llvm/lib/CodeGen/TargetSchedule.cpp
@@ -129,8 +129,7 @@ resolveSchedClass(const MachineInstr *MI) const {
   unsigned NIter = 0;
 #endif
   while (SCDesc->isVariant()) {
-++NIter;
-assert(NIter < 6 && "Variants are nested deeper than the magic number");
+assert(++NIter < 6 && "Variants are nested deeper than the magic number");
 
 SchedClass = STI->resolveSchedClass(SchedClass, MI, this);
 SCDesc = SchedModel.getSchedClassDesc(SchedClass);



___
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] [InstCombine] Fix miscompile in negation of select (#89698) (PR #91089)

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

https://github.com/AtariDreams created 
https://github.com/llvm/llvm-project/pull/91089

Swapping the operands of a select is not valid if one hand is more poisonous 
that the other, because the negation zero contains poison elements.

Fix this by adding an extra parameter to isKnownNegation() to forbid poison 
elements.

I've implemented this using manual checks to avoid needing four variants for 
the NeedsNSW/AllowPoison combinations. Maybe there is a better way to do this...

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

(cherry picked from commit a1b1c4a6d1d52916c5d885170a5f54632d579cdc)

>From 24a0c2c1923b257160f6afa59778e5ca02b7234f Mon Sep 17 00:00:00 2001
From: Nikita Popov 
Date: Wed, 24 Apr 2024 10:56:26 +0900
Subject: [PATCH] [InstCombine] Fix miscompile in negation of select (#89698)

Swapping the operands of a select is not valid if one hand is more
poisonous that the other, because the negation zero contains poison
elements.

Fix this by adding an extra parameter to isKnownNegation() to forbid
poison elements.

I've implemented this using manual checks to avoid needing four variants
for the NeedsNSW/AllowPoison combinations. Maybe there is a better way
to do this...

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

(cherry picked from commit a1b1c4a6d1d52916c5d885170a5f54632d579cdc)
---
 llvm/include/llvm/Analysis/ValueTracking.h|  3 ++-
 llvm/lib/Analysis/ValueTracking.cpp   | 24 +--
 .../InstCombine/InstCombineNegator.cpp|  3 ++-
 .../InstCombine/sub-of-negatible.ll   | 13 ++
 4 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/llvm/include/llvm/Analysis/ValueTracking.h 
b/llvm/include/llvm/Analysis/ValueTracking.h
index 7360edfce1f39a..a5fa0c8a2c74c8 100644
--- a/llvm/include/llvm/Analysis/ValueTracking.h
+++ b/llvm/include/llvm/Analysis/ValueTracking.h
@@ -134,7 +134,8 @@ bool isKnownNonZero(const Value *V, const DataLayout &DL, 
unsigned Depth = 0,
 /// Currently can recoginze Value pair:
 /// 1:  if X = sub (0, Y) or Y = sub (0, X)
 /// 2:  if X = sub (A, B) and Y = sub (B, A)
-bool isKnownNegation(const Value *X, const Value *Y, bool NeedNSW = false);
+bool isKnownNegation(const Value *X, const Value *Y, bool NeedNSW = false,
+ bool AllowPoison = true);
 
 /// Returns true if the give value is known to be non-negative.
 bool isKnownNonNegative(const Value *V, const SimplifyQuery &SQ,
diff --git a/llvm/lib/Analysis/ValueTracking.cpp 
b/llvm/lib/Analysis/ValueTracking.cpp
index 9f9451e4e814ac..72b1c97d20204d 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -7621,17 +7621,27 @@ static SelectPatternResult 
matchMinMax(CmpInst::Predicate Pred,
   return {SPF_UNKNOWN, SPNB_NA, false};
 }
 
-bool llvm::isKnownNegation(const Value *X, const Value *Y, bool NeedNSW) {
+bool llvm::isKnownNegation(const Value *X, const Value *Y, bool NeedNSW,
+   bool AllowPoison) {
   assert(X && Y && "Invalid operand");
 
-  // X = sub (0, Y) || X = sub nsw (0, Y)
-  if ((!NeedNSW && match(X, m_Sub(m_ZeroInt(), m_Specific(Y ||
-  (NeedNSW && match(X, m_NSWSub(m_ZeroInt(), m_Specific(Y)
+  auto IsNegationOf = [&](const Value *X, const Value *Y) {
+if (!match(X, m_Neg(m_Specific(Y
+  return false;
+
+auto *BO = cast(X);
+if (NeedNSW && !BO->hasNoSignedWrap())
+  return false;
+
+auto *Zero = cast(BO->getOperand(0));
+if (!AllowPoison && !Zero->isNullValue())
+  return false;
+
 return true;
+  };
 
-  // Y = sub (0, X) || Y = sub nsw (0, X)
-  if ((!NeedNSW && match(Y, m_Sub(m_ZeroInt(), m_Specific(X ||
-  (NeedNSW && match(Y, m_NSWSub(m_ZeroInt(), m_Specific(X)
+  // X = -Y or Y = -X
+  if (IsNegationOf(X, Y) || IsNegationOf(Y, X))
 return true;
 
   // X = sub (A, B), Y = sub (B, A) || X = sub nsw (A, B), Y = sub nsw (B, A)
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp 
b/llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
index 62e49469cb0198..beb404bbdc0166 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
@@ -320,7 +320,8 @@ std::array 
Negator::getSortedOperandsOfBinOp(Instruction *I) {
 return NegatedPHI;
   }
   case Instruction::Select: {
-if (isKnownNegation(I->getOperand(1), I->getOperand(2))) {
+if (isKnownNegation(I->getOperand(1), I->getOperand(2), /*NeedNSW=*/false,
+/*AllowPoison=*/false)) {
   // Of one hand of select is known to be negation of another hand,
   // just swap the hands around.
   auto *NewSelect = cast(I->clone());
diff --git a/llvm/test/Transforms/InstCombine/sub-of-negatible.ll 
b/llvm/test/Transforms/InstCombine/sub-of-negatible.ll
index f2a28c0dd02b39..b2e14ceaca1b08 100644
--- a/llvm/test/Transforms/InstCombine/sub-of-negatible.ll
+++ b/llvm/test/Transforms/InstCombine/sub-of-negatible.ll
@

[llvm-branch-commits] [llvm] release/18.x: [InstCombine] Fix miscompile in negation of select (#89698) (PR #91089)

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

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


[llvm-branch-commits] [llvm] release/18.x: [InstCombine] Fix miscompile in negation of select (#89698) (PR #91089)

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

llvmbot wrote:



@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-llvm-analysis

Author: AtariDreams (AtariDreams)


Changes

Swapping the operands of a select is not valid if one hand is more poisonous 
that the other, because the negation zero contains poison elements.

Fix this by adding an extra parameter to isKnownNegation() to forbid poison 
elements.

I've implemented this using manual checks to avoid needing four variants for 
the NeedsNSW/AllowPoison combinations. Maybe there is a better way to do this...

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

(cherry picked from commit a1b1c4a6d1d52916c5d885170a5f54632d579cdc)

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


4 Files Affected:

- (modified) llvm/include/llvm/Analysis/ValueTracking.h (+2-1) 
- (modified) llvm/lib/Analysis/ValueTracking.cpp (+17-7) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp (+2-1) 
- (modified) llvm/test/Transforms/InstCombine/sub-of-negatible.ll (+13) 


``diff
diff --git a/llvm/include/llvm/Analysis/ValueTracking.h 
b/llvm/include/llvm/Analysis/ValueTracking.h
index 7360edfce1f39a..a5fa0c8a2c74c8 100644
--- a/llvm/include/llvm/Analysis/ValueTracking.h
+++ b/llvm/include/llvm/Analysis/ValueTracking.h
@@ -134,7 +134,8 @@ bool isKnownNonZero(const Value *V, const DataLayout &DL, 
unsigned Depth = 0,
 /// Currently can recoginze Value pair:
 /// 1:  if X = sub (0, Y) or Y = sub (0, X)
 /// 2:  if X = sub (A, B) and Y = sub (B, A)
-bool isKnownNegation(const Value *X, const Value *Y, bool NeedNSW = false);
+bool isKnownNegation(const Value *X, const Value *Y, bool NeedNSW = false,
+ bool AllowPoison = true);
 
 /// Returns true if the give value is known to be non-negative.
 bool isKnownNonNegative(const Value *V, const SimplifyQuery &SQ,
diff --git a/llvm/lib/Analysis/ValueTracking.cpp 
b/llvm/lib/Analysis/ValueTracking.cpp
index 9f9451e4e814ac..72b1c97d20204d 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -7621,17 +7621,27 @@ static SelectPatternResult 
matchMinMax(CmpInst::Predicate Pred,
   return {SPF_UNKNOWN, SPNB_NA, false};
 }
 
-bool llvm::isKnownNegation(const Value *X, const Value *Y, bool NeedNSW) {
+bool llvm::isKnownNegation(const Value *X, const Value *Y, bool NeedNSW,
+   bool AllowPoison) {
   assert(X && Y && "Invalid operand");
 
-  // X = sub (0, Y) || X = sub nsw (0, Y)
-  if ((!NeedNSW && match(X, m_Sub(m_ZeroInt(), m_Specific(Y ||
-  (NeedNSW && match(X, m_NSWSub(m_ZeroInt(), m_Specific(Y)
+  auto IsNegationOf = [&](const Value *X, const Value *Y) {
+if (!match(X, m_Neg(m_Specific(Y
+  return false;
+
+auto *BO = cast(X);
+if (NeedNSW && !BO->hasNoSignedWrap())
+  return false;
+
+auto *Zero = cast(BO->getOperand(0));
+if (!AllowPoison && !Zero->isNullValue())
+  return false;
+
 return true;
+  };
 
-  // Y = sub (0, X) || Y = sub nsw (0, X)
-  if ((!NeedNSW && match(Y, m_Sub(m_ZeroInt(), m_Specific(X ||
-  (NeedNSW && match(Y, m_NSWSub(m_ZeroInt(), m_Specific(X)
+  // X = -Y or Y = -X
+  if (IsNegationOf(X, Y) || IsNegationOf(Y, X))
 return true;
 
   // X = sub (A, B), Y = sub (B, A) || X = sub nsw (A, B), Y = sub nsw (B, A)
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp 
b/llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
index 62e49469cb0198..beb404bbdc0166 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
@@ -320,7 +320,8 @@ std::array 
Negator::getSortedOperandsOfBinOp(Instruction *I) {
 return NegatedPHI;
   }
   case Instruction::Select: {
-if (isKnownNegation(I->getOperand(1), I->getOperand(2))) {
+if (isKnownNegation(I->getOperand(1), I->getOperand(2), /*NeedNSW=*/false,
+/*AllowPoison=*/false)) {
   // Of one hand of select is known to be negation of another hand,
   // just swap the hands around.
   auto *NewSelect = cast(I->clone());
diff --git a/llvm/test/Transforms/InstCombine/sub-of-negatible.ll 
b/llvm/test/Transforms/InstCombine/sub-of-negatible.ll
index f2a28c0dd02b39..b2e14ceaca1b08 100644
--- a/llvm/test/Transforms/InstCombine/sub-of-negatible.ll
+++ b/llvm/test/Transforms/InstCombine/sub-of-negatible.ll
@@ -1385,6 +1385,19 @@ define i8 @dont_negate_ordinary_select(i8 %x, i8 %y, i8 
%z, i1 %c) {
   ret i8 %t1
 }
 
+define <2 x i32> @negate_select_of_negation_poison(<2 x i1> %c, <2 x i32> %x) {
+; CHECK-LABEL: @negate_select_of_negation_poison(
+; CHECK-NEXT:[[NEG:%.*]] = sub <2 x i32> , [[X:%.*]]
+; CHECK-NEXT:[[SEL:%.*]] = select <2 x i1> [[C:%.*]], <2 x i32> [[NEG]], 
<2 x i32> [[X]]
+; CHECK-NEXT:[[NEG2:%.*]] = sub <2 x i32> zeroinitializer, [[SEL]]
+; CHECK-NEXT:ret <2 x i32> [[NEG2]]
+;
+  %neg = sub <2 x i32> , %x
+  %sel = select <2 x i1> %c, <2 x i32> %neg, <2 x i32> %x
+  %n

[llvm-branch-commits] [llvm] [LV, LAA] Don't vectorize loops with load and store to invar address. (PR #91092)

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

https://github.com/AtariDreams created 
https://github.com/llvm/llvm-project/pull/91092

Code checking stores to invariant addresses and reductions made an incorrect 
assumption that the case of both a load & store to the same invariant address 
does not need to be handled.

In some cases when vectorizing with runtime checks, there may be dependences 
with a load and store to the same address, storing a reduction value.

Update LAA to separately track if there was a store-store and a load-store 
dependence with an invariant addresses.

Bail out early if there as a load-store dependence with invariant address. If 
there was a store-store one, still apply the logic checking if they all store a 
reduction.

(cherry picked from commit b54a78d69be1952884462cb897abb9cf60a33978)

>From 16d48f16ec520a07a21fcc35a41f3781874ab40f Mon Sep 17 00:00:00 2001
From: Florian Hahn 
Date: Sat, 4 May 2024 20:53:53 +0100
Subject: [PATCH] [LV,LAA] Don't vectorize loops with load and store to invar
 address.

Code checking stores to invariant addresses and reductions made an
incorrect assumption that the case of both a load & store to the same
invariant address does not need to be handled.

In some cases when vectorizing with runtime checks, there may be
dependences with a load and store to the same address, storing a
reduction value.

Update LAA to separately track if there was a store-store and a
load-store dependence with an invariant addresses.

Bail out early if there as a load-store dependence with invariant
address. If there was a store-store one, still apply the logic checking
if they all store a reduction.

(cherry picked from commit b54a78d69be1952884462cb897abb9cf60a33978)
---
 .../llvm/Analysis/LoopAccessAnalysis.h| 28 +++
 llvm/lib/Analysis/LoopAccessAnalysis.cpp  | 14 +---
 .../Vectorize/LoopVectorizationLegality.cpp   | 16 ++---
 .../reduction-with-invariant-store.ll | 34 +++
 4 files changed, 76 insertions(+), 16 deletions(-)

diff --git a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h 
b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
index e39c371b41ec5c..1d67a71f43edde 100644
--- a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
+++ b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
@@ -579,7 +579,11 @@ class LoopAccessInfo {
  AAResults *AA, DominatorTree *DT, LoopInfo *LI);
 
   /// Return true we can analyze the memory accesses in the loop and there are
-  /// no memory dependence cycles.
+  /// no memory dependence cycles. Note that for dependences between loads &
+  /// stores with uniform addresses,
+  /// hasStoreStoreDependenceInvolvingLoopInvariantAddress and
+  /// hasLoadStoreDependenceInvolvingLoopInvariantAddress also need to be
+  /// checked.
   bool canVectorizeMemory() const { return CanVecMem; }
 
   /// Return true if there is a convergent operation in the loop. There may
@@ -632,10 +636,16 @@ class LoopAccessInfo {
   /// Print the information about the memory accesses in the loop.
   void print(raw_ostream &OS, unsigned Depth = 0) const;
 
-  /// If the loop has memory dependence involving an invariant address, i.e. 
two
-  /// stores or a store and a load, then return true, else return false.
-  bool hasDependenceInvolvingLoopInvariantAddress() const {
-return HasDependenceInvolvingLoopInvariantAddress;
+  /// Return true if the loop has memory dependence involving two stores to an
+  /// invariant address, else return false.
+  bool hasStoreStoreDependenceInvolvingLoopInvariantAddress() const {
+return HasStoreStoreDependenceInvolvingLoopInvariantAddress;
+  }
+
+  /// Return true if the loop has memory dependence involving a load and a 
store
+  /// to an invariant address, else return false.
+  bool hasLoadStoreDependenceInvolvingLoopInvariantAddress() const {
+return HasLoadStoreDependenceInvolvingLoopInvariantAddress;
   }
 
   /// Return the list of stores to invariant addresses.
@@ -697,8 +707,12 @@ class LoopAccessInfo {
   bool CanVecMem = false;
   bool HasConvergentOp = false;
 
-  /// Indicator that there are non vectorizable stores to a uniform address.
-  bool HasDependenceInvolvingLoopInvariantAddress = false;
+  /// Indicator that there are two non vectorizable stores to the same uniform
+  /// address.
+  bool HasStoreStoreDependenceInvolvingLoopInvariantAddress = false;
+  /// Indicator that there is non vectorizable load and store to the same
+  /// uniform address.
+  bool HasLoadStoreDependenceInvolvingLoopInvariantAddress = false;
 
   /// List of stores to invariant addresses.
   SmallVector StoresToInvariantAddresses;
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp 
b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index dd6b88fee415a7..fc9e82015e44f2 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -2465,7 +2465,7 @@ void LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo 
*LI,
 if (isInvariant(Ptr)) {
   // Record stor

[llvm-branch-commits] [llvm] [LV, LAA] Don't vectorize loops with load and store to invar address. (PR #91092)

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

llvmbot wrote:



@llvm/pr-subscribers-llvm-analysis

@llvm/pr-subscribers-llvm-transforms

Author: AtariDreams (AtariDreams)


Changes

Code checking stores to invariant addresses and reductions made an incorrect 
assumption that the case of both a load & store to the same invariant 
address does not need to be handled.

In some cases when vectorizing with runtime checks, there may be dependences 
with a load and store to the same address, storing a reduction value.

Update LAA to separately track if there was a store-store and a load-store 
dependence with an invariant addresses.

Bail out early if there as a load-store dependence with invariant address. If 
there was a store-store one, still apply the logic checking if they all store a 
reduction.

(cherry picked from commit b54a78d69be1952884462cb897abb9cf60a33978)

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


4 Files Affected:

- (modified) llvm/include/llvm/Analysis/LoopAccessAnalysis.h (+21-7) 
- (modified) llvm/lib/Analysis/LoopAccessAnalysis.cpp (+9-5) 
- (modified) llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp 
(+12-4) 
- (modified) 
llvm/test/Transforms/LoopVectorize/reduction-with-invariant-store.ll (+34) 


``diff
diff --git a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h 
b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
index e39c371b41ec5c..1d67a71f43edde 100644
--- a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
+++ b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
@@ -579,7 +579,11 @@ class LoopAccessInfo {
  AAResults *AA, DominatorTree *DT, LoopInfo *LI);
 
   /// Return true we can analyze the memory accesses in the loop and there are
-  /// no memory dependence cycles.
+  /// no memory dependence cycles. Note that for dependences between loads &
+  /// stores with uniform addresses,
+  /// hasStoreStoreDependenceInvolvingLoopInvariantAddress and
+  /// hasLoadStoreDependenceInvolvingLoopInvariantAddress also need to be
+  /// checked.
   bool canVectorizeMemory() const { return CanVecMem; }
 
   /// Return true if there is a convergent operation in the loop. There may
@@ -632,10 +636,16 @@ class LoopAccessInfo {
   /// Print the information about the memory accesses in the loop.
   void print(raw_ostream &OS, unsigned Depth = 0) const;
 
-  /// If the loop has memory dependence involving an invariant address, i.e. 
two
-  /// stores or a store and a load, then return true, else return false.
-  bool hasDependenceInvolvingLoopInvariantAddress() const {
-return HasDependenceInvolvingLoopInvariantAddress;
+  /// Return true if the loop has memory dependence involving two stores to an
+  /// invariant address, else return false.
+  bool hasStoreStoreDependenceInvolvingLoopInvariantAddress() const {
+return HasStoreStoreDependenceInvolvingLoopInvariantAddress;
+  }
+
+  /// Return true if the loop has memory dependence involving a load and a 
store
+  /// to an invariant address, else return false.
+  bool hasLoadStoreDependenceInvolvingLoopInvariantAddress() const {
+return HasLoadStoreDependenceInvolvingLoopInvariantAddress;
   }
 
   /// Return the list of stores to invariant addresses.
@@ -697,8 +707,12 @@ class LoopAccessInfo {
   bool CanVecMem = false;
   bool HasConvergentOp = false;
 
-  /// Indicator that there are non vectorizable stores to a uniform address.
-  bool HasDependenceInvolvingLoopInvariantAddress = false;
+  /// Indicator that there are two non vectorizable stores to the same uniform
+  /// address.
+  bool HasStoreStoreDependenceInvolvingLoopInvariantAddress = false;
+  /// Indicator that there is non vectorizable load and store to the same
+  /// uniform address.
+  bool HasLoadStoreDependenceInvolvingLoopInvariantAddress = false;
 
   /// List of stores to invariant addresses.
   SmallVector StoresToInvariantAddresses;
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp 
b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index dd6b88fee415a7..fc9e82015e44f2 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -2465,7 +2465,7 @@ void LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo 
*LI,
 if (isInvariant(Ptr)) {
   // Record store instructions to loop invariant addresses
   StoresToInvariantAddresses.push_back(ST);
-  HasDependenceInvolvingLoopInvariantAddress |=
+  HasStoreStoreDependenceInvolvingLoopInvariantAddress |=
   !UniformStores.insert(Ptr).second;
 }
 
@@ -2521,7 +2521,7 @@ void LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo 
*LI,
 if (UniformStores.count(Ptr)) {
   LLVM_DEBUG(dbgs() << "LAA: Found an unsafe dependency between a uniform "
"load and uniform store to the same address!\n");
-  HasDependenceInvolvingLoopInvariantAddress = true;
+  HasLoadStoreDependenceInvolvingLoopInvariantAddress = true;
 }
 
 MemoryLocation Loc = MemoryLocation::get(LD);
@@ -2985,9 +2985,13 @@ void LoopAcces

[llvm-branch-commits] [BOLT][BAT] Fix translate for branches added by BOLT (PR #90811)

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

https://github.com/aaupov converted_to_draft 
https://github.com/llvm/llvm-project/pull/90811
___
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] Bump version to 18.1.6 (PR #91094)

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

https://github.com/tstellar created 
https://github.com/llvm/llvm-project/pull/91094

None

>From b71b9cfce7f3e5dce0cf1856df95cfe8d16252f1 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 4 May 2024 21:56:44 +
Subject: [PATCH] Bump version to 18.1.6

---
 llvm/CMakeLists.txt| 2 +-
 llvm/utils/lit/lit/__init__.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index f82be164ac9c48..26b7b01bb1f8de 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -22,7 +22,7 @@ if(NOT DEFINED LLVM_VERSION_MINOR)
   set(LLVM_VERSION_MINOR 1)
 endif()
 if(NOT DEFINED LLVM_VERSION_PATCH)
-  set(LLVM_VERSION_PATCH 5)
+  set(LLVM_VERSION_PATCH 6)
 endif()
 if(NOT DEFINED LLVM_VERSION_SUFFIX)
   set(LLVM_VERSION_SUFFIX)
diff --git a/llvm/utils/lit/lit/__init__.py b/llvm/utils/lit/lit/__init__.py
index 1cfcc7d37813bc..d8b0e3bd1c69e3 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__ = (18, 1, 5)
+__versioninfo__ = (18, 1, 6)
 __version__ = ".".join(str(v) for v in __versioninfo__) + "dev"
 
 __all__ = []

___
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] Bump version to 18.1.6 (PR #91094)

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

llvmbot wrote:




@llvm/pr-subscribers-testing-tools

Author: Tom Stellard (tstellar)


Changes



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


2 Files Affected:

- (modified) llvm/CMakeLists.txt (+1-1) 
- (modified) llvm/utils/lit/lit/__init__.py (+1-1) 


``diff
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index f82be164ac9c48..26b7b01bb1f8de 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -22,7 +22,7 @@ if(NOT DEFINED LLVM_VERSION_MINOR)
   set(LLVM_VERSION_MINOR 1)
 endif()
 if(NOT DEFINED LLVM_VERSION_PATCH)
-  set(LLVM_VERSION_PATCH 5)
+  set(LLVM_VERSION_PATCH 6)
 endif()
 if(NOT DEFINED LLVM_VERSION_SUFFIX)
   set(LLVM_VERSION_SUFFIX)
diff --git a/llvm/utils/lit/lit/__init__.py b/llvm/utils/lit/lit/__init__.py
index 1cfcc7d37813bc..d8b0e3bd1c69e3 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__ = (18, 1, 5)
+__versioninfo__ = (18, 1, 6)
 __version__ = ".".join(str(v) for v in __versioninfo__) + "dev"
 
 __all__ = []

``




https://github.com/llvm/llvm-project/pull/91094
___
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] [llvm] Backport some fixes for building the release binaries (PR #91095)

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

https://github.com/tstellar created 
https://github.com/llvm/llvm-project/pull/91095

None

>From b71b9cfce7f3e5dce0cf1856df95cfe8d16252f1 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 4 May 2024 21:56:44 +
Subject: [PATCH 1/4] Bump version to 18.1.6

---
 llvm/CMakeLists.txt| 2 +-
 llvm/utils/lit/lit/__init__.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index f82be164ac9c48..26b7b01bb1f8de 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -22,7 +22,7 @@ if(NOT DEFINED LLVM_VERSION_MINOR)
   set(LLVM_VERSION_MINOR 1)
 endif()
 if(NOT DEFINED LLVM_VERSION_PATCH)
-  set(LLVM_VERSION_PATCH 5)
+  set(LLVM_VERSION_PATCH 6)
 endif()
 if(NOT DEFINED LLVM_VERSION_SUFFIX)
   set(LLVM_VERSION_SUFFIX)
diff --git a/llvm/utils/lit/lit/__init__.py b/llvm/utils/lit/lit/__init__.py
index 1cfcc7d37813bc..d8b0e3bd1c69e3 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__ = (18, 1, 5)
+__versioninfo__ = (18, 1, 6)
 __version__ = ".".join(str(v) for v in __versioninfo__) + "dev"
 
 __all__ = []

>From dc6392e374ef8367e98b996569f3bb2898bcb99a Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Wed, 24 Apr 2024 07:47:42 -0700
Subject: [PATCH 2/4] [CMake][Release] Add stage2-package target (#89517)

This target will be used to generate the release binary package for
uploading to GitHub.

(cherry picked from commit a38f201f1ec70c2b1f3cf46e7f291c53bb16753e)
---
 clang/cmake/caches/Release.cmake | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/cmake/caches/Release.cmake b/clang/cmake/caches/Release.cmake
index bd1f688d61a7ea..fa972636553f1f 100644
--- a/clang/cmake/caches/Release.cmake
+++ b/clang/cmake/caches/Release.cmake
@@ -14,6 +14,7 @@ if (LLVM_RELEASE_ENABLE_PGO)
   set(CLANG_BOOTSTRAP_TARGETS
 generate-profdata
 stage2
+stage2-package
 stage2-clang
 stage2-distribution
 stage2-install
@@ -57,6 +58,7 @@ set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
 set(BOOTSTRAP_CLANG_ENABLE_BOOTSTRAP ON CACHE STRING "")
 set(BOOTSTRAP_CLANG_BOOTSTRAP_TARGETS
   clang
+  package
   check-all
   check-llvm
   check-clang CACHE STRING "")

>From 89f6c6ed99e27397e1d4ac8a0cf2e7d3cf11bccd Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Thu, 25 Apr 2024 15:32:08 -0700
Subject: [PATCH 3/4] [CMake][Release] Refactor cache file and use two stages
 for non-PGO builds (#89812)

Completely refactor the cache file to simplify it and remove unnecessary
variables. The main functional change here is that the non-PGO builds
now use two stages, so `ninja -C build stage2-package` can be used with
both PGO and non-PGO builds.

(cherry picked from commit 6473fbf2d68c8486d168f29afc35d3e8a6fabe69)
---
 clang/cmake/caches/Release.cmake | 134 +++
 1 file changed, 66 insertions(+), 68 deletions(-)

diff --git a/clang/cmake/caches/Release.cmake b/clang/cmake/caches/Release.cmake
index fa972636553f1f..c164d5497275f3 100644
--- a/clang/cmake/caches/Release.cmake
+++ b/clang/cmake/caches/Release.cmake
@@ -1,95 +1,93 @@
 # Plain options configure the first build.
 # BOOTSTRAP_* options configure the second build.
 # BOOTSTRAP_BOOTSTRAP_* options configure the third build.
+# PGO Builds have 3 stages (stage1, stage2-instrumented, stage2)
+# non-PGO Builds have 2 stages (stage1, stage2)
 
-# General Options
+
+function (set_final_stage_var name value type)
+  if (LLVM_RELEASE_ENABLE_PGO)
+set(BOOTSTRAP_BOOTSTRAP_${name} ${value} CACHE ${type} "")
+  else()
+set(BOOTSTRAP_${name} ${value} CACHE ${type} "")
+  endif()
+endfunction()
+
+function (set_instrument_and_final_stage_var name value type)
+  # This sets the varaible for the final stage in non-PGO builds and in
+  # the stage2-instrumented stage for PGO builds.
+  set(BOOTSTRAP_${name} ${value} CACHE ${type} "")
+  if (LLVM_RELEASE_ENABLE_PGO)
+# Set the variable in the final stage for PGO builds.
+set(BOOTSTRAP_BOOTSTRAP_${name} ${value} CACHE ${type} "")
+  endif()
+endfunction()
+
+# General Options:
+# If you want to override any of the LLVM_RELEASE_* variables you can set them
+# on the command line via -D, but you need to do this before you pass this
+# cache file to CMake via -C. e.g.
+#
+# cmake -D LLVM_RELEASE_ENABLE_PGO=ON -C Release.cmake
 set(LLVM_RELEASE_ENABLE_LTO THIN CACHE STRING "")
 set(LLVM_RELEASE_ENABLE_PGO OFF CACHE BOOL "")
-
+set(LLVM_RELEASE_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" 
CACHE STRING "")
+set(LLVM_RELEASE_ENABLE_PROJECTS 
"clang;lld;lldb;clang-tools-extra;bolt;polly;mlir;flang" CACHE STRING "")
+# Note we don't need to add install here, since it is one of the pre-defined
+# steps.
+set(LLVM_RELEASE_FINAL_STAGE_TARGETS 
"clang;package;check-all;check-llvm;check-clang" CACHE STRING "")
 set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
 
-# Stage 1 Bo

[llvm-branch-commits] [clang] [llvm] Backport some fixes for building the release binaries (PR #91095)

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

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Tom Stellard (tstellar)


Changes



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


4 Files Affected:

- (modified) clang/cmake/caches/Release.cmake (+68-67) 
- (modified) llvm/CMakeLists.txt (+1-1) 
- (modified) llvm/utils/lit/lit/__init__.py (+1-1) 
- (modified) llvm/utils/release/test-release.sh (+1-2) 


``diff
diff --git a/clang/cmake/caches/Release.cmake b/clang/cmake/caches/Release.cmake
index bd1f688d61a7ea..c0bfcbdfc1c2ae 100644
--- a/clang/cmake/caches/Release.cmake
+++ b/clang/cmake/caches/Release.cmake
@@ -1,93 +1,94 @@
 # Plain options configure the first build.
 # BOOTSTRAP_* options configure the second build.
 # BOOTSTRAP_BOOTSTRAP_* options configure the third build.
+# PGO Builds have 3 stages (stage1, stage2-instrumented, stage2)
+# non-PGO Builds have 2 stages (stage1, stage2)
 
-# General Options
+
+function (set_final_stage_var name value type)
+  if (LLVM_RELEASE_ENABLE_PGO)
+set(BOOTSTRAP_BOOTSTRAP_${name} ${value} CACHE ${type} "")
+  else()
+set(BOOTSTRAP_${name} ${value} CACHE ${type} "")
+  endif()
+endfunction()
+
+function (set_instrument_and_final_stage_var name value type)
+  # This sets the varaible for the final stage in non-PGO builds and in
+  # the stage2-instrumented stage for PGO builds.
+  set(BOOTSTRAP_${name} ${value} CACHE ${type} "")
+  if (LLVM_RELEASE_ENABLE_PGO)
+# Set the variable in the final stage for PGO builds.
+set(BOOTSTRAP_BOOTSTRAP_${name} ${value} CACHE ${type} "")
+  endif()
+endfunction()
+
+# General Options:
+# If you want to override any of the LLVM_RELEASE_* variables you can set them
+# on the command line via -D, but you need to do this before you pass this
+# cache file to CMake via -C. e.g.
+#
+# cmake -D LLVM_RELEASE_ENABLE_PGO=ON -C Release.cmake
 set(LLVM_RELEASE_ENABLE_LTO THIN CACHE STRING "")
 set(LLVM_RELEASE_ENABLE_PGO OFF CACHE BOOL "")
-
+set(LLVM_RELEASE_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" 
CACHE STRING "")
+set(LLVM_RELEASE_ENABLE_PROJECTS 
"clang;lld;lldb;clang-tools-extra;bolt;polly;mlir;flang" CACHE STRING "")
+# Note we don't need to add install here, since it is one of the pre-defined
+# steps.
+set(LLVM_RELEASE_FINAL_STAGE_TARGETS 
"clang;package;check-all;check-llvm;check-clang" CACHE STRING "")
 set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
 
-# Stage 1 Bootstrap Setup
+# Stage 1 Options
+set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
 set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+
+set(STAGE1_PROJECTS "clang")
+set(STAGE1_RUNTIMES "")
+
 if (LLVM_RELEASE_ENABLE_PGO)
+  list(APPEND STAGE1_PROJECTS "lld")
+  list(APPEND STAGE1_RUNTIMES "compiler-rt")
   set(CLANG_BOOTSTRAP_TARGETS
 generate-profdata
-stage2
+stage2-package
 stage2-clang
-stage2-distribution
 stage2-install
-stage2-install-distribution
-stage2-install-distribution-toolchain
 stage2-check-all
 stage2-check-llvm
-stage2-check-clang
-stage2-test-suite CACHE STRING "")
-else()
-  set(CLANG_BOOTSTRAP_TARGETS
-clang
-check-all
-check-llvm
-check-clang
-test-suite
-stage3
-stage3-clang
-stage3-check-all
-stage3-check-llvm
-stage3-check-clang
-stage3-install
-stage3-test-suite CACHE STRING "")
-endif()
+stage2-check-clang CACHE STRING "")
 
-# Stage 1 Options
-set(STAGE1_PROJECTS "clang")
-set(STAGE1_RUNTIMES "")
+  # Configuration for stage2-instrumented
+  set(BOOTSTRAP_CLANG_ENABLE_BOOTSTRAP ON CACHE STRING "")
+  # This enables the build targets for the final stage which is called stage2.
+  set(BOOTSTRAP_CLANG_BOOTSTRAP_TARGETS ${LLVM_RELEASE_FINAL_STAGE_TARGETS} 
CACHE STRING "")
+  set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED IR CACHE STRING "")
+  set(BOOTSTRAP_LLVM_ENABLE_RUNTIMES "compiler-rt" CACHE STRING "")
+  set(BOOTSTRAP_LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "")
 
-if (LLVM_RELEASE_ENABLE_PGO)
-  list(APPEND STAGE1_PROJECTS "lld")
-  list(APPEND STAGE1_RUNTIMES "compiler-rt")
+else()
+  if (LLVM_RELEASE_ENABLE_LTO)
+list(APPEND STAGE1_PROJECTS "lld")
+  endif()
+  # Any targets added here will be given the target name stage2-${target}, so
+  # if you want to run them you can just use:
+  # ninja -C $BUILDDIR stage2-${target}
+  set(CLANG_BOOTSTRAP_TARGETS ${LLVM_RELEASE_FINAL_STAGE_TARGETS} CACHE STRING 
"")
 endif()
 
+# Stage 1 Common Config
 set(LLVM_ENABLE_RUNTIMES ${STAGE1_RUNTIMES} CACHE STRING "")
 set(LLVM_ENABLE_PROJECTS ${STAGE1_PROJECTS} CACHE STRING "")
 
-set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
-
-# Stage 2 Bootstrap Setup
-set(BOOTSTRAP_CLANG_ENABLE_BOOTSTRAP ON CACHE STRING "")
-set(BOOTSTRAP_CLANG_BOOTSTRAP_TARGETS
-  clang
-  check-all
-  check-llvm
-  check-clang CACHE STRING "")
-
-# Stage 2 Options
-set(STAGE2_PROJECTS "clang")
-set(STAGE2_RUNTIMES "")
-
-if (LLVM_RELEASE_ENABLE_LTO OR LLVM_RELEASE_ENABLE_PGO)
- list(APPEND STAGE2_PROJECTS "lld")
-endif()
-
-if (LLVM_RELEASE_ENABLE_PGO)
-  s

[llvm-branch-commits] [clang] [llvm] Backport some fixes for building the release binaries (PR #91095)

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

llvmbot wrote:




@llvm/pr-subscribers-testing-tools

Author: Tom Stellard (tstellar)


Changes



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


4 Files Affected:

- (modified) clang/cmake/caches/Release.cmake (+68-67) 
- (modified) llvm/CMakeLists.txt (+1-1) 
- (modified) llvm/utils/lit/lit/__init__.py (+1-1) 
- (modified) llvm/utils/release/test-release.sh (+1-2) 


``diff
diff --git a/clang/cmake/caches/Release.cmake b/clang/cmake/caches/Release.cmake
index bd1f688d61a7ea..c0bfcbdfc1c2ae 100644
--- a/clang/cmake/caches/Release.cmake
+++ b/clang/cmake/caches/Release.cmake
@@ -1,93 +1,94 @@
 # Plain options configure the first build.
 # BOOTSTRAP_* options configure the second build.
 # BOOTSTRAP_BOOTSTRAP_* options configure the third build.
+# PGO Builds have 3 stages (stage1, stage2-instrumented, stage2)
+# non-PGO Builds have 2 stages (stage1, stage2)
 
-# General Options
+
+function (set_final_stage_var name value type)
+  if (LLVM_RELEASE_ENABLE_PGO)
+set(BOOTSTRAP_BOOTSTRAP_${name} ${value} CACHE ${type} "")
+  else()
+set(BOOTSTRAP_${name} ${value} CACHE ${type} "")
+  endif()
+endfunction()
+
+function (set_instrument_and_final_stage_var name value type)
+  # This sets the varaible for the final stage in non-PGO builds and in
+  # the stage2-instrumented stage for PGO builds.
+  set(BOOTSTRAP_${name} ${value} CACHE ${type} "")
+  if (LLVM_RELEASE_ENABLE_PGO)
+# Set the variable in the final stage for PGO builds.
+set(BOOTSTRAP_BOOTSTRAP_${name} ${value} CACHE ${type} "")
+  endif()
+endfunction()
+
+# General Options:
+# If you want to override any of the LLVM_RELEASE_* variables you can set them
+# on the command line via -D, but you need to do this before you pass this
+# cache file to CMake via -C. e.g.
+#
+# cmake -D LLVM_RELEASE_ENABLE_PGO=ON -C Release.cmake
 set(LLVM_RELEASE_ENABLE_LTO THIN CACHE STRING "")
 set(LLVM_RELEASE_ENABLE_PGO OFF CACHE BOOL "")
-
+set(LLVM_RELEASE_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" 
CACHE STRING "")
+set(LLVM_RELEASE_ENABLE_PROJECTS 
"clang;lld;lldb;clang-tools-extra;bolt;polly;mlir;flang" CACHE STRING "")
+# Note we don't need to add install here, since it is one of the pre-defined
+# steps.
+set(LLVM_RELEASE_FINAL_STAGE_TARGETS 
"clang;package;check-all;check-llvm;check-clang" CACHE STRING "")
 set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
 
-# Stage 1 Bootstrap Setup
+# Stage 1 Options
+set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
 set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+
+set(STAGE1_PROJECTS "clang")
+set(STAGE1_RUNTIMES "")
+
 if (LLVM_RELEASE_ENABLE_PGO)
+  list(APPEND STAGE1_PROJECTS "lld")
+  list(APPEND STAGE1_RUNTIMES "compiler-rt")
   set(CLANG_BOOTSTRAP_TARGETS
 generate-profdata
-stage2
+stage2-package
 stage2-clang
-stage2-distribution
 stage2-install
-stage2-install-distribution
-stage2-install-distribution-toolchain
 stage2-check-all
 stage2-check-llvm
-stage2-check-clang
-stage2-test-suite CACHE STRING "")
-else()
-  set(CLANG_BOOTSTRAP_TARGETS
-clang
-check-all
-check-llvm
-check-clang
-test-suite
-stage3
-stage3-clang
-stage3-check-all
-stage3-check-llvm
-stage3-check-clang
-stage3-install
-stage3-test-suite CACHE STRING "")
-endif()
+stage2-check-clang CACHE STRING "")
 
-# Stage 1 Options
-set(STAGE1_PROJECTS "clang")
-set(STAGE1_RUNTIMES "")
+  # Configuration for stage2-instrumented
+  set(BOOTSTRAP_CLANG_ENABLE_BOOTSTRAP ON CACHE STRING "")
+  # This enables the build targets for the final stage which is called stage2.
+  set(BOOTSTRAP_CLANG_BOOTSTRAP_TARGETS ${LLVM_RELEASE_FINAL_STAGE_TARGETS} 
CACHE STRING "")
+  set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED IR CACHE STRING "")
+  set(BOOTSTRAP_LLVM_ENABLE_RUNTIMES "compiler-rt" CACHE STRING "")
+  set(BOOTSTRAP_LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "")
 
-if (LLVM_RELEASE_ENABLE_PGO)
-  list(APPEND STAGE1_PROJECTS "lld")
-  list(APPEND STAGE1_RUNTIMES "compiler-rt")
+else()
+  if (LLVM_RELEASE_ENABLE_LTO)
+list(APPEND STAGE1_PROJECTS "lld")
+  endif()
+  # Any targets added here will be given the target name stage2-${target}, so
+  # if you want to run them you can just use:
+  # ninja -C $BUILDDIR stage2-${target}
+  set(CLANG_BOOTSTRAP_TARGETS ${LLVM_RELEASE_FINAL_STAGE_TARGETS} CACHE STRING 
"")
 endif()
 
+# Stage 1 Common Config
 set(LLVM_ENABLE_RUNTIMES ${STAGE1_RUNTIMES} CACHE STRING "")
 set(LLVM_ENABLE_PROJECTS ${STAGE1_PROJECTS} CACHE STRING "")
 
-set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
-
-# Stage 2 Bootstrap Setup
-set(BOOTSTRAP_CLANG_ENABLE_BOOTSTRAP ON CACHE STRING "")
-set(BOOTSTRAP_CLANG_BOOTSTRAP_TARGETS
-  clang
-  check-all
-  check-llvm
-  check-clang CACHE STRING "")
-
-# Stage 2 Options
-set(STAGE2_PROJECTS "clang")
-set(STAGE2_RUNTIMES "")
-
-if (LLVM_RELEASE_ENABLE_LTO OR LLVM_RELEASE_ENABLE_PGO)
- list(APPEND STAGE2_PROJECTS "lld")
-endif()
-
-if (LLVM_RELEASE_ENABLE_P

[llvm-branch-commits] [clang] [llvm] Backport some fixes for building the release binaries (PR #91095)

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

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

>From b71b9cfce7f3e5dce0cf1856df95cfe8d16252f1 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 4 May 2024 21:56:44 +
Subject: [PATCH 1/8] Bump version to 18.1.6

---
 llvm/CMakeLists.txt| 2 +-
 llvm/utils/lit/lit/__init__.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index f82be164ac9c48..26b7b01bb1f8de 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -22,7 +22,7 @@ if(NOT DEFINED LLVM_VERSION_MINOR)
   set(LLVM_VERSION_MINOR 1)
 endif()
 if(NOT DEFINED LLVM_VERSION_PATCH)
-  set(LLVM_VERSION_PATCH 5)
+  set(LLVM_VERSION_PATCH 6)
 endif()
 if(NOT DEFINED LLVM_VERSION_SUFFIX)
   set(LLVM_VERSION_SUFFIX)
diff --git a/llvm/utils/lit/lit/__init__.py b/llvm/utils/lit/lit/__init__.py
index 1cfcc7d37813bc..d8b0e3bd1c69e3 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__ = (18, 1, 5)
+__versioninfo__ = (18, 1, 6)
 __version__ = ".".join(str(v) for v in __versioninfo__) + "dev"
 
 __all__ = []

>From dc6392e374ef8367e98b996569f3bb2898bcb99a Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Wed, 24 Apr 2024 07:47:42 -0700
Subject: [PATCH 2/8] [CMake][Release] Add stage2-package target (#89517)

This target will be used to generate the release binary package for
uploading to GitHub.

(cherry picked from commit a38f201f1ec70c2b1f3cf46e7f291c53bb16753e)
---
 clang/cmake/caches/Release.cmake | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/cmake/caches/Release.cmake b/clang/cmake/caches/Release.cmake
index bd1f688d61a7ea..fa972636553f1f 100644
--- a/clang/cmake/caches/Release.cmake
+++ b/clang/cmake/caches/Release.cmake
@@ -14,6 +14,7 @@ if (LLVM_RELEASE_ENABLE_PGO)
   set(CLANG_BOOTSTRAP_TARGETS
 generate-profdata
 stage2
+stage2-package
 stage2-clang
 stage2-distribution
 stage2-install
@@ -57,6 +58,7 @@ set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
 set(BOOTSTRAP_CLANG_ENABLE_BOOTSTRAP ON CACHE STRING "")
 set(BOOTSTRAP_CLANG_BOOTSTRAP_TARGETS
   clang
+  package
   check-all
   check-llvm
   check-clang CACHE STRING "")

>From 89f6c6ed99e27397e1d4ac8a0cf2e7d3cf11bccd Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Thu, 25 Apr 2024 15:32:08 -0700
Subject: [PATCH 3/8] [CMake][Release] Refactor cache file and use two stages
 for non-PGO builds (#89812)

Completely refactor the cache file to simplify it and remove unnecessary
variables. The main functional change here is that the non-PGO builds
now use two stages, so `ninja -C build stage2-package` can be used with
both PGO and non-PGO builds.

(cherry picked from commit 6473fbf2d68c8486d168f29afc35d3e8a6fabe69)
---
 clang/cmake/caches/Release.cmake | 134 +++
 1 file changed, 66 insertions(+), 68 deletions(-)

diff --git a/clang/cmake/caches/Release.cmake b/clang/cmake/caches/Release.cmake
index fa972636553f1f..c164d5497275f3 100644
--- a/clang/cmake/caches/Release.cmake
+++ b/clang/cmake/caches/Release.cmake
@@ -1,95 +1,93 @@
 # Plain options configure the first build.
 # BOOTSTRAP_* options configure the second build.
 # BOOTSTRAP_BOOTSTRAP_* options configure the third build.
+# PGO Builds have 3 stages (stage1, stage2-instrumented, stage2)
+# non-PGO Builds have 2 stages (stage1, stage2)
 
-# General Options
+
+function (set_final_stage_var name value type)
+  if (LLVM_RELEASE_ENABLE_PGO)
+set(BOOTSTRAP_BOOTSTRAP_${name} ${value} CACHE ${type} "")
+  else()
+set(BOOTSTRAP_${name} ${value} CACHE ${type} "")
+  endif()
+endfunction()
+
+function (set_instrument_and_final_stage_var name value type)
+  # This sets the varaible for the final stage in non-PGO builds and in
+  # the stage2-instrumented stage for PGO builds.
+  set(BOOTSTRAP_${name} ${value} CACHE ${type} "")
+  if (LLVM_RELEASE_ENABLE_PGO)
+# Set the variable in the final stage for PGO builds.
+set(BOOTSTRAP_BOOTSTRAP_${name} ${value} CACHE ${type} "")
+  endif()
+endfunction()
+
+# General Options:
+# If you want to override any of the LLVM_RELEASE_* variables you can set them
+# on the command line via -D, but you need to do this before you pass this
+# cache file to CMake via -C. e.g.
+#
+# cmake -D LLVM_RELEASE_ENABLE_PGO=ON -C Release.cmake
 set(LLVM_RELEASE_ENABLE_LTO THIN CACHE STRING "")
 set(LLVM_RELEASE_ENABLE_PGO OFF CACHE BOOL "")
-
+set(LLVM_RELEASE_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" 
CACHE STRING "")
+set(LLVM_RELEASE_ENABLE_PROJECTS 
"clang;lld;lldb;clang-tools-extra;bolt;polly;mlir;flang" CACHE STRING "")
+# Note we don't need to add install here, since it is one of the pre-defined
+# steps.
+set(LLVM_RELEASE_FINAL_STAGE_TARGETS 
"clang;package;check-all;check-llvm;check-clang" CACHE STRING "")
 set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
 
-# Stage 1 Bootstra

[llvm-branch-commits] [llvm] [workflows] Fix libclang-abi-tests to work with new version scheme (PR #91096)

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

https://github.com/tstellar created 
https://github.com/llvm/llvm-project/pull/91096

None

>From 19cb0cd2e2e499b46593d4708f0beaab671586bd Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 4 May 2024 23:10:21 +
Subject: [PATCH] [workflows] Fix libclang-abi-tests to work with new version
 scheme

---
 .github/workflows/libclang-abi-tests.yml | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/libclang-abi-tests.yml 
b/.github/workflows/libclang-abi-tests.yml
index ccfc1e5fb8a742..14da910e667ea1 100644
--- a/.github/workflows/libclang-abi-tests.yml
+++ b/.github/workflows/libclang-abi-tests.yml
@@ -51,9 +51,10 @@ jobs:
 id: vars
 run: |
   remote_repo='https://github.com/llvm/llvm-project'
-  if [ ${{ steps.version.outputs.LLVM_VERSION_MINOR }} -ne 0 ] || [ 
${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
+  echo "BASELINE_VERSION_MINOR=1" >> "$GITHUB_OUTPUT"
+  if [ ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
 major_version=$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} 
- 1))
-baseline_ref="llvmorg-$major_version.0.0"
+baseline_ref="llvmorg-$major_version.1.0"
 
 # If there is a minor release, we want to use that as the base 
line.
 minor_ref=$(git ls-remote --refs -t "$remote_repo" 
llvmorg-"$major_version".[1-9].[0-9] | tail -n1 | grep -o 'llvmorg-.\+' || true)
@@ -75,7 +76,7 @@ jobs:
   else
 {
   echo "BASELINE_VERSION_MAJOR=${{ 
steps.version.outputs.LLVM_VERSION_MAJOR }}"
-  echo "BASELINE_REF=llvmorg-${{ 
steps.version.outputs.LLVM_VERSION_MAJOR }}.0.0"
+  echo "BASELINE_REF=llvmorg-${{ 
steps.version.outputs.LLVM_VERSION_MAJOR }}.1.0"
   echo "ABI_HEADERS=."
   echo "ABI_LIBS=libclang.so libclang-cpp.so"
 } >> "$GITHUB_OUTPUT"

___
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] [workflows] Fix libclang-abi-tests to work with new version scheme (PR #91096)

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

llvmbot wrote:




@llvm/pr-subscribers-github-workflow

Author: Tom Stellard (tstellar)


Changes



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


1 Files Affected:

- (modified) .github/workflows/libclang-abi-tests.yml (+4-3) 


``diff
diff --git a/.github/workflows/libclang-abi-tests.yml 
b/.github/workflows/libclang-abi-tests.yml
index ccfc1e5fb8a742..14da910e667ea1 100644
--- a/.github/workflows/libclang-abi-tests.yml
+++ b/.github/workflows/libclang-abi-tests.yml
@@ -51,9 +51,10 @@ jobs:
 id: vars
 run: |
   remote_repo='https://github.com/llvm/llvm-project'
-  if [ ${{ steps.version.outputs.LLVM_VERSION_MINOR }} -ne 0 ] || [ 
${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
+  echo "BASELINE_VERSION_MINOR=1" >> "$GITHUB_OUTPUT"
+  if [ ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
 major_version=$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} 
- 1))
-baseline_ref="llvmorg-$major_version.0.0"
+baseline_ref="llvmorg-$major_version.1.0"
 
 # If there is a minor release, we want to use that as the base 
line.
 minor_ref=$(git ls-remote --refs -t "$remote_repo" 
llvmorg-"$major_version".[1-9].[0-9] | tail -n1 | grep -o 'llvmorg-.\+' || true)
@@ -75,7 +76,7 @@ jobs:
   else
 {
   echo "BASELINE_VERSION_MAJOR=${{ 
steps.version.outputs.LLVM_VERSION_MAJOR }}"
-  echo "BASELINE_REF=llvmorg-${{ 
steps.version.outputs.LLVM_VERSION_MAJOR }}.0.0"
+  echo "BASELINE_REF=llvmorg-${{ 
steps.version.outputs.LLVM_VERSION_MAJOR }}.1.0"
   echo "ABI_HEADERS=."
   echo "ABI_LIBS=libclang.so libclang-cpp.so"
 } >> "$GITHUB_OUTPUT"

``




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


[llvm-branch-commits] [llvm] release/18.x: [LV, LAA] Don't vectorize loops with load and store to invar address. (PR #91092)

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

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


[llvm-branch-commits] [llvm] release/18.x: [InstCombine] Fix miscompile in negation of select (#89698) (PR #91089)

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

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


[llvm-branch-commits] [llvm] release/18.x: [InstCombine] Fix miscompile in negation of select (#89698) (PR #91089)

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

https://github.com/AtariDreams reopened 
https://github.com/llvm/llvm-project/pull/91089
___
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] [workflows] Fix libclang-abi-tests to work with new version scheme (PR #91096)

2024-05-04 Thread Aiden Grossman via llvm-branch-commits

https://github.com/boomanaiden154 commented:

Given this only runs on the release branches, this patch should probably land 
in `main` as well?

https://github.com/llvm/llvm-project/pull/91096
___
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] [llvm] Backport some fixes for building the release binaries (PR #91095)

2024-05-04 Thread Aiden Grossman via llvm-branch-commits


@@ -22,7 +22,7 @@ if(NOT DEFINED LLVM_VERSION_MINOR)
   set(LLVM_VERSION_MINOR 1)
 endif()
 if(NOT DEFINED LLVM_VERSION_PATCH)
-  set(LLVM_VERSION_PATCH 5)
+  set(LLVM_VERSION_PATCH 6)

boomanaiden154 wrote:

Is this supposed to be included in this PR?

https://github.com/llvm/llvm-project/pull/91095
___
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] [llvm] Backport some fixes for building the release binaries (PR #91095)

2024-05-04 Thread Aiden Grossman via llvm-branch-commits

https://github.com/boomanaiden154 edited 
https://github.com/llvm/llvm-project/pull/91095
___
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] [llvm] Backport some fixes for building the release binaries (PR #91095)

2024-05-04 Thread Aiden Grossman via llvm-branch-commits

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

Seems reasonable enough to me.

https://github.com/llvm/llvm-project/pull/91095
___
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] [llvm] Backport some fixes for building the release binaries (PR #91095)

2024-05-04 Thread Aiden Grossman via llvm-branch-commits


@@ -2,7 +2,7 @@
 
 __author__ = "Daniel Dunbar"
 __email__ = "dan...@minormatter.com"
-__versioninfo__ = (18, 1, 5)
+__versioninfo__ = (18, 1, 6)

boomanaiden154 wrote:

Ditto here?

https://github.com/llvm/llvm-project/pull/91095
___
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] 8e87d82 - Revert "SystemZ: Fold copy of vector immediate to gr128 (#90706)"

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

Author: Vitaly Buka
Date: 2024-05-04T18:46:55-07:00
New Revision: 8e87d82f9c5f5e436c582f7f652ad96945ddf339

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

LOG: Revert "SystemZ: Fold copy of vector immediate to gr128 (#90706)"

This reverts commit 49c5f4d56a89278fcc426cabbeeec33e0915980e.

Added: 


Modified: 
llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
llvm/lib/Target/SystemZ/SystemZInstrInfo.h

Removed: 
llvm/test/CodeGen/SystemZ/fold-copy-vector-immediate.mir



diff  --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp 
b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
index 0d1aab89c5de89e..c18d4e7aa73e114 100644
--- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
@@ -640,51 +640,6 @@ bool SystemZInstrInfo::foldImmediate(MachineInstr &UseMI, 
MachineInstr &DefMI,
  Register Reg,
  MachineRegisterInfo *MRI) const {
   unsigned DefOpc = DefMI.getOpcode();
-
-  if (DefOpc == SystemZ::VGBM) {
-int64_t ImmVal = DefMI.getOperand(1).getImm();
-if (ImmVal != 0) // TODO: Handle other values
-  return false;
-
-// Fold gr128 = COPY (vr128 VGBM imm)
-//
-// %tmp:gr64 = LGHI 0
-// to  gr128 = REG_SEQUENCE %tmp, %tmp
-assert(DefMI.getOperand(0).getReg() == Reg);
-
-if (!UseMI.isCopy())
-  return false;
-
-Register CopyDstReg = UseMI.getOperand(0).getReg();
-if (CopyDstReg.isVirtual() &&
-MRI->getRegClass(CopyDstReg) == &SystemZ::GR128BitRegClass &&
-MRI->hasOneNonDBGUse(Reg)) {
-  // TODO: Handle physical registers
-  // TODO: Handle gr64 uses with subregister indexes
-  // TODO: Should this multi-use cases?
-  Register TmpReg = MRI->createVirtualRegister(&SystemZ::GR64BitRegClass);
-  MachineBasicBlock &MBB = *UseMI.getParent();
-
-  // FIXME: probably should be DefMI's DebugLoc but this matches
-  // loadImmediate's guessing
-  const DebugLoc &DL = UseMI.getDebugLoc();
-
-  loadImmediate(MBB, UseMI.getIterator(), TmpReg, ImmVal);
-
-  BuildMI(MBB, UseMI.getIterator(), DL, get(SystemZ::REG_SEQUENCE),
-  CopyDstReg)
-  .addReg(TmpReg)
-  .addImm(SystemZ::subreg_h64)
-  .addReg(TmpReg)
-  .addImm(SystemZ::subreg_l64);
-
-  UseMI.eraseFromParent();
-  return true;
-}
-
-return false;
-  }
-
   if (DefOpc != SystemZ::LHIMux && DefOpc != SystemZ::LHI &&
   DefOpc != SystemZ::LGHI)
 return false;
@@ -2282,16 +2237,3 @@ areMemAccessesTriviallyDisjoint(const MachineInstr &MIa,
 
   return false;
 }
-
-bool SystemZInstrInfo::getConstValDefinedInReg(const MachineInstr &MI,
-   const Register Reg,
-   int64_t &ImmVal) const {
-
-  if (MI.getOpcode() == SystemZ::VGBM && Reg == MI.getOperand(0).getReg()) {
-ImmVal = MI.getOperand(1).getImm();
-// TODO: Handle non-0 values
-return ImmVal == 0;
-  }
-
-  return false;
-}

diff  --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.h 
b/llvm/lib/Target/SystemZ/SystemZInstrInfo.h
index 61338b0816155ab..aa10fb56496231f 100644
--- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.h
+++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.h
@@ -383,9 +383,6 @@ class SystemZInstrInfo : public SystemZGenInstrInfo {
   bool
   areMemAccessesTriviallyDisjoint(const MachineInstr &MIa,
   const MachineInstr &MIb) const override;
-
-  bool getConstValDefinedInReg(const MachineInstr &MI, const Register Reg,
-   int64_t &ImmVal) const override;
 };
 
 } // end namespace llvm

diff  --git a/llvm/test/CodeGen/SystemZ/fold-copy-vector-immediate.mir 
b/llvm/test/CodeGen/SystemZ/fold-copy-vector-immediate.mir
deleted file mode 100644
index 2aee0cb521c4c8f..000
--- a/llvm/test/CodeGen/SystemZ/fold-copy-vector-immediate.mir
+++ /dev/null
@@ -1,182 +0,0 @@
-# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 
UTC_ARGS: --version 4
-# RUN: llc -mtriple=s390x-linux-gnu -mcpu=z13 -run-pass=peephole-opt -o - %s | 
FileCheck %s
-

-name:fold_vgbm_0_copyvr128_to_gr128_virtreg
-tracksRegLiveness: true
-body: |
-  bb.0:
-  liveins: $r2d
-; CHECK-LABEL: name: fold_vgbm_0_copyvr128_to_gr128_virtreg
-; CHECK: liveins: $r2d
-; CHECK-NEXT: {{  $}}
-; CHECK-NEXT: [[COPY:%[0-9]+]]:gr64bit = COPY $r2d
-; CHECK-NEXT: [[COPY1:%[0-9]+]]:addr64bit = COPY [[COPY]]
-; CHECK-NEXT: [[VGBM:%[0-9]+]]:vr128bit = VGBM 0
-; CHECK-NEXT: [[LGHI:%[0-9]+]]:gr64bit = LGHI 0
-; CHECK-NEXT: [[REG_SEQUENCE:%[0-9]+]]:gr128bit = REG_SEQUENCE [[LGHI]], 
%subreg.subreg_h64, [[LGHI]], 

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

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

aemerson wrote:

@tstellar It looks like this cherry-pick has a test failure, what's the 
recommended way to resolve this? Make a new PR or modify this one (if that's 
possible?)

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