[llvm] r360044 - Fix compilation warnings when compiling with GCC 7.3
Alexandre Ganea via llvm-commits
llvm-commits at lists.llvm.org
Mon May 6 06:41:54 PDT 2019
Author: aganea
Date: Mon May 6 06:41:54 2019
New Revision: 360044
URL: http://llvm.org/viewvc/llvm-project?rev=360044&view=rev
Log:
Fix compilation warnings when compiling with GCC 7.3
Differential Revision: https://reviews.llvm.org/D61046
Modified:
llvm/trunk/lib/Target/AMDGPU/R600ISelLowering.cpp
llvm/trunk/unittests/IR/ConstantRangeTest.cpp
llvm/trunk/unittests/Support/TypeTraitsTest.cpp
llvm/trunk/unittests/Transforms/Scalar/CMakeLists.txt
llvm/trunk/unittests/Transforms/Scalar/LoopPassManagerTest.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/R600ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/R600ISelLowering.cpp?rev=360044&r1=360043&r2=360044&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/R600ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/R600ISelLowering.cpp Mon May 6 06:41:54 2019
@@ -1714,6 +1714,12 @@ static SDValue CompactSwizzlableVector(
if (NewBldVec[i].isUndef())
continue;
+ // Fix spurious warning with gcc 7.3 -O3
+ // warning: array subscript is above array bounds [-Warray-bounds]
+ // if (NewBldVec[i] == NewBldVec[j]) {
+ // ~~~~~~~~~~~^
+ if (i >= 4)
+ continue;
for (unsigned j = 0; j < i; j++) {
if (NewBldVec[i] == NewBldVec[j]) {
NewBldVec[i] = DAG.getUNDEF(NewBldVec[i].getValueType());
Modified: llvm/trunk/unittests/IR/ConstantRangeTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/ConstantRangeTest.cpp?rev=360044&r1=360043&r2=360044&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/ConstantRangeTest.cpp (original)
+++ llvm/trunk/unittests/IR/ConstantRangeTest.cpp Mon May 6 06:41:54 2019
@@ -459,6 +459,7 @@ void testBinarySetOperationExhaustive(Fn
}
}
+ (void)HaveInterrupt3;
assert(!HaveInterrupt3 && "Should have at most three ranges");
ConstantRange SmallestCR = OpFn(CR1, CR2, ConstantRange::Smallest);
Modified: llvm/trunk/unittests/Support/TypeTraitsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/TypeTraitsTest.cpp?rev=360044&r1=360043&r2=360044&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/TypeTraitsTest.cpp (original)
+++ llvm/trunk/unittests/Support/TypeTraitsTest.cpp Mon May 6 06:41:54 2019
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Support/type_traits.h"
+#include "gtest/gtest.h"
namespace {
@@ -71,6 +72,26 @@ template void TrivialityTester<Z &&, fal
template void TrivialityTester<A &&, false, true>();
template void TrivialityTester<B &&, false, true>();
+TEST(Triviality, Tester) {
+ TrivialityTester<int, true, true>();
+ TrivialityTester<void *, true, true>();
+ TrivialityTester<int &, true, true>();
+ TrivialityTester<int &&, false, true>();
+
+ TrivialityTester<X, true, true>();
+ TrivialityTester<Y, false, false>();
+ TrivialityTester<Z, false, false>();
+ TrivialityTester<A, true, false>();
+ TrivialityTester<B, false, true>();
+
+ TrivialityTester<Z &, true, true>();
+ TrivialityTester<A &, true, true>();
+ TrivialityTester<B &, true, true>();
+ TrivialityTester<Z &&, false, true>();
+ TrivialityTester<A &&, false, true>();
+ TrivialityTester<B &&, false, true>();
+}
+
} // namespace triviality
} // end anonymous namespace
Modified: llvm/trunk/unittests/Transforms/Scalar/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Transforms/Scalar/CMakeLists.txt?rev=360044&r1=360043&r2=360044&view=diff
==============================================================================
--- llvm/trunk/unittests/Transforms/Scalar/CMakeLists.txt (original)
+++ llvm/trunk/unittests/Transforms/Scalar/CMakeLists.txt Mon May 6 06:41:54 2019
@@ -10,3 +10,8 @@ set(LLVM_LINK_COMPONENTS
add_llvm_unittest(ScalarTests
LoopPassManagerTest.cpp
)
+
+# Workaround for the gcc 6.1 bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80916.
+if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
+ set_source_files_properties(LoopPassManagerTest.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-function)
+endif()
Modified: llvm/trunk/unittests/Transforms/Scalar/LoopPassManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Transforms/Scalar/LoopPassManagerTest.cpp?rev=360044&r1=360043&r2=360044&view=diff
==============================================================================
--- llvm/trunk/unittests/Transforms/Scalar/LoopPassManagerTest.cpp (original)
+++ llvm/trunk/unittests/Transforms/Scalar/LoopPassManagerTest.cpp Mon May 6 06:41:54 2019
@@ -20,19 +20,9 @@
#include "llvm/IR/PassManager.h"
#include "llvm/Support/SourceMgr.h"
-// Workaround for the gcc 6.1 bug PR80916.
-#if defined(__GNUC__) && __GNUC__ > 5
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wunused-function"
-#endif
-
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#if defined(__GNUC__) && __GNUC__ > 5
-# pragma GCC diagnostic pop
-#endif
-
using namespace llvm;
namespace {
More information about the llvm-commits
mailing list