<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Quentin,<br>
    <br>
    I think I have found a possible regression in LLVM that was revealed
    by one of your commits (r235647) which changes the handling of
    undefs by MachineCopyPropagation. This occurs on X86-64 with the
    following code:<br>
    <br>
    %vreg92<def> = IMPLICIT_DEF; VR128:%vreg92<br>
    %vreg91<def,tied1> = PUNPCKLBWrr %vreg78<tied0>,
    %vreg92; VR128:%vreg91,%vreg78,%vreg92<br>
    %vreg94<def> = IMPLICIT_DEF; VR128:%vreg94<br>
    %vreg93<def,tied1> = PUNPCKLWDrr %vreg91<tied0>,
    %vreg94; VR128:%vreg93,%vreg91,%vreg94<br>
    %vreg95<def,tied1> = PSLLDri %vreg93<tied0>, 31;
    VR128:%vreg95,%vreg93<br>
    %vreg96<def,tied1> = PSRADri %vreg95<tied0>, 31;
    VR128:%vreg96,%vreg95 <br>
    <br>
    Later on the IMPLICIT_DEFs are turned into <undef> which,
    after your changes, causes MachineCopyPropagation to remove one
    copy:<br>
    <br>
    MOVAPSmr %RSP, 1, %noreg, 16, %noreg, %XMM0<kill>;
    mem:ST16[FixedStack11]<br>
    %XMM2<def> = MOVAPSrm %RSP, 1, %noreg, 160, %noreg;
    mem:LD16[FixedStack2]<br>
    %XMM0<def> = KILL %XMM2 ; This was COPY before
    MachineCopyPropagation<br>
    %XMM1<def> = COPY %XMM2<br>
    %XMM2<def,tied1> = PUNPCKLBWrr %XMM2<kill,tied0>,
    %XMM0<undef><br>
    %XMM2<def,tied1> = PUNPCKLWDrr %XMM2<kill,tied0>,
    %XMM0<undef><br>
    %XMM2<def,tied1> = PSLLDri %XMM2<kill,tied0>, 31<br>
    %XMM2<def,tied1> = PSRADri %XMM2<kill,tied0>, 31<br>
    <br>
    One of our test that was previously passing now fails, and the
    removed COPY is the only difference in the generated code I can see.
    Looking at only the code above it seems that the copy is not needed,
    which is strange.<br>
    <br>
    I have reduced the IR that exhibits this issue to a manageable size
    and created a .ll file for testing. When I run this file with lli
    using the interpreter it passes, same with the JIT on ARM. It fails
    however on X86-64 using the JIT. Reverting your changes, it passes
    on X86-64 using the JIT.<br>
    <br>
    Do you think that it's a bug in the X86 target that was revealed by
    your changes or that MachineCopyPropagation is doing something
    wrong?<br>
    <br>
    Thanks,<br>
    Pierre-Andre<br>
    <meta name="qrichtext" content="1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">
p, li { white-space: pre-wrap; }
</style>
    <pre class="moz-signature" cols="72">-- 
Pierre-Andre Saulais
Principal Software Engineer (Compilers)
Codeplay Software Ltd
45 York Place, Edinburgh, EH1 3HP
Tel: 0131 466 0503
Fax: 0131 557 6600
Website: <a class="moz-txt-link-freetext" href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.codeplay.com&d=AwMCaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=6Yb486qPW2bDfKjkJaInXJSK8ebWq_ZCby2RCT-7dSU&s=N1pI2mtH8xBqFRGH0g_WzKR4bbF9eAyS5dD6NT6LTMk&e=">http://www.codeplay.com</a>
Twitter: <a class="moz-txt-link-freetext" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__twitter.com_codeplaysoft&d=AwMCaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=6Yb486qPW2bDfKjkJaInXJSK8ebWq_ZCby2RCT-7dSU&s=HyWvBcMwN0cLyoDRQcD00NQkYn5mLmJU5BbZPJXcM40&e=">https://twitter.com/codeplaysoft</a>

This email and any attachments may contain confidential and /or privileged information and is for use by the addressee only. If you are not the intended recipient, please notify Codeplay Software Ltd immediately and delete the message from your computer. You may not copy or forward it,or use or disclose its contents to any other person. Any views or other information in this message which do not relate to our business are not authorized by Codeplay software Ltd, nor does this message form part of any contract unless so stated.
As internet communications are capable of data corruption Codeplay Software Ltd does not accept any responsibility for any changes made to this message after it was sent. Please note that Codeplay Software Ltd does not accept any liability or responsibility for viruses and it is your responsibility to scan any attachments.
Company registered in England and Wales, number: 04567874
Registered office: 81 Linkfield Street, Redhill RH1 6BY
</pre>
  </body>
</html>