<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Polly - AST Generation] Derive knowledge about loops that are known to be executed at least once"
   href="https://bugs.llvm.org/show_bug.cgi?id=32998">32998</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[Polly - AST Generation] Derive knowledge about loops that are known to be executed at least once
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Polly
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>isl
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>polly-dev@googlegroups.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>tobias@grosser.es
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>