<html>
    <head>
      <base href="http://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 --- - Infinite loop in llvm::MachineBlockFrequencyInfo::getBlockFreq"
   href="http://llvm.org/bugs/show_bug.cgi?id=21913">21913</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Infinite loop in llvm::MachineBlockFrequencyInfo::getBlockFreq
          </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>Common Code Generator Code
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>email@piotr-stefaniak.me
          </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>I seem to have found a case where Clang (rev. 224219) gets stuck in
llvm::BranchProbability::scale(unsigned long) and/or
llvm::MachineBlockFrequencyInfo::getBlockFreq(llvm::MachineBasicBlock const*).

This is how I reproduce it:

pstef@gentoo /tmp $ git clone --depth 1 <a href="https://github.com/libtom/libtomcrypt">https://github.com/libtom/libtomcrypt</a>
Cloning into 'libtomcrypt'...
remote: Counting objects: 546, done.
remote: Compressing objects: 100% (468/468), done.
remote: Total 546 (delta 155), reused 190 (delta 74)
Receiving objects: 100% (546/546), 2.64 MiB | 851.00 KiB/s, done.
Resolving deltas: 100% (155/155), done.
Checking connectivity... done.
pstef@gentoo /tmp $ cd libtomcrypt
pstef@gentoo /tmp/libtomcrypt $ clang -fsanitize=undefined -I./src/headers/ -O1
-c -o src/ciphers/safer/saferp.o src/ciphers/safer/saferp.c
^C
pstef@gentoo /tmp/libtomcrypt $ \time clang -fsanitize=undefined
-I./src/headers/ -O1 -c -o src/ciphers/safer/saferp.o
src/ciphers/safer/saferp.c
^CCommand terminated by signal 2
0.00user 0.00system 8:17.20elapsed 0%CPU (0avgtext+0avgdata 52784maxresident)k
0inputs+0outputs (0major+330minor)pagefaults 0swaps
pstef@gentoo /tmp/libtomcrypt $ uname -a
Linux gentoo 3.16.5-gentoo #1 SMP Sun Nov 23 12:08:11 CET 2014 x86_64 Intel
Core 2 Duo P9xxx (Penryn Class Core 2) GenuineIntel GNU/Linux
pstef@gentoo /tmp/libtomcrypt $ clang --version
clang version 3.6.0 (trunk 224219)
Target: x86_64-unknown-linux-gnu
Thread model: posix


And this is the most relevant (slightly edited) part of PerfTop's output:

   PerfTop:    3856 irqs/sec  kernel: 0.4%  exact:  0.0% [4000Hz cpu-clock], 
(all, 1 CPU)
------------------------------------------------------------------------------------------
    36.76%  clang             [.] llvm::BranchProbability::scale(unsigned long)
const                                                     
    23.85%  clang             [.]
llvm::MachineBlockFrequencyInfo::getBlockFreq(llvm::MachineBasicBlock const*)
const                     
     9.37%  clang             [.]
llvm::BlockFrequencyInfoImplBase::getBlockFreq(llvm::BlockFrequencyInfoImplBase::BlockNode
const&) const
     1.52%  clang             [.] 0x000000000198ea5c                            
     1.20%  libc-2.19.so      [.] 0x000000000008b65b


As requested from nicholas, I'm adding the post-optimized llvm IR as an
attachment to this report. It's created with:

clang -fsanitize=undefined -I./src/headers/ -O1 -flto -c -o file.bc
src/ciphers/safer/saferp.c</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>