[LLVMdev] Seg faulting on vector ops

Christophe Avoinne christophe.avoinne at laposte.net
Sat Jul 21 16:10:59 PDT 2007


On 21/07/2007 23:51:28, Chris Lattner (sabre at nondot.org) wrote:
 > Evan's solution is the right one. However, your code is valid, so it
 > shouldn't
 > crash. I think it dies because linux does not guarantee that
 > the stack is 16 byte aligned, and the vector operations expect this. The
 > code generator should compensate and dynamically align the stack on 
entry
 > to the function. This should be a relatively straight-forward extension
 > to the x86 backend if you're interested.

in fact, if llvm is able to warant (?) that the stack pointer is aligned 
to 16-byte, there is no reason to DYNAMICALLY align the stack at all 
entries because thoses operations can be expensive for some 
architectures. What you need is to align the stack on entry of the 
"main" function. Of course, if you are mixing calls of llvm functions in 
non-llvm functions, that's a problem and you probably need to use 
dynamical alignments.



More information about the llvm-dev mailing list