[PATCH] D24856: [ARM] Promote small global constants to constant pools - fixed for PR30470 and PR30475
James Molloy via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 23 02:16:39 PDT 2016
jmolloy created this revision.
jmolloy added a reviewer: olista01.
jmolloy added a subscriber: llvm-commits.
jmolloy set the repository for this revision to rL LLVM.
Herald added subscribers: samparker, rengolin, aemerson.
Hi Oliver,
This patch is very similar to that already approved but has been reengineered to support debug info. Debug info emission can emit a reference to a global we choose to promote. Previously this would cause a linker error (PR30475). This time, we use an ARMConstantPoolValue to track which global a constant pool entry came from so we can emit the right symbol in the backend.
Original commit message:
If a constant is unamed_addr and is only used within one function, we can save
on the code size and runtime cost of an indirection by changing the global's storage
to inside the constant pool. For example, instead of:
ldr r0, .CPI0
bl printf
bx lr
.CPI0: &format_string
format_string: .asciz "hello, world!\n"
We can emit:
adr r0, .CPI0
bl printf
bx lr
.CPI0: .asciz "hello, world!\n"
This can cause significant code size savings when many small strings are used in one
function (4 bytes per string).
This recommit contains fixes for a nasty bug related to fast-isel fallback - because
fast-isel doesn't know about this optimization, if it runs and emits references to
a string that we inline (because fast-isel fell back to SDAG) we will end up
with an inlined string and also an out-of-line string, and we won't emit the
out-of-line string, causing backend failures.
It also contains fixes for emitting .text relocations which made the sanitizer
bots unhappy.
Repository:
rL LLVM
https://reviews.llvm.org/D24856
Files:
lib/Target/ARM/ARMAsmPrinter.cpp
lib/Target/ARM/ARMAsmPrinter.h
lib/Target/ARM/ARMConstantIslandPass.cpp
lib/Target/ARM/ARMConstantPoolValue.cpp
lib/Target/ARM/ARMConstantPoolValue.h
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/ARM/ARMMachineFunctionInfo.cpp
lib/Target/ARM/ARMMachineFunctionInfo.h
test/CodeGen/ARM/constantpool-promote-dbg.ll
test/CodeGen/ARM/constantpool-promote.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24856.72239.patch
Type: text/x-patch
Size: 27392 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160923/cc444848/attachment.bin>
More information about the llvm-commits
mailing list