llvm-project/llvm/test
James Molloy fbfd173447 [Thumb-1] Synthesize TBB/TBH instructions to make use of compressed jump tables
The TBB and TBH instructions in Thumb-2 allow jump tables to be compressed into sequences of bytes or shorts respectively. These instructions do not exist in Thumb-1, however it is possible to synthesize them out of a sequence of other instructions.

It turns out this sequence is so short that it's almost never a lose for performance and is ALWAYS a significant win for code size.

TBB example:
Before: lsls r0, r0, #2    After: add  r0, pc
        adr  r1, .LJTI0_0         ldrb r0, [r0, #6]
        ldr  r0, [r0, r1]         lsls r0, r0, #1
        mov  pc, r0               add  pc, r0
  => No change in prologue code size or dynamic instruction count. Jump table shrunk by a factor of 4.

The only case that can increase dynamic instruction count is the TBH case:

Before: lsls r0, r4, #2    After: lsls r4, r4, #1
        adr  r1, .LJTI0_0         add  r4, pc
        ldr  r0, [r0, r1]         ldrh r4, [r4, #6]
        mov  pc, r0               lsls r4, r4, #1
                                  add  pc, r4
  => 1 more instruction in prologue. Jump table shrunk by a factor of 2.

So there is an argument that this should be disabled when optimizing for performance (and a TBH needs to be generated). I'm not so sure about that in practice, because on small cores with Thumb-1 performance is often tied to code size. But I'm willing to turn it off when optimizing for performance if people want (also note that TBHs are fairly rare in practice!)

llvm-svn: 284580
2016-10-19 12:06:49 +00:00
..
Analysis [SCEV] More accurate calculation of max backedge count of some less-than loops 2016-10-18 10:10:53 +00:00
Assembler DebugInfo: change alignment type from uint64_t to uint32_t to save space. 2016-10-18 14:31:22 +00:00
Bindings
Bitcode Teach llvm::StripDebugInfo() about global variable !dbg attachments. 2016-10-10 17:53:33 +00:00
BugPoint Disable fatal errors in the Verifier instantiated by bugpoint's crash 2016-10-18 16:24:43 +00:00
CodeGen [Thumb-1] Synthesize TBB/TBH instructions to make use of compressed jump tables 2016-10-19 12:06:49 +00:00
DebugInfo Revert r284545 again as the regression in ppc still exists. There is bug in MBPI exposed by th patch. 2016-10-19 01:18:25 +00:00
Demangle Add an c++ itanium demangler to llvm. 2016-09-06 19:16:48 +00:00
Examples
ExecutionEngine Handle relocations to thumb functions when dynamic linking COFF modules 2016-10-17 18:56:18 +00:00
Feature
FileCheck
Instrumentation [asan] Append line number to variable name if line is available and in the same file as the function. 2016-10-18 23:29:41 +00:00
Integer
JitListener
LTO LTO: Use the correct mangler function in LTOCodeGenerator::applyScopeRestrictions(). 2016-10-12 20:12:19 +00:00
LibDriver
Linker Fix autoupgrade logic for Objective-C class properties module flag 2016-09-16 00:38:18 +00:00
MC [mips][ias] Handle more complicated expressions for memory operands 2016-10-18 15:17:17 +00:00
Object One more additional error check for invalid Mach-O files for a 2016-10-18 20:24:12 +00:00
ObjectYAML
Other [PM] Port CFGViewer and CFGPrinter to the new Pass Manager 2016-09-15 18:35:27 +00:00
SymbolRewriter
TableGen [TableGen] AsmMatcher: Add AsmVariantName to Instruction class. 2016-09-08 15:50:52 +00:00
ThinLTO/X86 [ThinLTO] Don't link module level assembly when importing 2016-10-12 18:39:29 +00:00
Transforms Update the section.ll to fix non-x86 failure. 2016-10-19 03:53:41 +00:00
Unit
Verifier Verifier: Reject any unknown named MD nodes in the llvm.dbg namespace. 2016-10-05 22:15:37 +00:00
YAMLParser
tools dwarfdump: -summarize-types: print a short summary (unqualified type name, hash, length) of type units rather than dumping contents 2016-10-18 21:09:48 +00:00
.clang-format
CMakeLists.txt Add an llvm-opt-report tool to generate basic source-annotated optimization summaries 2016-10-05 22:10:35 +00:00
TestRunner.sh
lit.cfg cmake: Install the OCaml libraries into a more correct path 2016-09-30 18:34:23 +00:00
lit.site.cfg.in