[llvm-bugs] [Bug 32571] New: (New)GVN should be able to handle memsets with the same value even if they alias

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 7 12:14:39 PDT 2017


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

            Bug ID: 32571
           Summary: (New)GVN should be able to handle memsets with the
                    same value even if they alias
           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 the following example,
```
declare void @llvm.memset.p0i8.i64(i8*, i8, i64, i32, i1)

define double @memset_same_value(double *%a, double *%b) {
    %acast = bitcast double *%a to i8*
    %bcast = bitcast double *%b to i8*
    call void @llvm.memset.p0i8.i64(i8* %acast, i8 0, i64 8, i32 8, i1 0)
    call void @llvm.memset.p0i8.i64(i8* %bcast, i8 0, i64 8, i32 8, i1 0)
    %la = load double, double* %a
    ret double %la
}
```
GVN won't fold the load to 0, because it's afraid that the second memset
aliases it. While this may be true, since it's storing the same value, it
shouldn't matter.

-- 
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/53f5fa41/attachment.html>


More information about the llvm-bugs mailing list