<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 --- - Inliner fails with negative threshholds"
   href="https://llvm.org/bugs/show_bug.cgi?id=26495">26495</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Inliner fails with negative threshholds
          </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>Interprocedural Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>hans@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>david.majnemer@gmail.com, eraman@google.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>David reported on IRC the other week that we fail to inline g into f and f into
h here:


target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"

define void @h(i8* nocapture readnone %this) {
entry:
  call void @f(i8* %this)
  unreachable
}

define linkonce_odr void @f(i8* nocapture readnone %this) {
entry:
  tail call void @g(i8* %this)
  unreachable
}

define linkonce_odr void @g(i8* nocapture readnone %this) {
entry:
  br label %for.cond

for.cond:
  tail call void @foo(i32 1)
  br label %for.cond
}

declare void @foo(i32)



$ bin/opt -inline /tmp/a.ll -S -debug
[..]
      Analyzing call of g...
      NumConstantArgs: 0
      NumConstantOffsetPtrArgs: 1
      NumAllocaArgs: 0
      NumConstantPtrCmps: 0
      NumConstantPtrDiffs: 0
      NumInstructionsSimplified: 1
      NumInstructions: 2
      SROACostSavings: 0
      SROACostSavingsLost: 0
      ContainsNoDuplicateCall: 0
      Cost: 30
      Threshold: -337
    NOT Inlining: cost=30, thres=-337, Call:   tail call void @g(i8* %this)
Inliner visiting SCC: h: 1 call sites.
      Analyzing call of f...
      NumConstantArgs: 0
      NumConstantOffsetPtrArgs: 1
      NumAllocaArgs: 0
      NumConstantPtrCmps: 0
      NumConstantPtrDiffs: 0
      NumInstructionsSimplified: 0
      NumInstructions: 1
      SROACostSavings: 0
      SROACostSavingsLost: 0
      ContainsNoDuplicateCall: 0
      Cost: 30
      Threshold: -337
    NOT Inlining: cost=30, thres=-337, Call:   call void @f(i8* %this)</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>