[PATCH] D102615: [LoopDeletion] Break backedge if we can prove that the loop is exited on 1st iteration (try 3)

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 1 03:20:33 PDT 2021


mkazantsev added a comment.

In D102615#2790558 <https://reviews.llvm.org/D102615#2790558>, @xbolva00 wrote:

> In D102615#2790544 <https://reviews.llvm.org/D102615#2790544>, @mkazantsev wrote:
>
>> In D102615#2790190 <https://reviews.llvm.org/D102615#2790190>, @xbolva00 wrote:
>>
>>> In D102615#2789636 <https://reviews.llvm.org/D102615#2789636>, @mkazantsev wrote:
>>>
>>>> In D102615#2788964 <https://reviews.llvm.org/D102615#2788964>, @xbolva00 wrote:
>>>>
>>>>> What are the latest compile time data for this patch?
>>>>
>>>> There have been several separate follow-ups to address the compile time, but I believe we never measured it all together.
>>>
>>> Could we get new data? @nikic? I am not sure if followups were not reverted as well so if follow up patches can recommited as NFC(I) patches, it would be great.
>>
>> The followups were all reverted and integrated into this one. I see no point in merging them separately, unless we want more pain with reverts (if it is needed again). They are just part of the algorithm.
>
> Nice, so only this patch needs to tested for compile time. But if less than +0.5%, it should be acceptable. There were many improvements in ct, so I do think there is some space for less cheap optimizations.

Yes, only this patch. The NFC(I)s were basically this

  auto *BTC = SE.getBackedgeTakenCount(L);
  if (!isa<SCEVCouldNotCompute>(BTC) && SE.isKnownNonZero(BTC))
    return LoopDeletionResult::Unmodified;
  if (!BTC->isZero() && !canProveExitOnFirstIteration(L, DT, SE, LI))
    return LoopDeletionResult::Unmodified;

and

  if (L->contains(IfFalse) && SE.isKnownPredicate(Pred, LHSS, RHSS))  // contains check is NFCI
    MarkLiveEdge(BB, IfTrue);
  else if (L->contains(IfTrue) &&  // contains check is NFCI
           SE.isKnownPredicate(ICmpInst::getInversePredicate(Pred), LHSS,
                               RHSS))
    MarkLiveEdge(BB, IfFalse);
  else
    MarkAllSuccessorsLive(BB);

No need to tear them off, they fit well.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102615/new/

https://reviews.llvm.org/D102615



More information about the llvm-commits mailing list