pcwang-thead added a comment.

In D126461#3541577 <https://reviews.llvm.org/D126461#3541577>, @craig.topper 
wrote:

> What if it isn't known to be null at compile time but gets optimized to it.

Thanks, I haven't thought it clearly and I just wanted to solve found bugs. :-)
I changed it to generate IRs to do the check. It is the same as GCC 
implementation now I think.
https://github.com/riscv-collab/riscv-gcc/blob/riscv-gcc-10.1-rvv-dev/gcc/config/riscv/riscv_vector.h#L289

  if (new_vl)                                                           \
      {                                                                 \
      if (__riscv_xlen == 32)                                           \
        *new_vl = __builtin_riscv_vreadvlsi ();                         \
      else                                                              \
        *new_vl = __builtin_riscv_vreadvldi ();                         \
      } 



> Are we trying to make passing a null pointer defined behavior for these 
> intrinsics?

Yes, but only for vleff instructions, since it has two outputs actually. And 
this behavior is compatible with GCC.
If necessary, I will propose it to rvv-intrinsic-doc.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126461/new/

https://reviews.llvm.org/D126461

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to