[PATCH] D74691: [Attributor] add some pattern to containsCycle

Stefanos Baziotis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 23:01:36 PST 2020


baziotis added a comment.

In D74691#1881580 <https://reviews.llvm.org/D74691#1881580>, @baziotis wrote:

> In D74691#1881530 <https://reviews.llvm.org/D74691#1881530>, @omarahmed wrote:
>
> > > First of all, try to get L. If you don't have a loop (so, L is null) then this
> > >  SCC is not a loop so return true immediately.
> >
> > couldn't we use SCCiter.hasLoop() in addition to this condition to check for loops as this condition always breaks with me in tests like that which have SCCs with single block that does not have loops and the above condition makes them return true when they don't have any cycles ?
> >
> >   define void @only_return() #0 {
> >       ret void
> >   }
> >
>
>
> Yes, you're right! I missed that.


Note that this means that you'll have to change the approach when LI or SI are null. Having a SCC at all is not enough. You still have to loop through them until either you find one that hasLoop (and return true) or return false.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74691





More information about the llvm-commits mailing list