[llvm] a5de497 - [NFC][llvm-exegesis] `InstructionBenchmark`: only allow move constructor

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 06:15:56 PST 2022


Hopefully e9972a7113edb2bcc1e2b4b2204523c5500681ee helps?

On Mon, Dec 19, 2022 at 5:33 AM Yung, Douglas <douglas.yung at sony.com> wrote:
>
> Hi Roman,
>
> I believe your change is causing a build failure on older versions of GCC. (Another build failure was masking this failure on the build bot and the link below is after the previous problem was reverted showing the new problem which I bisected to your commit)
>
> https://lab.llvm.org/staging/#/builders/235/builds/1090
>
> FAILED: tools/llvm-exegesis/lib/CMakeFiles/LLVMExegesis.dir/BenchmarkResult.cpp.o
> [stdout] /opt/ccache/bin/g++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/llvm-exegesis/lib -I/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/tools/llvm-exegesis/lib -Iinclude -I/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -fno-exceptions -fno-rtti -UNDEBUG -std=c++1z -MD -MT tools/llvm-exegesis/lib/CMakeFiles/LLVMExegesis.dir/BenchmarkResult.cpp.o -MF tools/llvm-exegesis/lib/CMakeFiles/LLVMExegesis.dir/BenchmarkResult.cpp.o.d -o tools/llvm-exegesis/lib/CMakeFiles/LLVMExegesis.dir/BenchmarkResult.cpp.o -c /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
> [stdout] /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp: In static member function ‘static llvm::Expected<llvm::exegesis::InstructionBenchmark> llvm::exegesis::InstructionBenchmark::readYaml(const llvm::exegesis::LLVMState&, llvm::MemoryBufferRef)’:
> [stdout] /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp:352:10: error: could not convert ‘Benchmark’ from ‘llvm::exegesis::InstructionBenchmark’ to ‘llvm::Expected<llvm::exegesis::InstructionBenchmark>’
> [stdout]    return Benchmark;
> [stdout]           ^~~~~~~~~
> [stdout] In file included from /usr/include/c++/7/memory:64:0,
> [stdout]                  from /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/tools/llvm-exegesis/lib/MCInstrDescView.h:21,
> [stdout]                  from /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/tools/llvm-exegesis/lib/LlvmState.h:17,
> [stdout]                  from /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h:18,
> [stdout]                  from /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp:9:
> [stdout] /usr/include/c++/7/bits/stl_construct.h: In instantiation of ‘void std::_Construct(_T1*, _Args&& ...) [with _T1 = llvm::exegesis::InstructionBenchmark; _Args = {const llvm::exegesis::InstructionBenchmark&}]’:
> [stdout] /usr/include/c++/7/bits/stl_uninitialized.h:83:18:   required from ‘static _ForwardIterator std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const llvm::exegesis::InstructionBenchmark*, std::vector<llvm::exegesis::InstructionBenchmark> >; _ForwardIterator = llvm::exegesis::InstructionBenchmark*; bool _TrivialValueTypes = false]’
> [stdout] /usr/include/c++/7/bits/stl_uninitialized.h:134:15:   required from ‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const llvm::exegesis::InstructionBenchmark*, std::vector<llvm::exegesis::InstructionBenchmark> >; _ForwardIterator = llvm::exegesis::InstructionBenchmark*]’
> [stdout] /usr/include/c++/7/bits/stl_uninitialized.h:289:37:   required from ‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = __gnu_cxx::__normal_iterator<const llvm::exegesis::InstructionBenchmark*, std::vector<llvm::exegesis::InstructionBenchmark> >; _ForwardIterator = llvm::exegesis::InstructionBenchmark*; _Tp = llvm::exegesis::InstructionBenchmark]’
> [stdout] /usr/include/c++/7/bits/stl_vector.h:331:31:   required from ‘std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = llvm::exegesis::InstructionBenchmark; _Alloc = std::allocator<llvm::exegesis::InstructionBenchmark>]’
> [stdout] /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/include/llvm/Support/Error.h:520:5:   required from ‘llvm::Expected<T>::Expected(OtherT&&, std::enable_if_t<is_convertible_v<OtherT, T> >*) [with OtherT = std::vector<llvm::exegesis::InstructionBenchmark>&; T = std::vector<llvm::exegesis::InstructionBenchmark>; std::enable_if_t<is_convertible_v<OtherT, T> > = void]’
> [stdout] /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp:370:10:   required from here
> [stdout] /usr/include/c++/7/bits/stl_construct.h:75:7: error: use of deleted function ‘llvm::exegesis::InstructionBenchmark::InstructionBenchmark(const llvm::exegesis::InstructionBenchmark&)’
> [stdout]      { ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
> [stdout]        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> [stdout] In file included from /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp:9:0:
> [stdout] /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h:85:3: note: declared here
> [stdout]    InstructionBenchmark(const InstructionBenchmark &) = delete;
> [stdout]    ^~~~~~~~~~~~~~~~~~~~
>
> Can you take a look?
>
> Douglas Yung
>
> -----Original Message-----
> From: llvm-commits <llvm-commits-bounces at lists.llvm.org> On Behalf Of Roman Lebedev via llvm-commits
> Sent: Saturday, December 17, 2022 17:24
> To: llvm-commits at lists.llvm.org
> Subject: [llvm] a5de497 - [NFC][llvm-exegesis] `InstructionBenchmark`: only allow move constructor
>
>
> Author: Roman Lebedev
> Date: 2022-12-18T04:23:20+03:00
> New Revision: a5de49755cab6ccea9380f7f51a133d2e37cdc88
>
> URL: https://urldefense.com/v3/__https://github.com/llvm/llvm-project/commit/a5de49755cab6ccea9380f7f51a133d2e37cdc88__;!!JmoZiZGBv3RvKRSx!6eOZYa4OHMFJd5dyVcXjtuI8c_BtmxA8RY0b8FTsT5pv0y1EflfL9L-JhaJD-bHdwU6QhNXJfYnaUym2v_vYO1RCwwpA$
> DIFF: https://urldefense.com/v3/__https://github.com/llvm/llvm-project/commit/a5de49755cab6ccea9380f7f51a133d2e37cdc88.diff__;!!JmoZiZGBv3RvKRSx!6eOZYa4OHMFJd5dyVcXjtuI8c_BtmxA8RY0b8FTsT5pv0y1EflfL9L-JhaJD-bHdwU6QhNXJfYnaUym2v_vYO2bze4IU$
>
> LOG: [NFC][llvm-exegesis] `InstructionBenchmark`: only allow move constructor
>
> We don't ever legitimately need to copy it, so let's make that explicit
>
> Added:
>
>
> Modified:
>     llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
>     llvm/unittests/tools/llvm-exegesis/Mips/BenchmarkResultTest.cpp
>     llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp
>
> Removed:
>
>
>
> ################################################################################
> diff  --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
> index 679946d723e0..11c2ade6789e 100644
> --- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
> +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
> @@ -78,6 +78,14 @@ struct InstructionBenchmark {
>    std::vector<uint8_t> AssembledSnippet;
>    // How to aggregate measurements.
>    enum ResultAggregationModeE { Min, Max, Mean, MinVariance };
> +
> +  InstructionBenchmark() = default;
> +  InstructionBenchmark(InstructionBenchmark &&) = default;
> +
> +  InstructionBenchmark(const InstructionBenchmark &) = delete;
> + InstructionBenchmark &operator=(const InstructionBenchmark &) =
> + delete;  InstructionBenchmark &operator=(InstructionBenchmark &&) =
> + delete;
> +
>    // Read functions.
>    static Expected<InstructionBenchmark> readYaml(const LLVMState &State,
>                                                   MemoryBufferRef Buffer);
>
> diff  --git a/llvm/unittests/tools/llvm-exegesis/Mips/BenchmarkResultTest.cpp b/llvm/unittests/tools/llvm-exegesis/Mips/BenchmarkResultTest.cpp
> index 429e6589eb5d..575e53d75310 100644
> --- a/llvm/unittests/tools/llvm-exegesis/Mips/BenchmarkResultTest.cpp
> +++ b/llvm/unittests/tools/llvm-exegesis/Mips/BenchmarkResultTest.cpp
> @@ -112,7 +112,7 @@ TEST_F(MipsBenchmarkResultTest, WriteToAndReadFromDisk) {
>      const auto FromDiskVector =
>          ExitOnErr(InstructionBenchmark::readYamls(State, *Buffer));
>      ASSERT_EQ(FromDiskVector.size(), size_t{1});
> -    const auto FromDisk = FromDiskVector[0];
> +    const auto &FromDisk = FromDiskVector[0];
>      EXPECT_THAT(FromDisk.Key.Instructions,
>                  Pointwise(EqMCInst(), ToDisk.Key.Instructions));
>      EXPECT_EQ(FromDisk.Key.Config, ToDisk.Key.Config);
>
> diff  --git a/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp
> index 0d47a76b5480..bfee792d158a 100644
> --- a/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp
> +++ b/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp
> @@ -136,7 +136,7 @@ TEST(BenchmarkResultTest, WriteToAndReadFromDisk) {
>      const auto FromDiskVector =
>          ExitOnErr(InstructionBenchmark::readYamls(State, *Buffer));
>      ASSERT_EQ(FromDiskVector.size(), size_t{1});
> -    const auto FromDisk = FromDiskVector[0];
> +    const auto &FromDisk = FromDiskVector[0];
>      EXPECT_THAT(FromDisk.Key.Instructions,
>                  Pointwise(EqMCInst(), ToDisk.Key.Instructions));
>      EXPECT_EQ(FromDisk.Key.Config, ToDisk.Key.Config);
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://urldefense.com/v3/__https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits__;!!JmoZiZGBv3RvKRSx!6eOZYa4OHMFJd5dyVcXjtuI8c_BtmxA8RY0b8FTsT5pv0y1EflfL9L-JhaJD-bHdwU6QhNXJfYnaUym2v_vYO0OorQg_$


More information about the llvm-commits mailing list