summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Colombet <quentin.colombet@gmail.com>2019-10-11 20:58:26 +0000
committerQuentin Colombet <quentin.colombet@gmail.com>2019-10-11 20:58:26 +0000
commit49036dd3aef9265270dcf4bb645050510b68e183 (patch)
tree6a23c66ee8d0212647aed850c8886e2639c32b4f
parent9bea4ec28cdf2a0b020e17b1999723b3e48eb088 (diff)
downloadbcm5719-llvm-49036dd3aef9265270dcf4bb645050510b68e183.tar.gz
bcm5719-llvm-49036dd3aef9265270dcf4bb645050510b68e183.zip
[GISel][UnitTest] Fix a bunch of tests that were not doing anything
After r368065, all the tests using GISelMITest must call setUp() before doing anything, otherwise the TargetMachine is not going to be set up. A few tests added after that commit were not doing that and ended up testing effectively nothing. Fix the setup of all the tests and fix the failing tests. llvm-svn: 374595
-rw-r--r--llvm/unittests/CodeGen/GlobalISel/KnownBitsTest.cpp5
-rw-r--r--llvm/unittests/CodeGen/GlobalISel/MachineIRBuilderTest.cpp9
2 files changed, 11 insertions, 3 deletions
diff --git a/llvm/unittests/CodeGen/GlobalISel/KnownBitsTest.cpp b/llvm/unittests/CodeGen/GlobalISel/KnownBitsTest.cpp
index 863a0a7215a..f7b037866e0 100644
--- a/llvm/unittests/CodeGen/GlobalISel/KnownBitsTest.cpp
+++ b/llvm/unittests/CodeGen/GlobalISel/KnownBitsTest.cpp
@@ -120,17 +120,16 @@ TEST_F(GISelMITest, TestKnownBits) {
}
TEST_F(GISelMITest, TestSignBitIsZero) {
+ setUp();
if (!TM)
return;
const LLT S32 = LLT::scalar(32);
- auto SignBit = B.buildConstant(S32, 0x8000000);
+ auto SignBit = B.buildConstant(S32, 0x80000000);
auto Zero = B.buildConstant(S32, 0);
GISelKnownBits KnownBits(*MF);
EXPECT_TRUE(KnownBits.signBitIsZero(Zero.getReg(0)));
- EXPECT_FALSE(KnownBits.signBitIsZero(Zero.getReg(0)));
EXPECT_FALSE(KnownBits.signBitIsZero(SignBit.getReg(0)));
- EXPECT_TRUE(KnownBits.signBitIsZero(SignBit.getReg(0)));
}
diff --git a/llvm/unittests/CodeGen/GlobalISel/MachineIRBuilderTest.cpp b/llvm/unittests/CodeGen/GlobalISel/MachineIRBuilderTest.cpp
index f39c28dc648..7e633c5ac3f 100644
--- a/llvm/unittests/CodeGen/GlobalISel/MachineIRBuilderTest.cpp
+++ b/llvm/unittests/CodeGen/GlobalISel/MachineIRBuilderTest.cpp
@@ -74,6 +74,7 @@ TEST_F(GISelMITest, TestBuildConstantFConstantDeath) {
#endif
TEST_F(GISelMITest, DstOpSrcOp) {
+ setUp();
if (!TM)
return;
@@ -99,6 +100,7 @@ TEST_F(GISelMITest, DstOpSrcOp) {
}
TEST_F(GISelMITest, BuildUnmerge) {
+ setUp();
if (!TM)
return;
@@ -119,6 +121,7 @@ TEST_F(GISelMITest, BuildUnmerge) {
}
TEST_F(GISelMITest, TestBuildFPInsts) {
+ setUp();
if (!TM)
return;
@@ -154,6 +157,7 @@ TEST_F(GISelMITest, TestBuildFPInsts) {
}
TEST_F(GISelMITest, BuildIntrinsic) {
+ setUp();
if (!TM)
return;
@@ -182,6 +186,7 @@ TEST_F(GISelMITest, BuildIntrinsic) {
}
TEST_F(GISelMITest, BuildXor) {
+ setUp();
if (!TM)
return;
@@ -210,6 +215,7 @@ TEST_F(GISelMITest, BuildXor) {
}
TEST_F(GISelMITest, BuildBitCounts) {
+ setUp();
if (!TM)
return;
@@ -237,6 +243,7 @@ TEST_F(GISelMITest, BuildBitCounts) {
}
TEST_F(GISelMITest, BuildCasts) {
+ setUp();
if (!TM)
return;
@@ -261,6 +268,7 @@ TEST_F(GISelMITest, BuildCasts) {
}
TEST_F(GISelMITest, BuildMinMax) {
+ setUp();
if (!TM)
return;
@@ -286,6 +294,7 @@ TEST_F(GISelMITest, BuildMinMax) {
}
TEST_F(GISelMITest, BuildAtomicRMW) {
+ setUp();
if (!TM)
return;
OpenPOWER on IntegriCloud