-
Notifications
You must be signed in to change notification settings - Fork 13.4k
condition jump instruction seems lost when optimization opened with -O1 or -O2 or -Oz #82744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
I found similar issue https://gitlab.com/embeddable-common-lisp/ecl/-/issues/737 and can confirm problem exists. cl_object si_make_seq_iterator_va(cl_narg narg, ...)
{
cl_object x[2];
va_list args; va_start(args,narg);
x[0] = va_arg(args,cl_object);
for (int i = 1; i < narg; i++){
x[i] = va_arg(args,cl_object);
}
va_end(args);
return si_make_seq_iterator(narg, x[0], x[1]);
} When Without optimization things work correctly. Broken functionsi_make_seq_iterator_va:
sub sp, sp, #0x40
stp x29, x30, [sp, #0x30]
add x29, sp, #0x30
adrp x8, 642
ldr x8, [x8, #0x58]
ldr x8, [x8]
stur x8, [x29, #-0x8]
add x8, x29, #0x10
orr x8, x8, #0x8
str x8, [sp, #0x10]
ldr x1, [x29, #0x10]
mov w8, #0x1
add x9, sp, #0x18
ldr x10, [sp, #0x10]
add x11, x10, #0x8
str x11, [sp, #0x10]
ldr x10, [x10]
str x10, [x9, x8, lsl #3]
add x8, x8, #0x1
cmp x0, x8
b.ne 0x1ef24 ; <+52> at seq.c:480:10
ldr x8, [sp, #0x20]
str x8, [sp]
bl 0x1ed80 ; si_make_seq_iterator at seq.c:404
ldur x8, [x29, #-0x8]
adrp x9, 642
ldr x9, [x9, #0x58]
ldr x9, [x9]
cmp x9, x8
b.ne 0x1ef74 ; <+132> at seq.c
ldp x29, x30, [sp, #0x30]
add sp, sp, #0x40
ret
bl 0x1947e4 ; symbol stub for: __stack_chk_fail Correct functionsi_make_seq_iterator_va:
sub sp, sp, #0x60
stp x29, x30, [sp, #0x50]
add x29, sp, #0x50
adrp x8, 985
ldr x8, [x8, #0x60]
ldr x8, [x8]
stur x8, [x29, #-0x8]
stur x0, [x29, #-0x20]
add x9, sp, #0x28
add x8, x29, #0x10
str x8, [x9]
ldr x9, [sp, #0x28]
ldr x8, [x9]
add x9, x9, #0x8
str x9, [sp, #0x28]
str x8, [sp, #0x20]
ldr x8, [sp, #0x20]
stur x8, [x29, #-0x18]
mov w8, #0x1
str w8, [sp, #0x1c]
b 0x3f61c ; <+84> at seq.c:479:18
ldrsw x8, [sp, #0x1c]
ldur x9, [x29, #-0x20]
subs x8, x8, x9
cset w8, ge
tbnz w8, #0x0, 0x3f66c ; <+164> at seq.c:483:30
b 0x3f634 ; <+108> at seq.c:480:10
ldr x9, [sp, #0x28]
ldr x8, [x9]
add x9, x9, #0x8
str x9, [sp, #0x28]
str x8, [sp, #0x10]
ldr x8, [sp, #0x10]
ldrsw x10, [sp, #0x1c]
sub x9, x29, #0x18
str x8, [x9, x10, lsl #3]
b 0x3f65c ; <+148> at seq.c:479:29
ldr w8, [sp, #0x1c]
add w8, w8, #0x1
str w8, [sp, #0x1c]
b 0x3f61c ; <+84> at seq.c:479:18
ldur x0, [x29, #-0x20]
ldur x1, [x29, #-0x18]
ldur x8, [x29, #-0x10]
mov x9, sp
str x8, [x9]
bl 0x3f228 ; si_make_seq_iterator at seq.c:404
str x0, [sp, #0x8]
ldur x9, [x29, #-0x8]
adrp x8, 985
ldr x8, [x8, #0x60]
ldr x8, [x8]
subs x8, x8, x9
cset w8, eq
tbnz w8, #0x0, 0x3f6ac ; <+228> at seq.c
b 0x3f6a8 ; <+224> at seq.c:483:2
bl 0x30e424 ; symbol stub for: __stack_chk_fail
ldr x0, [sp, #0x8]
ldp x29, x30, [sp, #0x50]
add sp, sp, #0x60
ret Checked with latest git version of LLVM/Clang. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
when i use below command to compile FFmpeg 4.3.1
libavformat/utils.c
with Clang 14 on Macmini M1 macOS 14.3.1:then I disassembe like below:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump -S libavformat/utils.o > utils14.txt
I found code
if (st->index_entries) {
in functionff_seek_frame_binary
compiled like below, when I run to here, it always crashes:but when I use Clang 13 with same the compile command, it generates the code below:
someone can help me find if my compile command has an error somewhere?
utils.zip
The text was updated successfully, but these errors were encountered: