[llvm-bugs] [Bug 28282] New: [ARM] Code size bloating caused by constant hoisting
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jun 23 17:01:59 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=28282
Bug ID: 28282
Summary: [ARM] Code size bloating caused by constant hoisting
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: weimingz at codeaurora.org
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Created attachment 16631
--> https://llvm.org/bugs/attachment.cgi?id=16631&action=edit
test cast
clang -Os -march=armv7m test.ll -S -o test.s
it generates large code
@ BB#0: @ %entry
.save {r4, r5, r6, r7, r8, r9, r10, r11, lr}
push.w {r4, r5, r6, r7, r8, r9, r10, r11, lr}
.pad #4
sub sp, #4
mov r4, r1
movs r5, #32
tst.w r2, #1
bne .LBB0_2
@ BB#1: @ %if.then12
ldrd lr, r3, [r0]
rsb.w r12, r5, #32
ldr r0, [r0, #8]
rsb.w r9, r5, #64
sub.w r10, r5, #64
sub.w r11, r5, #96
lsl.w r1, r3, r12
lsr.w r2, lr, r5
lsl.w r8, r0, r9
lsr.w r0, r0, r10
orrs r1, r2
sub.w r2, r5, #32
cmp r2, #0
it ge
lsrge.w r1, r3, r2
cmp.w r11, #0
it ge
movge r0, #0
cmp r5, #64
it lo
orrlo.w r0, r1, r8
cmp r5, #0
it eq
moveq r0, lr
ldrd lr, r3, [r4]
ldr r7, [r4, #8]
cmp r2, #0
lsl.w r6, r3, r12
lsr.w r1, lr, r5
orr.w r1, r1, r6
it ge
lsrge.w r1, r3, r2
lsr.w r3, r7, r10
cmp.w r11, #0
lsl.w r2, r7, r9
it ge
movge r3, #0
cmp r5, #64
it lo
orrlo.w r3, r1, r2
cmp r5, #0
it eq
moveq r3, lr
cmp r3, r0
itt ne
movne r0, #1
blne foo
.LBB0_2: @ %land.lhs.true39
ldm.w r4, {r1, r2, r3}
rsb.w r0, r5, #32
lsl.w r0, r2, r0
lsr.w r7, r1, r5
orrs r0, r7
sub.w r7, r5, #32
cmp r7, #0
it ge
lsrge.w r0, r2, r7
rsb.w r2, r5, #64
sub.w r7, r5, #64
lsl.w r2, r3, r2
lsrs r3, r7
sub.w r7, r5, #96
cmp r7, #0
it ge
movge r3, #0
cmp r5, #64
it lo
orrlo.w r3, r0, r2
cmp r5, #0
it eq
moveq r3, r1
cmp r3, #62
itt lo
addlo sp, #4
poplo.w {r4, r5, r6, r7, r8, r9, r10, r11, pc}
movs r0, #16
add sp, #4
pop.w {r4, r5, r6, r7, r8, r9, r10, r11, lr}
b foo
.Lfunc_end0:
.size test, .Lfunc_end0-test
.fnend
If Hoist constant is disabled manually, the code is normal:
test:
.fnstart
@ BB#0: @ %entry
.save {r4, lr}
push {r4, lr}
mov r4, r1
tst.w r2, #1
bne .LBB0_2
@ BB#1: @ %if.then12
ldr r0, [r0, #4]
ldr r1, [r4, #4]
cmp r1, r0
itt ne
movne r0, #1
blne foo
.LBB0_2: @ %land.lhs.true39
ldr r0, [r4, #4]
cmp r0, #62
it lo
poplo {r4, pc}
movs r0, #16
pop.w {r4, lr}
b foo
.Lfunc_end0:
.size test, .Lfunc_end0-test
.fnend
--
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/20160624/37dd0b69/attachment-0001.html>
More information about the llvm-bugs
mailing list