<div dir="ltr">Is the address of the call here supposed to be 0?<div><br></div><div>
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> 245: movabsq $0, %rax</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> 255: callq *%rax</span>
<br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div>
<br><div class="gmail_quote">On Fri, Apr 20, 2018 at 8:54 AM, Tom Hudson via Phabricator <span dir="ltr"><<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">tomhudson added a comment.<br>
<br>
The simplest example I have of what's breaking is the llvmpipe test code; src/gallium/drivers/llvmpipe/<wbr>lp_test_blend.c from <a href="https://cgit.freedesktop.org/mesa/mesa/" rel="noreferrer" target="_blank">https://cgit.freedesktop.org/<wbr>mesa/mesa/</a>. Both 17.0.3 and 18.0.0 break.<br>
<br>
llvmpipe was explicitly issuing sse2.psubs and sse2.padds in src/gallium/auxiliary/gallivm/<wbr>lp_bld_arit.c; that produced working code before this patch, but after this patch immediately crashes. By removing the issue of the sse2 padds/psubs our test case works again.<br>
<br>
Debug output looks like this:<br>
<br>
llc -mattr option(s): +sse2,+cx16,+sahf,-tbm,-<wbr>avx512ifma,-sha,-gfni,-fma4,-<wbr>vpclmulqdq,-prfchw,+bmi2,-<wbr>cldemote,+fsgsbase,-xsavec,+<wbr>popcnt,+aes,-avx512bitalg,-<wbr>xsaves,-avx512er,-avx512vnni,-<wbr>avx512vpopcntdq,-clwb,-<wbr>avx512f,-clzero,-pku,+mmx,-<wbr>lwp,-rdpid,-xop,-rdseed,-ibt,-<wbr>sse4a,-avx512bw,-clflushopt,+<wbr>xsave,-avx512vbmi2,-avx512vl,-<wbr>avx512cd,+avx,-vaes,-rtm,+fma,<wbr>+bmi,+rdrnd,-mwaitx,+sse4.1,+<wbr>sse4.2,+avx2,-wbnoinvd,+sse,+<wbr>lzcnt,+pclmul,-prefetchwt1,+<wbr>f16c,+ssse3,-sgx,-shstk,+cmov,<wbr>-avx512vbmi,+movbe,+xsaveopt,-<wbr>avx512dq,-adx,-avx512pf,+sse3<br>
llc -mcpu option: haswell<br>
<br>
test:<br>
<br>
0: pushq %rbp<br>
1: movq %rsp, %rbp<br>
4: pushq %rbx<br>
5: subq $40, %rsp<br>
9: movq %r8, %rbx<br>
12: vmovdqa (%rdi), %xmm0<br>
16: vmovdqa (%rdx), %xmm1<br>
20: movabsq $140737174016000, %rax<br>
30: vpand (%rax), %xmm0, %xmm2<br>
34: vpsrld $8, %xmm2, %xmm3<br>
39: vpor %xmm2, %xmm3, %xmm2<br>
43: vpcmpeqd %xmm3, %xmm3, %xmm3<br>
47: vpxor %xmm3, %xmm0, %xmm3<br>
51: movabsq $140737174016032, %rax<br>
61: vpbroadcastd (%rax), %xmm4<br>
66: vmovdqa %xmm4, -48(%rbp)<br>
71: vpblendvb %xmm4, (%rsi), %xmm3, %xmm3<br>
77: vpsrld $16, %xmm2, %xmm4<br>
82: vpor %xmm2, %xmm4, %xmm2<br>
86: vpmovzxbw %xmm0, %xmm4<br>
91: vpxor %xmm5, %xmm5, %xmm5<br>
95: vpunpckhbw %xmm5, %xmm0, %xmm0<br>
99: vpmovzxbw %xmm2, %xmm6<br>
104: vpmullw %xmm4, %xmm6, %xmm4<br>
108: vpunpckhbw %xmm5, %xmm2, %xmm2<br>
112: vpmullw %xmm0, %xmm2, %xmm0<br>
116: vpsrlw $8, %xmm4, %xmm2<br>
121: movabsq $140737174016016, %rax<br>
131: vmovdqa (%rax), %xmm6<br>
135: vpaddw %xmm6, %xmm4, %xmm4<br>
139: vpaddw %xmm4, %xmm2, %xmm2<br>
143: vpsrlw $8, %xmm2, %xmm2<br>
148: vpsrlw $8, %xmm0, %xmm4<br>
153: vpaddw %xmm6, %xmm0, %xmm0<br>
157: vpaddw %xmm0, %xmm4, %xmm0<br>
161: vpsrlw $8, %xmm0, %xmm0<br>
166: vpackuswb %xmm0, %xmm2, %xmm0<br>
170: vpmovzxbw %xmm1, %xmm2<br>
175: vpunpckhbw %xmm5, %xmm1, %xmm1<br>
179: vpmovzxbw %xmm3, %xmm4<br>
184: vpmullw %xmm4, %xmm2, %xmm2<br>
188: vpunpckhbw %xmm5, %xmm3, %xmm3<br>
192: vpmullw %xmm3, %xmm1, %xmm1<br>
196: vpsrlw $8, %xmm2, %xmm3<br>
201: vpaddw %xmm6, %xmm2, %xmm2<br>
205: vpaddw %xmm2, %xmm3, %xmm2<br>
209: vpsrlw $8, %xmm2, %xmm2<br>
214: vpsrlw $8, %xmm1, %xmm3<br>
219: vpaddw %xmm6, %xmm1, %xmm1<br>
223: vpaddw %xmm1, %xmm3, %xmm1<br>
227: vpsrlw $8, %xmm1, %xmm1<br>
232: vpackuswb %xmm1, %xmm2, %xmm1<br>
236: vpminub %xmm1, %xmm0, %xmm2<br>
240: vmovdqa %xmm2, -32(%rbp)<br>
245: movabsq $0, %rax<br>
255: callq *%rax<br>
257: vmovdqa -48(%rbp), %xmm1<br>
262: vpblendvb %xmm1, -32(%rbp), %xmm0, %xmm0<br>
269: vmovdqa %xmm0, (%rbx)<br>
273: addq $40, %rsp<br>
277: popq %rbx<br>
278: popq %rbp<br>
279: retq<br>
<br>
After we return from the callq, we seem to have a corrupt stack.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
Repository:<br>
rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D44785" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D44785</a><br>
<br>
<br>
<br>
</div></div></blockquote></div><br></div>