[PATCH] D74691: [Attributor] add some pattern to containsCycle
Stefanos Baziotis via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 20 02:44:44 PST 2020
baziotis added inline comments.
================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:2421
+ }
+ } while (L != L->getParentLoop() && (L = L->getParentLoop()));
}
----------------
omarahmed wrote:
> omarahmed wrote:
> > baziotis wrote:
> > > Sorry but this is unclear to me. Could you explain the reasoning? I'd think that the `while` version is easier to deal with, was there a problem with it?
> > the while version was making an infinte loop error , I think getParentLoop when there was no parent anymore it returned the same loop and not null so i fixed it by this first check .
> oh i didn't see this continue part so i think now it is the one that makes that , i will edit it to the while version again :)
:)
Btw, the idea to do a do-while and return if there was no initial loop was very good!
Also, I wrote the `while` assuming that if there's no parent loop, `getParentLoop()` will return `null`. I now see there's no documentation in `getParentLoop()`, but given that code: https://llvm.org/doxygen/LoopInfo_8h_source.html#l00097
which chases back `ParentLoop`, which is what `getParentLoop()` returns, it should return null when there's no parent.
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