Skip to content

Commit 346d2c0

Browse files
committed
[KnownBitsTest] Standardize variable names in exhaustive tests
1 parent 1588368 commit 346d2c0

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

llvm/unittests/Support/KnownBitsTest.cpp

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -117,25 +117,25 @@ TEST(KnownBitsTest, AddCarryExhaustive) {
117117
ForeachKnownBits(1, [&](const KnownBits &KnownCarry) {
118118
// Explicitly compute known bits of the addition by trying all
119119
// possibilities.
120-
KnownBits Known(Bits);
121-
Known.Zero.setAllBits();
122-
Known.One.setAllBits();
120+
KnownBits Exact(Bits);
121+
Exact.Zero.setAllBits();
122+
Exact.One.setAllBits();
123123
ForeachNumInKnownBits(Known1, [&](const APInt &N1) {
124124
ForeachNumInKnownBits(Known2, [&](const APInt &N2) {
125125
ForeachNumInKnownBits(KnownCarry, [&](const APInt &Carry) {
126126
APInt Add = N1 + N2;
127127
if (Carry.getBoolValue())
128128
++Add;
129129

130-
Known.One &= Add;
131-
Known.Zero &= ~Add;
130+
Exact.One &= Add;
131+
Exact.Zero &= ~Add;
132132
});
133133
});
134134
});
135135

136-
KnownBits KnownComputed =
136+
KnownBits Computed =
137137
KnownBits::computeForAddCarry(Known1, Known2, KnownCarry);
138-
EXPECT_EQ(Known, KnownComputed);
138+
EXPECT_EQ(Exact, Computed);
139139
});
140140
});
141141
});
@@ -146,16 +146,16 @@ static void TestAddSubExhaustive(bool IsAdd) {
146146
unsigned Bits = 4;
147147
ForeachKnownBits(Bits, [&](const KnownBits &Known1) {
148148
ForeachKnownBits(Bits, [&](const KnownBits &Known2) {
149-
KnownBits Known(Bits), KnownNSW(Bits), KnownNUW(Bits),
150-
KnownNSWAndNUW(Bits);
151-
Known.Zero.setAllBits();
152-
Known.One.setAllBits();
153-
KnownNSW.Zero.setAllBits();
154-
KnownNSW.One.setAllBits();
155-
KnownNUW.Zero.setAllBits();
156-
KnownNUW.One.setAllBits();
157-
KnownNSWAndNUW.Zero.setAllBits();
158-
KnownNSWAndNUW.One.setAllBits();
149+
KnownBits Exact(Bits), ExactNSW(Bits), ExactNUW(Bits),
150+
ExactNSWAndNUW(Bits);
151+
Exact.Zero.setAllBits();
152+
Exact.One.setAllBits();
153+
ExactNSW.Zero.setAllBits();
154+
ExactNSW.One.setAllBits();
155+
ExactNUW.Zero.setAllBits();
156+
ExactNUW.One.setAllBits();
157+
ExactNSWAndNUW.Zero.setAllBits();
158+
ExactNSWAndNUW.One.setAllBits();
159159

160160
ForeachNumInKnownBits(Known1, [&](const APInt &N1) {
161161
ForeachNumInKnownBits(Known2, [&](const APInt &N2) {
@@ -170,47 +170,47 @@ static void TestAddSubExhaustive(bool IsAdd) {
170170
Res = N1.ssub_ov(N2, SignedOverflow);
171171
}
172172

173-
Known.One &= Res;
174-
Known.Zero &= ~Res;
173+
Exact.One &= Res;
174+
Exact.Zero &= ~Res;
175175

176176
if (!SignedOverflow) {
177-
KnownNSW.One &= Res;
178-
KnownNSW.Zero &= ~Res;
177+
ExactNSW.One &= Res;
178+
ExactNSW.Zero &= ~Res;
179179
}
180180

181181
if (!UnsignedOverflow) {
182-
KnownNUW.One &= Res;
183-
KnownNUW.Zero &= ~Res;
182+
ExactNUW.One &= Res;
183+
ExactNUW.Zero &= ~Res;
184184
}
185185

186186
if (!UnsignedOverflow && !SignedOverflow) {
187-
KnownNSWAndNUW.One &= Res;
188-
KnownNSWAndNUW.Zero &= ~Res;
187+
ExactNSWAndNUW.One &= Res;
188+
ExactNSWAndNUW.Zero &= ~Res;
189189
}
190190
});
191191
});
192192

193-
KnownBits KnownComputed = KnownBits::computeForAddSub(
193+
KnownBits Computed = KnownBits::computeForAddSub(
194194
IsAdd, /*NSW=*/false, /*NUW=*/false, Known1, Known2);
195-
EXPECT_TRUE(checkResult(Name, Known, KnownComputed, {Known1, Known2},
195+
EXPECT_TRUE(checkResult(Name, Exact, Computed, {Known1, Known2},
196196
/*CheckOptimality=*/true));
197197

198-
KnownBits KnownNSWComputed = KnownBits::computeForAddSub(
198+
KnownBits ComputedNSW = KnownBits::computeForAddSub(
199199
IsAdd, /*NSW=*/true, /*NUW=*/false, Known1, Known2);
200-
EXPECT_TRUE(checkResult(Name + " nsw", KnownNSW, KnownNSWComputed,
200+
EXPECT_TRUE(checkResult(Name + " nsw", ExactNSW, ComputedNSW,
201201
{Known1, Known2},
202202
/*CheckOptimality=*/true));
203203

204-
KnownBits KnownNUWComputed = KnownBits::computeForAddSub(
204+
KnownBits ComputedNUW = KnownBits::computeForAddSub(
205205
IsAdd, /*NSW=*/false, /*NUW=*/true, Known1, Known2);
206-
EXPECT_TRUE(checkResult(Name + " nuw", KnownNUW, KnownNUWComputed,
206+
EXPECT_TRUE(checkResult(Name + " nuw", ExactNUW, ComputedNUW,
207207
{Known1, Known2},
208208
/*CheckOptimality=*/true));
209209

210-
KnownBits KnownNSWAndNUWComputed = KnownBits::computeForAddSub(
210+
KnownBits ComputedNSWAndNUW = KnownBits::computeForAddSub(
211211
IsAdd, /*NSW=*/true, /*NUW=*/true, Known1, Known2);
212-
EXPECT_TRUE(checkResult(Name + " nsw nuw", KnownNSWAndNUW,
213-
KnownNSWAndNUWComputed, {Known1, Known2},
212+
EXPECT_TRUE(checkResult(Name + " nsw nuw", ExactNSWAndNUW,
213+
ComputedNSWAndNUW, {Known1, Known2},
214214
/*CheckOptimality=*/true));
215215
});
216216
});
@@ -228,25 +228,25 @@ TEST(KnownBitsTest, SubBorrowExhaustive) {
228228
ForeachKnownBits(1, [&](const KnownBits &KnownBorrow) {
229229
// Explicitly compute known bits of the subtraction by trying all
230230
// possibilities.
231-
KnownBits Known(Bits);
232-
Known.Zero.setAllBits();
233-
Known.One.setAllBits();
231+
KnownBits Exact(Bits);
232+
Exact.Zero.setAllBits();
233+
Exact.One.setAllBits();
234234
ForeachNumInKnownBits(Known1, [&](const APInt &N1) {
235235
ForeachNumInKnownBits(Known2, [&](const APInt &N2) {
236236
ForeachNumInKnownBits(KnownBorrow, [&](const APInt &Borrow) {
237237
APInt Sub = N1 - N2;
238238
if (Borrow.getBoolValue())
239239
--Sub;
240240

241-
Known.One &= Sub;
242-
Known.Zero &= ~Sub;
241+
Exact.One &= Sub;
242+
Exact.Zero &= ~Sub;
243243
});
244244
});
245245
});
246246

247-
KnownBits KnownComputed =
247+
KnownBits Computed =
248248
KnownBits::computeForSubBorrow(Known1, Known2, KnownBorrow);
249-
EXPECT_EQ(Known, KnownComputed);
249+
EXPECT_EQ(Exact, Computed);
250250
});
251251
});
252252
});

0 commit comments

Comments
 (0)