[llvm-bugs] [Bug 35241] New: 'Undefined behavior: Call with "tail" keyword references alloca' after memcpyopt

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 8 01:52:16 PST 2017


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: unassignedbugs at nondot.org
          Reporter: mikael.holmen at ericsson.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171108/3227ce6e/attachment-0001.html>


More information about the llvm-bugs mailing list