[llvm-bugs] [Bug 51755] New: Missing memmove detection with non constant size

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Sep 5 03:38:08 PDT 2021


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

            Bug ID: 51755
           Summary: Missing memmove detection with non constant size
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

void missing_memmove_unsigned (unsigned N, char *a)                             
{                                                                              
      unsigned j = N;  
      while (j > 0) {
          a[j] = a[j - 1];      
          --j;
      }                                                                         

}

void missing_memmove_signed(int N, char *a)                                     
{                                                                              
      int j;                                                                    
      for (j = N; j > 0; j--)                                              
        a[j] = a[j - 1];                                                        
}




GCC can emit memmove missing_memmove_signed.

https://godbolt.org/z/noTn15Ejc

-- 
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/20210905/752ffc8a/attachment.html>


More information about the llvm-bugs mailing list