[llvm-bugs] [Bug 34223] New: [InlineCost] Failure to Map a PHI to a Constant

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 17 10:23:58 PDT 2017


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

            Bug ID: 34223
           Summary: [InlineCost] Failure to Map a PHI to a Constant
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: haicheng at codeaurora.org
                CC: llvm-bugs at lists.llvm.org

If a callee has IR like this

entry:
  switch i32 %arg, label %end.switch [
    i32 1, label %sw.bb1
    i32 2, label %sw.bb2
    ......
    i32 N, label %sw.bbN
  ]

sw.bb1:                                           ; preds = %entry
  ...

sw.bb2:                                           ; preds = %entry
  ...
  ...
sw.bbN:                                           ; preds = %entry
  ...

switch.end:                                       ; preds = %sw.1,
%sw.2,...,%sw.N
  %ph = phi i32 [ 1, %sw.bb1 ], [ 2, %sw.bb2 ], ..., [N, %sw.bbN]

The switch condition is a function argument which is a constant from all the
callsites.  Then, the phi in switch.end can be mapped to a constant since its
incoming block is known.  In my specific test case, the rest of the callee is
relied on %ph and can be proved to be free if %ph can be mapped to a constant.
Currently, InlineCost does not consider the possibility of phi-constant
mapping.

-- 
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/20170817/9206f98c/attachment.html>


More information about the llvm-bugs mailing list