Skip to content

Commit c402a93

Browse files
committed
Add comments
1 parent 8c89a63 commit c402a93

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9200,9 +9200,13 @@ ScalarEvolution::ExitLimit ScalarEvolution::computeExitLimitFromICmp(
92009200
if (!EnableFiniteLoopControl || !ControllingFiniteLoop ||
92019201
!isLoopInvariant(RHS, L)) {
92029202
// Otherwise, perform the addition in a wider type, to avoid overflow.
9203+
// If the LHS is an addrec with the appropriate nowrap flag, the
9204+
// extension will be sunk into it and the exit count can be analyzed.
92039205
auto *OldType = dyn_cast<IntegerType>(LHS->getType());
92049206
if (!OldType)
92059207
break;
9208+
// Prefer doubling the bitwidth over adding a single bit to make it more
9209+
// likely that we use a legal type.
92069210
auto *NewType =
92079211
Type::getIntNTy(OldType->getContext(), OldType->getBitWidth() * 2);
92089212
if (ICmpInst::isSigned(Pred)) {

0 commit comments

Comments
 (0)