To be pedantic... use of the frame pointer isn't necessary. The stack pointer would be fine. That's just how GCC calculates the offset for this test case. <br><br>On Monday, September 26, 2011, Cameron McInally <<a href="mailto:cameron.mcinally@nyu.edu">cameron.mcinally@nyu.edu</a>> wrote:<br>
> Hey guys,<br>><br>> I'm working on a bug for x86-64 in LLVM 2.9. Well, it's actually two issues. The assembly generated for large stack offsets has an overflow; And, once the overflow is fixed, the displacement is too large for GNU ld to handle it.<br>
><br>> void fool( int long n )<br>> {<br>> double w[268435600];<br>> double z[268435600];<br>> unsigned long i;<br>> for ( i = 0; i < n; i++ ) {<br>> w[i] = 1.0;<br>> z[i] = 2.0;<br>
> }<br>> printf(" n: %lld, W %g Z %g\n", n, w[1], z[1] );<br>> }<br>><br>> Here's one of the offending instructions produced by 2.9:<br>><br>> movsd -2147482472 <tel:2147482472>(%rsp), %xmm0<br>
><br>> Fixing the displacement overflow is pretty easy. It's just a matter of changing a few variable types in LLVM from unsigned to uint64_t in the functions that calculate the stack offsets. The real trouble I'm having<br>
> is finding a good place to break up the displacements during lowering. I would like the offset to be calculated similar to gcc:<br>><br>> movabsq $-4294969640, %rdx<br>> movsd 0(%rbp,%rdx), %xmm0<br>><br>
> Any suggestions on the correct lowering pass to do a transformation like this? I'm an LLVM noob, so I'm not sure where it should go.<br>><br>> Tx,<br>> Cameron