[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-08 Thread Paul Kirth via llvm-branch-commits

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

>From 788f58b302f20a000db3a9741e54cc861c9dcb88 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 1 Jul 2024 10:13:23 -0700
Subject: [PATCH] Fix mismerge

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 70 ---
 lld/test/ELF/riscv-attributes.s   |  4 +-
 llvm/include/llvm/Support/RISCVAttributes.h   |  4 +-
 .../MCTargetDesc/RISCVTargetStreamer.cpp  | 15 ++--
 4 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1d9be92601006..0d0ab5de9acc1 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1088,65 +1088,51 @@ static void mergeAtomic(DenseMap::iterator it,
 const InputSectionBase *oldSection,
 const InputSectionBase *newSection, unsigned int 
oldTag,
 unsigned int newTag) {
-  using RISCVAttrs::RISCVAtomicAbiTag;
+  using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
   // Same tags stay the same, and UNKNOWN is compatible with anything
-  if (oldTag == newTag ||
-  newTag == static_cast(RISCVAtomicAbiTag::UNKNOWN))
+  if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
 return;
 
-  auto reportAbiError = [&]() {
-errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
-toString(oldSection) + ": atomic_abi=" + Twine(oldTag) +
-"\n>>> " + toString(newSection) +
-": atomic_abi=" + Twine(newTag));
-  };
-
-  switch (static_cast(oldTag)) {
-  case RISCVAtomicAbiTag::UNKNOWN:
+  switch (oldTag) {
+  case AtomicABI::UNKNOWN:
 it->getSecond() = newTag;
 return;
-  case RISCVAtomicAbiTag::A6C:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6C:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  reportAbiError();
+case AtomicABI::A7:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6C:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A6S:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6C:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6S:
+switch (newTag) {
+case AtomicABI::A6C:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+case AtomicABI::A7:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6S:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A7:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+  case AtomicABI::A7:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAtomicAbiTag::A6C:
-  reportAbiError();
+case AtomicABI::A6C:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A7:
-  break;
 };
+  default:
+llvm_unreachable("unknown AtomicABI");
   };
-  llvm_unreachable("unknown AtomicABI");
 }
 
 static RISCVAttributesSection *
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 38b0fe8e7797e..91321f33297aa 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -48,9 +48,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6C.s -o 
atomic_abi_A6C.o
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A7.s -o 
atomic_abi_A7.o
 # RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | 
FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error:
-# ATOMIC_ABI_ERROR: error: atomic abi mismatch for .riscv.attributes
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A6C.o:(.riscv.attributes): atomic_abi=1
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A7.o:(.riscv.attributes): atomic_abi=3
+# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has 
atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3
 
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6S.s -o 
atomic_abi_A6S.o
 # RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S
diff --git 

[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-08 Thread Paul Kirth via llvm-branch-commits

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

>From 788f58b302f20a000db3a9741e54cc861c9dcb88 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 1 Jul 2024 10:13:23 -0700
Subject: [PATCH] Fix mismerge

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 70 ---
 lld/test/ELF/riscv-attributes.s   |  4 +-
 llvm/include/llvm/Support/RISCVAttributes.h   |  4 +-
 .../MCTargetDesc/RISCVTargetStreamer.cpp  | 15 ++--
 4 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1d9be926010066..0d0ab5de9acc17 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1088,65 +1088,51 @@ static void mergeAtomic(DenseMap::iterator it,
 const InputSectionBase *oldSection,
 const InputSectionBase *newSection, unsigned int 
oldTag,
 unsigned int newTag) {
-  using RISCVAttrs::RISCVAtomicAbiTag;
+  using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
   // Same tags stay the same, and UNKNOWN is compatible with anything
-  if (oldTag == newTag ||
-  newTag == static_cast(RISCVAtomicAbiTag::UNKNOWN))
+  if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
 return;
 
-  auto reportAbiError = [&]() {
-errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
-toString(oldSection) + ": atomic_abi=" + Twine(oldTag) +
-"\n>>> " + toString(newSection) +
-": atomic_abi=" + Twine(newTag));
-  };
-
-  switch (static_cast(oldTag)) {
-  case RISCVAtomicAbiTag::UNKNOWN:
+  switch (oldTag) {
+  case AtomicABI::UNKNOWN:
 it->getSecond() = newTag;
 return;
-  case RISCVAtomicAbiTag::A6C:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6C:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  reportAbiError();
+case AtomicABI::A7:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6C:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A6S:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6C:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6S:
+switch (newTag) {
+case AtomicABI::A6C:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+case AtomicABI::A7:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6S:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A7:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+  case AtomicABI::A7:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAtomicAbiTag::A6C:
-  reportAbiError();
+case AtomicABI::A6C:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A7:
-  break;
 };
+  default:
+llvm_unreachable("unknown AtomicABI");
   };
-  llvm_unreachable("unknown AtomicABI");
 }
 
 static RISCVAttributesSection *
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 38b0fe8e7797e2..91321f33297aa9 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -48,9 +48,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6C.s -o 
atomic_abi_A6C.o
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A7.s -o 
atomic_abi_A7.o
 # RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | 
FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error:
-# ATOMIC_ABI_ERROR: error: atomic abi mismatch for .riscv.attributes
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A6C.o:(.riscv.attributes): atomic_abi=1
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A7.o:(.riscv.attributes): atomic_abi=3
+# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has 
atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3
 
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6S.s -o 
atomic_abi_A6S.o
 # RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S
diff --git 

[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-03 Thread Fangrui Song via llvm-branch-commits

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


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


[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-02 Thread Paul Kirth via llvm-branch-commits

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

>From 788f58b302f20a000db3a9741e54cc861c9dcb88 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 1 Jul 2024 10:13:23 -0700
Subject: [PATCH] Fix mismerge

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 70 ---
 lld/test/ELF/riscv-attributes.s   |  4 +-
 llvm/include/llvm/Support/RISCVAttributes.h   |  4 +-
 .../MCTargetDesc/RISCVTargetStreamer.cpp  | 15 ++--
 4 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1d9be92601006..0d0ab5de9acc1 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1088,65 +1088,51 @@ static void mergeAtomic(DenseMap::iterator it,
 const InputSectionBase *oldSection,
 const InputSectionBase *newSection, unsigned int 
oldTag,
 unsigned int newTag) {
-  using RISCVAttrs::RISCVAtomicAbiTag;
+  using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
   // Same tags stay the same, and UNKNOWN is compatible with anything
-  if (oldTag == newTag ||
-  newTag == static_cast(RISCVAtomicAbiTag::UNKNOWN))
+  if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
 return;
 
-  auto reportAbiError = [&]() {
-errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
-toString(oldSection) + ": atomic_abi=" + Twine(oldTag) +
-"\n>>> " + toString(newSection) +
-": atomic_abi=" + Twine(newTag));
-  };
-
-  switch (static_cast(oldTag)) {
-  case RISCVAtomicAbiTag::UNKNOWN:
+  switch (oldTag) {
+  case AtomicABI::UNKNOWN:
 it->getSecond() = newTag;
 return;
-  case RISCVAtomicAbiTag::A6C:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6C:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  reportAbiError();
+case AtomicABI::A7:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6C:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A6S:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6C:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6S:
+switch (newTag) {
+case AtomicABI::A6C:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+case AtomicABI::A7:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6S:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A7:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+  case AtomicABI::A7:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAtomicAbiTag::A6C:
-  reportAbiError();
+case AtomicABI::A6C:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A7:
-  break;
 };
+  default:
+llvm_unreachable("unknown AtomicABI");
   };
-  llvm_unreachable("unknown AtomicABI");
 }
 
 static RISCVAttributesSection *
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 38b0fe8e7797e..91321f33297aa 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -48,9 +48,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6C.s -o 
atomic_abi_A6C.o
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A7.s -o 
atomic_abi_A7.o
 # RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | 
FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error:
-# ATOMIC_ABI_ERROR: error: atomic abi mismatch for .riscv.attributes
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A6C.o:(.riscv.attributes): atomic_abi=1
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A7.o:(.riscv.attributes): atomic_abi=3
+# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has 
atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3
 
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6S.s -o 
atomic_abi_A6S.o
 # RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S
diff --git 

[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-02 Thread Paul Kirth via llvm-branch-commits

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

>From 788f58b302f20a000db3a9741e54cc861c9dcb88 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 1 Jul 2024 10:13:23 -0700
Subject: [PATCH] Fix mismerge

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 70 ---
 lld/test/ELF/riscv-attributes.s   |  4 +-
 llvm/include/llvm/Support/RISCVAttributes.h   |  4 +-
 .../MCTargetDesc/RISCVTargetStreamer.cpp  | 15 ++--
 4 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1d9be92601006..0d0ab5de9acc1 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1088,65 +1088,51 @@ static void mergeAtomic(DenseMap::iterator it,
 const InputSectionBase *oldSection,
 const InputSectionBase *newSection, unsigned int 
oldTag,
 unsigned int newTag) {
-  using RISCVAttrs::RISCVAtomicAbiTag;
+  using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
   // Same tags stay the same, and UNKNOWN is compatible with anything
-  if (oldTag == newTag ||
-  newTag == static_cast(RISCVAtomicAbiTag::UNKNOWN))
+  if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
 return;
 
-  auto reportAbiError = [&]() {
-errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
-toString(oldSection) + ": atomic_abi=" + Twine(oldTag) +
-"\n>>> " + toString(newSection) +
-": atomic_abi=" + Twine(newTag));
-  };
-
-  switch (static_cast(oldTag)) {
-  case RISCVAtomicAbiTag::UNKNOWN:
+  switch (oldTag) {
+  case AtomicABI::UNKNOWN:
 it->getSecond() = newTag;
 return;
-  case RISCVAtomicAbiTag::A6C:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6C:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  reportAbiError();
+case AtomicABI::A7:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6C:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A6S:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6C:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6S:
+switch (newTag) {
+case AtomicABI::A6C:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+case AtomicABI::A7:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6S:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A7:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+  case AtomicABI::A7:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAtomicAbiTag::A6C:
-  reportAbiError();
+case AtomicABI::A6C:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A7:
-  break;
 };
+  default:
+llvm_unreachable("unknown AtomicABI");
   };
-  llvm_unreachable("unknown AtomicABI");
 }
 
 static RISCVAttributesSection *
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 38b0fe8e7797e..91321f33297aa 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -48,9 +48,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6C.s -o 
atomic_abi_A6C.o
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A7.s -o 
atomic_abi_A7.o
 # RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | 
FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error:
-# ATOMIC_ABI_ERROR: error: atomic abi mismatch for .riscv.attributes
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A6C.o:(.riscv.attributes): atomic_abi=1
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A7.o:(.riscv.attributes): atomic_abi=3
+# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has 
atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3
 
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6S.s -o 
atomic_abi_A6S.o
 # RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S
diff --git 

[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-01 Thread Paul Kirth via llvm-branch-commits

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

>From 788f58b302f20a000db3a9741e54cc861c9dcb88 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 1 Jul 2024 10:13:23 -0700
Subject: [PATCH] Fix mismerge

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 70 ---
 lld/test/ELF/riscv-attributes.s   |  4 +-
 llvm/include/llvm/Support/RISCVAttributes.h   |  4 +-
 .../MCTargetDesc/RISCVTargetStreamer.cpp  | 15 ++--
 4 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1d9be92601006..0d0ab5de9acc1 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1088,65 +1088,51 @@ static void mergeAtomic(DenseMap::iterator it,
 const InputSectionBase *oldSection,
 const InputSectionBase *newSection, unsigned int 
oldTag,
 unsigned int newTag) {
-  using RISCVAttrs::RISCVAtomicAbiTag;
+  using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
   // Same tags stay the same, and UNKNOWN is compatible with anything
-  if (oldTag == newTag ||
-  newTag == static_cast(RISCVAtomicAbiTag::UNKNOWN))
+  if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
 return;
 
-  auto reportAbiError = [&]() {
-errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
-toString(oldSection) + ": atomic_abi=" + Twine(oldTag) +
-"\n>>> " + toString(newSection) +
-": atomic_abi=" + Twine(newTag));
-  };
-
-  switch (static_cast(oldTag)) {
-  case RISCVAtomicAbiTag::UNKNOWN:
+  switch (oldTag) {
+  case AtomicABI::UNKNOWN:
 it->getSecond() = newTag;
 return;
-  case RISCVAtomicAbiTag::A6C:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6C:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  reportAbiError();
+case AtomicABI::A7:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6C:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A6S:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6C:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6S:
+switch (newTag) {
+case AtomicABI::A6C:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+case AtomicABI::A7:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6S:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A7:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+  case AtomicABI::A7:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAtomicAbiTag::A6C:
-  reportAbiError();
+case AtomicABI::A6C:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A7:
-  break;
 };
+  default:
+llvm_unreachable("unknown AtomicABI");
   };
-  llvm_unreachable("unknown AtomicABI");
 }
 
 static RISCVAttributesSection *
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 38b0fe8e7797e..91321f33297aa 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -48,9 +48,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6C.s -o 
atomic_abi_A6C.o
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A7.s -o 
atomic_abi_A7.o
 # RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | 
FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error:
-# ATOMIC_ABI_ERROR: error: atomic abi mismatch for .riscv.attributes
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A6C.o:(.riscv.attributes): atomic_abi=1
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A7.o:(.riscv.attributes): atomic_abi=3
+# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has 
atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3
 
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6S.s -o 
atomic_abi_A6S.o
 # RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S
diff --git 

[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-01 Thread Paul Kirth via llvm-branch-commits

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

>From 788f58b302f20a000db3a9741e54cc861c9dcb88 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 1 Jul 2024 10:13:23 -0700
Subject: [PATCH] Fix mismerge

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 70 ---
 lld/test/ELF/riscv-attributes.s   |  4 +-
 llvm/include/llvm/Support/RISCVAttributes.h   |  4 +-
 .../MCTargetDesc/RISCVTargetStreamer.cpp  | 15 ++--
 4 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1d9be92601006..0d0ab5de9acc1 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1088,65 +1088,51 @@ static void mergeAtomic(DenseMap::iterator it,
 const InputSectionBase *oldSection,
 const InputSectionBase *newSection, unsigned int 
oldTag,
 unsigned int newTag) {
-  using RISCVAttrs::RISCVAtomicAbiTag;
+  using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
   // Same tags stay the same, and UNKNOWN is compatible with anything
-  if (oldTag == newTag ||
-  newTag == static_cast(RISCVAtomicAbiTag::UNKNOWN))
+  if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
 return;
 
-  auto reportAbiError = [&]() {
-errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
-toString(oldSection) + ": atomic_abi=" + Twine(oldTag) +
-"\n>>> " + toString(newSection) +
-": atomic_abi=" + Twine(newTag));
-  };
-
-  switch (static_cast(oldTag)) {
-  case RISCVAtomicAbiTag::UNKNOWN:
+  switch (oldTag) {
+  case AtomicABI::UNKNOWN:
 it->getSecond() = newTag;
 return;
-  case RISCVAtomicAbiTag::A6C:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6C:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  reportAbiError();
+case AtomicABI::A7:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6C:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A6S:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6C:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6S:
+switch (newTag) {
+case AtomicABI::A6C:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+case AtomicABI::A7:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6S:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A7:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+  case AtomicABI::A7:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAtomicAbiTag::A6C:
-  reportAbiError();
+case AtomicABI::A6C:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A7:
-  break;
 };
+  default:
+llvm_unreachable("unknown AtomicABI");
   };
-  llvm_unreachable("unknown AtomicABI");
 }
 
 static RISCVAttributesSection *
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 38b0fe8e7797e..91321f33297aa 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -48,9 +48,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6C.s -o 
atomic_abi_A6C.o
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A7.s -o 
atomic_abi_A7.o
 # RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | 
FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error:
-# ATOMIC_ABI_ERROR: error: atomic abi mismatch for .riscv.attributes
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A6C.o:(.riscv.attributes): atomic_abi=1
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A7.o:(.riscv.attributes): atomic_abi=3
+# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has 
atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3
 
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6S.s -o 
atomic_abi_A6S.o
 # RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S
diff --git 

[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-01 Thread Paul Kirth via llvm-branch-commits

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

>From 788f58b302f20a000db3a9741e54cc861c9dcb88 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 1 Jul 2024 10:13:23 -0700
Subject: [PATCH] Fix mismerge

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 70 ---
 lld/test/ELF/riscv-attributes.s   |  4 +-
 llvm/include/llvm/Support/RISCVAttributes.h   |  4 +-
 .../MCTargetDesc/RISCVTargetStreamer.cpp  | 15 ++--
 4 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1d9be92601006..0d0ab5de9acc1 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1088,65 +1088,51 @@ static void mergeAtomic(DenseMap::iterator it,
 const InputSectionBase *oldSection,
 const InputSectionBase *newSection, unsigned int 
oldTag,
 unsigned int newTag) {
-  using RISCVAttrs::RISCVAtomicAbiTag;
+  using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
   // Same tags stay the same, and UNKNOWN is compatible with anything
-  if (oldTag == newTag ||
-  newTag == static_cast(RISCVAtomicAbiTag::UNKNOWN))
+  if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
 return;
 
-  auto reportAbiError = [&]() {
-errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
-toString(oldSection) + ": atomic_abi=" + Twine(oldTag) +
-"\n>>> " + toString(newSection) +
-": atomic_abi=" + Twine(newTag));
-  };
-
-  switch (static_cast(oldTag)) {
-  case RISCVAtomicAbiTag::UNKNOWN:
+  switch (oldTag) {
+  case AtomicABI::UNKNOWN:
 it->getSecond() = newTag;
 return;
-  case RISCVAtomicAbiTag::A6C:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6C:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  reportAbiError();
+case AtomicABI::A7:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6C:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A6S:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6C:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6S:
+switch (newTag) {
+case AtomicABI::A6C:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+case AtomicABI::A7:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6S:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A7:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+  case AtomicABI::A7:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAtomicAbiTag::A6C:
-  reportAbiError();
+case AtomicABI::A6C:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A7:
-  break;
 };
+  default:
+llvm_unreachable("unknown AtomicABI");
   };
-  llvm_unreachable("unknown AtomicABI");
 }
 
 static RISCVAttributesSection *
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 38b0fe8e7797e..91321f33297aa 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -48,9 +48,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6C.s -o 
atomic_abi_A6C.o
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A7.s -o 
atomic_abi_A7.o
 # RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | 
FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error:
-# ATOMIC_ABI_ERROR: error: atomic abi mismatch for .riscv.attributes
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A6C.o:(.riscv.attributes): atomic_abi=1
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A7.o:(.riscv.attributes): atomic_abi=3
+# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has 
atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3
 
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6S.s -o 
atomic_abi_A6S.o
 # RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S
diff --git 

[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-01 Thread Paul Kirth via llvm-branch-commits

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

>From 788f58b302f20a000db3a9741e54cc861c9dcb88 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 1 Jul 2024 10:13:23 -0700
Subject: [PATCH] Fix mismerge

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 70 ---
 lld/test/ELF/riscv-attributes.s   |  4 +-
 llvm/include/llvm/Support/RISCVAttributes.h   |  4 +-
 .../MCTargetDesc/RISCVTargetStreamer.cpp  | 15 ++--
 4 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1d9be92601006..0d0ab5de9acc1 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1088,65 +1088,51 @@ static void mergeAtomic(DenseMap::iterator it,
 const InputSectionBase *oldSection,
 const InputSectionBase *newSection, unsigned int 
oldTag,
 unsigned int newTag) {
-  using RISCVAttrs::RISCVAtomicAbiTag;
+  using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
   // Same tags stay the same, and UNKNOWN is compatible with anything
-  if (oldTag == newTag ||
-  newTag == static_cast(RISCVAtomicAbiTag::UNKNOWN))
+  if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
 return;
 
-  auto reportAbiError = [&]() {
-errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
-toString(oldSection) + ": atomic_abi=" + Twine(oldTag) +
-"\n>>> " + toString(newSection) +
-": atomic_abi=" + Twine(newTag));
-  };
-
-  switch (static_cast(oldTag)) {
-  case RISCVAtomicAbiTag::UNKNOWN:
+  switch (oldTag) {
+  case AtomicABI::UNKNOWN:
 it->getSecond() = newTag;
 return;
-  case RISCVAtomicAbiTag::A6C:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6C:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  reportAbiError();
+case AtomicABI::A7:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6C:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A6S:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6C:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6S:
+switch (newTag) {
+case AtomicABI::A6C:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+case AtomicABI::A7:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6S:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A7:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+  case AtomicABI::A7:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAtomicAbiTag::A6C:
-  reportAbiError();
+case AtomicABI::A6C:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A7:
-  break;
 };
+  default:
+llvm_unreachable("unknown AtomicABI");
   };
-  llvm_unreachable("unknown AtomicABI");
 }
 
 static RISCVAttributesSection *
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 38b0fe8e7797e..91321f33297aa 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -48,9 +48,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6C.s -o 
atomic_abi_A6C.o
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A7.s -o 
atomic_abi_A7.o
 # RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | 
FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error:
-# ATOMIC_ABI_ERROR: error: atomic abi mismatch for .riscv.attributes
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A6C.o:(.riscv.attributes): atomic_abi=1
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A7.o:(.riscv.attributes): atomic_abi=3
+# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has 
atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3
 
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6S.s -o 
atomic_abi_A6S.o
 # RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S
diff --git 

[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-01 Thread Paul Kirth via llvm-branch-commits

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

>From 788f58b302f20a000db3a9741e54cc861c9dcb88 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 1 Jul 2024 10:13:23 -0700
Subject: [PATCH] Fix mismerge

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 70 ---
 lld/test/ELF/riscv-attributes.s   |  4 +-
 llvm/include/llvm/Support/RISCVAttributes.h   |  4 +-
 .../MCTargetDesc/RISCVTargetStreamer.cpp  | 15 ++--
 4 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1d9be92601006..0d0ab5de9acc1 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1088,65 +1088,51 @@ static void mergeAtomic(DenseMap::iterator it,
 const InputSectionBase *oldSection,
 const InputSectionBase *newSection, unsigned int 
oldTag,
 unsigned int newTag) {
-  using RISCVAttrs::RISCVAtomicAbiTag;
+  using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
   // Same tags stay the same, and UNKNOWN is compatible with anything
-  if (oldTag == newTag ||
-  newTag == static_cast(RISCVAtomicAbiTag::UNKNOWN))
+  if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
 return;
 
-  auto reportAbiError = [&]() {
-errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
-toString(oldSection) + ": atomic_abi=" + Twine(oldTag) +
-"\n>>> " + toString(newSection) +
-": atomic_abi=" + Twine(newTag));
-  };
-
-  switch (static_cast(oldTag)) {
-  case RISCVAtomicAbiTag::UNKNOWN:
+  switch (oldTag) {
+  case AtomicABI::UNKNOWN:
 it->getSecond() = newTag;
 return;
-  case RISCVAtomicAbiTag::A6C:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6C:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  reportAbiError();
+case AtomicABI::A7:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6C:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A6S:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6C:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6S:
+switch (newTag) {
+case AtomicABI::A6C:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+case AtomicABI::A7:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6S:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A7:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+  case AtomicABI::A7:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAtomicAbiTag::A6C:
-  reportAbiError();
+case AtomicABI::A6C:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A7:
-  break;
 };
+  default:
+llvm_unreachable("unknown AtomicABI");
   };
-  llvm_unreachable("unknown AtomicABI");
 }
 
 static RISCVAttributesSection *
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 38b0fe8e7797e..91321f33297aa 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -48,9 +48,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6C.s -o 
atomic_abi_A6C.o
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A7.s -o 
atomic_abi_A7.o
 # RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | 
FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error:
-# ATOMIC_ABI_ERROR: error: atomic abi mismatch for .riscv.attributes
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A6C.o:(.riscv.attributes): atomic_abi=1
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A7.o:(.riscv.attributes): atomic_abi=3
+# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has 
atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3
 
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6S.s -o 
atomic_abi_A6S.o
 # RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S
diff --git 

[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-01 Thread Paul Kirth via llvm-branch-commits

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

>From 788f58b302f20a000db3a9741e54cc861c9dcb88 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 1 Jul 2024 10:13:23 -0700
Subject: [PATCH] Fix mismerge

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 70 ---
 lld/test/ELF/riscv-attributes.s   |  4 +-
 llvm/include/llvm/Support/RISCVAttributes.h   |  4 +-
 .../MCTargetDesc/RISCVTargetStreamer.cpp  | 15 ++--
 4 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1d9be92601006..0d0ab5de9acc1 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1088,65 +1088,51 @@ static void mergeAtomic(DenseMap::iterator it,
 const InputSectionBase *oldSection,
 const InputSectionBase *newSection, unsigned int 
oldTag,
 unsigned int newTag) {
-  using RISCVAttrs::RISCVAtomicAbiTag;
+  using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
   // Same tags stay the same, and UNKNOWN is compatible with anything
-  if (oldTag == newTag ||
-  newTag == static_cast(RISCVAtomicAbiTag::UNKNOWN))
+  if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
 return;
 
-  auto reportAbiError = [&]() {
-errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
-toString(oldSection) + ": atomic_abi=" + Twine(oldTag) +
-"\n>>> " + toString(newSection) +
-": atomic_abi=" + Twine(newTag));
-  };
-
-  switch (static_cast(oldTag)) {
-  case RISCVAtomicAbiTag::UNKNOWN:
+  switch (oldTag) {
+  case AtomicABI::UNKNOWN:
 it->getSecond() = newTag;
 return;
-  case RISCVAtomicAbiTag::A6C:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6C:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  reportAbiError();
+case AtomicABI::A7:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6C:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A6S:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6C:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6S:
+switch (newTag) {
+case AtomicABI::A6C:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+case AtomicABI::A7:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6S:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A7:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+  case AtomicABI::A7:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAtomicAbiTag::A6C:
-  reportAbiError();
+case AtomicABI::A6C:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A7:
-  break;
 };
+  default:
+llvm_unreachable("unknown AtomicABI");
   };
-  llvm_unreachable("unknown AtomicABI");
 }
 
 static RISCVAttributesSection *
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 38b0fe8e7797e..91321f33297aa 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -48,9 +48,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6C.s -o 
atomic_abi_A6C.o
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A7.s -o 
atomic_abi_A7.o
 # RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | 
FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error:
-# ATOMIC_ABI_ERROR: error: atomic abi mismatch for .riscv.attributes
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A6C.o:(.riscv.attributes): atomic_abi=1
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A7.o:(.riscv.attributes): atomic_abi=3
+# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has 
atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3
 
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6S.s -o 
atomic_abi_A6S.o
 # RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S
diff --git 

[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-01 Thread Paul Kirth via llvm-branch-commits

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

>From 788f58b302f20a000db3a9741e54cc861c9dcb88 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 1 Jul 2024 10:13:23 -0700
Subject: [PATCH] Fix mismerge

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 70 ---
 lld/test/ELF/riscv-attributes.s   |  4 +-
 llvm/include/llvm/Support/RISCVAttributes.h   |  4 +-
 .../MCTargetDesc/RISCVTargetStreamer.cpp  | 15 ++--
 4 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1d9be92601006..0d0ab5de9acc1 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1088,65 +1088,51 @@ static void mergeAtomic(DenseMap::iterator it,
 const InputSectionBase *oldSection,
 const InputSectionBase *newSection, unsigned int 
oldTag,
 unsigned int newTag) {
-  using RISCVAttrs::RISCVAtomicAbiTag;
+  using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
   // Same tags stay the same, and UNKNOWN is compatible with anything
-  if (oldTag == newTag ||
-  newTag == static_cast(RISCVAtomicAbiTag::UNKNOWN))
+  if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
 return;
 
-  auto reportAbiError = [&]() {
-errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
-toString(oldSection) + ": atomic_abi=" + Twine(oldTag) +
-"\n>>> " + toString(newSection) +
-": atomic_abi=" + Twine(newTag));
-  };
-
-  switch (static_cast(oldTag)) {
-  case RISCVAtomicAbiTag::UNKNOWN:
+  switch (oldTag) {
+  case AtomicABI::UNKNOWN:
 it->getSecond() = newTag;
 return;
-  case RISCVAtomicAbiTag::A6C:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6C:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  reportAbiError();
+case AtomicABI::A7:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6C:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A6S:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6C:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6S:
+switch (newTag) {
+case AtomicABI::A6C:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+case AtomicABI::A7:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6S:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A7:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+  case AtomicABI::A7:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAtomicAbiTag::A6C:
-  reportAbiError();
+case AtomicABI::A6C:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A7:
-  break;
 };
+  default:
+llvm_unreachable("unknown AtomicABI");
   };
-  llvm_unreachable("unknown AtomicABI");
 }
 
 static RISCVAttributesSection *
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 38b0fe8e7797e..91321f33297aa 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -48,9 +48,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6C.s -o 
atomic_abi_A6C.o
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A7.s -o 
atomic_abi_A7.o
 # RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | 
FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error:
-# ATOMIC_ABI_ERROR: error: atomic abi mismatch for .riscv.attributes
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A6C.o:(.riscv.attributes): atomic_abi=1
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A7.o:(.riscv.attributes): atomic_abi=3
+# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has 
atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3
 
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6S.s -o 
atomic_abi_A6S.o
 # RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S
diff --git 

[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-01 Thread Paul Kirth via llvm-branch-commits

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

>From 788f58b302f20a000db3a9741e54cc861c9dcb88 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 1 Jul 2024 10:13:23 -0700
Subject: [PATCH] Fix mismerge

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 70 ---
 lld/test/ELF/riscv-attributes.s   |  4 +-
 llvm/include/llvm/Support/RISCVAttributes.h   |  4 +-
 .../MCTargetDesc/RISCVTargetStreamer.cpp  | 15 ++--
 4 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1d9be92601006..0d0ab5de9acc1 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1088,65 +1088,51 @@ static void mergeAtomic(DenseMap::iterator it,
 const InputSectionBase *oldSection,
 const InputSectionBase *newSection, unsigned int 
oldTag,
 unsigned int newTag) {
-  using RISCVAttrs::RISCVAtomicAbiTag;
+  using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
   // Same tags stay the same, and UNKNOWN is compatible with anything
-  if (oldTag == newTag ||
-  newTag == static_cast(RISCVAtomicAbiTag::UNKNOWN))
+  if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
 return;
 
-  auto reportAbiError = [&]() {
-errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
-toString(oldSection) + ": atomic_abi=" + Twine(oldTag) +
-"\n>>> " + toString(newSection) +
-": atomic_abi=" + Twine(newTag));
-  };
-
-  switch (static_cast(oldTag)) {
-  case RISCVAtomicAbiTag::UNKNOWN:
+  switch (oldTag) {
+  case AtomicABI::UNKNOWN:
 it->getSecond() = newTag;
 return;
-  case RISCVAtomicAbiTag::A6C:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6C:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  reportAbiError();
+case AtomicABI::A7:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6C:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A6S:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6C:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6S:
+switch (newTag) {
+case AtomicABI::A6C:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+case AtomicABI::A7:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6S:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A7:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+  case AtomicABI::A7:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAtomicAbiTag::A6C:
-  reportAbiError();
+case AtomicABI::A6C:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A7:
-  break;
 };
+  default:
+llvm_unreachable("unknown AtomicABI");
   };
-  llvm_unreachable("unknown AtomicABI");
 }
 
 static RISCVAttributesSection *
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 38b0fe8e7797e..91321f33297aa 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -48,9 +48,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6C.s -o 
atomic_abi_A6C.o
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A7.s -o 
atomic_abi_A7.o
 # RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | 
FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error:
-# ATOMIC_ABI_ERROR: error: atomic abi mismatch for .riscv.attributes
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A6C.o:(.riscv.attributes): atomic_abi=1
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A7.o:(.riscv.attributes): atomic_abi=3
+# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has 
atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3
 
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6S.s -o 
atomic_abi_A6S.o
 # RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S
diff --git 

[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-01 Thread Paul Kirth via llvm-branch-commits

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

>From 788f58b302f20a000db3a9741e54cc861c9dcb88 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 1 Jul 2024 10:13:23 -0700
Subject: [PATCH] Fix mismerge

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 70 ---
 lld/test/ELF/riscv-attributes.s   |  4 +-
 llvm/include/llvm/Support/RISCVAttributes.h   |  4 +-
 .../MCTargetDesc/RISCVTargetStreamer.cpp  | 15 ++--
 4 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1d9be92601006..0d0ab5de9acc1 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1088,65 +1088,51 @@ static void mergeAtomic(DenseMap::iterator it,
 const InputSectionBase *oldSection,
 const InputSectionBase *newSection, unsigned int 
oldTag,
 unsigned int newTag) {
-  using RISCVAttrs::RISCVAtomicAbiTag;
+  using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
   // Same tags stay the same, and UNKNOWN is compatible with anything
-  if (oldTag == newTag ||
-  newTag == static_cast(RISCVAtomicAbiTag::UNKNOWN))
+  if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
 return;
 
-  auto reportAbiError = [&]() {
-errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
-toString(oldSection) + ": atomic_abi=" + Twine(oldTag) +
-"\n>>> " + toString(newSection) +
-": atomic_abi=" + Twine(newTag));
-  };
-
-  switch (static_cast(oldTag)) {
-  case RISCVAtomicAbiTag::UNKNOWN:
+  switch (oldTag) {
+  case AtomicABI::UNKNOWN:
 it->getSecond() = newTag;
 return;
-  case RISCVAtomicAbiTag::A6C:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6C:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  reportAbiError();
+case AtomicABI::A7:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6C:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A6S:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6C:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6S:
+switch (newTag) {
+case AtomicABI::A6C:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+case AtomicABI::A7:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6S:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A7:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+  case AtomicABI::A7:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAtomicAbiTag::A6C:
-  reportAbiError();
+case AtomicABI::A6C:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A7:
-  break;
 };
+  default:
+llvm_unreachable("unknown AtomicABI");
   };
-  llvm_unreachable("unknown AtomicABI");
 }
 
 static RISCVAttributesSection *
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 38b0fe8e7797e..91321f33297aa 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -48,9 +48,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6C.s -o 
atomic_abi_A6C.o
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A7.s -o 
atomic_abi_A7.o
 # RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | 
FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error:
-# ATOMIC_ABI_ERROR: error: atomic abi mismatch for .riscv.attributes
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A6C.o:(.riscv.attributes): atomic_abi=1
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A7.o:(.riscv.attributes): atomic_abi=3
+# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has 
atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3
 
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6S.s -o 
atomic_abi_A6S.o
 # RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S
diff --git 

[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-01 Thread Paul Kirth via llvm-branch-commits

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

>From 788f58b302f20a000db3a9741e54cc861c9dcb88 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 1 Jul 2024 10:13:23 -0700
Subject: [PATCH] Fix mismerge

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 70 ---
 lld/test/ELF/riscv-attributes.s   |  4 +-
 llvm/include/llvm/Support/RISCVAttributes.h   |  4 +-
 .../MCTargetDesc/RISCVTargetStreamer.cpp  | 15 ++--
 4 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1d9be92601006..0d0ab5de9acc1 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1088,65 +1088,51 @@ static void mergeAtomic(DenseMap::iterator it,
 const InputSectionBase *oldSection,
 const InputSectionBase *newSection, unsigned int 
oldTag,
 unsigned int newTag) {
-  using RISCVAttrs::RISCVAtomicAbiTag;
+  using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
   // Same tags stay the same, and UNKNOWN is compatible with anything
-  if (oldTag == newTag ||
-  newTag == static_cast(RISCVAtomicAbiTag::UNKNOWN))
+  if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
 return;
 
-  auto reportAbiError = [&]() {
-errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
-toString(oldSection) + ": atomic_abi=" + Twine(oldTag) +
-"\n>>> " + toString(newSection) +
-": atomic_abi=" + Twine(newTag));
-  };
-
-  switch (static_cast(oldTag)) {
-  case RISCVAtomicAbiTag::UNKNOWN:
+  switch (oldTag) {
+  case AtomicABI::UNKNOWN:
 it->getSecond() = newTag;
 return;
-  case RISCVAtomicAbiTag::A6C:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6C:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  reportAbiError();
+case AtomicABI::A7:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6C:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A6S:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6C:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6S:
+switch (newTag) {
+case AtomicABI::A6C:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+case AtomicABI::A7:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6S:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A7:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+  case AtomicABI::A7:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAtomicAbiTag::A6C:
-  reportAbiError();
+case AtomicABI::A6C:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A7:
-  break;
 };
+  default:
+llvm_unreachable("unknown AtomicABI");
   };
-  llvm_unreachable("unknown AtomicABI");
 }
 
 static RISCVAttributesSection *
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 38b0fe8e7797e..91321f33297aa 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -48,9 +48,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6C.s -o 
atomic_abi_A6C.o
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A7.s -o 
atomic_abi_A7.o
 # RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | 
FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error:
-# ATOMIC_ABI_ERROR: error: atomic abi mismatch for .riscv.attributes
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A6C.o:(.riscv.attributes): atomic_abi=1
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A7.o:(.riscv.attributes): atomic_abi=3
+# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has 
atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3
 
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6S.s -o 
atomic_abi_A6S.o
 # RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S
diff --git 

[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-01 Thread Paul Kirth via llvm-branch-commits

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

>From 788f58b302f20a000db3a9741e54cc861c9dcb88 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 1 Jul 2024 10:13:23 -0700
Subject: [PATCH] Fix mismerge

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 70 ---
 lld/test/ELF/riscv-attributes.s   |  4 +-
 llvm/include/llvm/Support/RISCVAttributes.h   |  4 +-
 .../MCTargetDesc/RISCVTargetStreamer.cpp  | 15 ++--
 4 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1d9be92601006..0d0ab5de9acc1 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1088,65 +1088,51 @@ static void mergeAtomic(DenseMap::iterator it,
 const InputSectionBase *oldSection,
 const InputSectionBase *newSection, unsigned int 
oldTag,
 unsigned int newTag) {
-  using RISCVAttrs::RISCVAtomicAbiTag;
+  using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
   // Same tags stay the same, and UNKNOWN is compatible with anything
-  if (oldTag == newTag ||
-  newTag == static_cast(RISCVAtomicAbiTag::UNKNOWN))
+  if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
 return;
 
-  auto reportAbiError = [&]() {
-errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
-toString(oldSection) + ": atomic_abi=" + Twine(oldTag) +
-"\n>>> " + toString(newSection) +
-": atomic_abi=" + Twine(newTag));
-  };
-
-  switch (static_cast(oldTag)) {
-  case RISCVAtomicAbiTag::UNKNOWN:
+  switch (oldTag) {
+  case AtomicABI::UNKNOWN:
 it->getSecond() = newTag;
 return;
-  case RISCVAtomicAbiTag::A6C:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6C:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  reportAbiError();
+case AtomicABI::A7:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6C:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A6S:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6C:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6S:
+switch (newTag) {
+case AtomicABI::A6C:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+case AtomicABI::A7:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6S:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A7:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+  case AtomicABI::A7:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAtomicAbiTag::A6C:
-  reportAbiError();
+case AtomicABI::A6C:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A7:
-  break;
 };
+  default:
+llvm_unreachable("unknown AtomicABI");
   };
-  llvm_unreachable("unknown AtomicABI");
 }
 
 static RISCVAttributesSection *
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 38b0fe8e7797e..91321f33297aa 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -48,9 +48,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6C.s -o 
atomic_abi_A6C.o
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A7.s -o 
atomic_abi_A7.o
 # RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | 
FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error:
-# ATOMIC_ABI_ERROR: error: atomic abi mismatch for .riscv.attributes
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A6C.o:(.riscv.attributes): atomic_abi=1
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A7.o:(.riscv.attributes): atomic_abi=3
+# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has 
atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3
 
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6S.s -o 
atomic_abi_A6S.o
 # RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S
diff --git 

[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-01 Thread Paul Kirth via llvm-branch-commits

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

>From 788f58b302f20a000db3a9741e54cc861c9dcb88 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 1 Jul 2024 10:13:23 -0700
Subject: [PATCH] Fix mismerge

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 70 ---
 lld/test/ELF/riscv-attributes.s   |  4 +-
 llvm/include/llvm/Support/RISCVAttributes.h   |  4 +-
 .../MCTargetDesc/RISCVTargetStreamer.cpp  | 15 ++--
 4 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1d9be92601006..0d0ab5de9acc1 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1088,65 +1088,51 @@ static void mergeAtomic(DenseMap::iterator it,
 const InputSectionBase *oldSection,
 const InputSectionBase *newSection, unsigned int 
oldTag,
 unsigned int newTag) {
-  using RISCVAttrs::RISCVAtomicAbiTag;
+  using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
   // Same tags stay the same, and UNKNOWN is compatible with anything
-  if (oldTag == newTag ||
-  newTag == static_cast(RISCVAtomicAbiTag::UNKNOWN))
+  if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
 return;
 
-  auto reportAbiError = [&]() {
-errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
-toString(oldSection) + ": atomic_abi=" + Twine(oldTag) +
-"\n>>> " + toString(newSection) +
-": atomic_abi=" + Twine(newTag));
-  };
-
-  switch (static_cast(oldTag)) {
-  case RISCVAtomicAbiTag::UNKNOWN:
+  switch (oldTag) {
+  case AtomicABI::UNKNOWN:
 it->getSecond() = newTag;
 return;
-  case RISCVAtomicAbiTag::A6C:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6C:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  reportAbiError();
+case AtomicABI::A7:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6C:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A6S:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6C:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6S:
+switch (newTag) {
+case AtomicABI::A6C:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+case AtomicABI::A7:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6S:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A7:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+  case AtomicABI::A7:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAtomicAbiTag::A6C:
-  reportAbiError();
+case AtomicABI::A6C:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A7:
-  break;
 };
+  default:
+llvm_unreachable("unknown AtomicABI");
   };
-  llvm_unreachable("unknown AtomicABI");
 }
 
 static RISCVAttributesSection *
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 38b0fe8e7797e..91321f33297aa 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -48,9 +48,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6C.s -o 
atomic_abi_A6C.o
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A7.s -o 
atomic_abi_A7.o
 # RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | 
FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error:
-# ATOMIC_ABI_ERROR: error: atomic abi mismatch for .riscv.attributes
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A6C.o:(.riscv.attributes): atomic_abi=1
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A7.o:(.riscv.attributes): atomic_abi=3
+# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has 
atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3
 
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6S.s -o 
atomic_abi_A6S.o
 # RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S
diff --git 

[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)

2024-07-01 Thread Paul Kirth via llvm-branch-commits

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

>From 788f58b302f20a000db3a9741e54cc861c9dcb88 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 1 Jul 2024 10:13:23 -0700
Subject: [PATCH] Fix mismerge

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp| 70 ---
 lld/test/ELF/riscv-attributes.s   |  4 +-
 llvm/include/llvm/Support/RISCVAttributes.h   |  4 +-
 .../MCTargetDesc/RISCVTargetStreamer.cpp  | 15 ++--
 4 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1d9be92601006..0d0ab5de9acc1 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1088,65 +1088,51 @@ static void mergeAtomic(DenseMap::iterator it,
 const InputSectionBase *oldSection,
 const InputSectionBase *newSection, unsigned int 
oldTag,
 unsigned int newTag) {
-  using RISCVAttrs::RISCVAtomicAbiTag;
+  using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
   // Same tags stay the same, and UNKNOWN is compatible with anything
-  if (oldTag == newTag ||
-  newTag == static_cast(RISCVAtomicAbiTag::UNKNOWN))
+  if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
 return;
 
-  auto reportAbiError = [&]() {
-errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
-toString(oldSection) + ": atomic_abi=" + Twine(oldTag) +
-"\n>>> " + toString(newSection) +
-": atomic_abi=" + Twine(newTag));
-  };
-
-  switch (static_cast(oldTag)) {
-  case RISCVAtomicAbiTag::UNKNOWN:
+  switch (oldTag) {
+  case AtomicABI::UNKNOWN:
 it->getSecond() = newTag;
 return;
-  case RISCVAtomicAbiTag::A6C:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6C:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  reportAbiError();
+case AtomicABI::A7:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6C:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A6S:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6C:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C);
+  case AtomicABI::A6S:
+switch (newTag) {
+case AtomicABI::A6C:
+  it->getSecond() = AtomicABI::A6C;
   return;
-case RISCVAtomicAbiTag::A7:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+case AtomicABI::A7:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A6S:
-  break;
 };
-break;
 
-  case RISCVAtomicAbiTag::A7:
-switch (static_cast(newTag)) {
-case RISCVAtomicAbiTag::A6S:
-  it->getSecond() = static_cast(RISCVAtomicAbiTag::A7);
+  case AtomicABI::A7:
+switch (newTag) {
+case AtomicABI::A6S:
+  it->getSecond() = AtomicABI::A7;
   return;
-case RISCVAtomicAbiTag::A6C:
-  reportAbiError();
+case AtomicABI::A6C:
+  errorOrWarn(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
+  " but " + toString(newSection) +
+  " has atomic_abi=" + Twine(newTag));
   return;
-case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN:
-case RISCVAttrs::RISCVAtomicAbiTag::A7:
-  break;
 };
+  default:
+llvm_unreachable("unknown AtomicABI");
   };
-  llvm_unreachable("unknown AtomicABI");
 }
 
 static RISCVAttributesSection *
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 38b0fe8e7797e..91321f33297aa 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -48,9 +48,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6C.s -o 
atomic_abi_A6C.o
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A7.s -o 
atomic_abi_A7.o
 # RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | 
FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error:
-# ATOMIC_ABI_ERROR: error: atomic abi mismatch for .riscv.attributes
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A6C.o:(.riscv.attributes): atomic_abi=1
-# ATOMIC_ABI_ERROR-NEXT: >>> atomic_abi_A7.o:(.riscv.attributes): atomic_abi=3
+# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has 
atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3
 
 # RUN: llvm-mc -filetype=obj -triple=riscv64  atomic_abi_A6S.s -o 
atomic_abi_A6S.o
 # RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S
diff --git