[PATCH] D145650: [X86] Create extra prolog/epilog for stack realignment
Jordan Rupprecht via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 24 12:41:29 PDT 2023
rupprecht added a comment.
This relanded in e4ceb5a7bb9b8f6d730530345649286370dd3ff8 <https://reviews.llvm.org/rGe4ceb5a7bb9b8f6d730530345649286370dd3ff8>, and we're seeing runtime errors in Halide when building with asan.
I don't have a standalone reproducer I can share yet, but the issue we see is when attempting to return from this method: https://github.com/halide/Halide/blob/main/src/runtime/x86_cpu_features.cpp. If I had to guess, it's a bad interaction with the cpuid implementation here: https://github.com/halide/Halide/blob/2a51f71a0add536ab986c675d1239db860dbc655/src/runtime/x86.ll#L145
The problem is `$rsp` is not pointing to the right place, and so `ret` jumps to a bogus location, so the next instruction faults:
... break on start address of x86_cpu_features ...
(lldb) x/2 $rsp
0x7fffffffb818: 0x5806dc35 0x00005555
(lldb) c
...
(lldb) di -l
repro_test`Halide::Runtime::Internal::halide_get_cpu_features:
0x55555806e23e <+1246>: movq -0x48(%rbp), %r10
0x55555806e242 <+1250>: leaq -0x28(%rbp), %rsp
0x55555806e246 <+1254>: popq %rbx
0x55555806e247 <+1255>: popq %r12
0x55555806e249 <+1257>: popq %r13
0x55555806e24b <+1259>: popq %r14
0x55555806e24d <+1261>: popq %r15
0x55555806e24f <+1263>: popq %rbp
0x55555806e250 <+1264>: leaq -0x10(%r10), %rsp
-> 0x55555806e254 <+1268>: retq
(lldb) x/2 $rsp
0x7fffffffb810: 0xffffb890 0x00007fff
(lldb) x/2 0x7fffffffb818
0x7fffffffb818: 0x5806dc35 0x00005555
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145650/new/
https://reviews.llvm.org/D145650
More information about the llvm-commits
mailing list