Skip to content
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

MultiSource/Benchmarks/Prolangs-C/allroots broken on x86 #1368

Closed
asl opened this issue Nov 10, 2006 · 14 comments
Closed

MultiSource/Benchmarks/Prolangs-C/allroots broken on x86 #1368

asl opened this issue Nov 10, 2006 · 14 comments
Labels
backend:X86 bugzilla Issues migrated from bugzilla miscompilation

Comments

@asl
Copy link
Collaborator

asl commented Nov 10, 2006

Bugzilla Link 996
Resolution FIXED
Resolved on Nov 07, 2018 00:17
Version trunk
OS Linux
Attachments LLVM bytecode, Generated assembler code
CC @lattner

Extended Description

This test is definitely broken. Please find attached LLVM bytecode & generated
assembler code.

Generated code segfaults at first "movaps" instruction in newton function. llc
-march=pentium3 generates working code.

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 10, 2006

Anton, could you give us more information on this?

If it crashes on the first movaps in newton:
movaps %xmm0, 48(%esp)

That must means %esp is not properly aligned. Can you verify if this is the case?

Can you tell me if it segfault the first time it reaches this function? Do you
have a backtrace? The bug is likely to be higher up in the caller chain.

@lattner
Copy link
Collaborator

lattner commented Nov 10, 2006

what is the stack alignment on linux? 8 bytes, 4 bytes? I'm pretty sure it's not 16.

@lattner
Copy link
Collaborator

lattner commented Nov 10, 2006

Might this be related to Bug 995?

-Chris

@asl
Copy link
Collaborator Author

asl commented Nov 10, 2006

Yes, it's that instruction. It crashes the first time entering the function
(e.g. "break newton", "run", and few "stepi"'s leads to crash). Stack seems to
be unaligned (at the point of crash):

(gdb) p $esp
$1 = (void *) 0xbf8e0c08

and that seems to be the problem

@asl
Copy link
Collaborator Author

asl commented Nov 10, 2006

Chris, default stack alignment on linux is 4 bytes, but sse stuff usually wants
memory operands to be 16 bytes aligned.

@lattner
Copy link
Collaborator

lattner commented Nov 10, 2006

Evan, are we generating movaps for f64 load/stores or something?

-Chris

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 10, 2006

Yep. We use movaps for f32/f64 load / store. That obviously doesn't work for
non-darwin targets.

@asl
Copy link
Collaborator Author

asl commented Nov 10, 2006

Can we just override stack alignment from command line? This will allow use
movaps on non-darwin targets, if stack alignment if fine for this.

@lattner
Copy link
Collaborator

lattner commented Nov 10, 2006

nope, stack alignment is part of the ABI. You can't compile just some functions with aligned stacks: the
stack coming into the function has to be aligned.

@asl
Copy link
Collaborator Author

asl commented Nov 10, 2006

Well, assume we have 4 bytes stack alignment on linux by default. Command line
switch will override stack alignment to e.g. 32. This will enable "movaps" but
doesn't break ABI.

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 10, 2006

I misspoke. Actually we are not using movaps for f32/f64 load / stores. The
movaps is probably added by the spiller. I'll poke.

@lattner
Copy link
Collaborator

lattner commented Nov 10, 2006

this requires either:

  1. dynamic readjustment of the stack pointer in the prolog
  2. the entire program to be compiled with this option

Since 'entire program' implies libraries (e.g. libc), it isn't feasible.

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 10, 2006

We should not have been generating spills of vector values in this test case.
This was a bug in the X86 max / min dag combine.
Fixed.

@asl
Copy link
Collaborator Author

asl commented Nov 11, 2006

Works for me now, thanks, Evan.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:X86 bugzilla Issues migrated from bugzilla miscompilation
Projects
None yet
Development

No branches or pull requests

3 participants