[llvm-bugs] [Bug 27357] New: get_local and set_local elimination opportunities

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 14 16:15:40 PDT 2016


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

            Bug ID: 27357
           Summary: get_local and set_local elimination opportunities
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: WebAssembly
          Assignee: unassignedbugs at nondot.org
          Reporter: alonzakai at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Binaryen's simplify-locals pass removes get_locals that the backend doesn't,
and in some cases also a set_local or two. For example on fannkuch it removes
206 out of 3035 (7%) get_locals, and one set_local out of 1419.

STR: build a program then run binaryen shell --metrics --simplify-locals
--metrics and it will print out how many it removed.

He's an example text diff from fannkuch:

-              (set_local $$19
-                (i32.add
-                  (get_local $$15)
-                  (i32.const -1)
-                )
-              )
               (set_local $$14
                 (i32.add
                   (get_local $$14)
                   (i32.const -4)
                 )
               )
               (set_local $$13
                 (i32.const 1)
               )
               (set_local $$15
-                (get_local $$19)
+                (set_local $$19
+                  (i32.add
+                    (get_local $$15)
+                    (i32.const -1)
+                  )
+                )
               )

so it "sinks" that set_local down into the get_local, which is eliminated.

Talking to sunfish about this, he said he already knows what's going on here.

-- 
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/20160414/965dcf32/attachment.html>


More information about the llvm-bugs mailing list