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

            Bug ID: 26495
           Summary: Inliner fails with negative threshholds
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: h...@chromium.org
                CC: david.majne...@gmail.com, era...@google.com,
                    llvm-bugs@lists.llvm.org
    Classification: Unclassified

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)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to