[llvm-bugs] [Bug 32998] New: [Polly - AST Generation] Derive knowledge about loops that are known to be executed at least once

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 10 23:39:50 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=32998

            Bug ID: 32998
           Summary: [Polly - AST Generation] Derive knowledge about loops
                    that are known to be executed at least once
           Product: Polly
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: isl
          Assignee: polly-dev at googlegroups.com
          Reporter: tobias at grosser.es
                CC: llvm-bugs at lists.llvm.org

Polly generates in lib/CodeGen/LoopGenerators.cpp:createLoop one of the two
loop forms:


//              BeforeBB                      BeforeBB                          
//                 |                             |                              
//                 v                             v                              
//              GuardBB                      PreHeaderBB                        
//              /      |                         |   _____                      
//     __  PreHeaderBB  |                        v  \/    |                     
//    /  \    /         |                     HeaderBB  latch                   
// latch  HeaderBB      |                        |\       |                     
//    \  /    \         /                        | \------/                     
//     <       \       /                         |                              
//              \     /                          v                              
//              ExitBB                         ExitBB   


In C, this means a loop:

for (i = LB; i <= UB; i++)
   S(i);

is generated either as:

if (LB <= UB) {
  long i = LB;
  do {
   S(i);
   i++;
  } while (LB <= UB);
}

or as

  long i = LB;
  do {
   S(i);
   i++;
  } while (LB <= UB);

in case we can statically proof that LB <= UB. Polly can do this only for
integer constants, but isl can likely proof this information a lot more often.
It would be great if isl can provide this information, such that we can avoid
code size increase due to the unnecessary condition. The condition likely also
hinders loop invariant code motion.

Background: Polly (and LLVM in general) does this rewriting to move branches
after the loop body, such that the content of the loop body can be hoisted out
of the loop without any control flow branches blocking this hoisting.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170511/aa68d9bf/attachment-0001.html>


More information about the llvm-bugs mailing list