[llvm-bugs] [Bug 50143] New: Memory SSA DSE regression - store after calloc not eliminated

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 27 06:47:19 PDT 2021


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

            Bug ID: 50143
           Summary: Memory SSA DSE regression - store after calloc not
                    eliminated
           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

#include <string.h>
#include <stdlib.h>

void * foo(long i) {
    char *p = calloc(1, 10);
    p[i] = 0;
    return p;
}


LLVM 11 and lower:
define dso_local noalias i8* @foo(i64 %0) local_unnamed_addr #0 {
  %2 = tail call noalias dereferenceable_or_null(10) i8* @calloc(i64 1, i64 10)
#2
  ret i8* %2
}

LLVM 12+:

define dso_local noalias i8* @foo(i64 %0) local_unnamed_addr #0 {
  %2 = tail call noalias dereferenceable_or_null(10) i8* @calloc(i64 1, i64 10)
#2
  %3 = getelementptr inbounds i8, i8* %2, i64 %0
  store i8 0, i8* %3, align 1, !tbaa !2
  ret i8* %2
}

-- 
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/20210427/19be8515/attachment.html>


More information about the llvm-bugs mailing list