Skip to content

Commit 49036dd

Browse files
committed
[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
1 parent 9bea4ec commit 49036dd

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

llvm/unittests/CodeGen/GlobalISel/KnownBitsTest.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,16 @@ TEST_F(GISelMITest, TestKnownBits) {
120120
}
121121

122122
TEST_F(GISelMITest, TestSignBitIsZero) {
123+
setUp();
123124
if (!TM)
124125
return;
125126

126127
const LLT S32 = LLT::scalar(32);
127-
auto SignBit = B.buildConstant(S32, 0x8000000);
128+
auto SignBit = B.buildConstant(S32, 0x80000000);
128129
auto Zero = B.buildConstant(S32, 0);
129130

130131
GISelKnownBits KnownBits(*MF);
131132

132133
EXPECT_TRUE(KnownBits.signBitIsZero(Zero.getReg(0)));
133-
EXPECT_FALSE(KnownBits.signBitIsZero(Zero.getReg(0)));
134134
EXPECT_FALSE(KnownBits.signBitIsZero(SignBit.getReg(0)));
135-
EXPECT_TRUE(KnownBits.signBitIsZero(SignBit.getReg(0)));
136135
}

llvm/unittests/CodeGen/GlobalISel/MachineIRBuilderTest.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ TEST_F(GISelMITest, TestBuildConstantFConstantDeath) {
7474
#endif
7575

7676
TEST_F(GISelMITest, DstOpSrcOp) {
77+
setUp();
7778
if (!TM)
7879
return;
7980

@@ -99,6 +100,7 @@ TEST_F(GISelMITest, DstOpSrcOp) {
99100
}
100101

101102
TEST_F(GISelMITest, BuildUnmerge) {
103+
setUp();
102104
if (!TM)
103105
return;
104106

@@ -119,6 +121,7 @@ TEST_F(GISelMITest, BuildUnmerge) {
119121
}
120122

121123
TEST_F(GISelMITest, TestBuildFPInsts) {
124+
setUp();
122125
if (!TM)
123126
return;
124127

@@ -154,6 +157,7 @@ TEST_F(GISelMITest, TestBuildFPInsts) {
154157
}
155158

156159
TEST_F(GISelMITest, BuildIntrinsic) {
160+
setUp();
157161
if (!TM)
158162
return;
159163

@@ -182,6 +186,7 @@ TEST_F(GISelMITest, BuildIntrinsic) {
182186
}
183187

184188
TEST_F(GISelMITest, BuildXor) {
189+
setUp();
185190
if (!TM)
186191
return;
187192

@@ -210,6 +215,7 @@ TEST_F(GISelMITest, BuildXor) {
210215
}
211216

212217
TEST_F(GISelMITest, BuildBitCounts) {
218+
setUp();
213219
if (!TM)
214220
return;
215221

@@ -237,6 +243,7 @@ TEST_F(GISelMITest, BuildBitCounts) {
237243
}
238244

239245
TEST_F(GISelMITest, BuildCasts) {
246+
setUp();
240247
if (!TM)
241248
return;
242249

@@ -261,6 +268,7 @@ TEST_F(GISelMITest, BuildCasts) {
261268
}
262269

263270
TEST_F(GISelMITest, BuildMinMax) {
271+
setUp();
264272
if (!TM)
265273
return;
266274

@@ -286,6 +294,7 @@ TEST_F(GISelMITest, BuildMinMax) {
286294
}
287295

288296
TEST_F(GISelMITest, BuildAtomicRMW) {
297+
setUp();
289298
if (!TM)
290299
return;
291300

0 commit comments

Comments
 (0)