[llvm-bugs] [Bug 50481] New: [ARM] Machine Outliner issue with LDRD/STRD in Thumb mode
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed May 26 05:52:42 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50481
Bug ID: 50481
Summary: [ARM] Machine Outliner issue with LDRD/STRD in Thumb
mode
Product: libraries
Version: 12.0
Hardware: PC
OS: All
Status: NEW
Severity: release blocker
Priority: P
Component: Backend: ARM
Assignee: unassignedbugs at nondot.org
Reporter: yvan.roux at linaro.org
CC: llvm-bugs at lists.llvm.org, smithp352 at googlemail.com,
Ties.Stuij at arm.com
This issue was reported and described by rust-lang community here:
https://github.com/rust-lang/rust/issues/85351
The problem occurs when the machine outliner extracts a chunck of code which
contains a call and loads or stores a pair of registers from or into the
stack, such as:
bl foo
strd r0, r1, [sp, #0]
strd r2, r3, [sp, #8]
LR needs to be saved into the stack when jumping in such an outlined
function and stack's offsets should be changed accordingly, thus the
function should look like:
<OUTLINED_FUNCTION_0>:
str.w lr, [sp, #-8]!
bl foo
strd r0, r1, [sp, #8]
strd r2, r3, [sp, #16]
ldr.w lr, [sp], #8
bx lr
But in the code generated by llvm-12 for Thumb2 targets, the stack offsets
are not patched. In fact, these offsets are patched in the MIR by the
Machine Outliner, but it assumes that immediates encoded in
AddrModeT2_i8s4 instructions are scaled like it is the case for the other
addressing modes.
I'll submit a small patch to fix the outliner which will change the scale
and bit number in that part, but maybe it'd be nice to do a bigger change
to make the encoding more consistent (there are already some fixme notes
about that in the code)
--
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/20210526/871384fb/attachment.html>
More information about the llvm-bugs
mailing list