Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/22403 )

Change subject: mem-cache: Modify compressor to appease newer compilers
......................................................................

mem-cache: Modify compressor to appease newer compilers

The type of the local unique_ptr variable was different from the return type.

In C++11 because of such difference, a copy-ellision would not be possible,
and that required the use of a std::move.

In C++14 the restriction of same types being required was removed, so
std::move would not be needed anymore.

With the addition of the -Wredundant-move warning in newer compilers, having
the std::move on the return became an issue, breaking compilation.

Change-Id: I45d18dfc500bb5db5fe360814feb91853c735a19
Signed-off-by: Daniel R. Carvalho <oda...@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22403
Tested-by: kokoro <noreply+kok...@google.com>
Maintainer: Nikos Nikoleris <nikos.nikole...@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikole...@arm.com>
---
M src/mem/cache/compressors/dictionary_compressor_impl.hh
1 file changed, 4 insertions(+), 3 deletions(-)

Approvals:
  Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/mem/cache/compressors/dictionary_compressor_impl.hh b/src/mem/cache/compressors/dictionary_compressor_impl.hh
index 66827d7..4932402 100644
--- a/src/mem/cache/compressors/dictionary_compressor_impl.hh
+++ b/src/mem/cache/compressors/dictionary_compressor_impl.hh
@@ -117,23 +117,24 @@
 std::unique_ptr<BaseCacheCompressor::CompressionData>
 DictionaryCompressor<T>::compress(const uint64_t* data)
 {
-    std::unique_ptr<CompData> comp_data =
+    std::unique_ptr<BaseCacheCompressor::CompressionData> comp_data =
         std::unique_ptr<CompData>(new CompData());

     // Reset dictionary
     resetDictionary();

     // Compress every value sequentially
+ CompData* const comp_data_ptr = static_cast<CompData*>(comp_data.get());
     const std::vector<T> values((T*)data, (T*)data + blkSize / sizeof(T));
     for (const auto& value : values) {
         std::unique_ptr<Pattern> pattern = compressValue(value);
         DPRINTF(CacheComp, "Compressed %016x to %s\n", value,
             pattern->print());
-        comp_data->addEntry(std::move(pattern));
+        comp_data_ptr->addEntry(std::move(pattern));
     }

     // Return compressed line
-    return std::move(comp_data);
+    return comp_data;
 }

 template <class T>

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/22403
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I45d18dfc500bb5db5fe360814feb91853c735a19
Gerrit-Change-Number: 22403
Gerrit-PatchSet: 3
Gerrit-Owner: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-CC: Nicholas Sielicki <sieli...@yandex.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to