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: [email protected]
          Reporter: [email protected]
                CC: [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to