Skip to content

Commit

Permalink
[LSR][NFC] Use range-based for (#113889)
Browse files Browse the repository at this point in the history
  • Loading branch information
pfusik authored Nov 5, 2024
1 parent aea6b25 commit 1a44a53
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2663,15 +2663,15 @@ LSRInstance::OptimizeLoopTermCond() {
// Conservatively avoid trying to use the post-inc value in non-latch
// exits if there may be pre-inc users in intervening blocks.
if (LatchBlock != ExitingBlock)
for (IVUsers::const_iterator UI = IU.begin(), E = IU.end(); UI != E; ++UI)
for (const IVStrideUse &UI : IU)
// Test if the use is reachable from the exiting block. This dominator
// query is a conservative approximation of reachability.
if (&*UI != CondUse &&
!DT.properlyDominates(UI->getUser()->getParent(), ExitingBlock)) {
if (&UI != CondUse &&
!DT.properlyDominates(UI.getUser()->getParent(), ExitingBlock)) {
// Conservatively assume there may be reuse if the quotient of their
// strides could be a legal scale.
const SCEV *A = IU.getStride(*CondUse, L);
const SCEV *B = IU.getStride(*UI, L);
const SCEV *B = IU.getStride(UI, L);
if (!A || !B) continue;
if (SE.getTypeSizeInBits(A->getType()) !=
SE.getTypeSizeInBits(B->getType())) {
Expand All @@ -2692,9 +2692,9 @@ LSRInstance::OptimizeLoopTermCond() {
C->getValue().isMinSignedValue())
goto decline_post_inc;
// Check for possible scaled-address reuse.
if (isAddressUse(TTI, UI->getUser(), UI->getOperandValToReplace())) {
MemAccessTy AccessTy = getAccessType(
TTI, UI->getUser(), UI->getOperandValToReplace());
if (isAddressUse(TTI, UI.getUser(), UI.getOperandValToReplace())) {
MemAccessTy AccessTy =
getAccessType(TTI, UI.getUser(), UI.getOperandValToReplace());
int64_t Scale = C->getSExtValue();
if (TTI.isLegalAddressingMode(AccessTy.MemTy, /*BaseGV=*/nullptr,
/*BaseOffset=*/0,
Expand Down

0 comments on commit 1a44a53

Please sign in to comment.