[llvm-bugs] [Bug 35128] New: inaccessiblememonly and inaccessiblemem_or_argmemonly overwrite does not work on call with operand bundle

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 29 20:15:57 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=35128

            Bug ID: 35128
           Summary: inaccessiblememonly and inaccessiblemem_or_argmemonly
                    overwrite does not work on call with operand bundle
           Product: libraries
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: yyc1992 at gmail.com
                CC: llvm-bugs at lists.llvm.org

According to LangRef,

> Calls and invokes with operand bundles have unknown read / write effect on the heap on entry and exit (even if the call target is readnone or readonly), unless they’re overridden with callsite specific attributes.

However, the callsite specific override seems to only work for `readonly`,
`readnone`, `argmemonly` but not for `inaccessiblememonly` and
`inaccessiblemem_or_argmemonly` as shown by the test case below,

```
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%jl_value_t = type opaque

define i64 @f(i64* %p, i64 %v) {
  store i64 %v, i64* %p
  call void @g() #0 [ "unknown"(i64* %p) ]
  %v2 = load i64, i64* %p
  ret i64 %v2
}

declare void @g() #0

; attributes #0 = { inaccessiblememonly }
attributes #0 = { inaccessiblemem_or_argmemonly }
```

`opt -O3` does not remove the load instruction with either attributes but any
of the following does,

* Change the attribute to any one of `readonly`, `readnone`, `argmemonly`
* Remove the operand bundle.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171030/9173d10a/attachment-0001.html>


More information about the llvm-bugs mailing list