[PATCH] D126461: [RISCV] Extract and store new vl of vleff iff destination isn't null

Zakk Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 7 19:06:14 PDT 2022


khchen added a comment.

> Store to null will be changed to unreachable, so all instructions after vleff intrinsic call will be deleted and it causes runtime errors. If destination to store is null, we won't extract and store the new vl.



> 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.

Compiling with -O0, I didn't see this behavior, so are you trying to make the optimized code behavior is compatible with GCC?

In addition, it seems this behavior also exist in scalar code, do we also need to make the scalar result is compatible with GCC?
ex.

  int foo (int j){
      int *k = nullptr;
      *k = 10;
      return 100;
  }

compiling with `-O3`, llvm generates empty function but gcc generates

  foo(int):
          sw      zero,0(zero)
          ebreak

https://godbolt.org/z/46vGrzs49

Please correct me if I misunderstand something, thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126461



More information about the cfe-commits mailing list