[llvm] [RISCV] Add IntrArgMemOnly for vector load/store intrinsic (PR #78415)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 17 19:17:43 PST 2024


================
@@ -200,7 +203,8 @@ let TargetPrefix = "riscv" in {
         : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
                     [LLVMMatchType<0>, llvm_ptr_ty,
                      llvm_anyint_ty, LLVMMatchType<1>],
-                    [NoCapture<ArgIndex<1>>, IntrReadMem]>, RISCVVIntrinsic {
+                    [NoCapture<ArgIndex<1>>, IntrReadMem, IntrArgMemOnly]>,
----------------
topperc wrote:

And I removed it from X86 gather/scatter a few years ago.

```
commit 35f55d72f6f8895d64171a42ee0635ef8d76c61d
Author: Craig Topper <craig.topper at intel.com>
Date:   Fri Mar 1 13:02:40 2019

    [X86] Remove IntrArgMemOnly from target specific gather/scatter intrinsics
    
    IntrArgMemOnly implies that only memory pointed to by pointer typed arguments will be accessed. But these intrinsics allow you to pass null to the pointer argument and put the full address into the index argument. Other passes won't be able to understand this.
    
    A colleague found that ISPC was creating gathers like this and then dead store elimination removed some stores because it didn't understand what the gather was doing since the pointer argument was null.
    
    Differential Revision: https://reviews.llvm.org/D58805
    
    llvm-svn: 355228
```

https://github.com/llvm/llvm-project/pull/78415


More information about the llvm-commits mailing list