[llvm-branch-commits] [libc] [libc][math][c23] Add log2f16 C23 math function (PR #106084)
https://github.com/overmighty updated https://github.com/llvm/llvm-project/pull/106084 >From 9040e13d634e265f0dfda9dda3947fc40d0fd5f0 Mon Sep 17 00:00:00 2001 From: OverMighty Date: Mon, 26 Aug 2024 16:36:19 +0200 Subject: [PATCH 1/3] [libc][math][c23] Add log2f16 C23 math function Part of #95250. --- libc/config/gpu/entrypoints.txt | 1 + libc/config/linux/x86_64/entrypoints.txt | 1 + libc/docs/math/index.rst | 2 +- libc/spec/stdc.td | 1 + libc/src/math/CMakeLists.txt | 1 + libc/src/math/generic/CMakeLists.txt | 21 libc/src/math/generic/expxf16.h | 14 +++ libc/src/math/generic/log2f16.cpp | 147 ++ libc/src/math/log2f16.h | 21 libc/test/src/math/CMakeLists.txt | 11 ++ libc/test/src/math/log2f16_test.cpp | 40 ++ libc/test/src/math/smoke/CMakeLists.txt | 12 ++ libc/test/src/math/smoke/log2f16_test.cpp | 47 +++ 13 files changed, 318 insertions(+), 1 deletion(-) create mode 100644 libc/src/math/generic/log2f16.cpp create mode 100644 libc/src/math/log2f16.h create mode 100644 libc/test/src/math/log2f16_test.cpp create mode 100644 libc/test/src/math/smoke/log2f16_test.cpp diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt index d9df737efea3d7..2cc54e8a4b970c 100644 --- a/libc/config/gpu/entrypoints.txt +++ b/libc/config/gpu/entrypoints.txt @@ -567,6 +567,7 @@ if(LIBC_TYPES_HAS_FLOAT16) libc.src.math.llogbf16 libc.src.math.llrintf16 libc.src.math.llroundf16 +libc.src.math.log2f16 libc.src.math.logbf16 libc.src.math.logf16 libc.src.math.lrintf16 diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt index 9969152982fbb0..edde190a90c61d 100644 --- a/libc/config/linux/x86_64/entrypoints.txt +++ b/libc/config/linux/x86_64/entrypoints.txt @@ -660,6 +660,7 @@ if(LIBC_TYPES_HAS_FLOAT16) libc.src.math.llogbf16 libc.src.math.llrintf16 libc.src.math.llroundf16 +libc.src.math.log2f16 libc.src.math.logbf16 libc.src.math.logf16 libc.src.math.lrintf16 diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst index ea3034cbef3f81..406ca05f74f35c 100644 --- a/libc/docs/math/index.rst +++ b/libc/docs/math/index.rst @@ -318,7 +318,7 @@ Higher Math Functions +---+--+-++--++++ | log1p | |check| | |check| || || 7.12.6.14 | F.10.3.14 | +---+--+-++--++++ -| log2 | |check| | |check| || || 7.12.6.15 | F.10.3.15 | +| log2 | |check| | |check| || |check| || 7.12.6.15 | F.10.3.15 | +---+--+-++--++++ | log2p1| | || || 7.12.6.16 | F.10.3.16 | +---+--+-++--++++ diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td index cc49835ac7e125..d2a073847503ef 100644 --- a/libc/spec/stdc.td +++ b/libc/spec/stdc.td @@ -648,6 +648,7 @@ def StdC : StandardSpec<"stdc"> { FunctionSpec<"log2", RetValSpec, [ArgSpec]>, FunctionSpec<"log2f", RetValSpec, [ArgSpec]>, + GuardedFunctionSpec<"log2f16", RetValSpec, [ArgSpec], "LIBC_TYPES_HAS_FLOAT16">, FunctionSpec<"log", RetValSpec, [ArgSpec]>, FunctionSpec<"logf", RetValSpec, [ArgSpec]>, diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt index 4642b294262752..0ba1d33c6cbe9b 100644 --- a/libc/src/math/CMakeLists.txt +++ b/libc/src/math/CMakeLists.txt @@ -340,6 +340,7 @@ add_math_entrypoint_object(log1pf) add_math_entrypoint_object(log2) add_math_entrypoint_object(log2f) +add_math_entrypoint_object(log2f16) add_math_entrypoint_object(log) add_math_entrypoint_object(logf) diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt index 4e90f7208a51ac..0bde9ff12a4588 100644 --- a/libc/src/math/generic/CMakeLists.txt +++ b/libc/src/math/generi
[llvm-branch-commits] [flang] [Flang] Split runtime headers in preparation for cross-compilation. NFC. (PR #112188)
@@ -0,0 +1,73 @@ +//===-- include/flang/Runtime/descriptor-consts.h ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef FORTRAN_RUNTIME_DESCRIPTOR_CONSTS_H_ +#define FORTRAN_RUNTIME_DESCRIPTOR_CONSTS_H_ + +#include "flang/Common/api-attrs.h" +#include "flang/ISO_Fortran_binding_wrapper.h" +#include +#include + +// Value of the addendum presence flag. +#define _CFI_ADDENDUM_FLAG 1 +// Number of bits needed to be shifted when manipulating the allocator index. +#define _CFI_ALLOCATOR_IDX_SHIFT 1 +// Allocator index mask. +#define _CFI_ALLOCATOR_IDX_MASK 0b1110 clementval wrote: Why are you moving these? They are only used in the file where they were previously defined. https://github.com/llvm/llvm-project/pull/112188 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] [libcxxabi] release/19.x: [libc++] Avoid re-exporting a few specific symbols from libc++abi (#109054) (PR #110677)
ldionne wrote: > Can someone post this as a breaking change to the discourse so that I can > link it from the release notes? https://discourse.llvm.org/t/libc-llvm-19-1-2-removal-of-some-libc-abi-re-exported-symbols-on-apple-platforms/82551 (Still being moderated) https://github.com/llvm/llvm-project/pull/110677 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/19.x: [Clang] Instantiate Typedefs referenced by type alias deduction guides (#111804) (PR #112293)
https://github.com/erichkeane approved this pull request. Should be small enough, and I think it fixes a couple of nice pain points. https://github.com/llvm/llvm-project/pull/112293 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][math][c23] Add sinhf16 and coshf16 C23 math functions (PR #105947)
https://github.com/overmighty updated https://github.com/llvm/llvm-project/pull/105947 >From f0162048fbcff1a4f24c8072c5af49bdaa08d1d8 Mon Sep 17 00:00:00 2001 From: OverMighty Date: Sat, 24 Aug 2024 18:02:51 +0200 Subject: [PATCH 1/2] [libc][math][c23] Add sinhf16 and coshf16 C23 math functions Part of #95250. --- libc/config/gpu/entrypoints.txt | 2 + libc/config/linux/x86_64/entrypoints.txt | 2 + libc/docs/math/index.rst | 4 +- libc/spec/stdc.td | 4 + libc/src/math/CMakeLists.txt | 4 + libc/src/math/coshf16.h | 21 libc/src/math/generic/CMakeLists.txt | 38 ++ libc/src/math/generic/coshf16.cpp | 103 libc/src/math/generic/expxf16.h | 113 + libc/src/math/generic/sinhf16.cpp | 144 ++ libc/src/math/sinhf16.h | 21 libc/test/src/math/CMakeLists.txt | 22 libc/test/src/math/coshf16_test.cpp | 40 ++ libc/test/src/math/sinhf16_test.cpp | 40 ++ libc/test/src/math/smoke/CMakeLists.txt | 24 libc/test/src/math/smoke/coshf16_test.cpp | 89 + libc/test/src/math/smoke/sinhf16_test.cpp | 87 + 17 files changed, 756 insertions(+), 2 deletions(-) create mode 100644 libc/src/math/coshf16.h create mode 100644 libc/src/math/generic/coshf16.cpp create mode 100644 libc/src/math/generic/sinhf16.cpp create mode 100644 libc/src/math/sinhf16.h create mode 100644 libc/test/src/math/coshf16_test.cpp create mode 100644 libc/test/src/math/sinhf16_test.cpp create mode 100644 libc/test/src/math/smoke/coshf16_test.cpp create mode 100644 libc/test/src/math/smoke/sinhf16_test.cpp diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt index 251ad43ece8d05..4bb81f5d3b2de1 100644 --- a/libc/config/gpu/entrypoints.txt +++ b/libc/config/gpu/entrypoints.txt @@ -521,6 +521,7 @@ if(LIBC_TYPES_HAS_FLOAT16) libc.src.math.canonicalizef16 libc.src.math.ceilf16 libc.src.math.copysignf16 +libc.src.math.coshf16 libc.src.math.exp10f16 libc.src.math.exp10m1f16 libc.src.math.exp2f16 @@ -585,6 +586,7 @@ if(LIBC_TYPES_HAS_FLOAT16) libc.src.math.scalbnf16 libc.src.math.setpayloadf16 libc.src.math.setpayloadsigf16 +libc.src.math.sinhf16 libc.src.math.totalorderf16 libc.src.math.totalordermagf16 libc.src.math.truncf16 diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt index 59ccdc51240f84..a8988336cb44fc 100644 --- a/libc/config/linux/x86_64/entrypoints.txt +++ b/libc/config/linux/x86_64/entrypoints.txt @@ -610,6 +610,7 @@ if(LIBC_TYPES_HAS_FLOAT16) libc.src.math.canonicalizef16 libc.src.math.ceilf16 libc.src.math.copysignf16 +libc.src.math.coshf16 libc.src.math.exp10f16 libc.src.math.exp10m1f16 libc.src.math.exp2f16 @@ -678,6 +679,7 @@ if(LIBC_TYPES_HAS_FLOAT16) libc.src.math.scalbnf16 libc.src.math.setpayloadf16 libc.src.math.setpayloadsigf16 +libc.src.math.sinhf16 libc.src.math.totalorderf16 libc.src.math.totalordermagf16 libc.src.math.truncf16 diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst index 3d6dd8c0035ead..29a0e6e29d8612 100644 --- a/libc/docs/math/index.rst +++ b/libc/docs/math/index.rst @@ -278,7 +278,7 @@ Higher Math Functions +---+--+-++--++++ | cos | |check| | |check| || || 7.12.4.5 | F.10.1.5 | +---+--+-++--++++ -| cosh | |check| | || || 7.12.5.4 | F.10.2.4 | +| cosh | |check| | || |check| || 7.12.5.4 | F.10.2.4 | +---+--+-++--++++ | cospi | |check| | || || 7.12.4.12 | F.10.1.12 | +---+--+-++--++++ @@ -340,7 +340,7 @@ Higher Math Functions +---+--+--
[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port machine trace metrics analysis to new pass manager. (PR #108507)
https://github.com/arsenm approved this pull request. https://github.com/llvm/llvm-project/pull/108507 ___ 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] [CodeGen][NewPM] Port machine trace metrics analysis to new pass manager. (PR #108507)
@@ -395,37 +414,52 @@ MachineTraceMetrics::Ensemble * MachineTraceMetrics::getEnsemble(MachineTraceStrategy strategy) { assert(strategy < MachineTraceStrategy::TS_NumStrategies && "Invalid trace strategy enum"); - Ensemble *&E = Ensembles[static_cast(strategy)]; + std::unique_ptr &E = + Ensembles[static_cast(strategy)]; if (E) -return E; +return E.get(); // Allocate new Ensemble on demand. switch (strategy) { case MachineTraceStrategy::TS_MinInstrCount: -return (E = new MinInstrCountEnsemble(this)); +E = std::make_unique(MinInstrCountEnsemble(this)); +break; case MachineTraceStrategy::TS_Local: -return (E = new LocalEnsemble(this)); +E = std::make_unique(LocalEnsemble(this)); +break; default: llvm_unreachable("Invalid trace strategy enum"); } + return E.get(); } void MachineTraceMetrics::invalidate(const MachineBasicBlock *MBB) { LLVM_DEBUG(dbgs() << "Invalidate traces through " << printMBBReference(*MBB) << '\n'); BlockInfo[MBB->getNumber()].invalidate(); - for (Ensemble *E : Ensembles) + for (auto &E : Ensembles) if (E) - E->invalidate(MBB); + E.get()->invalidate(MBB); +} + +bool MachineTraceMetrics::invalidate( +MachineFunction &, const PreservedAnalyses &PA, +MachineFunctionAnalysisManager::Invalidator &) { + // Check whether the analysis, all analyses on machine functions, or the + // machine function's CFG have been preserved. + auto PAC = PA.getChecker(); + return !PAC.preserved() && + !PAC.preservedSet>() && + !PAC.preservedSet(); } void MachineTraceMetrics::verifyAnalysis() const { if (!MF) return; #ifndef NDEBUG assert(BlockInfo.size() == MF->getNumBlockIDs() && "Outdated BlockInfo size"); - for (Ensemble *E : Ensembles) + for (auto &E : Ensembles) if (E) - E->verify(); + E.get()->verify(); arsenm wrote: Shouldn't need .get https://github.com/llvm/llvm-project/pull/108507 ___ 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] [CodeGen][NewPM] Port EarlyIfConversion pass to NPM. (PR #108508)
https://github.com/arsenm approved this pull request. https://github.com/llvm/llvm-project/pull/108508 ___ 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] [CodeGen][NewPM] Port machine trace metrics analysis to new pass manager. (PR #108507)
https://github.com/cdevadas updated https://github.com/llvm/llvm-project/pull/108507 >From e0e4e978c06a2c78b31382274527201e03082e00 Mon Sep 17 00:00:00 2001 From: Christudasan Devadasan Date: Thu, 12 Sep 2024 23:38:09 +0530 Subject: [PATCH 1/3] [CodeGen][NewPM] Port machine trace metrics analysis to new pass manager. --- .../llvm/CodeGen/MachineTraceMetrics.h| 58 ++--- llvm/include/llvm/InitializePasses.h | 2 +- .../llvm/Passes/MachinePassRegistry.def | 4 +- llvm/lib/CodeGen/EarlyIfConversion.cpp| 8 +-- llvm/lib/CodeGen/MachineCombiner.cpp | 8 +-- llvm/lib/CodeGen/MachineTraceMetrics.cpp | 62 +++ llvm/lib/Passes/PassBuilder.cpp | 1 + .../AArch64/AArch64ConditionalCompares.cpp| 8 +-- .../AArch64/AArch64StorePairSuppress.cpp | 6 +- 9 files changed, 119 insertions(+), 38 deletions(-) diff --git a/llvm/include/llvm/CodeGen/MachineTraceMetrics.h b/llvm/include/llvm/CodeGen/MachineTraceMetrics.h index c7d97597d551cd..36718f80a1b6dd 100644 --- a/llvm/include/llvm/CodeGen/MachineTraceMetrics.h +++ b/llvm/include/llvm/CodeGen/MachineTraceMetrics.h @@ -46,12 +46,13 @@ #ifndef LLVM_CODEGEN_MACHINETRACEMETRICS_H #define LLVM_CODEGEN_MACHINETRACEMETRICS_H -#include "llvm/ADT/SparseSet.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/SparseSet.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachinePassManager.h" #include "llvm/CodeGen/TargetSchedule.h" namespace llvm { @@ -93,7 +94,7 @@ enum class MachineTraceStrategy { TS_NumStrategies }; -class MachineTraceMetrics : public MachineFunctionPass { +class MachineTraceMetrics { const MachineFunction *MF = nullptr; const TargetInstrInfo *TII = nullptr; const TargetRegisterInfo *TRI = nullptr; @@ -102,19 +103,22 @@ class MachineTraceMetrics : public MachineFunctionPass { TargetSchedModel SchedModel; public: + friend class MachineTraceMetricsWrapperPass; friend class Ensemble; friend class Trace; class Ensemble; - static char ID; + // For legacy pass. + MachineTraceMetrics() { +std::fill(std::begin(Ensembles), std::end(Ensembles), nullptr); + } - MachineTraceMetrics(); + explicit MachineTraceMetrics(MachineFunction &MF, const MachineLoopInfo &LI); + ~MachineTraceMetrics(); - void getAnalysisUsage(AnalysisUsage&) const override; - bool runOnMachineFunction(MachineFunction&) override; - void releaseMemory() override; - void verifyAnalysis() const override; + void init(MachineFunction &Func, const MachineLoopInfo &LI); + void clear(); /// Per-basic block information that doesn't depend on the trace through the /// block. @@ -400,6 +404,12 @@ class MachineTraceMetrics : public MachineFunctionPass { /// Call Ensemble::getTrace() again to update any trace handles. void invalidate(const MachineBasicBlock *MBB); + /// Handle invalidation explicitly. + bool invalidate(MachineFunction &, const PreservedAnalyses &PA, + MachineFunctionAnalysisManager::Invalidator &); + + void verifyAnalysis() const; + private: // One entry per basic block, indexed by block number. SmallVector BlockInfo; @@ -435,6 +445,38 @@ inline raw_ostream &operator<<(raw_ostream &OS, return OS; } +class MachineTraceMetricsAnalysis +: public AnalysisInfoMixin { + friend AnalysisInfoMixin; + static AnalysisKey Key; + +public: + using Result = MachineTraceMetrics; + Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM); +}; + +/// Verifier pass for \c MachineTraceMetrics. +struct MachineTraceMetricsVerifierPass +: PassInfoMixin { + PreservedAnalyses run(MachineFunction &MF, +MachineFunctionAnalysisManager &MFAM); + static bool isRequired() { return true; } +}; + +class MachineTraceMetricsWrapperPass : public MachineFunctionPass { +public: + static char ID; + MachineTraceMetrics MTM; + + MachineTraceMetricsWrapperPass(); + + void getAnalysisUsage(AnalysisUsage &) const override; + bool runOnMachineFunction(MachineFunction &) override; + void releaseMemory() override { MTM.clear(); } + void verifyAnalysis() const override { MTM.verifyAnalysis(); } + MachineTraceMetrics &getMTM() { return MTM; } +}; + } // end namespace llvm #endif // LLVM_CODEGEN_MACHINETRACEMETRICS_H diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h index 6a75dc0285cc61..5ed0ad98a2a72d 100644 --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -209,7 +209,7 @@ void initializeMachineRegionInfoPassPass(PassRegistry &); void initializeMachineSanitizerBinaryMetadataPass(PassRegistry &); void initializeMachineSchedulerPass(PassRegistry &); void initializeMachineSinkingPass(PassRegistry &); -void initializeMachineTraceMetricsPass(PassRegistry &);
[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port machine trace metrics analysis to new pass manager. (PR #108507)
https://github.com/cdevadas updated https://github.com/llvm/llvm-project/pull/108507 >From e0e4e978c06a2c78b31382274527201e03082e00 Mon Sep 17 00:00:00 2001 From: Christudasan Devadasan Date: Thu, 12 Sep 2024 23:38:09 +0530 Subject: [PATCH 1/3] [CodeGen][NewPM] Port machine trace metrics analysis to new pass manager. --- .../llvm/CodeGen/MachineTraceMetrics.h| 58 ++--- llvm/include/llvm/InitializePasses.h | 2 +- .../llvm/Passes/MachinePassRegistry.def | 4 +- llvm/lib/CodeGen/EarlyIfConversion.cpp| 8 +-- llvm/lib/CodeGen/MachineCombiner.cpp | 8 +-- llvm/lib/CodeGen/MachineTraceMetrics.cpp | 62 +++ llvm/lib/Passes/PassBuilder.cpp | 1 + .../AArch64/AArch64ConditionalCompares.cpp| 8 +-- .../AArch64/AArch64StorePairSuppress.cpp | 6 +- 9 files changed, 119 insertions(+), 38 deletions(-) diff --git a/llvm/include/llvm/CodeGen/MachineTraceMetrics.h b/llvm/include/llvm/CodeGen/MachineTraceMetrics.h index c7d97597d551cd..36718f80a1b6dd 100644 --- a/llvm/include/llvm/CodeGen/MachineTraceMetrics.h +++ b/llvm/include/llvm/CodeGen/MachineTraceMetrics.h @@ -46,12 +46,13 @@ #ifndef LLVM_CODEGEN_MACHINETRACEMETRICS_H #define LLVM_CODEGEN_MACHINETRACEMETRICS_H -#include "llvm/ADT/SparseSet.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/SparseSet.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachinePassManager.h" #include "llvm/CodeGen/TargetSchedule.h" namespace llvm { @@ -93,7 +94,7 @@ enum class MachineTraceStrategy { TS_NumStrategies }; -class MachineTraceMetrics : public MachineFunctionPass { +class MachineTraceMetrics { const MachineFunction *MF = nullptr; const TargetInstrInfo *TII = nullptr; const TargetRegisterInfo *TRI = nullptr; @@ -102,19 +103,22 @@ class MachineTraceMetrics : public MachineFunctionPass { TargetSchedModel SchedModel; public: + friend class MachineTraceMetricsWrapperPass; friend class Ensemble; friend class Trace; class Ensemble; - static char ID; + // For legacy pass. + MachineTraceMetrics() { +std::fill(std::begin(Ensembles), std::end(Ensembles), nullptr); + } - MachineTraceMetrics(); + explicit MachineTraceMetrics(MachineFunction &MF, const MachineLoopInfo &LI); + ~MachineTraceMetrics(); - void getAnalysisUsage(AnalysisUsage&) const override; - bool runOnMachineFunction(MachineFunction&) override; - void releaseMemory() override; - void verifyAnalysis() const override; + void init(MachineFunction &Func, const MachineLoopInfo &LI); + void clear(); /// Per-basic block information that doesn't depend on the trace through the /// block. @@ -400,6 +404,12 @@ class MachineTraceMetrics : public MachineFunctionPass { /// Call Ensemble::getTrace() again to update any trace handles. void invalidate(const MachineBasicBlock *MBB); + /// Handle invalidation explicitly. + bool invalidate(MachineFunction &, const PreservedAnalyses &PA, + MachineFunctionAnalysisManager::Invalidator &); + + void verifyAnalysis() const; + private: // One entry per basic block, indexed by block number. SmallVector BlockInfo; @@ -435,6 +445,38 @@ inline raw_ostream &operator<<(raw_ostream &OS, return OS; } +class MachineTraceMetricsAnalysis +: public AnalysisInfoMixin { + friend AnalysisInfoMixin; + static AnalysisKey Key; + +public: + using Result = MachineTraceMetrics; + Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM); +}; + +/// Verifier pass for \c MachineTraceMetrics. +struct MachineTraceMetricsVerifierPass +: PassInfoMixin { + PreservedAnalyses run(MachineFunction &MF, +MachineFunctionAnalysisManager &MFAM); + static bool isRequired() { return true; } +}; + +class MachineTraceMetricsWrapperPass : public MachineFunctionPass { +public: + static char ID; + MachineTraceMetrics MTM; + + MachineTraceMetricsWrapperPass(); + + void getAnalysisUsage(AnalysisUsage &) const override; + bool runOnMachineFunction(MachineFunction &) override; + void releaseMemory() override { MTM.clear(); } + void verifyAnalysis() const override { MTM.verifyAnalysis(); } + MachineTraceMetrics &getMTM() { return MTM; } +}; + } // end namespace llvm #endif // LLVM_CODEGEN_MACHINETRACEMETRICS_H diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h index 6a75dc0285cc61..5ed0ad98a2a72d 100644 --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -209,7 +209,7 @@ void initializeMachineRegionInfoPassPass(PassRegistry &); void initializeMachineSanitizerBinaryMetadataPass(PassRegistry &); void initializeMachineSchedulerPass(PassRegistry &); void initializeMachineSinkingPass(PassRegistry &); -void initializeMachineTraceMetricsPass(PassRegistry &);
[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port EarlyIfConversion pass to NPM. (PR #108508)
https://github.com/cdevadas updated https://github.com/llvm/llvm-project/pull/108508 >From 9f27fd5fbaa0c9a9075d074d1915ea0cc65e3b07 Mon Sep 17 00:00:00 2001 From: Christudasan Devadasan Date: Fri, 13 Sep 2024 12:22:03 +0530 Subject: [PATCH 1/2] [CodeGen][NewPM] Port EarlyIfConversion pass to NPM. --- llvm/include/llvm/CodeGen/EarlyIfConversion.h | 24 ++ llvm/include/llvm/CodeGen/Passes.h| 2 +- llvm/include/llvm/InitializePasses.h | 2 +- llvm/include/llvm/Passes/CodeGenPassBuilder.h | 1 + .../llvm/Passes/MachinePassRegistry.def | 2 +- llvm/lib/CodeGen/CodeGen.cpp | 2 +- llvm/lib/CodeGen/EarlyIfConversion.cpp| 79 ++- llvm/lib/CodeGen/TargetPassConfig.cpp | 4 +- llvm/lib/Passes/PassBuilder.cpp | 1 + .../Target/AArch64/AArch64TargetMachine.cpp | 2 +- .../lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 2 +- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | 2 +- .../Target/SystemZ/SystemZTargetMachine.cpp | 2 +- llvm/lib/Target/X86/X86TargetMachine.cpp | 2 +- .../early-ifcvt-likely-predictable.mir| 1 + .../AArch64/early-ifcvt-regclass-mismatch.mir | 1 + .../AArch64/early-ifcvt-same-value.mir| 1 + .../CodeGen/PowerPC/early-ifcvt-no-isel.mir | 2 + 18 files changed, 102 insertions(+), 30 deletions(-) create mode 100644 llvm/include/llvm/CodeGen/EarlyIfConversion.h diff --git a/llvm/include/llvm/CodeGen/EarlyIfConversion.h b/llvm/include/llvm/CodeGen/EarlyIfConversion.h new file mode 100644 index 00..78bf12ade02c3d --- /dev/null +++ b/llvm/include/llvm/CodeGen/EarlyIfConversion.h @@ -0,0 +1,24 @@ +//===- llvm/CodeGen/EarlyIfConversion.h -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef LLVM_CODEGEN_EARLYIFCONVERSION_H +#define LLVM_CODEGEN_EARLYIFCONVERSION_H + +#include "llvm/CodeGen/MachinePassManager.h" + +namespace llvm { + +class EarlyIfConverterPass : public PassInfoMixin { +public: + PreservedAnalyses run(MachineFunction &MF, +MachineFunctionAnalysisManager &MFAM); +}; + +} // namespace llvm + +#endif // LLVM_CODEGEN_EARLYIFCONVERSION_H diff --git a/llvm/include/llvm/CodeGen/Passes.h b/llvm/include/llvm/CodeGen/Passes.h index 99421bdf769ffa..bbbf99626098a6 100644 --- a/llvm/include/llvm/CodeGen/Passes.h +++ b/llvm/include/llvm/CodeGen/Passes.h @@ -273,7 +273,7 @@ namespace llvm { /// EarlyIfConverter - This pass performs if-conversion on SSA form by /// inserting cmov instructions. - extern char &EarlyIfConverterID; + extern char &EarlyIfConverterLegacyID; /// EarlyIfPredicator - This pass performs if-conversion on SSA form by /// predicating if/else block and insert select at the join point. diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h index 5ed0ad98a2a72d..1374880b6a716b 100644 --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -98,7 +98,7 @@ void initializeDominatorTreeWrapperPassPass(PassRegistry &); void initializeDwarfEHPrepareLegacyPassPass(PassRegistry &); void initializeEarlyCSELegacyPassPass(PassRegistry &); void initializeEarlyCSEMemSSALegacyPassPass(PassRegistry &); -void initializeEarlyIfConverterPass(PassRegistry &); +void initializeEarlyIfConverterLegacyPass(PassRegistry &); void initializeEarlyIfPredicatorPass(PassRegistry &); void initializeEarlyMachineLICMPass(PassRegistry &); void initializeEarlyTailDuplicatePass(PassRegistry &); diff --git a/llvm/include/llvm/Passes/CodeGenPassBuilder.h b/llvm/include/llvm/Passes/CodeGenPassBuilder.h index 0d45df08cb0ca7..9ef6e39dbb1cdd 100644 --- a/llvm/include/llvm/Passes/CodeGenPassBuilder.h +++ b/llvm/include/llvm/Passes/CodeGenPassBuilder.h @@ -27,6 +27,7 @@ #include "llvm/CodeGen/CodeGenPrepare.h" #include "llvm/CodeGen/DeadMachineInstructionElim.h" #include "llvm/CodeGen/DwarfEHPrepare.h" +#include "llvm/CodeGen/EarlyIfConversion.h" #include "llvm/CodeGen/ExpandLargeDivRem.h" #include "llvm/CodeGen/ExpandLargeFpConvert.h" #include "llvm/CodeGen/ExpandMemCmp.h" diff --git a/llvm/include/llvm/Passes/MachinePassRegistry.def b/llvm/include/llvm/Passes/MachinePassRegistry.def index 1d7084354455c7..15c6e2de6488c4 100644 --- a/llvm/include/llvm/Passes/MachinePassRegistry.def +++ b/llvm/include/llvm/Passes/MachinePassRegistry.def @@ -128,6 +128,7 @@ MACHINE_FUNCTION_ANALYSIS("slot-indexes", SlotIndexesAnalysis()) #ifndef MACHINE_FUNCTION_PASS #define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) #endif +MACHINE_FUNCTION_PASS("early-ifcvt", EarlyIfConverterPass()) MACHINE_FUNCTION_PASS("dead-mi-elimination", DeadMachineInstructionElimPass()) MACHINE_FUNCTION_P
[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port EarlyIfConversion pass to NPM. (PR #108508)
https://github.com/cdevadas updated https://github.com/llvm/llvm-project/pull/108508 >From 9f27fd5fbaa0c9a9075d074d1915ea0cc65e3b07 Mon Sep 17 00:00:00 2001 From: Christudasan Devadasan Date: Fri, 13 Sep 2024 12:22:03 +0530 Subject: [PATCH 1/2] [CodeGen][NewPM] Port EarlyIfConversion pass to NPM. --- llvm/include/llvm/CodeGen/EarlyIfConversion.h | 24 ++ llvm/include/llvm/CodeGen/Passes.h| 2 +- llvm/include/llvm/InitializePasses.h | 2 +- llvm/include/llvm/Passes/CodeGenPassBuilder.h | 1 + .../llvm/Passes/MachinePassRegistry.def | 2 +- llvm/lib/CodeGen/CodeGen.cpp | 2 +- llvm/lib/CodeGen/EarlyIfConversion.cpp| 79 ++- llvm/lib/CodeGen/TargetPassConfig.cpp | 4 +- llvm/lib/Passes/PassBuilder.cpp | 1 + .../Target/AArch64/AArch64TargetMachine.cpp | 2 +- .../lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 2 +- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | 2 +- .../Target/SystemZ/SystemZTargetMachine.cpp | 2 +- llvm/lib/Target/X86/X86TargetMachine.cpp | 2 +- .../early-ifcvt-likely-predictable.mir| 1 + .../AArch64/early-ifcvt-regclass-mismatch.mir | 1 + .../AArch64/early-ifcvt-same-value.mir| 1 + .../CodeGen/PowerPC/early-ifcvt-no-isel.mir | 2 + 18 files changed, 102 insertions(+), 30 deletions(-) create mode 100644 llvm/include/llvm/CodeGen/EarlyIfConversion.h diff --git a/llvm/include/llvm/CodeGen/EarlyIfConversion.h b/llvm/include/llvm/CodeGen/EarlyIfConversion.h new file mode 100644 index 00..78bf12ade02c3d --- /dev/null +++ b/llvm/include/llvm/CodeGen/EarlyIfConversion.h @@ -0,0 +1,24 @@ +//===- llvm/CodeGen/EarlyIfConversion.h -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef LLVM_CODEGEN_EARLYIFCONVERSION_H +#define LLVM_CODEGEN_EARLYIFCONVERSION_H + +#include "llvm/CodeGen/MachinePassManager.h" + +namespace llvm { + +class EarlyIfConverterPass : public PassInfoMixin { +public: + PreservedAnalyses run(MachineFunction &MF, +MachineFunctionAnalysisManager &MFAM); +}; + +} // namespace llvm + +#endif // LLVM_CODEGEN_EARLYIFCONVERSION_H diff --git a/llvm/include/llvm/CodeGen/Passes.h b/llvm/include/llvm/CodeGen/Passes.h index 99421bdf769ffa..bbbf99626098a6 100644 --- a/llvm/include/llvm/CodeGen/Passes.h +++ b/llvm/include/llvm/CodeGen/Passes.h @@ -273,7 +273,7 @@ namespace llvm { /// EarlyIfConverter - This pass performs if-conversion on SSA form by /// inserting cmov instructions. - extern char &EarlyIfConverterID; + extern char &EarlyIfConverterLegacyID; /// EarlyIfPredicator - This pass performs if-conversion on SSA form by /// predicating if/else block and insert select at the join point. diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h index 5ed0ad98a2a72d..1374880b6a716b 100644 --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -98,7 +98,7 @@ void initializeDominatorTreeWrapperPassPass(PassRegistry &); void initializeDwarfEHPrepareLegacyPassPass(PassRegistry &); void initializeEarlyCSELegacyPassPass(PassRegistry &); void initializeEarlyCSEMemSSALegacyPassPass(PassRegistry &); -void initializeEarlyIfConverterPass(PassRegistry &); +void initializeEarlyIfConverterLegacyPass(PassRegistry &); void initializeEarlyIfPredicatorPass(PassRegistry &); void initializeEarlyMachineLICMPass(PassRegistry &); void initializeEarlyTailDuplicatePass(PassRegistry &); diff --git a/llvm/include/llvm/Passes/CodeGenPassBuilder.h b/llvm/include/llvm/Passes/CodeGenPassBuilder.h index 0d45df08cb0ca7..9ef6e39dbb1cdd 100644 --- a/llvm/include/llvm/Passes/CodeGenPassBuilder.h +++ b/llvm/include/llvm/Passes/CodeGenPassBuilder.h @@ -27,6 +27,7 @@ #include "llvm/CodeGen/CodeGenPrepare.h" #include "llvm/CodeGen/DeadMachineInstructionElim.h" #include "llvm/CodeGen/DwarfEHPrepare.h" +#include "llvm/CodeGen/EarlyIfConversion.h" #include "llvm/CodeGen/ExpandLargeDivRem.h" #include "llvm/CodeGen/ExpandLargeFpConvert.h" #include "llvm/CodeGen/ExpandMemCmp.h" diff --git a/llvm/include/llvm/Passes/MachinePassRegistry.def b/llvm/include/llvm/Passes/MachinePassRegistry.def index 1d7084354455c7..15c6e2de6488c4 100644 --- a/llvm/include/llvm/Passes/MachinePassRegistry.def +++ b/llvm/include/llvm/Passes/MachinePassRegistry.def @@ -128,6 +128,7 @@ MACHINE_FUNCTION_ANALYSIS("slot-indexes", SlotIndexesAnalysis()) #ifndef MACHINE_FUNCTION_PASS #define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) #endif +MACHINE_FUNCTION_PASS("early-ifcvt", EarlyIfConverterPass()) MACHINE_FUNCTION_PASS("dead-mi-elimination", DeadMachineInstructionElimPass()) MACHINE_FUNCTION_P
[llvm-branch-commits] [llvm] [AMDGPU][NewPM] Fill out addILPOpts. (PR #108514)
https://github.com/cdevadas updated https://github.com/llvm/llvm-project/pull/108514 >From 10462c6c2e6b087575d1f8f0c94c38ddebb013a9 Mon Sep 17 00:00:00 2001 From: Christudasan Devadasan Date: Fri, 13 Sep 2024 13:53:01 +0530 Subject: [PATCH] [AMDGPU][NewPM] Fill out addILPOpts. --- llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 7 +++ llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h | 1 + 2 files changed, 8 insertions(+) diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp index 8a3c1a92a63a2d..affb8a2654c1ab 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp @@ -1994,6 +1994,13 @@ void AMDGPUCodeGenPassBuilder::addPreISel(AddIRPass &addPass) const { addPass(RequireAnalysisPass()); } +void AMDGPUCodeGenPassBuilder::addILPOpts(AddMachinePass &addPass) const { + if (EnableEarlyIfConversion) +addPass(EarlyIfConverterPass()); + + Base::addILPOpts(addPass); +} + void AMDGPUCodeGenPassBuilder::addAsmPrinter(AddMachinePass &addPass, CreateMCStreamer) const { // TODO: Add AsmPrinter. diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h index af8476bc21ec61..d8a5111e5898d7 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h @@ -172,6 +172,7 @@ class AMDGPUCodeGenPassBuilder void addIRPasses(AddIRPass &) const; void addCodeGenPrepare(AddIRPass &) const; void addPreISel(AddIRPass &addPass) const; + void addILPOpts(AddMachinePass &) const; void addAsmPrinter(AddMachinePass &, CreateMCStreamer) const; Error addInstSelector(AddMachinePass &) const; void addMachineSSAOptimization(AddMachinePass &) const; ___ 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] 7ba7d8e - [clang-repl] [codegen] Reduce the state in TBAA. NFC for static compilation. (#98138)
Author: Vassil Vassilev Date: 2024-10-15T10:17:37+02:00 New Revision: 7ba7d8e2f7b6445b60679da826210cdde29eaf8b URL: https://github.com/llvm/llvm-project/commit/7ba7d8e2f7b6445b60679da826210cdde29eaf8b DIFF: https://github.com/llvm/llvm-project/commit/7ba7d8e2f7b6445b60679da826210cdde29eaf8b.diff LOG: [clang-repl] [codegen] Reduce the state in TBAA. NFC for static compilation. (#98138) In incremental compilation clang works with multiple `llvm::Module`s. Our current approach is to create a CodeGenModule entity for every new module request (via StartModule). However, some of the state such as the mangle context needs to be preserved to keep the original semantics in the ever-growing TU. Fixes: llvm/llvm-project#95581. cc: @jeaye (cherry picked from commit 6c62ad446b2441b78ae524d9e700e351d5a76394) Added: clang/test/Interpreter/assigment-with-implicit-ctor.cpp Modified: clang/lib/CodeGen/CGCall.cpp clang/lib/CodeGen/CGClass.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/CodeGenModule.h clang/lib/CodeGen/CodeGenTBAA.cpp clang/lib/CodeGen/CodeGenTBAA.h clang/lib/CodeGen/CodeGenTypes.cpp clang/lib/CodeGen/CodeGenTypes.h clang/lib/CodeGen/MicrosoftCXXABI.cpp Removed: diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index d7ebffa8c5e4e0..0416fa03d749a5 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -314,7 +314,8 @@ CodeGenTypes::arrangeCXXMethodDeclaration(const CXXMethodDecl *MD) { if (MD->isImplicitObjectMemberFunction()) { // The abstract case is perfectly fine. -const CXXRecordDecl *ThisType = TheCXXABI.getThisArgumentTypeForMethod(MD); +const CXXRecordDecl *ThisType = +getCXXABI().getThisArgumentTypeForMethod(MD); return arrangeCXXMethodType(ThisType, prototype.getTypePtr(), MD); } @@ -337,7 +338,7 @@ CodeGenTypes::arrangeCXXStructorDeclaration(GlobalDecl GD) { SmallVector argTypes; SmallVector paramInfos; - const CXXRecordDecl *ThisType = TheCXXABI.getThisArgumentTypeForMethod(GD); + const CXXRecordDecl *ThisType = getCXXABI().getThisArgumentTypeForMethod(GD); argTypes.push_back(DeriveThisType(ThisType, MD)); bool PassParams = true; @@ -356,7 +357,7 @@ CodeGenTypes::arrangeCXXStructorDeclaration(GlobalDecl GD) { appendParameterTypes(*this, argTypes, paramInfos, FTP); CGCXXABI::AddedStructorArgCounts AddedArgs = - TheCXXABI.buildStructorSignature(GD, argTypes); + getCXXABI().buildStructorSignature(GD, argTypes); if (!paramInfos.empty()) { // Note: prefix implies after the first param. if (AddedArgs.Prefix) @@ -372,11 +373,10 @@ CodeGenTypes::arrangeCXXStructorDeclaration(GlobalDecl GD) { : RequiredArgs::All); FunctionType::ExtInfo extInfo = FTP->getExtInfo(); - CanQualType resultType = TheCXXABI.HasThisReturn(GD) - ? argTypes.front() - : TheCXXABI.hasMostDerivedReturn(GD) - ? CGM.getContext().VoidPtrTy - : Context.VoidTy; + CanQualType resultType = getCXXABI().HasThisReturn(GD) ? argTypes.front() + : getCXXABI().hasMostDerivedReturn(GD) + ? CGM.getContext().VoidPtrTy + : Context.VoidTy; return arrangeLLVMFunctionInfo(resultType, FnInfoOpts::IsInstanceMethod, argTypes, extInfo, paramInfos, required); } @@ -437,11 +437,10 @@ CodeGenTypes::arrangeCXXConstructorCall(const CallArgList &args, : RequiredArgs::All; GlobalDecl GD(D, CtorKind); - CanQualType ResultType = TheCXXABI.HasThisReturn(GD) - ? ArgTypes.front() - : TheCXXABI.hasMostDerivedReturn(GD) - ? CGM.getContext().VoidPtrTy - : Context.VoidTy; + CanQualType ResultType = getCXXABI().HasThisReturn(GD) ? ArgTypes.front() + : getCXXABI().hasMostDerivedReturn(GD) + ? CGM.getContext().VoidPtrTy + : Context.VoidTy; FunctionType::ExtInfo Info = FPT->getExtInfo(); llvm::SmallVector ParamInfos; @@ -806,7 +805,7 @@ const CGFunctionInfo &CodeGenTypes::arrangeLLVMFunctionInfo( } else if (info.getCC() == CC_Swift || info.getCC() == CC_SwiftAsync) { swiftcall::computeABIInfo(CGM, *FI); } else { -getABIInfo().computeInfo(*FI); +CGM.getABIInfo().computeInfo(*FI); } // Loop over all of the computed argument and return value info. If any of @@ -6022,6 +6021,6 @@ RValue CodeGenFunction::EmitVAArg(VAArgExpr *VE, Address &VAListAddr, : EmitVAListRef(VE->getSubEx
[llvm-branch-commits] [clang] release/19.x: [clang-repl] [codegen] Reduce the state in TBAA. NFC for static compilation. (#98138) (PR #111953)
https://github.com/tru closed https://github.com/llvm/llvm-project/pull/111953 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/19.x: [clang-repl] [codegen] Reduce the state in TBAA. NFC for static compilation. (#98138) (PR #111953)
https://github.com/tru updated https://github.com/llvm/llvm-project/pull/111953 >From 7ba7d8e2f7b6445b60679da826210cdde29eaf8b Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Wed, 21 Aug 2024 07:22:31 +0200 Subject: [PATCH] [clang-repl] [codegen] Reduce the state in TBAA. NFC for static compilation. (#98138) In incremental compilation clang works with multiple `llvm::Module`s. Our current approach is to create a CodeGenModule entity for every new module request (via StartModule). However, some of the state such as the mangle context needs to be preserved to keep the original semantics in the ever-growing TU. Fixes: llvm/llvm-project#95581. cc: @jeaye (cherry picked from commit 6c62ad446b2441b78ae524d9e700e351d5a76394) --- clang/lib/CodeGen/CGCall.cpp | 31 +-- clang/lib/CodeGen/CGClass.cpp | 2 +- clang/lib/CodeGen/CodeGenModule.cpp | 15 + clang/lib/CodeGen/CodeGenModule.h | 5 +-- clang/lib/CodeGen/CodeGenTBAA.cpp | 13 +--- clang/lib/CodeGen/CodeGenTBAA.h | 5 +-- clang/lib/CodeGen/CodeGenTypes.cpp| 7 +++-- clang/lib/CodeGen/CodeGenTypes.h | 8 + clang/lib/CodeGen/MicrosoftCXXABI.cpp | 2 +- .../assigment-with-implicit-ctor.cpp | 13 10 files changed, 56 insertions(+), 45 deletions(-) create mode 100644 clang/test/Interpreter/assigment-with-implicit-ctor.cpp diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index d7ebffa8c5e4e0..0416fa03d749a5 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -314,7 +314,8 @@ CodeGenTypes::arrangeCXXMethodDeclaration(const CXXMethodDecl *MD) { if (MD->isImplicitObjectMemberFunction()) { // The abstract case is perfectly fine. -const CXXRecordDecl *ThisType = TheCXXABI.getThisArgumentTypeForMethod(MD); +const CXXRecordDecl *ThisType = +getCXXABI().getThisArgumentTypeForMethod(MD); return arrangeCXXMethodType(ThisType, prototype.getTypePtr(), MD); } @@ -337,7 +338,7 @@ CodeGenTypes::arrangeCXXStructorDeclaration(GlobalDecl GD) { SmallVector argTypes; SmallVector paramInfos; - const CXXRecordDecl *ThisType = TheCXXABI.getThisArgumentTypeForMethod(GD); + const CXXRecordDecl *ThisType = getCXXABI().getThisArgumentTypeForMethod(GD); argTypes.push_back(DeriveThisType(ThisType, MD)); bool PassParams = true; @@ -356,7 +357,7 @@ CodeGenTypes::arrangeCXXStructorDeclaration(GlobalDecl GD) { appendParameterTypes(*this, argTypes, paramInfos, FTP); CGCXXABI::AddedStructorArgCounts AddedArgs = - TheCXXABI.buildStructorSignature(GD, argTypes); + getCXXABI().buildStructorSignature(GD, argTypes); if (!paramInfos.empty()) { // Note: prefix implies after the first param. if (AddedArgs.Prefix) @@ -372,11 +373,10 @@ CodeGenTypes::arrangeCXXStructorDeclaration(GlobalDecl GD) { : RequiredArgs::All); FunctionType::ExtInfo extInfo = FTP->getExtInfo(); - CanQualType resultType = TheCXXABI.HasThisReturn(GD) - ? argTypes.front() - : TheCXXABI.hasMostDerivedReturn(GD) - ? CGM.getContext().VoidPtrTy - : Context.VoidTy; + CanQualType resultType = getCXXABI().HasThisReturn(GD) ? argTypes.front() + : getCXXABI().hasMostDerivedReturn(GD) + ? CGM.getContext().VoidPtrTy + : Context.VoidTy; return arrangeLLVMFunctionInfo(resultType, FnInfoOpts::IsInstanceMethod, argTypes, extInfo, paramInfos, required); } @@ -437,11 +437,10 @@ CodeGenTypes::arrangeCXXConstructorCall(const CallArgList &args, : RequiredArgs::All; GlobalDecl GD(D, CtorKind); - CanQualType ResultType = TheCXXABI.HasThisReturn(GD) - ? ArgTypes.front() - : TheCXXABI.hasMostDerivedReturn(GD) - ? CGM.getContext().VoidPtrTy - : Context.VoidTy; + CanQualType ResultType = getCXXABI().HasThisReturn(GD) ? ArgTypes.front() + : getCXXABI().hasMostDerivedReturn(GD) + ? CGM.getContext().VoidPtrTy + : Context.VoidTy; FunctionType::ExtInfo Info = FPT->getExtInfo(); llvm::SmallVector ParamInfos; @@ -806,7 +805,7 @@ const CGFunctionInfo &CodeGenTypes::arrangeLLVMFunctionInfo( } else if (info.getCC() == CC_Swift || info.getCC() == CC_SwiftAsync) { swiftcall::computeABIInfo(CGM, *FI); } else { -getABIInfo().computeInfo(*FI); +CGM.getABIInfo().computeInfo(*FI); } // Loop over all of the computed argument and return value info. If any of @@ -6022,6 +6021,6 @@ R
[llvm-branch-commits] [clang] release/19.x: [clang-repl] [codegen] Reduce the state in TBAA. NFC for static compilation. (#98138) (PR #111953)
github-actions[bot] wrote: @tru (or anyone else). If you would like to add a note about this fix in the release notes (completely optional). Please reply to this comment with a one or two sentence description of the fix. When you are done, please add the release:note label to this PR. https://github.com/llvm/llvm-project/pull/111953 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][math][c23] Add tanhf16 C23 math function (PR #106006)
https://github.com/overmighty updated https://github.com/llvm/llvm-project/pull/106006 >From 1a0ef1066e233c275133c6c75e3ba6631a2edadf Mon Sep 17 00:00:00 2001 From: OverMighty Date: Sun, 25 Aug 2024 22:02:09 +0200 Subject: [PATCH 1/2] [libc][math][c23] Add tanhf16 C23 math function Part of #95250. --- libc/config/gpu/entrypoints.txt | 1 + libc/config/linux/x86_64/entrypoints.txt | 1 + libc/docs/math/index.rst | 2 +- libc/spec/stdc.td | 1 + libc/src/math/CMakeLists.txt | 1 + libc/src/math/generic/CMakeLists.txt | 22 libc/src/math/generic/tanhf16.cpp | 144 ++ libc/src/math/tanhf16.h | 21 libc/test/src/math/CMakeLists.txt | 11 ++ libc/test/src/math/smoke/CMakeLists.txt | 12 ++ libc/test/src/math/smoke/tanhf16_test.cpp | 131 libc/test/src/math/tanhf16_test.cpp | 40 ++ 12 files changed, 386 insertions(+), 1 deletion(-) create mode 100644 libc/src/math/generic/tanhf16.cpp create mode 100644 libc/src/math/tanhf16.h create mode 100644 libc/test/src/math/smoke/tanhf16_test.cpp create mode 100644 libc/test/src/math/tanhf16_test.cpp diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt index 4bb81f5d3b2de1..d89093b2117c2d 100644 --- a/libc/config/gpu/entrypoints.txt +++ b/libc/config/gpu/entrypoints.txt @@ -587,6 +587,7 @@ if(LIBC_TYPES_HAS_FLOAT16) libc.src.math.setpayloadf16 libc.src.math.setpayloadsigf16 libc.src.math.sinhf16 +libc.src.math.tanhf16 libc.src.math.totalorderf16 libc.src.math.totalordermagf16 libc.src.math.truncf16 diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt index a8988336cb44fc..1645ff917821b3 100644 --- a/libc/config/linux/x86_64/entrypoints.txt +++ b/libc/config/linux/x86_64/entrypoints.txt @@ -680,6 +680,7 @@ if(LIBC_TYPES_HAS_FLOAT16) libc.src.math.setpayloadf16 libc.src.math.setpayloadsigf16 libc.src.math.sinhf16 +libc.src.math.tanhf16 libc.src.math.totalorderf16 libc.src.math.totalordermagf16 libc.src.math.truncf16 diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst index 29a0e6e29d8612..61c95e065b24da 100644 --- a/libc/docs/math/index.rst +++ b/libc/docs/math/index.rst @@ -348,7 +348,7 @@ Higher Math Functions +---+--+-++--++++ | tan | |check| | |check| || || 7.12.4.7 | F.10.1.7 | +---+--+-++--++++ -| tanh | |check| | || || 7.12.5.6 | F.10.2.6 | +| tanh | |check| | || |check| || 7.12.5.6 | F.10.2.6 | +---+--+-++--++++ | tanpi | | || || 7.12.4.14 | F.10.1.14 | +---+--+-++--++++ diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td index e4e46e7e13a586..196dab9f81b38e 100644 --- a/libc/spec/stdc.td +++ b/libc/spec/stdc.td @@ -798,6 +798,7 @@ def StdC : StandardSpec<"stdc"> { GuardedFunctionSpec<"sinhf16", RetValSpec, [ArgSpec], "LIBC_TYPES_HAS_FLOAT16">, FunctionSpec<"tanhf", RetValSpec, [ArgSpec]>, + GuardedFunctionSpec<"tanhf16", RetValSpec, [ArgSpec], "LIBC_TYPES_HAS_FLOAT16">, FunctionSpec<"acosf", RetValSpec, [ArgSpec]>, diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt index c35950d4b61823..8b9e7aeee591c7 100644 --- a/libc/src/math/CMakeLists.txt +++ b/libc/src/math/CMakeLists.txt @@ -495,6 +495,7 @@ add_math_entrypoint_object(tanf) add_math_entrypoint_object(tanh) add_math_entrypoint_object(tanhf) +add_math_entrypoint_object(tanhf16) add_math_entrypoint_object(tgamma) add_math_entrypoint_object(tgammaf) diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt index c29c5d0b007419..a5d10cf7f65cc1 100644 --- a/libc/src/math/generic/CMakeLists.txt +++ b/libc/src/math/generic
[llvm-branch-commits] [libc] [libc][math][c23] Add sinhf16 and coshf16 C23 math functions (PR #105947)
https://github.com/lntue approved this pull request. https://github.com/llvm/llvm-project/pull/105947 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] [libcxxabi] release/19.x: [libc++] Avoid re-exporting a few specific symbols from libc++abi (#109054) (PR #110677)
tru wrote: Thanks, I have accepted it and linked it from the release post. https://github.com/llvm/llvm-project/pull/110677 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][math][c23] Add tanhf16 C23 math function (PR #106006)
@@ -0,0 +1,145 @@ +//===-- Half-precision tanh(x) function ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "src/math/tanhf16.h" +#include "expxf16.h" +#include "hdr/fenv_macros.h" +#include "src/__support/CPP/array.h" +#include "src/__support/FPUtil/FEnvImpl.h" +#include "src/__support/FPUtil/FPBits.h" +#include "src/__support/FPUtil/PolyEval.h" +#include "src/__support/FPUtil/cast.h" +#include "src/__support/FPUtil/except_value_utils.h" +#include "src/__support/FPUtil/multiply_add.h" +#include "src/__support/FPUtil/nearest_integer.h" +#include "src/__support/FPUtil/rounding_mode.h" +#include "src/__support/common.h" +#include "src/__support/macros/config.h" +#include "src/__support/macros/optimization.h" + +namespace LIBC_NAMESPACE_DECL { + +static constexpr fputil::ExceptValues TANHF16_EXCEPTS = {{ +// x = 0x1.f54p+0, tanhf16(x) = 0x1.ecp-1 (RZ) +{0x3fd5U, 0x3bb0U, 1U, 0U, 0U}, +// x = -0x1.f54p+0, tanhf16(x) = -0x1.ecp-1 (RZ) +{0xbfd5U, 0xbbb0U, 0U, 1U, 0U}, +}}; + +LLVM_LIBC_FUNCTION(float16, tanhf16, (float16 x)) { + using FPBits = fputil::FPBits; + FPBits x_bits(x); + + uint16_t x_u = x_bits.uintval(); + uint16_t x_abs = x_u & 0x7fffU; + + // When -2^(-14) <= x <= -2^(-9), or |x| <= 0x1.d2p-4, + // or |x| >= atanh(1 - 2^(-11)), or x is NaN. + if (LIBC_UNLIKELY((x_u >= 0x8400U && x_u <= 0x9800U) || x_abs <= 0x2f48U || lntue wrote: The condition `-2^(-14) <= x <= -2^(-9)` implies `|x| <= 0x1.d2p-4`, so you only need the check `x_abs <= 0x2f48U` here. https://github.com/llvm/llvm-project/pull/106006 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [llvm] [LLVM] [Clang] Backport "Support for Gentoo `*t64` triples (64-bit time_t ABIs)" (PR #112364)
https://github.com/mgorny created https://github.com/llvm/llvm-project/pull/112364 This is a backport of 387b37af1aabf325e9be844361564dfad8d45c75 for 19.x, adjusted to add new Triple::EnvironmentType members at the end to avoid breaking backwards ABI compatibility. Gentoo is planning to introduce a `*t64` suffix for triples that will be used by 32-bit platforms that use 64-bit `time_t`. Add support for parsing and accepting these triples, and while at it make clang automatically enable the necessary glibc feature macros when this suffix is used. From 2c7139ea394c3caeb0e51064542423f332ca15f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Mon, 14 Oct 2024 13:18:04 +0200 Subject: [PATCH] [LLVM] [Clang] Backport "Support for Gentoo `*t64` triples (64-bit time_t ABIs)" This is a backport of 387b37af1aabf325e9be844361564dfad8d45c75 for 19.x, adjusted to add new Triple::EnvironmentType members at the end to avoid breaking backwards ABI compatibility. Gentoo is planning to introduce a `*t64` suffix for triples that will be used by 32-bit platforms that use 64-bit `time_t`. Add support for parsing and accepting these triples, and while at it make clang automatically enable the necessary glibc feature macros when this suffix is used. --- clang/lib/Basic/Targets/ARM.cpp| 2 + clang/lib/Basic/Targets/OSTargets.h| 4 ++ clang/lib/CodeGen/CodeGenModule.cpp| 5 +- clang/lib/CodeGen/Targets/ARM.cpp | 3 ++ clang/lib/Driver/Driver.cpp| 5 +- clang/lib/Driver/ToolChains/Arch/ARM.cpp | 7 +++ clang/lib/Driver/ToolChains/Gnu.cpp| 2 + clang/lib/Driver/ToolChains/Linux.cpp | 1 + clang/test/Preprocessor/time64.c | 12 + llvm/include/llvm/TargetParser/Triple.h| 35 ++--- llvm/lib/Target/ARM/ARMSubtarget.h | 4 +- llvm/lib/Target/ARM/ARMTargetMachine.cpp | 2 + llvm/lib/Target/ARM/ARMTargetMachine.h | 1 + llvm/lib/TargetParser/ARMTargetParser.cpp | 3 ++ llvm/lib/TargetParser/Triple.cpp | 6 +++ llvm/unittests/TargetParser/TripleTest.cpp | 58 ++ 16 files changed, 138 insertions(+), 12 deletions(-) create mode 100644 clang/test/Preprocessor/time64.c diff --git a/clang/lib/Basic/Targets/ARM.cpp b/clang/lib/Basic/Targets/ARM.cpp index 7423626d7c3cbf..e55feedbd5c6f9 100644 --- a/clang/lib/Basic/Targets/ARM.cpp +++ b/clang/lib/Basic/Targets/ARM.cpp @@ -311,7 +311,9 @@ ARMTargetInfo::ARMTargetInfo(const llvm::Triple &Triple, switch (Triple.getEnvironment()) { case llvm::Triple::Android: case llvm::Triple::GNUEABI: +case llvm::Triple::GNUEABIT64: case llvm::Triple::GNUEABIHF: +case llvm::Triple::GNUEABIHFT64: case llvm::Triple::MuslEABI: case llvm::Triple::MuslEABIHF: case llvm::Triple::OpenHOS: diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index 5f27c3469f861d..357c1965057c9b 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -337,6 +337,10 @@ class LLVM_LIBRARY_VISIBILITY LinuxTargetInfo : public OSTargetInfo { Builder.defineMacro("_GNU_SOURCE"); if (this->HasFloat128) Builder.defineMacro("__FLOAT128__"); +if (Triple.isTime64ABI()) { + Builder.defineMacro("_FILE_OFFSET_BITS", "64"); + Builder.defineMacro("_TIME_BITS", "64"); +} } public: diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index cf5e29e5a3db8d..8d9beab9fa7f88 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -177,10 +177,7 @@ createTargetCodeGenInfo(CodeGenModule &CGM) { else if (ABIStr == "aapcs16") Kind = ARMABIKind::AAPCS16_VFP; else if (CodeGenOpts.FloatABI == "hard" || - (CodeGenOpts.FloatABI != "soft" && - (Triple.getEnvironment() == llvm::Triple::GNUEABIHF || - Triple.getEnvironment() == llvm::Triple::MuslEABIHF || - Triple.getEnvironment() == llvm::Triple::EABIHF))) + (CodeGenOpts.FloatABI != "soft" && Triple.isHardFloatABI())) Kind = ARMABIKind::AAPCS_VFP; return createARMTargetCodeGenInfo(CGM, Kind); diff --git a/clang/lib/CodeGen/Targets/ARM.cpp b/clang/lib/CodeGen/Targets/ARM.cpp index d032b88d7683cd..457d761039a08d 100644 --- a/clang/lib/CodeGen/Targets/ARM.cpp +++ b/clang/lib/CodeGen/Targets/ARM.cpp @@ -35,7 +35,9 @@ class ARMABIInfo : public ABIInfo { case llvm::Triple::EABI: case llvm::Triple::EABIHF: case llvm::Triple::GNUEABI: +case llvm::Triple::GNUEABIT64: case llvm::Triple::GNUEABIHF: +case llvm::Triple::GNUEABIHFT64: case llvm::Triple::MuslEABI: case llvm::Triple::MuslEABIHF: return true; @@ -48,6 +50,7 @@ class ARMABIInfo : public ABIInfo { switch (getTarget().getTriple().getEnvironment()) { case llvm::Triple::EABIHF: case llvm::Triple::GNUEABIHF: +
[llvm-branch-commits] [clang] [llvm] [LLVM] [Clang] Backport "Support for Gentoo `*t64` triples (64-bit time_t ABIs)" (PR #112364)
llvmbot wrote: @llvm/pr-subscribers-backend-arm Author: Michał Górny (mgorny) Changes This is a backport of 387b37af1aabf325e9be844361564dfad8d45c75 for 19.x, adjusted to add new Triple::EnvironmentType members at the end to avoid breaking backwards ABI compatibility. Gentoo is planning to introduce a `*t64` suffix for triples that will be used by 32-bit platforms that use 64-bit `time_t`. Add support for parsing and accepting these triples, and while at it make clang automatically enable the necessary glibc feature macros when this suffix is used. --- Full diff: https://github.com/llvm/llvm-project/pull/112364.diff 16 Files Affected: - (modified) clang/lib/Basic/Targets/ARM.cpp (+2) - (modified) clang/lib/Basic/Targets/OSTargets.h (+4) - (modified) clang/lib/CodeGen/CodeGenModule.cpp (+1-4) - (modified) clang/lib/CodeGen/Targets/ARM.cpp (+3) - (modified) clang/lib/Driver/Driver.cpp (+4-1) - (modified) clang/lib/Driver/ToolChains/Arch/ARM.cpp (+7) - (modified) clang/lib/Driver/ToolChains/Gnu.cpp (+2) - (modified) clang/lib/Driver/ToolChains/Linux.cpp (+1) - (added) clang/test/Preprocessor/time64.c (+12) - (modified) llvm/include/llvm/TargetParser/Triple.h (+29-6) - (modified) llvm/lib/Target/ARM/ARMSubtarget.h (+3-1) - (modified) llvm/lib/Target/ARM/ARMTargetMachine.cpp (+2) - (modified) llvm/lib/Target/ARM/ARMTargetMachine.h (+1) - (modified) llvm/lib/TargetParser/ARMTargetParser.cpp (+3) - (modified) llvm/lib/TargetParser/Triple.cpp (+6) - (modified) llvm/unittests/TargetParser/TripleTest.cpp (+58) ``diff diff --git a/clang/lib/Basic/Targets/ARM.cpp b/clang/lib/Basic/Targets/ARM.cpp index 7423626d7c3cbf..e55feedbd5c6f9 100644 --- a/clang/lib/Basic/Targets/ARM.cpp +++ b/clang/lib/Basic/Targets/ARM.cpp @@ -311,7 +311,9 @@ ARMTargetInfo::ARMTargetInfo(const llvm::Triple &Triple, switch (Triple.getEnvironment()) { case llvm::Triple::Android: case llvm::Triple::GNUEABI: +case llvm::Triple::GNUEABIT64: case llvm::Triple::GNUEABIHF: +case llvm::Triple::GNUEABIHFT64: case llvm::Triple::MuslEABI: case llvm::Triple::MuslEABIHF: case llvm::Triple::OpenHOS: diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index 5f27c3469f861d..357c1965057c9b 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -337,6 +337,10 @@ class LLVM_LIBRARY_VISIBILITY LinuxTargetInfo : public OSTargetInfo { Builder.defineMacro("_GNU_SOURCE"); if (this->HasFloat128) Builder.defineMacro("__FLOAT128__"); +if (Triple.isTime64ABI()) { + Builder.defineMacro("_FILE_OFFSET_BITS", "64"); + Builder.defineMacro("_TIME_BITS", "64"); +} } public: diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index cf5e29e5a3db8d..8d9beab9fa7f88 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -177,10 +177,7 @@ createTargetCodeGenInfo(CodeGenModule &CGM) { else if (ABIStr == "aapcs16") Kind = ARMABIKind::AAPCS16_VFP; else if (CodeGenOpts.FloatABI == "hard" || - (CodeGenOpts.FloatABI != "soft" && - (Triple.getEnvironment() == llvm::Triple::GNUEABIHF || - Triple.getEnvironment() == llvm::Triple::MuslEABIHF || - Triple.getEnvironment() == llvm::Triple::EABIHF))) + (CodeGenOpts.FloatABI != "soft" && Triple.isHardFloatABI())) Kind = ARMABIKind::AAPCS_VFP; return createARMTargetCodeGenInfo(CGM, Kind); diff --git a/clang/lib/CodeGen/Targets/ARM.cpp b/clang/lib/CodeGen/Targets/ARM.cpp index d032b88d7683cd..457d761039a08d 100644 --- a/clang/lib/CodeGen/Targets/ARM.cpp +++ b/clang/lib/CodeGen/Targets/ARM.cpp @@ -35,7 +35,9 @@ class ARMABIInfo : public ABIInfo { case llvm::Triple::EABI: case llvm::Triple::EABIHF: case llvm::Triple::GNUEABI: +case llvm::Triple::GNUEABIT64: case llvm::Triple::GNUEABIHF: +case llvm::Triple::GNUEABIHFT64: case llvm::Triple::MuslEABI: case llvm::Triple::MuslEABIHF: return true; @@ -48,6 +50,7 @@ class ARMABIInfo : public ABIInfo { switch (getTarget().getTriple().getEnvironment()) { case llvm::Triple::EABIHF: case llvm::Triple::GNUEABIHF: +case llvm::Triple::GNUEABIHFT64: case llvm::Triple::MuslEABIHF: return true; default: diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 8e44d5afa40e05..ecae475f75da00 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -602,7 +602,8 @@ static llvm::Triple computeTargetTriple(const Driver &D, if (A->getOption().matches(options::OPT_m64) || A->getOption().matches(options::OPT_maix64)) { AT = Target.get64BitArchVariant().getArch(); - if (Target.getEnvironment() == llvm::Triple::GNUX32) + if (Target.getEnvironment() == llvm::Triple::GNUX32 || + Target.getEnvironment(
[llvm-branch-commits] [clang] [llvm] [LLVM] [Clang] Backport "Support for Gentoo `*t64` triples (64-bit time_t ABIs)" (PR #112364)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Michał Górny (mgorny) Changes This is a backport of 387b37af1aabf325e9be844361564dfad8d45c75 for 19.x, adjusted to add new Triple::EnvironmentType members at the end to avoid breaking backwards ABI compatibility. Gentoo is planning to introduce a `*t64` suffix for triples that will be used by 32-bit platforms that use 64-bit `time_t`. Add support for parsing and accepting these triples, and while at it make clang automatically enable the necessary glibc feature macros when this suffix is used. --- Full diff: https://github.com/llvm/llvm-project/pull/112364.diff 16 Files Affected: - (modified) clang/lib/Basic/Targets/ARM.cpp (+2) - (modified) clang/lib/Basic/Targets/OSTargets.h (+4) - (modified) clang/lib/CodeGen/CodeGenModule.cpp (+1-4) - (modified) clang/lib/CodeGen/Targets/ARM.cpp (+3) - (modified) clang/lib/Driver/Driver.cpp (+4-1) - (modified) clang/lib/Driver/ToolChains/Arch/ARM.cpp (+7) - (modified) clang/lib/Driver/ToolChains/Gnu.cpp (+2) - (modified) clang/lib/Driver/ToolChains/Linux.cpp (+1) - (added) clang/test/Preprocessor/time64.c (+12) - (modified) llvm/include/llvm/TargetParser/Triple.h (+29-6) - (modified) llvm/lib/Target/ARM/ARMSubtarget.h (+3-1) - (modified) llvm/lib/Target/ARM/ARMTargetMachine.cpp (+2) - (modified) llvm/lib/Target/ARM/ARMTargetMachine.h (+1) - (modified) llvm/lib/TargetParser/ARMTargetParser.cpp (+3) - (modified) llvm/lib/TargetParser/Triple.cpp (+6) - (modified) llvm/unittests/TargetParser/TripleTest.cpp (+58) ``diff diff --git a/clang/lib/Basic/Targets/ARM.cpp b/clang/lib/Basic/Targets/ARM.cpp index 7423626d7c3cbf..e55feedbd5c6f9 100644 --- a/clang/lib/Basic/Targets/ARM.cpp +++ b/clang/lib/Basic/Targets/ARM.cpp @@ -311,7 +311,9 @@ ARMTargetInfo::ARMTargetInfo(const llvm::Triple &Triple, switch (Triple.getEnvironment()) { case llvm::Triple::Android: case llvm::Triple::GNUEABI: +case llvm::Triple::GNUEABIT64: case llvm::Triple::GNUEABIHF: +case llvm::Triple::GNUEABIHFT64: case llvm::Triple::MuslEABI: case llvm::Triple::MuslEABIHF: case llvm::Triple::OpenHOS: diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index 5f27c3469f861d..357c1965057c9b 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -337,6 +337,10 @@ class LLVM_LIBRARY_VISIBILITY LinuxTargetInfo : public OSTargetInfo { Builder.defineMacro("_GNU_SOURCE"); if (this->HasFloat128) Builder.defineMacro("__FLOAT128__"); +if (Triple.isTime64ABI()) { + Builder.defineMacro("_FILE_OFFSET_BITS", "64"); + Builder.defineMacro("_TIME_BITS", "64"); +} } public: diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index cf5e29e5a3db8d..8d9beab9fa7f88 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -177,10 +177,7 @@ createTargetCodeGenInfo(CodeGenModule &CGM) { else if (ABIStr == "aapcs16") Kind = ARMABIKind::AAPCS16_VFP; else if (CodeGenOpts.FloatABI == "hard" || - (CodeGenOpts.FloatABI != "soft" && - (Triple.getEnvironment() == llvm::Triple::GNUEABIHF || - Triple.getEnvironment() == llvm::Triple::MuslEABIHF || - Triple.getEnvironment() == llvm::Triple::EABIHF))) + (CodeGenOpts.FloatABI != "soft" && Triple.isHardFloatABI())) Kind = ARMABIKind::AAPCS_VFP; return createARMTargetCodeGenInfo(CGM, Kind); diff --git a/clang/lib/CodeGen/Targets/ARM.cpp b/clang/lib/CodeGen/Targets/ARM.cpp index d032b88d7683cd..457d761039a08d 100644 --- a/clang/lib/CodeGen/Targets/ARM.cpp +++ b/clang/lib/CodeGen/Targets/ARM.cpp @@ -35,7 +35,9 @@ class ARMABIInfo : public ABIInfo { case llvm::Triple::EABI: case llvm::Triple::EABIHF: case llvm::Triple::GNUEABI: +case llvm::Triple::GNUEABIT64: case llvm::Triple::GNUEABIHF: +case llvm::Triple::GNUEABIHFT64: case llvm::Triple::MuslEABI: case llvm::Triple::MuslEABIHF: return true; @@ -48,6 +50,7 @@ class ARMABIInfo : public ABIInfo { switch (getTarget().getTriple().getEnvironment()) { case llvm::Triple::EABIHF: case llvm::Triple::GNUEABIHF: +case llvm::Triple::GNUEABIHFT64: case llvm::Triple::MuslEABIHF: return true; default: diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 8e44d5afa40e05..ecae475f75da00 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -602,7 +602,8 @@ static llvm::Triple computeTargetTriple(const Driver &D, if (A->getOption().matches(options::OPT_m64) || A->getOption().matches(options::OPT_maix64)) { AT = Target.get64BitArchVariant().getArch(); - if (Target.getEnvironment() == llvm::Triple::GNUX32) + if (Target.getEnvironment() == llvm::Triple::GNUX32 || + Target.getEnvironment() == l
[llvm-branch-commits] [llvm] release/19.x: [Inliner] Don't propagate access attr to byval params (#112256) (PR #112365)
https://github.com/llvmbot milestoned https://github.com/llvm/llvm-project/pull/112365 ___ 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: [Inliner] Don't propagate access attr to byval params (#112256) (PR #112365)
https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/112365 Backport 3c777f04f065dda5f0c80eaaef2a7f623ccc20ed Requested by: @goldsteinn >From ec59e7b6fc5c4c8d85181882d660c80954caa935 Mon Sep 17 00:00:00 2001 From: goldsteinn <35538541+goldste...@users.noreply.github.com> Date: Tue, 15 Oct 2024 10:25:16 -0400 Subject: [PATCH] [Inliner] Don't propagate access attr to byval params (#112256) - **[Inliner] Add tests for bad propagationg of access attr for `byval` param; NFC** - **[Inliner] Don't propagate access attr to `byval` params** We previously only handled the case where the `byval` attr was in the callbase's param attr list. This PR also handles the case if the `ByVal` was a param attr on the function's param attr list. (cherry picked from commit 3c777f04f065dda5f0c80eaaef2a7f623ccc20ed) --- llvm/lib/Transforms/Utils/InlineFunction.cpp | 2 +- .../Inline/access-attributes-prop.ll | 20 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index 68696789530f4a..fda1c22cc1fb7d 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -1395,7 +1395,7 @@ static void AddParamAndFnBasicAttributes(const CallBase &CB, if (!Arg) continue; -if (AL.hasParamAttr(I, Attribute::ByVal)) +if (NewInnerCB->paramHasAttr(I, Attribute::ByVal)) // It's unsound to propagate memory attributes to byval arguments. // Even if CalledFunction doesn't e.g. write to the argument, // the call to NewInnerCB may write to its by-value copy. diff --git a/llvm/test/Transforms/Inline/access-attributes-prop.ll b/llvm/test/Transforms/Inline/access-attributes-prop.ll index 2c55f5f3b1f6ca..5051c92345ec75 100644 --- a/llvm/test/Transforms/Inline/access-attributes-prop.ll +++ b/llvm/test/Transforms/Inline/access-attributes-prop.ll @@ -580,3 +580,23 @@ define ptr @callee_bad_param_prop(ptr readonly %x) { %r = tail call ptr @llvm.ptrmask(ptr %x, i64 -1) ret ptr %r } + +define dso_local void @foo_byval_readonly2(ptr readonly %p) { +; CHECK-LABEL: define {{[^@]+}}@foo_byval_readonly2 +; CHECK-SAME: (ptr readonly [[P:%.*]]) { +; CHECK-NEXT:call void @bar4(ptr [[P]]) +; CHECK-NEXT:ret void +; + call void @bar4(ptr %p) + ret void +} + +define void @prop_byval_readonly2(ptr %p) { +; CHECK-LABEL: define {{[^@]+}}@prop_byval_readonly2 +; CHECK-SAME: (ptr [[P:%.*]]) { +; CHECK-NEXT:call void @bar4(ptr [[P]]) +; CHECK-NEXT:ret void +; + call void @foo_byval_readonly2(ptr %p) + ret void +} ___ 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: [Inliner] Don't propagate access attr to byval params (#112256) (PR #112365)
llvmbot wrote: @llvm/pr-subscribers-llvm-transforms Author: None (llvmbot) Changes Backport 3c777f04f065dda5f0c80eaaef2a7f623ccc20ed Requested by: @goldsteinn --- Full diff: https://github.com/llvm/llvm-project/pull/112365.diff 2 Files Affected: - (modified) llvm/lib/Transforms/Utils/InlineFunction.cpp (+1-1) - (modified) llvm/test/Transforms/Inline/access-attributes-prop.ll (+20) ``diff diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index 68696789530f4a..fda1c22cc1fb7d 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -1395,7 +1395,7 @@ static void AddParamAndFnBasicAttributes(const CallBase &CB, if (!Arg) continue; -if (AL.hasParamAttr(I, Attribute::ByVal)) +if (NewInnerCB->paramHasAttr(I, Attribute::ByVal)) // It's unsound to propagate memory attributes to byval arguments. // Even if CalledFunction doesn't e.g. write to the argument, // the call to NewInnerCB may write to its by-value copy. diff --git a/llvm/test/Transforms/Inline/access-attributes-prop.ll b/llvm/test/Transforms/Inline/access-attributes-prop.ll index 2c55f5f3b1f6ca..5051c92345ec75 100644 --- a/llvm/test/Transforms/Inline/access-attributes-prop.ll +++ b/llvm/test/Transforms/Inline/access-attributes-prop.ll @@ -580,3 +580,23 @@ define ptr @callee_bad_param_prop(ptr readonly %x) { %r = tail call ptr @llvm.ptrmask(ptr %x, i64 -1) ret ptr %r } + +define dso_local void @foo_byval_readonly2(ptr readonly %p) { +; CHECK-LABEL: define {{[^@]+}}@foo_byval_readonly2 +; CHECK-SAME: (ptr readonly [[P:%.*]]) { +; CHECK-NEXT:call void @bar4(ptr [[P]]) +; CHECK-NEXT:ret void +; + call void @bar4(ptr %p) + ret void +} + +define void @prop_byval_readonly2(ptr %p) { +; CHECK-LABEL: define {{[^@]+}}@prop_byval_readonly2 +; CHECK-SAME: (ptr [[P:%.*]]) { +; CHECK-NEXT:call void @bar4(ptr [[P]]) +; CHECK-NEXT:ret void +; + call void @foo_byval_readonly2(ptr %p) + ret void +} `` https://github.com/llvm/llvm-project/pull/112365 ___ 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: [Inliner] Don't propagate access attr to byval params (#112256) (PR #112365)
llvmbot wrote: @nikic What do you think about merging this PR to the release branch? https://github.com/llvm/llvm-project/pull/112365 ___ 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: [Inliner] Don't propagate access attr to byval params (#112256) (PR #112365)
github-actions[bot] wrote: ⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo. Please turn off [Keep my email addresses private](https://github.com/settings/emails) setting in your account. See [LLVM Discourse](https://discourse.llvm.org/t/hidden-emails-on-github-should-we-do-something-about-it) for more information. https://github.com/llvm/llvm-project/pull/112365 ___ 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] [RISCV] fix RISCVPushPopOptimizer pass (PR #110813)
dlav-sc wrote: @topperc @michaelmaitland, could you take another look, please? https://github.com/llvm/llvm-project/pull/110813 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang] Split runtime headers in preparation for cross-compilation. NFC. (PR #112188)
https://github.com/Meinersbur ready_for_review https://github.com/llvm/llvm-project/pull/112188 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang] Split runtime headers in preparation for cross-compilation. NFC. (PR #112188)
llvmbot wrote: @llvm/pr-subscribers-flang-runtime @llvm/pr-subscribers-flang-codegen Author: Michael Kruse (Meinersbur) Changes Split some headers into headers for public and private declarations in preparation for #110217. Moving the runtime-private headers in runtime-private include directory will occur in #110298. * Do not use `sizeof(Descriptor)` in the compiler. The size of the descriptor is target-dependent while `sizeof(Descriptor)` is the size of the Descriptor for the host platform which might be too small when cross-compiling to a different platform. Another problem is that the emitted assembly ((cross-)compiling to the same target) is not identical between Flang's running on different systems. Moving the declaration of `class Descriptor` out of the included header will also reduce the amount of #included source. * Do not use `sizeof(ArrayConstructorVector)` and `alignof(ArrayConstructorVector)` in the compiler. Same reason as with `Descriptor`. * Compute the descriptor's extra flags without instantiating a Descriptor. `Fortran::runtime::Descriptor` is defined in the runtime, not the compiler. * Move `InquiryKeywordHashDecode` into runtime-private header. The function is defined in the runtime and trying to call it in the compiler will lead to a link-error. * Move allocator kind magic numbers into common header. They are the only declarations out of `allocator-registry.h` in the compiler as well. --- Patch is 30.29 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/112188.diff 30 Files Affected: - (modified) flang/include/flang/Lower/Allocatable.h (+1-1) - (modified) flang/include/flang/Optimizer/Builder/MutableBox.h (+1-1) - (modified) flang/include/flang/Optimizer/CodeGen/DescriptorModel.h (+1-1) - (modified) flang/include/flang/Runtime/CUDA/allocator.h (+1-1) - (modified) flang/include/flang/Runtime/CUDA/descriptor.h (+1-1) - (added) flang/include/flang/Runtime/allocator-registry-consts.h (+20) - (modified) flang/include/flang/Runtime/allocator-registry.h (+1-8) - (added) flang/include/flang/Runtime/array-constructor-consts.h (+54) - (modified) flang/include/flang/Runtime/array-constructor.h (+9-71) - (added) flang/include/flang/Runtime/descriptor-consts.h (+73) - (modified) flang/include/flang/Runtime/descriptor.h (+3-13) - (added) flang/include/flang/Runtime/io-api-funcs.h (+39) - (modified) flang/include/flang/Runtime/io-api.h (-3) - (added) flang/include/flang/Runtime/iostat-funcs.h (+23) - (modified) flang/include/flang/Runtime/iostat.h (-2) - (modified) flang/lib/Lower/ConvertVariable.cpp (+1-1) - (modified) flang/lib/Optimizer/Builder/Runtime/ArrayConstructor.cpp (+3-3) - (modified) flang/lib/Optimizer/CodeGen/CodeGen.cpp (+7-11) - (modified) flang/lib/Semantics/compute-offsets.cpp (+6-2) - (modified) flang/runtime/environment-default-list.h () - (modified) flang/runtime/extensions.cpp (+1-1) - (modified) flang/runtime/internal-unit.cpp (+2) - (modified) flang/runtime/io-api-common.h (+1-1) - (modified) flang/runtime/io-api-minimal.cpp (+1-1) - (modified) flang/runtime/io-api.cpp (+1-1) - (modified) flang/runtime/io-error.h (+1-1) - (modified) flang/runtime/io-stmt.h (+1-1) - (modified) flang/runtime/iostat.cpp (+1-1) - (modified) flang/runtime/namelist.cpp (+1-1) - (modified) flang/unittests/Optimizer/Builder/Runtime/AllocatableTest.cpp (+1-1) ``diff diff --git a/flang/include/flang/Lower/Allocatable.h b/flang/include/flang/Lower/Allocatable.h index 1209b157ed1f41..0e89af94af40f6 100644 --- a/flang/include/flang/Lower/Allocatable.h +++ b/flang/include/flang/Lower/Allocatable.h @@ -15,7 +15,7 @@ #include "flang/Lower/AbstractConverter.h" #include "flang/Optimizer/Builder/MutableBox.h" -#include "flang/Runtime/allocator-registry.h" +#include "flang/Runtime/allocator-registry-consts.h" #include "llvm/ADT/StringRef.h" namespace mlir { diff --git a/flang/include/flang/Optimizer/Builder/MutableBox.h b/flang/include/flang/Optimizer/Builder/MutableBox.h index fea7c7204837b4..39657ddaf6e03a 100644 --- a/flang/include/flang/Optimizer/Builder/MutableBox.h +++ b/flang/include/flang/Optimizer/Builder/MutableBox.h @@ -14,7 +14,7 @@ #define FORTRAN_OPTIMIZER_BUILDER_MUTABLEBOX_H #include "flang/Optimizer/Builder/BoxValue.h" -#include "flang/Runtime/allocator-registry.h" +#include "flang/Runtime/allocator-registry-consts.h" #include "llvm/ADT/StringRef.h" namespace mlir { diff --git a/flang/include/flang/Optimizer/CodeGen/DescriptorModel.h b/flang/include/flang/Optimizer/CodeGen/DescriptorModel.h index ff0cf29e8073e6..9cccf8db87270e 100644 --- a/flang/include/flang/Optimizer/CodeGen/DescriptorModel.h +++ b/flang/include/flang/Optimizer/CodeGen/DescriptorModel.h @@ -23,7 +23,7 @@ #define OPTIMIZER_DESCRIPTOR_MODEL_H #include "flang/ISO_Fortran_binding_wrapper.h" -#include "flang/Runtime/descriptor.h" +#include "flang/Runtime/descriptor-consts.h" #include "m
[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port machine trace metrics analysis to new pass manager. (PR #108507)
@@ -39,46 +39,67 @@ using namespace llvm; #define DEBUG_TYPE "machine-trace-metrics" -char MachineTraceMetrics::ID = 0; +AnalysisKey MachineTraceMetricsAnalysis::Key; -char &llvm::MachineTraceMetricsID = MachineTraceMetrics::ID; +MachineTraceMetricsAnalysis::Result +MachineTraceMetricsAnalysis::run(MachineFunction &MF, + MachineFunctionAnalysisManager &MFAM) { + return Result(MF, MFAM.getResult(MF)); +} + +PreservedAnalyses +MachineTraceMetricsVerifierPass::run(MachineFunction &MF, + MachineFunctionAnalysisManager &MFAM) { + MFAM.getResult(MF).verifyAnalysis(); + return PreservedAnalyses::all(); +} -INITIALIZE_PASS_BEGIN(MachineTraceMetrics, DEBUG_TYPE, "Machine Trace Metrics", - false, true) +char MachineTraceMetricsWrapperPass::ID = 0; + +char &llvm::MachineTraceMetricsID = MachineTraceMetricsWrapperPass::ID; + +INITIALIZE_PASS_BEGIN(MachineTraceMetricsWrapperPass, DEBUG_TYPE, + "Machine Trace Metrics", false, true) INITIALIZE_PASS_DEPENDENCY(MachineLoopInfoWrapperPass) -INITIALIZE_PASS_END(MachineTraceMetrics, DEBUG_TYPE, +INITIALIZE_PASS_END(MachineTraceMetricsWrapperPass, DEBUG_TYPE, "Machine Trace Metrics", false, true) -MachineTraceMetrics::MachineTraceMetrics() : MachineFunctionPass(ID) { - std::fill(std::begin(Ensembles), std::end(Ensembles), nullptr); -} +MachineTraceMetricsWrapperPass::MachineTraceMetricsWrapperPass() +: MachineFunctionPass(ID) {} -void MachineTraceMetrics::getAnalysisUsage(AnalysisUsage &AU) const { +void MachineTraceMetricsWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); AU.addRequired(); MachineFunctionPass::getAnalysisUsage(AU); } -bool MachineTraceMetrics::runOnMachineFunction(MachineFunction &Func) { +void MachineTraceMetrics::init(MachineFunction &Func, + const MachineLoopInfo &LI) { MF = &Func; const TargetSubtargetInfo &ST = MF->getSubtarget(); TII = ST.getInstrInfo(); TRI = ST.getRegisterInfo(); MRI = &MF->getRegInfo(); - Loops = &getAnalysis().getLI(); + Loops = &LI; SchedModel.init(&ST); BlockInfo.resize(MF->getNumBlockIDs()); ProcReleaseAtCycles.resize(MF->getNumBlockIDs() * SchedModel.getNumProcResourceKinds()); +} + +bool MachineTraceMetricsWrapperPass::runOnMachineFunction(MachineFunction &MF) { + MTM.init(MF, getAnalysis().getLI()); return false; } -void MachineTraceMetrics::releaseMemory() { +MachineTraceMetrics::~MachineTraceMetrics() { clear(); } + +void MachineTraceMetrics::clear() { MF = nullptr; BlockInfo.clear(); - for (Ensemble *&E : Ensembles) { -delete E; -E = nullptr; + for (auto &E : Ensembles) { +if (E) arsenm wrote: Doesn't need null check https://github.com/llvm/llvm-project/pull/108507 ___ 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] AtomicExpand: Copy metadata from atomicrmw to cmpxchg (PR #109409)
arsenm wrote: ping https://github.com/llvm/llvm-project/pull/109409 ___ 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] [CodeGen][NewPM] Port machine trace metrics analysis to new pass manager. (PR #108507)
https://github.com/cdevadas updated https://github.com/llvm/llvm-project/pull/108507 >From e0e4e978c06a2c78b31382274527201e03082e00 Mon Sep 17 00:00:00 2001 From: Christudasan Devadasan Date: Thu, 12 Sep 2024 23:38:09 +0530 Subject: [PATCH 1/2] [CodeGen][NewPM] Port machine trace metrics analysis to new pass manager. --- .../llvm/CodeGen/MachineTraceMetrics.h| 58 ++--- llvm/include/llvm/InitializePasses.h | 2 +- .../llvm/Passes/MachinePassRegistry.def | 4 +- llvm/lib/CodeGen/EarlyIfConversion.cpp| 8 +-- llvm/lib/CodeGen/MachineCombiner.cpp | 8 +-- llvm/lib/CodeGen/MachineTraceMetrics.cpp | 62 +++ llvm/lib/Passes/PassBuilder.cpp | 1 + .../AArch64/AArch64ConditionalCompares.cpp| 8 +-- .../AArch64/AArch64StorePairSuppress.cpp | 6 +- 9 files changed, 119 insertions(+), 38 deletions(-) diff --git a/llvm/include/llvm/CodeGen/MachineTraceMetrics.h b/llvm/include/llvm/CodeGen/MachineTraceMetrics.h index c7d97597d551cd..36718f80a1b6dd 100644 --- a/llvm/include/llvm/CodeGen/MachineTraceMetrics.h +++ b/llvm/include/llvm/CodeGen/MachineTraceMetrics.h @@ -46,12 +46,13 @@ #ifndef LLVM_CODEGEN_MACHINETRACEMETRICS_H #define LLVM_CODEGEN_MACHINETRACEMETRICS_H -#include "llvm/ADT/SparseSet.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/SparseSet.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachinePassManager.h" #include "llvm/CodeGen/TargetSchedule.h" namespace llvm { @@ -93,7 +94,7 @@ enum class MachineTraceStrategy { TS_NumStrategies }; -class MachineTraceMetrics : public MachineFunctionPass { +class MachineTraceMetrics { const MachineFunction *MF = nullptr; const TargetInstrInfo *TII = nullptr; const TargetRegisterInfo *TRI = nullptr; @@ -102,19 +103,22 @@ class MachineTraceMetrics : public MachineFunctionPass { TargetSchedModel SchedModel; public: + friend class MachineTraceMetricsWrapperPass; friend class Ensemble; friend class Trace; class Ensemble; - static char ID; + // For legacy pass. + MachineTraceMetrics() { +std::fill(std::begin(Ensembles), std::end(Ensembles), nullptr); + } - MachineTraceMetrics(); + explicit MachineTraceMetrics(MachineFunction &MF, const MachineLoopInfo &LI); + ~MachineTraceMetrics(); - void getAnalysisUsage(AnalysisUsage&) const override; - bool runOnMachineFunction(MachineFunction&) override; - void releaseMemory() override; - void verifyAnalysis() const override; + void init(MachineFunction &Func, const MachineLoopInfo &LI); + void clear(); /// Per-basic block information that doesn't depend on the trace through the /// block. @@ -400,6 +404,12 @@ class MachineTraceMetrics : public MachineFunctionPass { /// Call Ensemble::getTrace() again to update any trace handles. void invalidate(const MachineBasicBlock *MBB); + /// Handle invalidation explicitly. + bool invalidate(MachineFunction &, const PreservedAnalyses &PA, + MachineFunctionAnalysisManager::Invalidator &); + + void verifyAnalysis() const; + private: // One entry per basic block, indexed by block number. SmallVector BlockInfo; @@ -435,6 +445,38 @@ inline raw_ostream &operator<<(raw_ostream &OS, return OS; } +class MachineTraceMetricsAnalysis +: public AnalysisInfoMixin { + friend AnalysisInfoMixin; + static AnalysisKey Key; + +public: + using Result = MachineTraceMetrics; + Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM); +}; + +/// Verifier pass for \c MachineTraceMetrics. +struct MachineTraceMetricsVerifierPass +: PassInfoMixin { + PreservedAnalyses run(MachineFunction &MF, +MachineFunctionAnalysisManager &MFAM); + static bool isRequired() { return true; } +}; + +class MachineTraceMetricsWrapperPass : public MachineFunctionPass { +public: + static char ID; + MachineTraceMetrics MTM; + + MachineTraceMetricsWrapperPass(); + + void getAnalysisUsage(AnalysisUsage &) const override; + bool runOnMachineFunction(MachineFunction &) override; + void releaseMemory() override { MTM.clear(); } + void verifyAnalysis() const override { MTM.verifyAnalysis(); } + MachineTraceMetrics &getMTM() { return MTM; } +}; + } // end namespace llvm #endif // LLVM_CODEGEN_MACHINETRACEMETRICS_H diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h index 6a75dc0285cc61..5ed0ad98a2a72d 100644 --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -209,7 +209,7 @@ void initializeMachineRegionInfoPassPass(PassRegistry &); void initializeMachineSanitizerBinaryMetadataPass(PassRegistry &); void initializeMachineSchedulerPass(PassRegistry &); void initializeMachineSinkingPass(PassRegistry &); -void initializeMachineTraceMetricsPass(PassRegistry &);
[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port EarlyIfConversion pass to NPM. (PR #108508)
https://github.com/cdevadas updated https://github.com/llvm/llvm-project/pull/108508 >From dc7a71f17436ab0ce96546cef7639ef2cffd173f Mon Sep 17 00:00:00 2001 From: Christudasan Devadasan Date: Fri, 13 Sep 2024 12:22:03 +0530 Subject: [PATCH 1/2] [CodeGen][NewPM] Port EarlyIfConversion pass to NPM. --- llvm/include/llvm/CodeGen/EarlyIfConversion.h | 24 ++ llvm/include/llvm/CodeGen/Passes.h| 2 +- llvm/include/llvm/InitializePasses.h | 2 +- llvm/include/llvm/Passes/CodeGenPassBuilder.h | 1 + .../llvm/Passes/MachinePassRegistry.def | 2 +- llvm/lib/CodeGen/CodeGen.cpp | 2 +- llvm/lib/CodeGen/EarlyIfConversion.cpp| 79 ++- llvm/lib/CodeGen/TargetPassConfig.cpp | 4 +- llvm/lib/Passes/PassBuilder.cpp | 1 + .../Target/AArch64/AArch64TargetMachine.cpp | 2 +- .../lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 2 +- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | 2 +- .../Target/SystemZ/SystemZTargetMachine.cpp | 2 +- llvm/lib/Target/X86/X86TargetMachine.cpp | 2 +- .../early-ifcvt-likely-predictable.mir| 1 + .../AArch64/early-ifcvt-regclass-mismatch.mir | 1 + .../AArch64/early-ifcvt-same-value.mir| 1 + .../CodeGen/PowerPC/early-ifcvt-no-isel.mir | 2 + 18 files changed, 102 insertions(+), 30 deletions(-) create mode 100644 llvm/include/llvm/CodeGen/EarlyIfConversion.h diff --git a/llvm/include/llvm/CodeGen/EarlyIfConversion.h b/llvm/include/llvm/CodeGen/EarlyIfConversion.h new file mode 100644 index 00..78bf12ade02c3d --- /dev/null +++ b/llvm/include/llvm/CodeGen/EarlyIfConversion.h @@ -0,0 +1,24 @@ +//===- llvm/CodeGen/EarlyIfConversion.h -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef LLVM_CODEGEN_EARLYIFCONVERSION_H +#define LLVM_CODEGEN_EARLYIFCONVERSION_H + +#include "llvm/CodeGen/MachinePassManager.h" + +namespace llvm { + +class EarlyIfConverterPass : public PassInfoMixin { +public: + PreservedAnalyses run(MachineFunction &MF, +MachineFunctionAnalysisManager &MFAM); +}; + +} // namespace llvm + +#endif // LLVM_CODEGEN_EARLYIFCONVERSION_H diff --git a/llvm/include/llvm/CodeGen/Passes.h b/llvm/include/llvm/CodeGen/Passes.h index 99421bdf769ffa..bbbf99626098a6 100644 --- a/llvm/include/llvm/CodeGen/Passes.h +++ b/llvm/include/llvm/CodeGen/Passes.h @@ -273,7 +273,7 @@ namespace llvm { /// EarlyIfConverter - This pass performs if-conversion on SSA form by /// inserting cmov instructions. - extern char &EarlyIfConverterID; + extern char &EarlyIfConverterLegacyID; /// EarlyIfPredicator - This pass performs if-conversion on SSA form by /// predicating if/else block and insert select at the join point. diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h index 5ed0ad98a2a72d..1374880b6a716b 100644 --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -98,7 +98,7 @@ void initializeDominatorTreeWrapperPassPass(PassRegistry &); void initializeDwarfEHPrepareLegacyPassPass(PassRegistry &); void initializeEarlyCSELegacyPassPass(PassRegistry &); void initializeEarlyCSEMemSSALegacyPassPass(PassRegistry &); -void initializeEarlyIfConverterPass(PassRegistry &); +void initializeEarlyIfConverterLegacyPass(PassRegistry &); void initializeEarlyIfPredicatorPass(PassRegistry &); void initializeEarlyMachineLICMPass(PassRegistry &); void initializeEarlyTailDuplicatePass(PassRegistry &); diff --git a/llvm/include/llvm/Passes/CodeGenPassBuilder.h b/llvm/include/llvm/Passes/CodeGenPassBuilder.h index 0d45df08cb0ca7..9ef6e39dbb1cdd 100644 --- a/llvm/include/llvm/Passes/CodeGenPassBuilder.h +++ b/llvm/include/llvm/Passes/CodeGenPassBuilder.h @@ -27,6 +27,7 @@ #include "llvm/CodeGen/CodeGenPrepare.h" #include "llvm/CodeGen/DeadMachineInstructionElim.h" #include "llvm/CodeGen/DwarfEHPrepare.h" +#include "llvm/CodeGen/EarlyIfConversion.h" #include "llvm/CodeGen/ExpandLargeDivRem.h" #include "llvm/CodeGen/ExpandLargeFpConvert.h" #include "llvm/CodeGen/ExpandMemCmp.h" diff --git a/llvm/include/llvm/Passes/MachinePassRegistry.def b/llvm/include/llvm/Passes/MachinePassRegistry.def index 1d7084354455c7..15c6e2de6488c4 100644 --- a/llvm/include/llvm/Passes/MachinePassRegistry.def +++ b/llvm/include/llvm/Passes/MachinePassRegistry.def @@ -128,6 +128,7 @@ MACHINE_FUNCTION_ANALYSIS("slot-indexes", SlotIndexesAnalysis()) #ifndef MACHINE_FUNCTION_PASS #define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) #endif +MACHINE_FUNCTION_PASS("early-ifcvt", EarlyIfConverterPass()) MACHINE_FUNCTION_PASS("dead-mi-elimination", DeadMachineInstructionElimPass()) MACHINE_FUNCTION_P
[llvm-branch-commits] [llvm] [AMDGPU][NewPM] Fill out addILPOpts. (PR #108514)
https://github.com/cdevadas updated https://github.com/llvm/llvm-project/pull/108514 >From 0be0bb79f9e6bae184905f753bc5bd5c73eb1e56 Mon Sep 17 00:00:00 2001 From: Christudasan Devadasan Date: Fri, 13 Sep 2024 13:53:01 +0530 Subject: [PATCH] [AMDGPU][NewPM] Fill out addILPOpts. --- llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 7 +++ llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h | 1 + 2 files changed, 8 insertions(+) diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp index 8a3c1a92a63a2d..affb8a2654c1ab 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp @@ -1994,6 +1994,13 @@ void AMDGPUCodeGenPassBuilder::addPreISel(AddIRPass &addPass) const { addPass(RequireAnalysisPass()); } +void AMDGPUCodeGenPassBuilder::addILPOpts(AddMachinePass &addPass) const { + if (EnableEarlyIfConversion) +addPass(EarlyIfConverterPass()); + + Base::addILPOpts(addPass); +} + void AMDGPUCodeGenPassBuilder::addAsmPrinter(AddMachinePass &addPass, CreateMCStreamer) const { // TODO: Add AsmPrinter. diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h index af8476bc21ec61..d8a5111e5898d7 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h @@ -172,6 +172,7 @@ class AMDGPUCodeGenPassBuilder void addIRPasses(AddIRPass &) const; void addCodeGenPrepare(AddIRPass &) const; void addPreISel(AddIRPass &addPass) const; + void addILPOpts(AddMachinePass &) const; void addAsmPrinter(AddMachinePass &, CreateMCStreamer) const; Error addInstSelector(AddMachinePass &) const; void addMachineSSAOptimization(AddMachinePass &) const; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][math][c23] Add sqrtf16 C23 math function (PR #112406)
overmighty wrote: Re-opening this as https://github.com/llvm/llvm-project/pull/106102 was merged when it shouldn't have been (it was merged into the previous stacked PR's branch). https://github.com/llvm/llvm-project/pull/112406 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][math][c23] Add sqrtf16 C23 math function (PR #112406)
https://github.com/overmighty edited https://github.com/llvm/llvm-project/pull/112406 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][math][c23] Add sqrtf16 C23 math function (PR #112406)
https://github.com/lntue approved this pull request. https://github.com/llvm/llvm-project/pull/112406 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] users/overmighty/libc math sqrtf16 (PR #112406)
https://github.com/overmighty edited https://github.com/llvm/llvm-project/pull/112406 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] users/overmighty/libc math sqrtf16 (PR #112406)
https://github.com/overmighty edited https://github.com/llvm/llvm-project/pull/112406 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][math][c23] Add sqrtf16 C23 math function (PR #112406)
https://github.com/overmighty edited https://github.com/llvm/llvm-project/pull/112406 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][math][c23] Add log10f16 C23 math function (PR #106091)
https://github.com/overmighty updated https://github.com/llvm/llvm-project/pull/106091 >From f0b1e6406d48f275db8590fa6c5f0360e9dee0e8 Mon Sep 17 00:00:00 2001 From: OverMighty Date: Mon, 26 Aug 2024 17:23:01 +0200 Subject: [PATCH 1/2] [libc][math][c23] Add log10f16 C23 math function Part of #95250. --- libc/config/gpu/entrypoints.txt| 1 + libc/config/linux/x86_64/entrypoints.txt | 1 + libc/docs/math/index.rst | 2 +- libc/spec/stdc.td | 1 + libc/src/math/CMakeLists.txt | 1 + libc/src/math/generic/CMakeLists.txt | 21 +++ libc/src/math/generic/expxf16.h| 14 ++ libc/src/math/generic/log10f16.cpp | 163 + libc/src/math/log10f16.h | 21 +++ libc/test/src/math/CMakeLists.txt | 11 ++ libc/test/src/math/log10f16_test.cpp | 40 + libc/test/src/math/smoke/CMakeLists.txt| 12 ++ libc/test/src/math/smoke/log10f16_test.cpp | 47 ++ 13 files changed, 334 insertions(+), 1 deletion(-) create mode 100644 libc/src/math/generic/log10f16.cpp create mode 100644 libc/src/math/log10f16.h create mode 100644 libc/test/src/math/log10f16_test.cpp create mode 100644 libc/test/src/math/smoke/log10f16_test.cpp diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt index 2cc54e8a4b970c..13bb88894297ca 100644 --- a/libc/config/gpu/entrypoints.txt +++ b/libc/config/gpu/entrypoints.txt @@ -567,6 +567,7 @@ if(LIBC_TYPES_HAS_FLOAT16) libc.src.math.llogbf16 libc.src.math.llrintf16 libc.src.math.llroundf16 +libc.src.math.log10f16 libc.src.math.log2f16 libc.src.math.logbf16 libc.src.math.logf16 diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt index edde190a90c61d..30c86791b12772 100644 --- a/libc/config/linux/x86_64/entrypoints.txt +++ b/libc/config/linux/x86_64/entrypoints.txt @@ -660,6 +660,7 @@ if(LIBC_TYPES_HAS_FLOAT16) libc.src.math.llogbf16 libc.src.math.llrintf16 libc.src.math.llroundf16 +libc.src.math.log10f16 libc.src.math.log2f16 libc.src.math.logbf16 libc.src.math.logf16 diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst index 406ca05f74f35c..bc73622ec14f78 100644 --- a/libc/docs/math/index.rst +++ b/libc/docs/math/index.rst @@ -312,7 +312,7 @@ Higher Math Functions +---+--+-++--++++ | log | |check| | |check| || |check| || 7.12.6.11 | F.10.3.11 | +---+--+-++--++++ -| log10 | |check| | |check| || || 7.12.6.12 | F.10.3.12 | +| log10 | |check| | |check| || |check| || 7.12.6.12 | F.10.3.12 | +---+--+-++--++++ | log10p1 | | || || 7.12.6.13 | F.10.3.13 | +---+--+-++--++++ diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td index d2a073847503ef..33bec2f71627e5 100644 --- a/libc/spec/stdc.td +++ b/libc/spec/stdc.td @@ -642,6 +642,7 @@ def StdC : StandardSpec<"stdc"> { FunctionSpec<"log10", RetValSpec, [ArgSpec]>, FunctionSpec<"log10f", RetValSpec, [ArgSpec]>, + GuardedFunctionSpec<"log10f16", RetValSpec, [ArgSpec], "LIBC_TYPES_HAS_FLOAT16">, FunctionSpec<"log1p", RetValSpec, [ArgSpec]>, FunctionSpec<"log1pf", RetValSpec, [ArgSpec]>, diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt index 0ba1d33c6cbe9b..4f5b201c916fab 100644 --- a/libc/src/math/CMakeLists.txt +++ b/libc/src/math/CMakeLists.txt @@ -334,6 +334,7 @@ add_math_entrypoint_object(ldexpf128) add_math_entrypoint_object(log10) add_math_entrypoint_object(log10f) +add_math_entrypoint_object(log10f16) add_math_entrypoint_object(log1p) add_math_entrypoint_object(log1pf) diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt index 0fbe99405aaef1..4a7661e32bc84b 100644 --- a/libc/src/math/generic/CMakeLists.t
[llvm-branch-commits] [clang] [llvm] [LLVM] [Clang] Backport "Support for Gentoo `*t64` triples (64-bit time_t ABIs)" (PR #112364)
https://github.com/mgorny milestoned https://github.com/llvm/llvm-project/pull/112364 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][math][c23] Add logf16 C23 math function (PR #106072)
https://github.com/overmighty updated https://github.com/llvm/llvm-project/pull/106072 >From aad60fb87036324aa33d755213897cada53ffee9 Mon Sep 17 00:00:00 2001 From: OverMighty Date: Mon, 26 Aug 2024 15:30:54 +0200 Subject: [PATCH 1/4] [libc][math][c23] Add logf16 C23 math function Part of #95250. --- libc/config/gpu/entrypoints.txt | 1 + libc/config/linux/x86_64/entrypoints.txt | 1 + libc/docs/math/index.rst | 2 +- libc/spec/stdc.td| 1 + libc/src/math/CMakeLists.txt | 1 + libc/src/math/generic/CMakeLists.txt | 22 libc/src/math/generic/expxf16.h | 26 libc/src/math/generic/logf16.cpp | 158 +++ libc/src/math/logf16.h | 21 +++ libc/test/UnitTest/FPMatcher.h | 13 ++ libc/test/src/math/CMakeLists.txt| 11 ++ libc/test/src/math/logf16_test.cpp | 40 ++ libc/test/src/math/smoke/CMakeLists.txt | 12 ++ libc/test/src/math/smoke/logf16_test.cpp | 47 +++ 14 files changed, 355 insertions(+), 1 deletion(-) create mode 100644 libc/src/math/generic/logf16.cpp create mode 100644 libc/src/math/logf16.h create mode 100644 libc/test/src/math/logf16_test.cpp create mode 100644 libc/test/src/math/smoke/logf16_test.cpp diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt index d89093b2117c2d..d9df737efea3d7 100644 --- a/libc/config/gpu/entrypoints.txt +++ b/libc/config/gpu/entrypoints.txt @@ -568,6 +568,7 @@ if(LIBC_TYPES_HAS_FLOAT16) libc.src.math.llrintf16 libc.src.math.llroundf16 libc.src.math.logbf16 +libc.src.math.logf16 libc.src.math.lrintf16 libc.src.math.lroundf16 libc.src.math.modff16 diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt index 1645ff917821b3..9969152982fbb0 100644 --- a/libc/config/linux/x86_64/entrypoints.txt +++ b/libc/config/linux/x86_64/entrypoints.txt @@ -661,6 +661,7 @@ if(LIBC_TYPES_HAS_FLOAT16) libc.src.math.llrintf16 libc.src.math.llroundf16 libc.src.math.logbf16 +libc.src.math.logf16 libc.src.math.lrintf16 libc.src.math.lroundf16 libc.src.math.modff16 diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst index 61c95e065b24da..ea3034cbef3f81 100644 --- a/libc/docs/math/index.rst +++ b/libc/docs/math/index.rst @@ -310,7 +310,7 @@ Higher Math Functions +---+--+-++--++++ | lgamma| | || || 7.12.8.3 | F.10.5.3 | +---+--+-++--++++ -| log | |check| | |check| || || 7.12.6.11 | F.10.3.11 | +| log | |check| | |check| || |check| || 7.12.6.11 | F.10.3.11 | +---+--+-++--++++ | log10 | |check| | |check| || || 7.12.6.12 | F.10.3.12 | +---+--+-++--++++ diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td index 196dab9f81b38e..cc49835ac7e125 100644 --- a/libc/spec/stdc.td +++ b/libc/spec/stdc.td @@ -651,6 +651,7 @@ def StdC : StandardSpec<"stdc"> { FunctionSpec<"log", RetValSpec, [ArgSpec]>, FunctionSpec<"logf", RetValSpec, [ArgSpec]>, + GuardedFunctionSpec<"logf16", RetValSpec, [ArgSpec], "LIBC_TYPES_HAS_FLOAT16">, FunctionSpec<"logb", RetValSpec, [ArgSpec]>, FunctionSpec<"logbf", RetValSpec, [ArgSpec]>, diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt index 8b9e7aeee591c7..4642b294262752 100644 --- a/libc/src/math/CMakeLists.txt +++ b/libc/src/math/CMakeLists.txt @@ -343,6 +343,7 @@ add_math_entrypoint_object(log2f) add_math_entrypoint_object(log) add_math_entrypoint_object(logf) +add_math_entrypoint_object(logf16) add_math_entrypoint_object(logb) add_math_entrypoint_object(logbf) diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt index 477dfd2af29e73..3e9693a8df9a57 100644 --- a/libc/src/math/generic/CMakeLis
[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port EarlyIfConversion pass to NPM. (PR #108508)
https://github.com/cdevadas updated https://github.com/llvm/llvm-project/pull/108508 >From f692bb7b707610ebd1ad5f61943802aaef723f67 Mon Sep 17 00:00:00 2001 From: Christudasan Devadasan Date: Fri, 13 Sep 2024 12:22:03 +0530 Subject: [PATCH 1/2] [CodeGen][NewPM] Port EarlyIfConversion pass to NPM. --- llvm/include/llvm/CodeGen/EarlyIfConversion.h | 24 ++ llvm/include/llvm/CodeGen/Passes.h| 2 +- llvm/include/llvm/InitializePasses.h | 2 +- llvm/include/llvm/Passes/CodeGenPassBuilder.h | 1 + .../llvm/Passes/MachinePassRegistry.def | 2 +- llvm/lib/CodeGen/CodeGen.cpp | 2 +- llvm/lib/CodeGen/EarlyIfConversion.cpp| 79 ++- llvm/lib/CodeGen/TargetPassConfig.cpp | 4 +- llvm/lib/Passes/PassBuilder.cpp | 1 + .../Target/AArch64/AArch64TargetMachine.cpp | 2 +- .../lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 2 +- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | 2 +- .../Target/SystemZ/SystemZTargetMachine.cpp | 2 +- llvm/lib/Target/X86/X86TargetMachine.cpp | 2 +- .../early-ifcvt-likely-predictable.mir| 1 + .../AArch64/early-ifcvt-regclass-mismatch.mir | 1 + .../AArch64/early-ifcvt-same-value.mir| 1 + .../CodeGen/PowerPC/early-ifcvt-no-isel.mir | 2 + 18 files changed, 102 insertions(+), 30 deletions(-) create mode 100644 llvm/include/llvm/CodeGen/EarlyIfConversion.h diff --git a/llvm/include/llvm/CodeGen/EarlyIfConversion.h b/llvm/include/llvm/CodeGen/EarlyIfConversion.h new file mode 100644 index 00..78bf12ade02c3d --- /dev/null +++ b/llvm/include/llvm/CodeGen/EarlyIfConversion.h @@ -0,0 +1,24 @@ +//===- llvm/CodeGen/EarlyIfConversion.h -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef LLVM_CODEGEN_EARLYIFCONVERSION_H +#define LLVM_CODEGEN_EARLYIFCONVERSION_H + +#include "llvm/CodeGen/MachinePassManager.h" + +namespace llvm { + +class EarlyIfConverterPass : public PassInfoMixin { +public: + PreservedAnalyses run(MachineFunction &MF, +MachineFunctionAnalysisManager &MFAM); +}; + +} // namespace llvm + +#endif // LLVM_CODEGEN_EARLYIFCONVERSION_H diff --git a/llvm/include/llvm/CodeGen/Passes.h b/llvm/include/llvm/CodeGen/Passes.h index 99421bdf769ffa..bbbf99626098a6 100644 --- a/llvm/include/llvm/CodeGen/Passes.h +++ b/llvm/include/llvm/CodeGen/Passes.h @@ -273,7 +273,7 @@ namespace llvm { /// EarlyIfConverter - This pass performs if-conversion on SSA form by /// inserting cmov instructions. - extern char &EarlyIfConverterID; + extern char &EarlyIfConverterLegacyID; /// EarlyIfPredicator - This pass performs if-conversion on SSA form by /// predicating if/else block and insert select at the join point. diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h index 5ed0ad98a2a72d..1374880b6a716b 100644 --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -98,7 +98,7 @@ void initializeDominatorTreeWrapperPassPass(PassRegistry &); void initializeDwarfEHPrepareLegacyPassPass(PassRegistry &); void initializeEarlyCSELegacyPassPass(PassRegistry &); void initializeEarlyCSEMemSSALegacyPassPass(PassRegistry &); -void initializeEarlyIfConverterPass(PassRegistry &); +void initializeEarlyIfConverterLegacyPass(PassRegistry &); void initializeEarlyIfPredicatorPass(PassRegistry &); void initializeEarlyMachineLICMPass(PassRegistry &); void initializeEarlyTailDuplicatePass(PassRegistry &); diff --git a/llvm/include/llvm/Passes/CodeGenPassBuilder.h b/llvm/include/llvm/Passes/CodeGenPassBuilder.h index 0d45df08cb0ca7..9ef6e39dbb1cdd 100644 --- a/llvm/include/llvm/Passes/CodeGenPassBuilder.h +++ b/llvm/include/llvm/Passes/CodeGenPassBuilder.h @@ -27,6 +27,7 @@ #include "llvm/CodeGen/CodeGenPrepare.h" #include "llvm/CodeGen/DeadMachineInstructionElim.h" #include "llvm/CodeGen/DwarfEHPrepare.h" +#include "llvm/CodeGen/EarlyIfConversion.h" #include "llvm/CodeGen/ExpandLargeDivRem.h" #include "llvm/CodeGen/ExpandLargeFpConvert.h" #include "llvm/CodeGen/ExpandMemCmp.h" diff --git a/llvm/include/llvm/Passes/MachinePassRegistry.def b/llvm/include/llvm/Passes/MachinePassRegistry.def index 1d7084354455c7..15c6e2de6488c4 100644 --- a/llvm/include/llvm/Passes/MachinePassRegistry.def +++ b/llvm/include/llvm/Passes/MachinePassRegistry.def @@ -128,6 +128,7 @@ MACHINE_FUNCTION_ANALYSIS("slot-indexes", SlotIndexesAnalysis()) #ifndef MACHINE_FUNCTION_PASS #define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) #endif +MACHINE_FUNCTION_PASS("early-ifcvt", EarlyIfConverterPass()) MACHINE_FUNCTION_PASS("dead-mi-elimination", DeadMachineInstructionElimPass()) MACHINE_FUNCTION_P
[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port machine trace metrics analysis to new pass manager. (PR #108507)
https://github.com/cdevadas updated https://github.com/llvm/llvm-project/pull/108507 >From eabec10a9a7daf537006ff5d580b798a285e33e3 Mon Sep 17 00:00:00 2001 From: Christudasan Devadasan Date: Thu, 12 Sep 2024 23:38:09 +0530 Subject: [PATCH 1/4] [CodeGen][NewPM] Port machine trace metrics analysis to new pass manager. --- .../llvm/CodeGen/MachineTraceMetrics.h| 58 ++--- llvm/include/llvm/InitializePasses.h | 2 +- .../llvm/Passes/MachinePassRegistry.def | 4 +- llvm/lib/CodeGen/EarlyIfConversion.cpp| 8 +-- llvm/lib/CodeGen/MachineCombiner.cpp | 8 +-- llvm/lib/CodeGen/MachineTraceMetrics.cpp | 62 +++ llvm/lib/Passes/PassBuilder.cpp | 1 + .../AArch64/AArch64ConditionalCompares.cpp| 8 +-- .../AArch64/AArch64StorePairSuppress.cpp | 6 +- 9 files changed, 119 insertions(+), 38 deletions(-) diff --git a/llvm/include/llvm/CodeGen/MachineTraceMetrics.h b/llvm/include/llvm/CodeGen/MachineTraceMetrics.h index c7d97597d551cd..36718f80a1b6dd 100644 --- a/llvm/include/llvm/CodeGen/MachineTraceMetrics.h +++ b/llvm/include/llvm/CodeGen/MachineTraceMetrics.h @@ -46,12 +46,13 @@ #ifndef LLVM_CODEGEN_MACHINETRACEMETRICS_H #define LLVM_CODEGEN_MACHINETRACEMETRICS_H -#include "llvm/ADT/SparseSet.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/SparseSet.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachinePassManager.h" #include "llvm/CodeGen/TargetSchedule.h" namespace llvm { @@ -93,7 +94,7 @@ enum class MachineTraceStrategy { TS_NumStrategies }; -class MachineTraceMetrics : public MachineFunctionPass { +class MachineTraceMetrics { const MachineFunction *MF = nullptr; const TargetInstrInfo *TII = nullptr; const TargetRegisterInfo *TRI = nullptr; @@ -102,19 +103,22 @@ class MachineTraceMetrics : public MachineFunctionPass { TargetSchedModel SchedModel; public: + friend class MachineTraceMetricsWrapperPass; friend class Ensemble; friend class Trace; class Ensemble; - static char ID; + // For legacy pass. + MachineTraceMetrics() { +std::fill(std::begin(Ensembles), std::end(Ensembles), nullptr); + } - MachineTraceMetrics(); + explicit MachineTraceMetrics(MachineFunction &MF, const MachineLoopInfo &LI); + ~MachineTraceMetrics(); - void getAnalysisUsage(AnalysisUsage&) const override; - bool runOnMachineFunction(MachineFunction&) override; - void releaseMemory() override; - void verifyAnalysis() const override; + void init(MachineFunction &Func, const MachineLoopInfo &LI); + void clear(); /// Per-basic block information that doesn't depend on the trace through the /// block. @@ -400,6 +404,12 @@ class MachineTraceMetrics : public MachineFunctionPass { /// Call Ensemble::getTrace() again to update any trace handles. void invalidate(const MachineBasicBlock *MBB); + /// Handle invalidation explicitly. + bool invalidate(MachineFunction &, const PreservedAnalyses &PA, + MachineFunctionAnalysisManager::Invalidator &); + + void verifyAnalysis() const; + private: // One entry per basic block, indexed by block number. SmallVector BlockInfo; @@ -435,6 +445,38 @@ inline raw_ostream &operator<<(raw_ostream &OS, return OS; } +class MachineTraceMetricsAnalysis +: public AnalysisInfoMixin { + friend AnalysisInfoMixin; + static AnalysisKey Key; + +public: + using Result = MachineTraceMetrics; + Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM); +}; + +/// Verifier pass for \c MachineTraceMetrics. +struct MachineTraceMetricsVerifierPass +: PassInfoMixin { + PreservedAnalyses run(MachineFunction &MF, +MachineFunctionAnalysisManager &MFAM); + static bool isRequired() { return true; } +}; + +class MachineTraceMetricsWrapperPass : public MachineFunctionPass { +public: + static char ID; + MachineTraceMetrics MTM; + + MachineTraceMetricsWrapperPass(); + + void getAnalysisUsage(AnalysisUsage &) const override; + bool runOnMachineFunction(MachineFunction &) override; + void releaseMemory() override { MTM.clear(); } + void verifyAnalysis() const override { MTM.verifyAnalysis(); } + MachineTraceMetrics &getMTM() { return MTM; } +}; + } // end namespace llvm #endif // LLVM_CODEGEN_MACHINETRACEMETRICS_H diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h index 6a75dc0285cc61..5ed0ad98a2a72d 100644 --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -209,7 +209,7 @@ void initializeMachineRegionInfoPassPass(PassRegistry &); void initializeMachineSanitizerBinaryMetadataPass(PassRegistry &); void initializeMachineSchedulerPass(PassRegistry &); void initializeMachineSinkingPass(PassRegistry &); -void initializeMachineTraceMetricsPass(PassRegistry &);
[llvm-branch-commits] [llvm] [AMDGPU][NewPM] Fill out addILPOpts. (PR #108514)
https://github.com/cdevadas updated https://github.com/llvm/llvm-project/pull/108514 >From 037b15166e575b59e115795e5b4fd8f4065b4483 Mon Sep 17 00:00:00 2001 From: Christudasan Devadasan Date: Fri, 13 Sep 2024 13:53:01 +0530 Subject: [PATCH] [AMDGPU][NewPM] Fill out addILPOpts. --- llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 7 +++ llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h | 1 + 2 files changed, 8 insertions(+) diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp index 8a3c1a92a63a2d..affb8a2654c1ab 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp @@ -1994,6 +1994,13 @@ void AMDGPUCodeGenPassBuilder::addPreISel(AddIRPass &addPass) const { addPass(RequireAnalysisPass()); } +void AMDGPUCodeGenPassBuilder::addILPOpts(AddMachinePass &addPass) const { + if (EnableEarlyIfConversion) +addPass(EarlyIfConverterPass()); + + Base::addILPOpts(addPass); +} + void AMDGPUCodeGenPassBuilder::addAsmPrinter(AddMachinePass &addPass, CreateMCStreamer) const { // TODO: Add AsmPrinter. diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h index af8476bc21ec61..d8a5111e5898d7 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h @@ -172,6 +172,7 @@ class AMDGPUCodeGenPassBuilder void addIRPasses(AddIRPass &) const; void addCodeGenPrepare(AddIRPass &) const; void addPreISel(AddIRPass &addPass) const; + void addILPOpts(AddMachinePass &) const; void addAsmPrinter(AddMachinePass &, CreateMCStreamer) const; Error addInstSelector(AddMachinePass &) const; void addMachineSSAOptimization(AddMachinePass &) const; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] clang/HIP: Remove REQUIRES libgcc from a test (PR #112412)
llvmbot wrote: @llvm/pr-subscribers-backend-amdgpu Author: Matt Arsenault (arsenm) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/112412.diff 1 Files Affected: - (modified) clang/test/Driver/hip-include-path.hip (-1) ``diff diff --git a/clang/test/Driver/hip-include-path.hip b/clang/test/Driver/hip-include-path.hip index 1b4179e65c0b97..52f5ce0d5b 100644 --- a/clang/test/Driver/hip-include-path.hip +++ b/clang/test/Driver/hip-include-path.hip @@ -1,4 +1,3 @@ -// REQUIRES: libgcc // UNSUPPORTED: system-windows // RUN: %clang -c -### --target=x86_64-unknown-linux-gnu --cuda-gpu-arch=gfx900 \ `` https://github.com/llvm/llvm-project/pull/112412 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] clang/HIP: Remove REQUIRES libgcc from a test (PR #112412)
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/112412 None >From 5b110776578758fb71c193b6e10b6711a7eaf38b Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Tue, 15 Oct 2024 22:02:18 +0400 Subject: [PATCH] clang/HIP: Remove REQUIRES libgcc from a test --- clang/test/Driver/hip-include-path.hip | 1 - 1 file changed, 1 deletion(-) diff --git a/clang/test/Driver/hip-include-path.hip b/clang/test/Driver/hip-include-path.hip index 1b4179e65c0b97..52f5ce0d5b 100644 --- a/clang/test/Driver/hip-include-path.hip +++ b/clang/test/Driver/hip-include-path.hip @@ -1,4 +1,3 @@ -// REQUIRES: libgcc // UNSUPPORTED: system-windows // RUN: %clang -c -### --target=x86_64-unknown-linux-gnu --cuda-gpu-arch=gfx900 \ ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] clang/HIP: Remove REQUIRES windows from a test (PR #112411)
arsenm wrote: > [!WARNING] > This pull request is not mergeable via GitHub because a downstack PR is > open. Once all requirements are satisfied, merge this PR as a stack href="https://app.graphite.dev/github/pr/llvm/llvm-project/112411?utm_source=stack-comment-downstack-mergeability-warning"; > >on Graphite. > https://graphite.dev/docs/merge-pull-requests";>Learn more * **#112412** https://app.graphite.dev/github/pr/llvm/llvm-project/112412?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> * **#112411** https://app.graphite.dev/github/pr/llvm/llvm-project/112411?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> 👈 * **#111976** https://app.graphite.dev/github/pr/llvm/llvm-project/111976?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> * **#111975** https://app.graphite.dev/github/pr/llvm/llvm-project/111975?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> * `main` This stack of pull requests is managed by Graphite. https://stacking.dev/?utm_source=stack-comment";>Learn more about stacking. Join @arsenm and the rest of your teammates on https://graphite.dev?utm-source=stack-comment";>https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="11px" height="11px"/> Graphite https://github.com/llvm/llvm-project/pull/112411 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] clang/HIP: Remove REQUIRES libgcc from a test (PR #112412)
arsenm wrote: > [!WARNING] > This pull request is not mergeable via GitHub because a downstack PR is > open. Once all requirements are satisfied, merge this PR as a stack href="https://app.graphite.dev/github/pr/llvm/llvm-project/112412?utm_source=stack-comment-downstack-mergeability-warning"; > >on Graphite. > https://graphite.dev/docs/merge-pull-requests";>Learn more * **#112412** https://app.graphite.dev/github/pr/llvm/llvm-project/112412?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> 👈 * **#112411** https://app.graphite.dev/github/pr/llvm/llvm-project/112411?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> * **#111976** https://app.graphite.dev/github/pr/llvm/llvm-project/111976?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> * **#111975** https://app.graphite.dev/github/pr/llvm/llvm-project/111975?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> * `main` This stack of pull requests is managed by Graphite. https://stacking.dev/?utm_source=stack-comment";>Learn more about stacking. Join @arsenm and the rest of your teammates on https://graphite.dev?utm-source=stack-comment";>https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="11px" height="11px"/> Graphite https://github.com/llvm/llvm-project/pull/112412 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] clang/HIP: Remove REQUIRES windows from a test (PR #112411)
https://github.com/arsenm ready_for_review https://github.com/llvm/llvm-project/pull/112411 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] clang/HIP: Remove REQUIRES libgcc from a test (PR #112412)
https://github.com/arsenm ready_for_review https://github.com/llvm/llvm-project/pull/112412 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] clang/HIP: Remove REQUIRES windows from a test (PR #112411)
llvmbot wrote: @llvm/pr-subscribers-backend-amdgpu @llvm/pr-subscribers-clang Author: Matt Arsenault (arsenm) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/112411.diff 1 Files Affected: - (modified) clang/test/Driver/hip-runtime-libs-msvc.hip (-2) ``diff diff --git a/clang/test/Driver/hip-runtime-libs-msvc.hip b/clang/test/Driver/hip-runtime-libs-msvc.hip index 8085e77d457e56..943cd0569f4fd1 100644 --- a/clang/test/Driver/hip-runtime-libs-msvc.hip +++ b/clang/test/Driver/hip-runtime-libs-msvc.hip @@ -1,5 +1,3 @@ -// REQUIRES: system-windows - // RUN: touch %t.o // Test HIP runtime lib args specified by --rocm-path. `` https://github.com/llvm/llvm-project/pull/112411 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] clang/HIP: Remove REQUIRES windows from a test (PR #112411)
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/112411 None >From 61b3467a0dbd3cc4b605a26739457202ab1f604e Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Tue, 15 Oct 2024 22:01:28 +0400 Subject: [PATCH] clang/HIP: Remove REQUIRES windows from a test --- clang/test/Driver/hip-runtime-libs-msvc.hip | 2 -- 1 file changed, 2 deletions(-) diff --git a/clang/test/Driver/hip-runtime-libs-msvc.hip b/clang/test/Driver/hip-runtime-libs-msvc.hip index 8085e77d457e56..943cd0569f4fd1 100644 --- a/clang/test/Driver/hip-runtime-libs-msvc.hip +++ b/clang/test/Driver/hip-runtime-libs-msvc.hip @@ -1,5 +1,3 @@ -// REQUIRES: system-windows - // RUN: touch %t.o // Test HIP runtime lib args specified by --rocm-path. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] clang/HIP: Remove REQUIRES windows from a test (PR #112411)
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/112411 ___ 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] AtomicExpand: Copy metadata from atomicrmw to cmpxchg (PR #109409)
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/109409 ___ 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] GlobalISel: Fix combine duplicating atomic loads (PR #111730)
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/111730 >From a14d4628a19d3f863f9b44a615951e864d755771 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Wed, 9 Oct 2024 22:05:48 +0400 Subject: [PATCH 1/2] GlobalISel: Fix combine duplicating atomic loads The sext_inreg (load) combine was not deleting the old load instruction, and it would never be deleted if volatile or atomic. --- .../lib/CodeGen/GlobalISel/CombinerHelper.cpp | 1 + .../AMDGPU/GlobalISel/atomic_load_flat.ll | 96 --- .../AMDGPU/GlobalISel/atomic_load_global.ll | 39 ++-- .../AMDGPU/GlobalISel/atomic_load_local_2.ll | 36 ++- ...lizer-combiner-sextload-from-sextinreg.mir | 2 - 5 files changed, 37 insertions(+), 137 deletions(-) diff --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp index 14e94d48bf8362..535c827f6a8223 100644 --- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp @@ -1110,6 +1110,7 @@ void CombinerHelper::applySextInRegOfLoad( Builder.buildLoadInstr(TargetOpcode::G_SEXTLOAD, MI.getOperand(0).getReg(), LoadDef->getPointerReg(), *NewMMO); MI.eraseFromParent(); + LoadDef->eraseFromParent(); } /// Return true if 'MI' is a load or a store that may be fold it's address diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/atomic_load_flat.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/atomic_load_flat.ll index 788fb04e842b4e..fc3bc09cf8e3e1 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/atomic_load_flat.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/atomic_load_flat.ll @@ -27,32 +27,12 @@ define i32 @atomic_load_flat_monotonic_i8_zext_to_i32(ptr %ptr) { } define i32 @atomic_load_flat_monotonic_i8_sext_to_i32(ptr %ptr) { -; GFX7-LABEL: atomic_load_flat_monotonic_i8_sext_to_i32: -; GFX7: ; %bb.0: -; GFX7-NEXT:s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GFX7-NEXT:flat_load_sbyte v2, v[0:1] glc -; GFX7-NEXT:flat_load_ubyte v0, v[0:1] glc -; GFX7-NEXT:s_waitcnt vmcnt(0) lgkmcnt(0) -; GFX7-NEXT:v_mov_b32_e32 v0, v2 -; GFX7-NEXT:s_setpc_b64 s[30:31] -; -; GFX8-LABEL: atomic_load_flat_monotonic_i8_sext_to_i32: -; GFX8: ; %bb.0: -; GFX8-NEXT:s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GFX8-NEXT:flat_load_sbyte v2, v[0:1] glc -; GFX8-NEXT:flat_load_ubyte v0, v[0:1] glc -; GFX8-NEXT:s_waitcnt vmcnt(0) lgkmcnt(0) -; GFX8-NEXT:v_mov_b32_e32 v0, v2 -; GFX8-NEXT:s_setpc_b64 s[30:31] -; -; GFX9-LABEL: atomic_load_flat_monotonic_i8_sext_to_i32: -; GFX9: ; %bb.0: -; GFX9-NEXT:s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GFX9-NEXT:flat_load_sbyte v2, v[0:1] glc -; GFX9-NEXT:flat_load_ubyte v3, v[0:1] glc -; GFX9-NEXT:s_waitcnt vmcnt(0) lgkmcnt(0) -; GFX9-NEXT:v_mov_b32_e32 v0, v2 -; GFX9-NEXT:s_setpc_b64 s[30:31] +; GCN-LABEL: atomic_load_flat_monotonic_i8_sext_to_i32: +; GCN: ; %bb.0: +; GCN-NEXT:s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GCN-NEXT:flat_load_sbyte v0, v[0:1] glc +; GCN-NEXT:s_waitcnt vmcnt(0) lgkmcnt(0) +; GCN-NEXT:s_setpc_b64 s[30:31] %load = load atomic i8, ptr %ptr monotonic, align 1 %ext = sext i8 %load to i32 ret i32 %ext @@ -71,32 +51,12 @@ define i16 @atomic_load_flat_monotonic_i8_zext_to_i16(ptr %ptr) { } define i16 @atomic_load_flat_monotonic_i8_sext_to_i16(ptr %ptr) { -; GFX7-LABEL: atomic_load_flat_monotonic_i8_sext_to_i16: -; GFX7: ; %bb.0: -; GFX7-NEXT:s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GFX7-NEXT:flat_load_sbyte v2, v[0:1] glc -; GFX7-NEXT:flat_load_ubyte v0, v[0:1] glc -; GFX7-NEXT:s_waitcnt vmcnt(0) lgkmcnt(0) -; GFX7-NEXT:v_mov_b32_e32 v0, v2 -; GFX7-NEXT:s_setpc_b64 s[30:31] -; -; GFX8-LABEL: atomic_load_flat_monotonic_i8_sext_to_i16: -; GFX8: ; %bb.0: -; GFX8-NEXT:s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GFX8-NEXT:flat_load_sbyte v2, v[0:1] glc -; GFX8-NEXT:flat_load_ubyte v0, v[0:1] glc -; GFX8-NEXT:s_waitcnt vmcnt(0) lgkmcnt(0) -; GFX8-NEXT:v_mov_b32_e32 v0, v2 -; GFX8-NEXT:s_setpc_b64 s[30:31] -; -; GFX9-LABEL: atomic_load_flat_monotonic_i8_sext_to_i16: -; GFX9: ; %bb.0: -; GFX9-NEXT:s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GFX9-NEXT:flat_load_sbyte v2, v[0:1] glc -; GFX9-NEXT:flat_load_ubyte v3, v[0:1] glc -; GFX9-NEXT:s_waitcnt vmcnt(0) lgkmcnt(0) -; GFX9-NEXT:v_mov_b32_e32 v0, v2 -; GFX9-NEXT:s_setpc_b64 s[30:31] +; GCN-LABEL: atomic_load_flat_monotonic_i8_sext_to_i16: +; GCN: ; %bb.0: +; GCN-NEXT:s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GCN-NEXT:flat_load_sbyte v0, v[0:1] glc +; GCN-NEXT:s_waitcnt vmcnt(0) lgkmcnt(0) +; GCN-NEXT:s_setpc_b64 s[30:31] %load = load atomic i8, ptr %ptr monotonic, align 1 %ext = sext i8 %load to i16 ret i16 %ext @@ -126,32 +86,12 @@ define i32 @atomic_load_flat_monotonic_i16_zext_to_i32(ptr %ptr) { } define i32 @atomic
[llvm-branch-commits] [llvm] GlobalISel: Fix combine duplicating atomic loads (PR #111730)
https://github.com/aemerson approved this pull request. LGTM. https://github.com/llvm/llvm-project/pull/111730 ___ 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] [RISCV] fix RISCVPushPopOptimizer pass (PR #110813)
https://github.com/topperc approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/110813 ___ 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] [NFC] Fix flakiness in test if run unsharded (PR #112439)
https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/112439 If we run all test in a single process, there is high probability that `99` is already claimed. ___ 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] Backport "[ELF] Make shouldAddProvideSym return values consistent when demoted to Undefined" (PR #112136)
DianQK wrote: Now we also need to backport #112386. Would it be safer to revert ebb326a51fec37b5a47e5702e8ea157cd4f835cd in release/19.x? https://github.com/llvm/llvm-project/pull/112136 ___ 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] Backport "[ELF] Make shouldAddProvideSym return values consistent when demoted to Undefined" (PR #112136)
https://github.com/DianQK ready_for_review https://github.com/llvm/llvm-project/pull/112136 ___ 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] Backport "[ELF] Make shouldAddProvideSym return values consistent when demoted to Undefined" (PR #112136)
MaskRay wrote: > Now we also need to backport #112386. Would it be safer to revert > [ebb326a](https://github.com/llvm/llvm-project/commit/ebb326a51fec37b5a47e5702e8ea157cd4f835cd) > in release/19.x? We could revert it, but I do not feel that the PROVIDE regression #111478 is important. I prefer that we do nothing for the release branch. https://github.com/llvm/llvm-project/pull/112136 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [llvm] [LLVM] [Clang] Backport "Support for Gentoo `*t64` triples (64-bit time_t ABIs)" (PR #112364)
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/112364 ___ 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: [WebAssembly] Fix feature coalescing (#110647) (PR #112431)
https://github.com/tlively approved this pull request. https://github.com/llvm/llvm-project/pull/112431 ___ 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: [WebAssembly] Fix feature coalescing (#110647) (PR #112431)
https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/112431 Backport 5a7b79c93e2e0c71aec016973f5f13d3bb2e7a62 Requested by: @nikic >From 349a0e9340c0fad094f31d700de814d1c32ba241 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 15 Oct 2024 09:34:55 +0200 Subject: [PATCH] [WebAssembly] Fix feature coalescing (#110647) This fixes a problem introduced in #80094. That PR copied negative features from the TargetMachine to the end of the feature string. This is not correct, because even if we have a baseline TM of say `-simd128`, but a function with `+simd128`, the coalesced feature string should have `+simd128`, not `-simd128`. To address the original motivation of that PR, we should instead explicitly materialize the negative features in the target feature string, so that explicitly disabled default features are honored. Unfortunately, there doesn't seem to be any way to actually test this using llc, because `-mattr` appends the specified features to the end of the `"target-features"` attribute. I've tested this locally by making it prepend the features instead. (cherry picked from commit 5a7b79c93e2e0c71aec016973f5f13d3bb2e7a62) --- .../Target/WebAssembly/WebAssemblyTargetMachine.cpp | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp index 23539a5f4b26f1..ac9e6d5a90cb3c 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp @@ -202,8 +202,7 @@ class CoalesceFeaturesAndStripAtomics final : public ModulePass { bool runOnModule(Module &M) override { FeatureBitset Features = coalesceFeatures(M); -std::string FeatureStr = -getFeatureString(Features, WasmTM->getTargetFeatureString()); +std::string FeatureStr = getFeatureString(Features); WasmTM->setTargetFeatureString(FeatureStr); for (auto &F : M) replaceFeatures(F, FeatureStr); @@ -241,17 +240,14 @@ class CoalesceFeaturesAndStripAtomics final : public ModulePass { return Features; } - static std::string getFeatureString(const FeatureBitset &Features, - StringRef TargetFS) { + static std::string getFeatureString(const FeatureBitset &Features) { std::string Ret; for (const SubtargetFeatureKV &KV : WebAssemblyFeatureKV) { if (Features[KV.Value]) Ret += (StringRef("+") + KV.Key + ",").str(); + else +Ret += (StringRef("-") + KV.Key + ",").str(); } -SubtargetFeatures TF{TargetFS}; -for (std::string const &F : TF.getFeatures()) - if (!SubtargetFeatures::isEnabled(F)) -Ret += F + ","; return Ret; } ___ 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: [WebAssembly] Fix feature coalescing (#110647) (PR #112431)
llvmbot wrote: @llvm/pr-subscribers-backend-webassembly Author: None (llvmbot) Changes Backport 5a7b79c93e2e0c71aec016973f5f13d3bb2e7a62 Requested by: @nikic --- Full diff: https://github.com/llvm/llvm-project/pull/112431.diff 1 Files Affected: - (modified) llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp (+4-8) ``diff diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp index 23539a5f4b26f1..ac9e6d5a90cb3c 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp @@ -202,8 +202,7 @@ class CoalesceFeaturesAndStripAtomics final : public ModulePass { bool runOnModule(Module &M) override { FeatureBitset Features = coalesceFeatures(M); -std::string FeatureStr = -getFeatureString(Features, WasmTM->getTargetFeatureString()); +std::string FeatureStr = getFeatureString(Features); WasmTM->setTargetFeatureString(FeatureStr); for (auto &F : M) replaceFeatures(F, FeatureStr); @@ -241,17 +240,14 @@ class CoalesceFeaturesAndStripAtomics final : public ModulePass { return Features; } - static std::string getFeatureString(const FeatureBitset &Features, - StringRef TargetFS) { + static std::string getFeatureString(const FeatureBitset &Features) { std::string Ret; for (const SubtargetFeatureKV &KV : WebAssemblyFeatureKV) { if (Features[KV.Value]) Ret += (StringRef("+") + KV.Key + ",").str(); + else +Ret += (StringRef("-") + KV.Key + ",").str(); } -SubtargetFeatures TF{TargetFS}; -for (std::string const &F : TF.getFeatures()) - if (!SubtargetFeatures::isEnabled(F)) -Ret += F + ","; return Ret; } `` https://github.com/llvm/llvm-project/pull/112431 ___ 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: [WebAssembly] Fix feature coalescing (#110647) (PR #112431)
llvmbot wrote: @tlively What do you think about merging this PR to the release branch? https://github.com/llvm/llvm-project/pull/112431 ___ 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: [WebAssembly] Fix feature coalescing (#110647) (PR #112431)
https://github.com/llvmbot milestoned https://github.com/llvm/llvm-project/pull/112431 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [AMDGPU] Still set up the two SGPRs for queue ptr even it is COV5 (PR #112403)
https://github.com/shiltian edited https://github.com/llvm/llvm-project/pull/112403 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [AMDGPU] Still set up the two SGPRs for queue ptr even it is COV5 (PR #112403)
@@ -4,12 +4,12 @@ define amdgpu_kernel void @s_clear_msb(ptr addrspace(1) %out, i32 %in) { ; SI-LABEL: s_clear_msb: ; SI: ; %bb.0: -; SI-NEXT:s_load_dword s4, s[2:3], 0xb -; SI-NEXT:s_load_dwordx2 s[0:1], s[2:3], 0x9 +; SI-NEXT:s_load_dword s6, s[4:5], 0xb +; SI-NEXT:s_load_dwordx2 s[0:1], s[4:5], 0x9 ; SI-NEXT:s_mov_b32 s3, 0xf000 ; SI-NEXT:s_mov_b32 s2, -1 ; SI-NEXT:s_waitcnt lgkmcnt(0) -; SI-NEXT:s_bitset0_b32 s4, 31 +; SI-NEXT:s_and_b32 s4, s6, 0x7fff shiltian wrote: @arsenm This looks like a big regression. Not sure why that happens. https://github.com/llvm/llvm-project/pull/112403 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits