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: unassignedb...@nondot.org Reporter: simonas+llvm....@kazlauskas.me CC: llvm-bugs@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.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs