[llvm-bugs] [Bug 30505] New: !range metadata pessimizes generated assembly

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 23 09:14:26 PDT 2016


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

            Bug ID: 30505
           Summary: !range metadata pessimizes generated assembly
           Product: libraries
           Version: 3.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Transformation Utilities
          Assignee: unassignedbugs at nondot.org
          Reporter: simonas+llvm.org at kazlauskas.me
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 17340
  --> https://llvm.org/bugs/attachment.cgi?id=17340&action=edit
Case where pessimisation happens

In the attached test case the instruction

    %1 = load i8, i8* %0, !range !1

has range metadata attached to it. In LLVM 3.9 Combine Redundant instructions
pass replaces this load with

    %1 = load i8, i8* %0, align 1, !range !1
    %trunc = trunc i8 %1 to i2

The truncation ends up never getting removed and results in extra and
unnecessary `andb $3, %dil` instruction in the optimised assembly. This extra
instruction is causing some noticeable overhead in a tight loop.

---

LLVM 3.8 does not apply the transformation detailed above. Therefore it does
not emit the superfluous `andb` instruction either.

As far as fixes are concerned, perhaps it would make sense to only `trunc` to
the bitwidths supported by the target machine?

-- 
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/20160923/61331b4e/attachment.html>


More information about the llvm-bugs mailing list