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

            Bug ID: 35241
           Summary: 'Undefined behavior: Call with "tail" keyword
                    references alloca' after memcpyopt
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: mikael.hol...@ericsson.com
                CC: llvm-bugs@lists.llvm.org

Created attachment 19382
  --> https://bugs.llvm.org/attachment.cgi?id=19382&action=edit
reproducer

opt -memcpyopt -lint -S -o tr14894.opt.ll tr14894.ll

makes lint complain with

Undefined behavior: Call with "tail" keyword references alloca
  tail call void @f1(%s* byval align 1 %c)

memcpyopt has turned

%tmp1 = bitcast %s* %c to i8*
%tmp2 = bitcast i8* bitcast (%s* @b to i8*) to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp2, i8* %tmp1, i32 3, i32 1, i1
false)
tail call void @f1(%s* byval align 1 @b)

into

%tmp1 = bitcast %s* %c to i8*
%tmp2 = bitcast i8* getelementptr inbounds (%s, %s* @b, i32 0, i32 0) to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp2, i8* %tmp1, i32 3, i32 1, i1
false)
tail call void @f1(%s* byval align 1 %c)

Should memcpyopt avoid th transformation for tail calls perhaps?

(Or is the lint warning in fact wrong for byval arguments?)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to