[llvm-bugs] [Bug 43894] New: dereferenceable_or_null prevents tail call

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Nov 3 16:09:20 PST 2019


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

            Bug ID: 43894
           Summary: dereferenceable_or_null prevents tail call
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: nok.raven at gmail.com
                CC: llvm-bugs at lists.llvm.org

The dereferenceable_or_null attribute prevents tail call:

define i8* @foo() {
  %1 = tail call i8* @qaz()
  ret i8* %1
}

define i8* @bar() {
  %1 = tail call dereferenceable_or_null(1) i8* @qaz()
  ret i8* %1
}

declare i8* @qaz()

https://godbolt.org/z/ar_VZO

Because of that there is a regression in Clang 10 (trunk 375507) which is
marking calls to malloc/calloc with dereferenceable_or_null attribute.

#include <stdlib.h>

void* foo(void) {
  return calloc(1, 1);
}
void* bar(void) {
  return malloc(1);
}

https://godbolt.org/z/Cg2jas

-- 
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/20191104/58d805b0/attachment.html>


More information about the llvm-bugs mailing list