[llvm-bugs] [Bug 34337] New: [InstCombineCalls] Prove callsite args constant to improve inlining decisions.

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 27 09:18:38 PDT 2017


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

            Bug ID: 34337
           Summary: [InstCombineCalls] Prove callsite args constant to
                    improve inlining decisions.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: mcrosier at codeaurora.org
                CC: llvm-bugs at lists.llvm.org

In InstCombineCalls::visitCallSite, we mark parameters that are known to be
non-null in order to improve the efficacy of the inline cost model.  We should
also be able to prove arguments as constant in a similar way (i.e., see
ValueTracking isKnownNonNullAt()).

We should be able to catch things like the following:
; RUN: opt < %s -instcombine -S | FileCheck %s

declare void @dummy(i32*)
declare void @dummy2(i32)

define void @test1(i32* %a) {
entry:
  %cond1 = icmp eq i32* %a, null
  br i1 %cond1, label %taken, label %end

taken:
  call void @dummy(i32* %a)
  ret void

end:
  ret void
}

define void @test2(i32* %a) {
entry:
  %cond1 = icmp ne i32* %a, null
  br i1 %cond1, label %taken, label %end

taken:
  ret void

end:
  call void @dummy(i32* %a)
  ret void
}

define void @test3(i32 %a) {
entry:
  %cond1 = icmp eq i32 %a, 3
  br i1 %cond1, label %taken, label %end

taken:
  call void @dummy2(i32 %a)
  ret void

end:
  ret void
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170827/31b664ea/attachment-0001.html>


More information about the llvm-bugs mailing list