[polly] r246161 - Do not detect Scops with only one loop.

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 05:26:18 PDT 2015


On 08/28/2015 02:15 PM, Johannes Doerfert wrote:
> On 08/28, Tobias Grosser wrote:
>>>> What about the following:
>>>>
>>>> Algorithm:
>>>>
>>>>    loopNum = 0;
>>>>
>>>>    entryNodeLoop = LI->getLoopFor(R->getEntry)
>>>>
>>>>    if loop in R
>>>>      children = loop->getParent()->children
>>>>    else if loop not in R:
>>>>      children = loop->children
>>>>    else // no loop at all
>>>>      children = LI->getoutermostloops
>>>>
>>>>    for child in children
>>>>      if (R->contains(child)) {
>>>>        loopNum++;
>>>>        if (child->subloops > 0)
>>>>          loopNum++;
>>>>
>>>>        if (loopNum >= 2)
>>>>          return true;
>>>>      }
>>>>    return false;
>>>
>>> I am not convinced that the loops we see and count should be in any kind
>>> related to the entry block of the region. What about code like this:
>>>
>>>    if (...)
>>>      LoopNest
>>>
>>> can't that be a region? Even if not, I think there is some kind of code
>>> with many loops but none of them contains the entry block. Do you
>>> disagree?
>>
>> That will be the second or the third case of the code above. The second in
>> case the scop is part of a larger loop and the third case if no loop surrounds
>> the scop.
> OK, got it now.
>
> Some special handling if entryNodeLoop is a toplevel loop but other than
> that it should work.

Why does the toplevel loop require special treatment? Only if there is no
surrounding loop aka. entryNodeLoop is nullptr the special handling as
visible in the else seems needed.

Best,
Tobias



More information about the llvm-commits mailing list