<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - LICM seems unnecessarily slow"
   href="https://llvm.org/bugs/show_bug.cgi?id=23077">23077</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LICM seems unnecessarily slow
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

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

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14121" name="attach_14121" title="Test case">attachment 14121</a> <a href="attachment.cgi?id=14121&action=edit" title="Test case">[details]</a></span>
Test case

This simple file takes with 'opt -basicaa -licm out.opt.ll' 130ms to run. This
is suprisingly slow.

If I comment out the following lines:

     // If there are any call sites in the alias set, add them to this AST.
-    for (unsigned i = 0, e = AS.UnknownInsts.size(); i != e; ++i)
-      add(AS.UnknownInsts[i]);
+    //for (unsigned i = 0, e = AS.UnknownInsts.size(); i != e; ++i)
+    //  add(AS.UnknownInsts[i]);

Compile time is reduced to 20ms.

Surisingly only a single test case fails:

    Transforms/LICM/PR21582.ll

I do not yet understand well what these Unknown instructions are suppose to be
used for, but I somehow have the feeling there is an obvious inefficiency here.

If I dump the AST:

+++ b/lib/Transforms/Scalar/LICM.cpp
@@ -200,6 +200,7 @@ bool LICM::runOnLoop(Loop *L, LPPassManager &LPM) {
     delete InnerAST;
     LoopToAliasSetMap.erase(InnerL);
   }
+  CurAST->dump();

I get(after some delay) the following output:

Alias Set Tracker: 128 alias sets for 0 pointer values.
  AliasSet[0x454de10, 1] may alias, Mod/Ref   
    1 Unknown instructions: void <badref>
  AliasSet[0x454de60, 1] may alias, Mod/Ref   
    1 Unknown instructions: void <badref>
  AliasSet[0x454deb0, 1] may alias, Mod/Ref   
    1 Unknown instructions: void <badref>
  AliasSet[0x454df20, 1] may alias, Mod/Ref   
    1 Unknown instructions: void <badref>
  AliasSet[0x454df90, 1] may alias, Mod/Ref   
    1 Unknown instructions: void <badref>
  AliasSet[0x454e000, 1] may alias, Mod/Ref   
    1 Unknown instructions: void <badref>

...

Do we really need 128 alias sets here?</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>