Skip to content

Commit 2ac11da

Browse files
authored
[SCEV] Improve code around constant TC (NFC) (llvm#133261)
1 parent df28c81 commit 2ac11da

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8253,14 +8253,14 @@ unsigned ScalarEvolution::getSmallConstantTripMultiple(const Loop *L) {
82538253
unsigned Multiple = getSmallConstantTripMultiple(L, ExitingBB);
82548254
if (!Res)
82558255
Res = Multiple;
8256-
Res = (unsigned)std::gcd(*Res, Multiple);
8256+
Res = std::gcd(*Res, Multiple);
82578257
}
82588258
return Res.value_or(1);
82598259
}
82608260

82618261
unsigned ScalarEvolution::getSmallConstantTripMultiple(const Loop *L,
82628262
const SCEV *ExitCount) {
8263-
if (ExitCount == getCouldNotCompute())
8263+
if (isa<SCEVCouldNotCompute>(ExitCount))
82648264
return 1;
82658265

82668266
// Get the trip count
@@ -8270,8 +8270,8 @@ unsigned ScalarEvolution::getSmallConstantTripMultiple(const Loop *L,
82708270
// If a trip multiple is huge (>=2^32), the trip count is still divisible by
82718271
// the greatest power of 2 divisor less than 2^32.
82728272
return Multiple.getActiveBits() > 32
8273-
? 1U << std::min((unsigned)31, Multiple.countTrailingZeros())
8274-
: (unsigned)Multiple.zextOrTrunc(32).getZExtValue();
8273+
? 1U << std::min(31U, Multiple.countTrailingZeros())
8274+
: (unsigned)Multiple.getZExtValue();
82758275
}
82768276

82778277
/// Returns the largest constant divisor of the trip count of this loop as a

0 commit comments

Comments
 (0)