[llvm-bugs] [Bug 32570] New: (New)GVN doesn't look through non-constant memcpy

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 7 12:08:02 PDT 2017


http://bugs.llvm.org/show_bug.cgi?id=32570

            Bug ID: 32570
           Summary: (New)GVN doesn't look through non-constant memcpy
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: keno at alumni.harvard.edu
                CC: llvm-bugs at lists.llvm.org

E.g. in this example, GVN can't turn this into `load a[100]`:
```
declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i32, i1)

define double @trivial_memcpy(<200 x double> *%a) {
    %b = alloca <200 x double>
    %acast = bitcast <200 x double> *%a to i8*
    %bcast = bitcast <200 x double> *%b to i8*
    call void @llvm.memcpy.p0i8.p0i8.i64(i8* %bcast, i8* %acast, i64 1600, i32
8, i1 0)
    %innerptr = getelementptr <200 x double>, <200 x double> *%a, i32 0, i32
100
    %inner = load double, double *%innerptr
    ret double %inner
}
```
Now for this particular example, SROA does do this optimization, but this feels
like something that GVN should be able to do as well.

-- 
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/20170407/e6bffed8/attachment.html>


More information about the llvm-bugs mailing list