[PATCH] Add NVPTXPeephole pass to reduce unnecessary address cast

Samuel Antao sfantao at us.ibm.com
Wed Jul 1 11:47:45 PDT 2015


Hi jingyue,

Thanks for looking into this.

The issue is solved partially by http://reviews.llvm.org/D10844. Now the address can be accessed inside the function. However, what I read from that address in the callee is different from what I write in the caller.

I've been investigating the issue and what I see is that with the patch I have for, e.g. param5 (that should point to the 63 constant) (I'm filtering out the code for the other parameters):

          mov.u64         %SPL, __local_depot0;
          cvta.local.u64  %SP, %SPL;
  ...
          add.u64         %rd3, %SPL, 0;
  ...
          mov.u32         %r21, 63;
          st.local.u32    [%rd3], %r21;
  ...
          add.u64         %rd18, %SP, 32;
  ...
          .param .b64 param5;
          st.param.b64    [param5+0], %rd18;
  ...
          call.uni 
          __kmpc_for_static_init_4, 
          (
  ...
          param5, 
  ...
          );

The code I had before (that was working), for the same parameter, was:

          mov.u64         %rd29, __local_depot0;
          cvta.local.u64  %SP, %rd29;
  ...
          add.u64         %rd9, %SP, 32;
          cvta.to.local.u64       %rd3, %rd9;
  ...
          mov.u32         %r21, 63;
          st.local.u32    [%rd3], %r21;
  ...
          add.u64         %rd18, %SP, 32;
  ...
          .param .b64 param5;
          st.param.b64    [param5+0], %rd18;
  ...
          call.uni 
          __kmpc_for_static_init_4, 
          (
  ...
          param5, 
  ...
          );

So apparently, the offsets of the frame are not being produced properly after the patch. Let me know if you need more information.

Thanks!
Samuel


http://reviews.llvm.org/D10549

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list