[llvm-branch-commits] [llvm][IR] Extend BranchWeightMetadata to track provenance of weights (PR #86609)
ilovepi wrote: @MatzeB @david-xl are there any lingering issues I've missed? I think all the comments have been addressed now. https://github.com/llvm/llvm-project/pull/86609 ___ 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][IR] Extend BranchWeightMetadata to track provenance of weights (PR #86609)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/86609 ___ 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][misexpect] Update MisExpect to use provenance tracking metadata (PR #86610)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/86610 ___ 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][misexpect] Update MisExpect to use provenance tracking metadata (PR #86610)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/86610 ___ 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][IR] Extend BranchWeightMetadata to track provenance of weights (PR #86609)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/86609 ___ 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][ProfDataUtils] provide getNumBranchWeights API (PR #90146)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/90146 ___ 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][ProfDataUtils] provide getNumBranchWeights API (PR #90146)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/90146 ___ 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][IR] Extend BranchWeightMetadata to track provenance of weights (PR #86609)
@@ -55,6 +55,17 @@ MDNode *getBranchWeightMDNode(const Instruction &I); /// Nullptr otherwise. MDNode *getValidBranchWeightMDNode(const Instruction &I); +/// Check if Branch Weight Metadata has an "expected" field from an llvm.expect* +/// intrinsic +bool hasBranchWeightProvenance(const Instruction &I); ilovepi wrote: hmm, I see your point, given its current use, but I do think we'll want to track more things in the future. Some other options: `IsBranchWeightFromLlvmIntrinsic`, `hasOptionalMetadataField`, or `hasBranchWeightOrigin`? The last is basically the same as the current, but avoids the use of `Provenance` like @MatzeB brought up earlier. WDYT? https://github.com/llvm/llvm-project/pull/86609 ___ 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] [llvm][IR] Extend BranchWeightMetadata to track provenance of weights (PR #86609)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/86609 >From 7760282ed8dba340d6873d06ff4c18c6efc25b56 Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Thu, 6 Jun 2024 19:04:19 + Subject: [PATCH] Add assert for metadata string value Created using spr 1.3.4 --- llvm/lib/IR/ProfDataUtils.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/lib/IR/ProfDataUtils.cpp b/llvm/lib/IR/ProfDataUtils.cpp index f738d76937c24..af536d2110eac 100644 --- a/llvm/lib/IR/ProfDataUtils.cpp +++ b/llvm/lib/IR/ProfDataUtils.cpp @@ -133,6 +133,7 @@ bool hasBranchWeightProvenance(const MDNode *ProfileData) { // NOTE: if we ever have more types of branch weight provenance, // we need to check the string value is "expected". For now, we // supply a more generic API, and avoid the spurious comparisons. + assert(ProfDataName->getString() == "expected"); return ProfDataName; } ___ 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][misexpect] Update MisExpect to use provenance tracking metadata (PR #86610)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/86610 ___ 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][misexpect] Update MisExpect to use provenance tracking metadata (PR #86610)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/86610 ___ 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][ProfDataUtils] provide getNumBranchWeights API (PR #90146)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/90146 ___ 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][ProfDataUtils] provide getNumBranchWeights API (PR #90146)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/90146 ___ 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] [llvm][IR] Extend BranchWeightMetadata to track provenance of weights (PR #86609)
@@ -123,6 +121,25 @@ bool hasValidBranchWeightMD(const Instruction &I) { return getValidBranchWeightMDNode(I); } +bool hasBranchWeightProvenance(const Instruction &I) { + auto *ProfileData = I.getMetadata(LLVMContext::MD_prof); + return hasBranchWeightProvenance(ProfileData); +} + +bool hasBranchWeightProvenance(const MDNode *ProfileData) { + if (!isBranchWeightMD(ProfileData)) +return false; + auto *ProfDataName = dyn_cast(ProfileData->getOperand(1)); + // NOTE: if we ever have more types of branch weight provenance, + // we need to check the string value is "expected". For now, we + // supply a more generic API, and avoid the spurious comparisons. + return ProfDataName; ilovepi wrote: done. https://github.com/llvm/llvm-project/pull/86609 ___ 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][misexpect] Update MisExpect to use provenance tracking metadata (PR #86610)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/86610 ___ 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][misexpect] Update MisExpect to use provenance tracking metadata (PR #86610)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/86610 ___ 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][ProfDataUtils] provide getNumBranchWeights API (PR #90146)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/90146 ___ 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][ProfDataUtils] provide getNumBranchWeights API (PR #90146)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/90146 ___ 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-doc][cmake] Copy assets to build directory (PR #95185)
https://github.com/ilovepi created https://github.com/llvm/llvm-project/pull/95185 While we copy the asset files, like index.js, into the correct location in the install step, tests do not have access to those resources in the build directory. This patch copies the contents of the clang-doc/assets directory into the build folder, so that they can be used in testing. ___ 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-doc][cmake] Copy assets to build directory (PR #95185)
ilovepi wrote: @petrhosek I'm pretty sure there's a better way to spell this, but I think we need something similar to properly test clang-doc w/o an install step. cc: @PeterChou1 https://github.com/llvm/llvm-project/pull/95185 ___ 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][misexpect] Update MisExpect to use provenance tracking metadata (PR #86610)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/86610 ___ 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][misexpect] Update MisExpect to use provenance tracking metadata (PR #86610)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/86610 ___ 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][ProfDataUtils] provide getNumBranchWeights API (PR #90146)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/90146 ___ 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][ProfDataUtils] provide getNumBranchWeights API (PR #90146)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/90146 ___ 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][ProfDataUtils] provide getNumBranchWeights API (PR #90146)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/90146 ___ 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][ProfDataUtils] provide getNumBranchWeights API (PR #90146)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/90146 ___ 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][misexpect] Enable diagnostics for profitable llvm.expect annotations (PR #96523)
https://github.com/ilovepi created https://github.com/llvm/llvm-project/pull/96523 Issue #56502 describes an enhancement related to the use of llvm.expect. The request is for a diagnostic mode that can identify branches that would benefit from the use of llvm.expect based on the branch_weights assigned from a PGO or sample profile. To support identify branches(or switches) that would benefit from the use of an llvm.expect intrinsic, we follow a similar checking pattern to that used in MisExpect, but only in cases where MisExpect diagnostics would not be used (i.e., when an llvm.expect intrinsic has already been used). ___ 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] [misexpect] Support diagnostics from frontend profile data (PR #96524)
https://github.com/ilovepi created https://github.com/llvm/llvm-project/pull/96524 None ___ 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][misexpect] Add support to clang for profitable annotation diagnostics (PR #96525)
https://github.com/ilovepi created https://github.com/llvm/llvm-project/pull/96525 Add basic plumbing to clang so that diagnostics can be surfaced to users. ___ 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] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)
https://github.com/ilovepi updated 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] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)
https://github.com/ilovepi edited 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] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)
https://github.com/ilovepi updated 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] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)
https://github.com/ilovepi updated 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] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)
https://github.com/ilovepi updated 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)
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 a/llvm/include/llvm/Sup
[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)
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 a/llvm/include/llvm/Sup
[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)
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 a/llvm/include/llvm/Sup
[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)
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 a/llvm/include/llvm/Sup
[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)
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 a/llvm/include/llvm/Sup
[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)
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 a/llvm/include/llvm/Sup
[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)
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 a/llvm/include/llvm/Sup
[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)
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 a/llvm/include/llvm/Sup
[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)
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 a/llvm/include/llvm/Sup
[llvm-branch-commits] [RISCV][lld] Support merging RISC-V Atomics ABI attributes (PR #97347)
https://github.com/ilovepi created https://github.com/llvm/llvm-project/pull/97347 This patch adds support for merging the atomic_abi attribute, specifid in https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#tag_riscv_atomic_abi-14-uleb128version, to LLD. The atomics_abi tag merging is conducted as follows: UNKNOWN is safe to merge with all other values. A6C is compatible with A6S, and results in the A6C ABI. A6C is incompatible with A7, and results in an error. A6S and A7 are compatible, and merging results in the A7 ABI. Note: the A7 is not yet supported in either LLVM or in any current hardware, and is therefore omitted from attribute generation in RISCVTargetStreamer. LLD support was split from https://github.com/llvm/llvm-project/pull/90266 ___ 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] [RISCV][lld] Support merging RISC-V Atomics ABI attributes (PR #97347)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/97347 ___ 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] [RISCV][lld] Support merging RISC-V Atomics ABI attributes (PR #97347)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/97347 ___ 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)
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 a/llvm/include/llvm/Sup
[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)
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 a/llvm/include/llvm/Sup
[llvm-branch-commits] [RISCV][lld] Support merging RISC-V Atomics ABI attributes (PR #97347)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/97347 ___ 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] [RISCV][lld] Support merging RISC-V Atomics ABI attributes (PR #97347)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/97347 ___ 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)
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 a/llvm/include/llvm/Sup
[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)
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 a/llvm/include/llvm/Sup
[llvm-branch-commits] [RISCV][lld] Support merging RISC-V Atomics ABI attributes (PR #97347)
@@ -1084,10 +1084,76 @@ static void mergeArch(RISCVISAUtils::OrderedExtensionMap &mergedExts, } } +static void mergeAtomic(DenseMap::iterator it, +const InputSectionBase *oldSection, +const InputSectionBase *newSection, +RISCVAttrs::RISCVAtomicAbiTag oldTag, +RISCVAttrs::RISCVAtomicAbiTag newTag) { + using RISCVAttrs::RISCVAtomicAbiTag; + // Same tags stay the same, and UNKNOWN is compatible with anything + if (oldTag == newTag || newTag == RISCVAtomicAbiTag::UNKNOWN) +return; + + auto reportAbiError = [&]() { +errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " + +toString(oldSection) + +": atomic_abi=" + Twine(static_cast(oldTag)) + +"\n>>> " + toString(newSection) + +": atomic_abi=" + Twine(static_cast(newTag))); + }; + + switch (static_cast(oldTag)) { ilovepi wrote: yes. Looks like I missed one. Thanks. https://github.com/llvm/llvm-project/pull/97347 ___ 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] [RISCV][lld] Support merging RISC-V Atomics ABI attributes (PR #97347)
@@ -1084,10 +1084,76 @@ static void mergeArch(RISCVISAUtils::OrderedExtensionMap &mergedExts, } } +static void mergeAtomic(DenseMap::iterator it, +const InputSectionBase *oldSection, +const InputSectionBase *newSection, +RISCVAttrs::RISCVAtomicAbiTag oldTag, +RISCVAttrs::RISCVAtomicAbiTag newTag) { + using RISCVAttrs::RISCVAtomicAbiTag; + // Same tags stay the same, and UNKNOWN is compatible with anything + if (oldTag == newTag || newTag == RISCVAtomicAbiTag::UNKNOWN) +return; + + auto reportAbiError = [&]() { +errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " + +toString(oldSection) + +": atomic_abi=" + Twine(static_cast(oldTag)) + +"\n>>> " + toString(newSection) + +": atomic_abi=" + Twine(static_cast(newTag))); + }; + + switch (static_cast(oldTag)) { + case RISCVAtomicAbiTag::UNKNOWN: +it->getSecond() = static_cast(newTag); +return; + case RISCVAtomicAbiTag::A6C: +switch (newTag) { +case RISCVAtomicAbiTag::A6S: + it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C); + return; +case RISCVAtomicAbiTag::A7: + reportAbiError(); + return; +case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN: +case RISCVAttrs::RISCVAtomicAbiTag::A6C: + return; +}; + + case RISCVAtomicAbiTag::A6S: +switch (newTag) { +case RISCVAtomicAbiTag::A6C: + it->getSecond() = static_cast(RISCVAtomicAbiTag::A6C); + return; +case RISCVAtomicAbiTag::A7: + it->getSecond() = static_cast(RISCVAtomicAbiTag::A7); + return; +case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN: +case RISCVAttrs::RISCVAtomicAbiTag::A6S: + return; +}; + + case RISCVAtomicAbiTag::A7: +switch (newTag) { +case RISCVAtomicAbiTag::A6S: + it->getSecond() = static_cast(RISCVAtomicAbiTag::A7); + return; +case RISCVAtomicAbiTag::A6C: + reportAbiError(); + return; +case RISCVAttrs::RISCVAtomicAbiTag::UNKNOWN: +case RISCVAttrs::RISCVAtomicAbiTag::A7: + return; +}; + }; + llvm_unreachable("unknown AtomicABI"); ilovepi wrote: Ah, fair point. I'll update w/ an error instead. https://github.com/llvm/llvm-project/pull/97347 ___ 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] [RISCV][lld] Support merging RISC-V Atomics ABI attributes (PR #97347)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/97347 ___ 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] [RISCV][lld] Support merging RISC-V Atomics ABI attributes (PR #97347)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/97347 ___ 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)
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 a/llvm/include/llvm/Sup
[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)
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 a/llvm/include/llvm/Sup
[llvm-branch-commits] [lld] [RISCV][lld] Support merging RISC-V Atomics ABI attributes (PR #97347)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/97347 >From 5c57d12517ad58310511eb27bf7cc4ec660d4fa7 Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Tue, 2 Jul 2024 09:39:46 -0700 Subject: [PATCH] Add handling for invalid tags Created using spr 1.3.4 --- lld/ELF/Arch/RISCV.cpp | 22 -- lld/test/ELF/riscv-attributes.s | 9 + 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp index c48b9f7c11047..07a1b63be8051 100644 --- a/lld/ELF/Arch/RISCV.cpp +++ b/lld/ELF/Arch/RISCV.cpp @@ -1102,7 +1102,20 @@ static void mergeAtomic(DenseMap::iterator it, ": atomic_abi=" + Twine(static_cast(newTag))); }; - switch (static_cast(oldTag)) { + auto reportUnknownAbiError = [](const InputSectionBase *section, + RISCVAtomicAbiTag tag) { +switch (tag) { +case RISCVAtomicAbiTag::UNKNOWN: +case RISCVAtomicAbiTag::A6C: +case RISCVAtomicAbiTag::A6S: +case RISCVAtomicAbiTag::A7: + return; +}; +errorOrWarn("unknown atomic abi for " + section->name + "\n>>> " + +toString(section) + +": atomic_abi=" + Twine(static_cast(tag))); + }; + switch (oldTag) { case RISCVAtomicAbiTag::UNKNOWN: it->getSecond() = static_cast(newTag); return; @@ -1145,7 +1158,12 @@ static void mergeAtomic(DenseMap::iterator it, return; }; }; - llvm_unreachable("unknown AtomicABI"); + + // If we get here, then we have an invalid tag, so report it. + // Putting these checks at the end allows us to only do these checks when we + // need to, since this is expected to be a rare occurrence. + reportUnknownAbiError(oldSection, oldTag); + reportUnknownAbiError(newSection, newTag); } static RISCVAttributesSection * diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s index 38b0fe8e7797e..057223c18418e 100644 --- a/lld/test/ELF/riscv-attributes.s +++ b/lld/test/ELF/riscv-attributes.s @@ -52,6 +52,12 @@ # 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 +## RISC-V tag merging for atomic_abi values A6C and invalid lead to an error. +# RUN: llvm-mc -filetype=obj -triple=riscv64 atomic_abi_invalid.s -o atomic_abi_invalid.o +# RUN: not ld.lld atomic_abi_A6C.o atomic_abi_invalid.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ATOMIC_ABI_INVALID --implicit-check-not=error: +# ATOMIC_ABI_INVALID: error: unknown atomic abi for .riscv.attributes +# ATOMIC_ABI_INVALID-NEXT: >>> atomic_abi_invalid.o:(.riscv.attributes): atomic_abi=42 + # 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 # RUN: llvm-readobj -A atomic_abi_A6C_A6S | FileCheck %s --check-prefix=A6C_A6S @@ -332,6 +338,9 @@ #--- atomic_abi_A7.s .attribute atomic_abi, 3 +#--- atomic_abi_invalid.s +.attribute atomic_abi, 42 + # UNKNOWN_NONE: BuildAttributes { # UNKNOWN_NONE-NEXT: FormatVersion: 0x41 # UNKNOWN_NONE-NEXT: Section 1 { ___ 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] [lld] Support merging RISC-V Atomics ABI attributes (PR #97347)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/97347 >From 5c57d12517ad58310511eb27bf7cc4ec660d4fa7 Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Tue, 2 Jul 2024 09:39:46 -0700 Subject: [PATCH] Add handling for invalid tags Created using spr 1.3.4 --- lld/ELF/Arch/RISCV.cpp | 22 -- lld/test/ELF/riscv-attributes.s | 9 + 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp index c48b9f7c11047..07a1b63be8051 100644 --- a/lld/ELF/Arch/RISCV.cpp +++ b/lld/ELF/Arch/RISCV.cpp @@ -1102,7 +1102,20 @@ static void mergeAtomic(DenseMap::iterator it, ": atomic_abi=" + Twine(static_cast(newTag))); }; - switch (static_cast(oldTag)) { + auto reportUnknownAbiError = [](const InputSectionBase *section, + RISCVAtomicAbiTag tag) { +switch (tag) { +case RISCVAtomicAbiTag::UNKNOWN: +case RISCVAtomicAbiTag::A6C: +case RISCVAtomicAbiTag::A6S: +case RISCVAtomicAbiTag::A7: + return; +}; +errorOrWarn("unknown atomic abi for " + section->name + "\n>>> " + +toString(section) + +": atomic_abi=" + Twine(static_cast(tag))); + }; + switch (oldTag) { case RISCVAtomicAbiTag::UNKNOWN: it->getSecond() = static_cast(newTag); return; @@ -1145,7 +1158,12 @@ static void mergeAtomic(DenseMap::iterator it, return; }; }; - llvm_unreachable("unknown AtomicABI"); + + // If we get here, then we have an invalid tag, so report it. + // Putting these checks at the end allows us to only do these checks when we + // need to, since this is expected to be a rare occurrence. + reportUnknownAbiError(oldSection, oldTag); + reportUnknownAbiError(newSection, newTag); } static RISCVAttributesSection * diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s index 38b0fe8e7797e..057223c18418e 100644 --- a/lld/test/ELF/riscv-attributes.s +++ b/lld/test/ELF/riscv-attributes.s @@ -52,6 +52,12 @@ # 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 +## RISC-V tag merging for atomic_abi values A6C and invalid lead to an error. +# RUN: llvm-mc -filetype=obj -triple=riscv64 atomic_abi_invalid.s -o atomic_abi_invalid.o +# RUN: not ld.lld atomic_abi_A6C.o atomic_abi_invalid.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ATOMIC_ABI_INVALID --implicit-check-not=error: +# ATOMIC_ABI_INVALID: error: unknown atomic abi for .riscv.attributes +# ATOMIC_ABI_INVALID-NEXT: >>> atomic_abi_invalid.o:(.riscv.attributes): atomic_abi=42 + # 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 # RUN: llvm-readobj -A atomic_abi_A6C_A6S | FileCheck %s --check-prefix=A6C_A6S @@ -332,6 +338,9 @@ #--- atomic_abi_A7.s .attribute atomic_abi, 3 +#--- atomic_abi_invalid.s +.attribute atomic_abi, 42 + # UNKNOWN_NONE: BuildAttributes { # UNKNOWN_NONE-NEXT: FormatVersion: 0x41 # UNKNOWN_NONE-NEXT: Section 1 { ___ 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] [lld] Support merging RISC-V Atomics ABI attributes (PR #97347)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/97347 >From 5c57d12517ad58310511eb27bf7cc4ec660d4fa7 Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Tue, 2 Jul 2024 09:39:46 -0700 Subject: [PATCH] Add handling for invalid tags Created using spr 1.3.4 --- lld/ELF/Arch/RISCV.cpp | 22 -- lld/test/ELF/riscv-attributes.s | 9 + 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp index c48b9f7c110476..07a1b63be80510 100644 --- a/lld/ELF/Arch/RISCV.cpp +++ b/lld/ELF/Arch/RISCV.cpp @@ -1102,7 +1102,20 @@ static void mergeAtomic(DenseMap::iterator it, ": atomic_abi=" + Twine(static_cast(newTag))); }; - switch (static_cast(oldTag)) { + auto reportUnknownAbiError = [](const InputSectionBase *section, + RISCVAtomicAbiTag tag) { +switch (tag) { +case RISCVAtomicAbiTag::UNKNOWN: +case RISCVAtomicAbiTag::A6C: +case RISCVAtomicAbiTag::A6S: +case RISCVAtomicAbiTag::A7: + return; +}; +errorOrWarn("unknown atomic abi for " + section->name + "\n>>> " + +toString(section) + +": atomic_abi=" + Twine(static_cast(tag))); + }; + switch (oldTag) { case RISCVAtomicAbiTag::UNKNOWN: it->getSecond() = static_cast(newTag); return; @@ -1145,7 +1158,12 @@ static void mergeAtomic(DenseMap::iterator it, return; }; }; - llvm_unreachable("unknown AtomicABI"); + + // If we get here, then we have an invalid tag, so report it. + // Putting these checks at the end allows us to only do these checks when we + // need to, since this is expected to be a rare occurrence. + reportUnknownAbiError(oldSection, oldTag); + reportUnknownAbiError(newSection, newTag); } static RISCVAttributesSection * diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s index 38b0fe8e7797e2..057223c18418e1 100644 --- a/lld/test/ELF/riscv-attributes.s +++ b/lld/test/ELF/riscv-attributes.s @@ -52,6 +52,12 @@ # 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 +## RISC-V tag merging for atomic_abi values A6C and invalid lead to an error. +# RUN: llvm-mc -filetype=obj -triple=riscv64 atomic_abi_invalid.s -o atomic_abi_invalid.o +# RUN: not ld.lld atomic_abi_A6C.o atomic_abi_invalid.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ATOMIC_ABI_INVALID --implicit-check-not=error: +# ATOMIC_ABI_INVALID: error: unknown atomic abi for .riscv.attributes +# ATOMIC_ABI_INVALID-NEXT: >>> atomic_abi_invalid.o:(.riscv.attributes): atomic_abi=42 + # 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 # RUN: llvm-readobj -A atomic_abi_A6C_A6S | FileCheck %s --check-prefix=A6C_A6S @@ -332,6 +338,9 @@ #--- atomic_abi_A7.s .attribute atomic_abi, 3 +#--- atomic_abi_invalid.s +.attribute atomic_abi, 42 + # UNKNOWN_NONE: BuildAttributes { # UNKNOWN_NONE-NEXT: FormatVersion: 0x41 # UNKNOWN_NONE-NEXT: Section 1 { ___ 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] [lld] Support merging RISC-V Atomics ABI attributes (PR #97347)
https://github.com/ilovepi edited https://github.com/llvm/llvm-project/pull/97347 ___ 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)
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 a/llvm/include/llvm
[llvm-branch-commits] [lld] [llvm] Reapply "[llvm][RISCV] Enable trailing fences for seq-cst stores by default (#87376)" (PR #90267)
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 a/llvm/include/llvm/Sup
[llvm-branch-commits] [misexpect] Support diagnostics from frontend profile data (PR #96524)
https://github.com/ilovepi edited https://github.com/llvm/llvm-project/pull/96524 ___ 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-tidy] Add FixIts for libc namespace macros (PR #99681)
https://github.com/ilovepi created https://github.com/llvm/llvm-project/pull/99681 This adds a few FixIts that update the usage of namespaces other than LIBC_NAMESPACE_DECL, and add the required header when its missing. ___ 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-tidy] Add FixIts for libc namespace macros (PR #99681)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/99681 ___ 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-tidy] Add FixIts for libc namespace macros (PR #99681)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/99681 ___ 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] [misexpect] Support diagnostics from frontend profile data (PR #96524)
@@ -369,9 +369,21 @@ static bool lowerExpectIntrinsic(Function &F) { if (BranchInst *BI = dyn_cast(BB.getTerminator())) { if (handleBranchExpect(*BI)) ExpectIntrinsicsHandled++; + else { +SmallVector Weights; +if (extractBranchWeights(*BI, Weights)) + misexpect::checkMissingAnnotations(*BI, Weights, + /*IsFrontendInstr=*/false); ilovepi wrote: oh no! You're right, this is basically dead. Let me go through this and try to figure out why I thought this was working as intended. https://github.com/llvm/llvm-project/pull/96524 ___ 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] [misexpect] Support diagnostics from frontend profile data (PR #96524)
@@ -3,7 +3,7 @@ ; RUN: llvm-profdata merge %S/Inputs/misexpect-branch-correct.proftext -o %t.profdata -; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -pgo-missing-annotations -pass-remarks=missing-annotation -S 2>&1 | FileCheck %s --check-prefix=MISSING_ANNOTATION +; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -pgo-missing-annotations -pass-remarks=missing-annotations -S 2>&1 | FileCheck %s --check-prefix=MISSING_ANNOTATION ilovepi wrote: Oops, I thought I had removed those in the base revision. Let me rebase this stack and address that in #96523. https://github.com/llvm/llvm-project/pull/96524 ___ 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-tidy] Add FixIts for libc namespace macros (PR #99681)
@@ -41,8 +50,26 @@ void ImplementationInNamespaceCheck::check( // Enforce that the namespace is the result of macro expansion if (Result.SourceManager->isMacroBodyExpansion(NS->getLocation()) == false) { -diag(NS->getLocation(), "the outermost namespace should be the '%0' macro") -<< RequiredNamespaceDeclMacroName; +auto DB = diag(NS->getLocation(), + "the outermost namespace should be the '%0' macro") + << RequiredNamespaceDeclMacroName; + +// TODO: Determine how to split inline namespaces correctly in the FixItHint +// +// We can't easily replace LIBC_NAMEPACE::inner::namespace { with +// +// namespace LIBC_NAMEPACE_DECL { +// namespace inner::namespace { +// +// For now, just update the simple case w/ LIBC_NAMEPACE_DECL +if (!NS->isInlineNamespace()) + DB << FixItHint::CreateReplacement(NS->getLocation(), + RequiredNamespaceDeclMacroName); + +DB << IncludeInserter.createIncludeInsertion( +Result.SourceManager->getFileID(NS->getBeginLoc()), +NamespaceMacroHeader); ilovepi wrote: hmm, yeah. That's a bit awkward. https://github.com/llvm/llvm-project/pull/99681 ___ 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-tidy] Add FixIts for libc namespace macros (PR #99681)
@@ -1,4 +1,6 @@ -// RUN: %check_clang_tidy %s llvmlibc-implementation-in-namespace %t +// RUN: %check_clang_tidy %s llvmlibc-implementation-in-namespace %t -fix ilovepi wrote: ack. I saw those running, but I saw `-fix` on a lot of other tests outside of llvmlibc. I'm guessing those are probalby older tests that predate that logic? either way, I'll address this shortly. https://github.com/llvm/llvm-project/pull/99681 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/19.x: [StackFrameLayoutAnalysis] Support more SlotTypes (#100562) (PR #101042)
https://github.com/ilovepi approved this pull request. I'd say its a good set of fixes to add to the release. https://github.com/llvm/llvm-project/pull/101042 ___ 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][misexpect] Enable diagnostics for profitable llvm.expect annotations (PR #96523)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/96523 ___ 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][misexpect] Enable diagnostics for profitable llvm.expect annotations (PR #96523)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/96523 ___ 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] [misexpect] Support diagnostics from frontend profile data (PR #96524)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/96524 ___ 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] [misexpect] Support diagnostics from frontend profile data (PR #96524)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/96524 ___ 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][misexpect] Add support to clang for profitable annotation diagnostics (PR #96525)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/96525 ___ 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][misexpect] Add support to clang for profitable annotation diagnostics (PR #96525)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/96525 ___ 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] [misexpect] Support diagnostics from frontend profile data (PR #96524)
@@ -0,0 +1,44 @@ +// Test that missing-annotations detects branches that are hot, but not annotated + +// test diagnostics are issued when profiling data mis-matches annotations +// RUN: llvm-profdata merge %S/Inputs/missing-annotations-branch.proftext -o %t.profdata ilovepi wrote: Sure. The use of Inputs here is mostly following the convention I've seen in other tests. I'm unsure how much I can reuse the `.proftext` file between tests, so I can probably just use split-lines for those too. https://github.com/llvm/llvm-project/pull/96524 ___ 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] ReleaseNotes: mention -mtls-dialect=desc (PR #82731)
https://github.com/ilovepi approved this pull request. https://github.com/llvm/llvm-project/pull/82731 ___ 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][dfa-jump-threading] Add option to allow DFAJumpThreading when (PR #83049)
https://github.com/ilovepi created https://github.com/llvm/llvm-project/pull/83049 optimizing for size ___ 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] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/83049 >From fc2e672d474442ef83e90c7a41265d6433651b63 Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Mon, 26 Feb 2024 21:42:24 + Subject: [PATCH] Refactor option names, and update test Created using spr 1.3.4 --- llvm/lib/Passes/PassBuilderPipelines.cpp| 4 ++-- llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp | 11 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index e48a31f79cc0c5..9f81ff1899ac5f 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -222,8 +222,8 @@ static cl::opt EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -static cl::opt -OptSizeDFAJumpThreading("optsize-dfa-jump-thread", +extern cl::opt +OptSizeDFAJumpThreading("dfa-jump-thread-optsize", cl::desc("Enable DFA jump threading when optimizing for size"), cl::init(false), cl::Hidden); diff --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp index 9156d756310d14..ce5e823e531e0f 100644 --- a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp @@ -110,11 +110,10 @@ static cl::opt cl::desc("Maximum cost accepted for the transformation"), cl::Hidden, cl::init(50)); -static cl::opt -IgnoreOptSize("dfa-jump-ignore-optsize", -cl::desc("Enable dfa jump threading, even when optimizing for size"), -cl::Hidden, cl::init(false)); - +static cl::opt DFAJumpThreadIgnoreOptSize( +"dfa-jump-ignore-optsize", +cl::desc("Enable dfa jump threading, even when optimizing for size"), +cl::Hidden, cl::init(false)); namespace { @@ -1250,7 +1249,7 @@ struct TransformDFA { bool DFAJumpThreading::run(Function &F) { LLVM_DEBUG(dbgs() << "\nDFA Jump threading: " << F.getName() << "\n"); - if (!IgnoreOptSize && F.hasOptSize()) { + if (!DFAJumpThreadIgnoreOptSize && F.hasOptSize()) { LLVM_DEBUG(dbgs() << "Skipping due to the 'minsize' attribute\n"); return false; } ___ 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] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
https://github.com/ilovepi edited https://github.com/llvm/llvm-project/pull/83049 ___ 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] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/83049 >From fc2e672d474442ef83e90c7a41265d6433651b63 Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Mon, 26 Feb 2024 21:42:24 + Subject: [PATCH 1/2] Refactor option names, and update test Created using spr 1.3.4 --- llvm/lib/Passes/PassBuilderPipelines.cpp| 4 ++-- llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp | 11 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index e48a31f79cc0c5..9f81ff1899ac5f 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -222,8 +222,8 @@ static cl::opt EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -static cl::opt -OptSizeDFAJumpThreading("optsize-dfa-jump-thread", +extern cl::opt +OptSizeDFAJumpThreading("dfa-jump-thread-optsize", cl::desc("Enable DFA jump threading when optimizing for size"), cl::init(false), cl::Hidden); diff --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp index 9156d756310d14..ce5e823e531e0f 100644 --- a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp @@ -110,11 +110,10 @@ static cl::opt cl::desc("Maximum cost accepted for the transformation"), cl::Hidden, cl::init(50)); -static cl::opt -IgnoreOptSize("dfa-jump-ignore-optsize", -cl::desc("Enable dfa jump threading, even when optimizing for size"), -cl::Hidden, cl::init(false)); - +static cl::opt DFAJumpThreadIgnoreOptSize( +"dfa-jump-ignore-optsize", +cl::desc("Enable dfa jump threading, even when optimizing for size"), +cl::Hidden, cl::init(false)); namespace { @@ -1250,7 +1249,7 @@ struct TransformDFA { bool DFAJumpThreading::run(Function &F) { LLVM_DEBUG(dbgs() << "\nDFA Jump threading: " << F.getName() << "\n"); - if (!IgnoreOptSize && F.hasOptSize()) { + if (!DFAJumpThreadIgnoreOptSize && F.hasOptSize()) { LLVM_DEBUG(dbgs() << "Skipping due to the 'minsize' attribute\n"); return false; } >From ffaa39b064da4d99e1834102ddbb38f0780e4ae7 Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Mon, 26 Feb 2024 21:55:44 + Subject: [PATCH 2/2] Make variable static + rename Created using spr 1.3.4 --- llvm/lib/Passes/PassBuilderPipelines.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index 9f81ff1899ac5f..a4db4614c6f830 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -222,8 +222,8 @@ static cl::opt EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -extern cl::opt -OptSizeDFAJumpThreading("dfa-jump-thread-optsize", +static cl::opt +DFAJumpThreadingOptSize("dfa-jump-thread-optsize", cl::desc("Enable DFA jump threading when optimizing for size"), cl::init(false), cl::Hidden); @@ -723,7 +723,7 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level, // Re-consider control flow based optimizations after redundancy elimination, // redo DCE, etc. if (EnableDFAJumpThreading && - ((Level.getSizeLevel() == 0) || OptSizeDFAJumpThreading)) + ((Level.getSizeLevel() == 0) || DFAJumpThreadingOptSize)) FPM.addPass(DFAJumpThreadingPass()); FPM.addPass(JumpThreadingPass()); ___ 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] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
@@ -222,6 +222,11 @@ static cl::opt EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); +static cl::opt +DFAJumpThreadingOptSize("dfa-jump-thread-optsize", + cl::desc("Enable DFA jump threading when optimizing for size"), + cl::init(false), cl::Hidden); + ilovepi wrote: Its rather unfortunate that we need 2 flags to enable a single behavior ... Is there a common place we can put this flag and use it here and in `DFAJumpThreading.cpp`? https://github.com/llvm/llvm-project/pull/83049 ___ 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] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
ilovepi wrote: cc: @petrhosek @PiJoules since I think they're interested. https://github.com/llvm/llvm-project/pull/83049 ___ 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] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
ilovepi wrote: > Can we have a more principled approach to determine when to allow this pass > to run than a `cl::opt`? For example, change the `CostThreshold` in the pass > depending on whether or not the function has `optsize`. Sure. I can take a look at doing it that way instead. it will probably be much cleaner. https://github.com/llvm/llvm-project/pull/83049 ___ 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] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
ilovepi wrote: > This pass is not part of the default pipeline -- do you enable this pass > downstream, or do you want to add options for _all_ uses of minsize, even if > there is no evidence of usefulness? We’d like to see if this can be useful to some of our size constrained users in the embedded space. Particularly because it has been proposed to turn this on in the default pipeline. https://discourse.llvm.org/t/rfc-enable-dfa-jumpthreading-pass-by-default/77231. Currently we don’t have evidence that this is beneficial, but for these targets we also don’t have a way to vet that with the current implementation. So to be concrete, I’d like the ability to enable this pass somehow even if compiling for size. If we can control this behavior with a threshold, then mechanically I don’t see much difference between that an the flags I’ve added in this pass. But right now we don’t have a way to evaluate if this may be useful at any threshold, and I think it’s useful if we can turn this knob in some way without changing the default behavior. https://github.com/llvm/llvm-project/pull/83049 ___ 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] Remove pipeline checks for optsize for DFAJumpThreadingPass (PR #83188)
https://github.com/ilovepi created https://github.com/llvm/llvm-project/pull/83188 The pass itself checks whether to apply the optimization based on the minsize attribute, so there isn't much functional benefit to preventing the pass from being added. Gating the pass gets added to the pass pipeline complicates the interaction with -enable-dfa-jump-thread, as well. ___ 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] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/83049 >From fc2e672d474442ef83e90c7a41265d6433651b63 Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Mon, 26 Feb 2024 21:42:24 + Subject: [PATCH 1/2] Refactor option names, and update test Created using spr 1.3.4 --- llvm/lib/Passes/PassBuilderPipelines.cpp| 4 ++-- llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp | 11 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index e48a31f79cc0c5..9f81ff1899ac5f 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -222,8 +222,8 @@ static cl::opt EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -static cl::opt -OptSizeDFAJumpThreading("optsize-dfa-jump-thread", +extern cl::opt +OptSizeDFAJumpThreading("dfa-jump-thread-optsize", cl::desc("Enable DFA jump threading when optimizing for size"), cl::init(false), cl::Hidden); diff --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp index 9156d756310d14..ce5e823e531e0f 100644 --- a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp @@ -110,11 +110,10 @@ static cl::opt cl::desc("Maximum cost accepted for the transformation"), cl::Hidden, cl::init(50)); -static cl::opt -IgnoreOptSize("dfa-jump-ignore-optsize", -cl::desc("Enable dfa jump threading, even when optimizing for size"), -cl::Hidden, cl::init(false)); - +static cl::opt DFAJumpThreadIgnoreOptSize( +"dfa-jump-ignore-optsize", +cl::desc("Enable dfa jump threading, even when optimizing for size"), +cl::Hidden, cl::init(false)); namespace { @@ -1250,7 +1249,7 @@ struct TransformDFA { bool DFAJumpThreading::run(Function &F) { LLVM_DEBUG(dbgs() << "\nDFA Jump threading: " << F.getName() << "\n"); - if (!IgnoreOptSize && F.hasOptSize()) { + if (!DFAJumpThreadIgnoreOptSize && F.hasOptSize()) { LLVM_DEBUG(dbgs() << "Skipping due to the 'minsize' attribute\n"); return false; } >From ffaa39b064da4d99e1834102ddbb38f0780e4ae7 Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Mon, 26 Feb 2024 21:55:44 + Subject: [PATCH 2/2] Make variable static + rename Created using spr 1.3.4 --- llvm/lib/Passes/PassBuilderPipelines.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index 9f81ff1899ac5f..a4db4614c6f830 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -222,8 +222,8 @@ static cl::opt EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -extern cl::opt -OptSizeDFAJumpThreading("dfa-jump-thread-optsize", +static cl::opt +DFAJumpThreadingOptSize("dfa-jump-thread-optsize", cl::desc("Enable DFA jump threading when optimizing for size"), cl::init(false), cl::Hidden); @@ -723,7 +723,7 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level, // Re-consider control flow based optimizations after redundancy elimination, // redo DCE, etc. if (EnableDFAJumpThreading && - ((Level.getSizeLevel() == 0) || OptSizeDFAJumpThreading)) + ((Level.getSizeLevel() == 0) || DFAJumpThreadingOptSize)) FPM.addPass(DFAJumpThreadingPass()); FPM.addPass(JumpThreadingPass()); ___ 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] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/83049 >From fc2e672d474442ef83e90c7a41265d6433651b63 Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Mon, 26 Feb 2024 21:42:24 + Subject: [PATCH 1/2] Refactor option names, and update test Created using spr 1.3.4 --- llvm/lib/Passes/PassBuilderPipelines.cpp| 4 ++-- llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp | 11 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index e48a31f79cc0c5..9f81ff1899ac5f 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -222,8 +222,8 @@ static cl::opt EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -static cl::opt -OptSizeDFAJumpThreading("optsize-dfa-jump-thread", +extern cl::opt +OptSizeDFAJumpThreading("dfa-jump-thread-optsize", cl::desc("Enable DFA jump threading when optimizing for size"), cl::init(false), cl::Hidden); diff --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp index 9156d756310d14..ce5e823e531e0f 100644 --- a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp @@ -110,11 +110,10 @@ static cl::opt cl::desc("Maximum cost accepted for the transformation"), cl::Hidden, cl::init(50)); -static cl::opt -IgnoreOptSize("dfa-jump-ignore-optsize", -cl::desc("Enable dfa jump threading, even when optimizing for size"), -cl::Hidden, cl::init(false)); - +static cl::opt DFAJumpThreadIgnoreOptSize( +"dfa-jump-ignore-optsize", +cl::desc("Enable dfa jump threading, even when optimizing for size"), +cl::Hidden, cl::init(false)); namespace { @@ -1250,7 +1249,7 @@ struct TransformDFA { bool DFAJumpThreading::run(Function &F) { LLVM_DEBUG(dbgs() << "\nDFA Jump threading: " << F.getName() << "\n"); - if (!IgnoreOptSize && F.hasOptSize()) { + if (!DFAJumpThreadIgnoreOptSize && F.hasOptSize()) { LLVM_DEBUG(dbgs() << "Skipping due to the 'minsize' attribute\n"); return false; } >From ffaa39b064da4d99e1834102ddbb38f0780e4ae7 Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Mon, 26 Feb 2024 21:55:44 + Subject: [PATCH 2/2] Make variable static + rename Created using spr 1.3.4 --- llvm/lib/Passes/PassBuilderPipelines.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index 9f81ff1899ac5f..a4db4614c6f830 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -222,8 +222,8 @@ static cl::opt EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -extern cl::opt -OptSizeDFAJumpThreading("dfa-jump-thread-optsize", +static cl::opt +DFAJumpThreadingOptSize("dfa-jump-thread-optsize", cl::desc("Enable DFA jump threading when optimizing for size"), cl::init(false), cl::Hidden); @@ -723,7 +723,7 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level, // Re-consider control flow based optimizations after redundancy elimination, // redo DCE, etc. if (EnableDFAJumpThreading && - ((Level.getSizeLevel() == 0) || OptSizeDFAJumpThreading)) + ((Level.getSizeLevel() == 0) || DFAJumpThreadingOptSize)) FPM.addPass(DFAJumpThreadingPass()); FPM.addPass(JumpThreadingPass()); ___ 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] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
ilovepi wrote: > also, we should remove pipeline checks for "optsize" and move those checks > into the passes themselves done in https://github.com/llvm/llvm-project/pull/83188 https://github.com/llvm/llvm-project/pull/83049 ___ 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] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/83049 >From fc2e672d474442ef83e90c7a41265d6433651b63 Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Mon, 26 Feb 2024 21:42:24 + Subject: [PATCH 1/3] Refactor option names, and update test Created using spr 1.3.4 --- llvm/lib/Passes/PassBuilderPipelines.cpp| 4 ++-- llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp | 11 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index e48a31f79cc0c5..9f81ff1899ac5f 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -222,8 +222,8 @@ static cl::opt EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -static cl::opt -OptSizeDFAJumpThreading("optsize-dfa-jump-thread", +extern cl::opt +OptSizeDFAJumpThreading("dfa-jump-thread-optsize", cl::desc("Enable DFA jump threading when optimizing for size"), cl::init(false), cl::Hidden); diff --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp index 9156d756310d14..ce5e823e531e0f 100644 --- a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp @@ -110,11 +110,10 @@ static cl::opt cl::desc("Maximum cost accepted for the transformation"), cl::Hidden, cl::init(50)); -static cl::opt -IgnoreOptSize("dfa-jump-ignore-optsize", -cl::desc("Enable dfa jump threading, even when optimizing for size"), -cl::Hidden, cl::init(false)); - +static cl::opt DFAJumpThreadIgnoreOptSize( +"dfa-jump-ignore-optsize", +cl::desc("Enable dfa jump threading, even when optimizing for size"), +cl::Hidden, cl::init(false)); namespace { @@ -1250,7 +1249,7 @@ struct TransformDFA { bool DFAJumpThreading::run(Function &F) { LLVM_DEBUG(dbgs() << "\nDFA Jump threading: " << F.getName() << "\n"); - if (!IgnoreOptSize && F.hasOptSize()) { + if (!DFAJumpThreadIgnoreOptSize && F.hasOptSize()) { LLVM_DEBUG(dbgs() << "Skipping due to the 'minsize' attribute\n"); return false; } >From ffaa39b064da4d99e1834102ddbb38f0780e4ae7 Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Mon, 26 Feb 2024 21:55:44 + Subject: [PATCH 2/3] Make variable static + rename Created using spr 1.3.4 --- llvm/lib/Passes/PassBuilderPipelines.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index 9f81ff1899ac5f..a4db4614c6f830 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -222,8 +222,8 @@ static cl::opt EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -extern cl::opt -OptSizeDFAJumpThreading("dfa-jump-thread-optsize", +static cl::opt +DFAJumpThreadingOptSize("dfa-jump-thread-optsize", cl::desc("Enable DFA jump threading when optimizing for size"), cl::init(false), cl::Hidden); @@ -723,7 +723,7 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level, // Re-consider control flow based optimizations after redundancy elimination, // redo DCE, etc. if (EnableDFAJumpThreading && - ((Level.getSizeLevel() == 0) || OptSizeDFAJumpThreading)) + ((Level.getSizeLevel() == 0) || DFAJumpThreadingOptSize)) FPM.addPass(DFAJumpThreadingPass()); FPM.addPass(JumpThreadingPass()); >From 72ecbcc68501c976b3277b28edc6aeafff9f4dad Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Wed, 28 Feb 2024 00:22:40 + Subject: [PATCH 3/3] Fix missing match in test, due to a deleted line Created using spr 1.3.4 --- llvm/test/Transforms/DFAJumpThreading/negative.ll | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/test/Transforms/DFAJumpThreading/negative.ll b/llvm/test/Transforms/DFAJumpThreading/negative.ll index cce6cc887ff206..c822b6613f7334 100644 --- a/llvm/test/Transforms/DFAJumpThreading/negative.ll +++ b/llvm/test/Transforms/DFAJumpThreading/negative.ll @@ -188,6 +188,7 @@ define i32 @negative5(i32 %num) minsize { ; CHECK-NEXT:ret i32 0 ; ; IGNORESIZE-LABEL: define i32 @negative5( +; IGNORESIZE-SAME: i32 [[NUM:%.*]]) #[[ATTR0:[0-9]+]] { ; IGNORESIZE-NEXT: entry: ; IGNORESIZE-NEXT:br label [[FOR_BODY:%.*]] ; IGNORESIZE: for.body: ___ 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] Remove pipeline checks for optsize for DFAJumpThreadingPass (PR #83188)
https://github.com/ilovepi closed https://github.com/llvm/llvm-project/pull/83188 ___ 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] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
https://github.com/ilovepi ready_for_review https://github.com/llvm/llvm-project/pull/83049 ___ 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] Remove pipeline checks for optsize for DFAJumpThreadingPass (PR #83188)
ilovepi wrote: huh, not sure why spr merged this into a branch, but I'll need to fix that. https://github.com/llvm/llvm-project/pull/83188 ___ 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] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
ilovepi wrote: > Can we have a more principled approach to determine when to allow this pass > to run than a `cl::opt`? For example, change the `CostThreshold` in the pass > depending on whether or not the function has `optsize`. So, I've experimented with this, and I'm not sure this is the right approach to take right away. I think its premature to suppose that at `-Oz` we would ever want this pass on by default. I don't think its a good idea to try and guess what the threshold should be. Likely, that is something specific targets would need to tune on their own via `-dfa-cost-threshold=`. I don't see a better way to allow us to experiment with this, than adding this flag, which is simple(allow the pass w/ optsize), and we can still use `-dfa-cost-threshold=` to determine what we should choose. I'd like to avoid running afoul of this pass being on by default in the future for size optimized targets when we're still in the experimental stage of evaluating this passes usefulness when combined with size optimizations. I agree that if we believe this is a good default in the future, we should adjust the logic to modify the threshold for optsize, but right now I don't have confidence that is the correct way forward. I'm looking to see if there is a way to use -enable-dfa-jump-threading to control this behavior, instead of introducing a new cl::opt. https://github.com/llvm/llvm-project/pull/83049 ___ 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] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/83049 >From fc2e672d474442ef83e90c7a41265d6433651b63 Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Mon, 26 Feb 2024 21:42:24 + Subject: [PATCH 1/3] Refactor option names, and update test Created using spr 1.3.4 --- llvm/lib/Passes/PassBuilderPipelines.cpp| 4 ++-- llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp | 11 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index e48a31f79cc0c5..9f81ff1899ac5f 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -222,8 +222,8 @@ static cl::opt EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -static cl::opt -OptSizeDFAJumpThreading("optsize-dfa-jump-thread", +extern cl::opt +OptSizeDFAJumpThreading("dfa-jump-thread-optsize", cl::desc("Enable DFA jump threading when optimizing for size"), cl::init(false), cl::Hidden); diff --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp index 9156d756310d14..ce5e823e531e0f 100644 --- a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp @@ -110,11 +110,10 @@ static cl::opt cl::desc("Maximum cost accepted for the transformation"), cl::Hidden, cl::init(50)); -static cl::opt -IgnoreOptSize("dfa-jump-ignore-optsize", -cl::desc("Enable dfa jump threading, even when optimizing for size"), -cl::Hidden, cl::init(false)); - +static cl::opt DFAJumpThreadIgnoreOptSize( +"dfa-jump-ignore-optsize", +cl::desc("Enable dfa jump threading, even when optimizing for size"), +cl::Hidden, cl::init(false)); namespace { @@ -1250,7 +1249,7 @@ struct TransformDFA { bool DFAJumpThreading::run(Function &F) { LLVM_DEBUG(dbgs() << "\nDFA Jump threading: " << F.getName() << "\n"); - if (!IgnoreOptSize && F.hasOptSize()) { + if (!DFAJumpThreadIgnoreOptSize && F.hasOptSize()) { LLVM_DEBUG(dbgs() << "Skipping due to the 'minsize' attribute\n"); return false; } >From ffaa39b064da4d99e1834102ddbb38f0780e4ae7 Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Mon, 26 Feb 2024 21:55:44 + Subject: [PATCH 2/3] Make variable static + rename Created using spr 1.3.4 --- llvm/lib/Passes/PassBuilderPipelines.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index 9f81ff1899ac5f..a4db4614c6f830 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -222,8 +222,8 @@ static cl::opt EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -extern cl::opt -OptSizeDFAJumpThreading("dfa-jump-thread-optsize", +static cl::opt +DFAJumpThreadingOptSize("dfa-jump-thread-optsize", cl::desc("Enable DFA jump threading when optimizing for size"), cl::init(false), cl::Hidden); @@ -723,7 +723,7 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level, // Re-consider control flow based optimizations after redundancy elimination, // redo DCE, etc. if (EnableDFAJumpThreading && - ((Level.getSizeLevel() == 0) || OptSizeDFAJumpThreading)) + ((Level.getSizeLevel() == 0) || DFAJumpThreadingOptSize)) FPM.addPass(DFAJumpThreadingPass()); FPM.addPass(JumpThreadingPass()); >From 72ecbcc68501c976b3277b28edc6aeafff9f4dad Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Wed, 28 Feb 2024 00:22:40 + Subject: [PATCH 3/3] Fix missing match in test, due to a deleted line Created using spr 1.3.4 --- llvm/test/Transforms/DFAJumpThreading/negative.ll | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/test/Transforms/DFAJumpThreading/negative.ll b/llvm/test/Transforms/DFAJumpThreading/negative.ll index cce6cc887ff206..c822b6613f7334 100644 --- a/llvm/test/Transforms/DFAJumpThreading/negative.ll +++ b/llvm/test/Transforms/DFAJumpThreading/negative.ll @@ -188,6 +188,7 @@ define i32 @negative5(i32 %num) minsize { ; CHECK-NEXT:ret i32 0 ; ; IGNORESIZE-LABEL: define i32 @negative5( +; IGNORESIZE-SAME: i32 [[NUM:%.*]]) #[[ATTR0:[0-9]+]] { ; IGNORESIZE-NEXT: entry: ; IGNORESIZE-NEXT:br label [[FOR_BODY:%.*]] ; IGNORESIZE: for.body: ___ 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] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
https://github.com/ilovepi edited https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits