[PATCH] D111009: Update inline builtin handling to honor gnu inline attribute

2021-10-19 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment. https://reviews.llvm.org/D112059 should address the issue pointed by @manojgupta and @nickdesaulniers Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111009/new/ https://reviews.llvm.org/D111009

[PATCH] D111009: Update inline builtin handling to honor gnu inline attribute

2021-10-18 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Also reported here: https://lore.kernel.org/llvm/1817774243.12566.1634255267713@localhost/ Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111009/new/ https://reviews.llvm.org/D111009

[PATCH] D111009: Update inline builtin handling to honor gnu inline attribute

2021-10-18 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. See also: https://github.com/ClangBuiltLinux/linux/issues/1477. Surprising that this didn't show up in newer kernels, just older (but still supported) kernel versions. Sorry I missed that in my tests. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST

[PATCH] D111009: Update inline builtin handling to honor gnu inline attribute

2021-10-16 Thread Manoj Gupta via Phabricator via cfe-commits
manojgupta added a comment. I am noticing a clang crash with ToT after this change. - testcase -- long a; char b, d; extern inline __attribute__((always_inline)) __attribute__((gnu_inline)) unsigned long strlen() { return a; } c(void) { strlen(); return 0; }

[PATCH] D111009: Update inline builtin handling to honor gnu inline attribute

2021-10-04 Thread serge via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG0f0e31cf511d: Update inline builtin handling to honor gnu inline attribute (authored by serge-sans-paille). Changed prior to commit: https://reviews.llvm.org/D111009?vs=376812=377023#toc Repository:

[PATCH] D111009: Update inline builtin handling to honor gnu inline attribute

2021-10-04 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers accepted this revision. nickdesaulniers added inline comments. This revision is now accepted and ready to land. Comment at: clang/lib/CodeGen/CGExpr.cpp:4901 + llvm::Function *Fn = llvm::cast(CalleePtr); + llvm::Module = CGF.CGM.getModule(); +

[PATCH] D111009: Update inline builtin handling to honor gnu inline attribute

2021-10-04 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 376812. serge-sans-paille added a comment. + extra test case + use internal linkage instead of available_externally linkage for generated clone CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111009/new/ https://reviews.llvm.org/D111009

[PATCH] D111009: Update inline builtin handling to honor gnu inline attribute

2021-10-03 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Diff 376794 builds! Let's still add a test for inline __attribute__((__always_inline__)) __attribute__((gnu_inline)) void* memcpy() {} though. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111009/new/ https://reviews.llvm.org/D111009

[PATCH] D111009: Update inline builtin handling to honor gnu inline attribute

2021-10-03 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. With Diff 376790 inline __attribute__((__always_inline__)) __attribute__((gnu_inline)) void* memcpy() {} `clang -O2` is producing undefined references to `memcpy.inline`. Please add that to the new unit tests added here. diff --git

[PATCH] D111009: Update inline builtin handling to honor gnu inline attribute

2021-10-03 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 376794. serge-sans-paille added a comment. + fix linkage of generated function CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111009/new/ https://reviews.llvm.org/D111009 Files: clang/lib/AST/Decl.cpp clang/lib/CodeGen/CGExpr.cpp

[PATCH] D111009: Update inline builtin handling to honor gnu inline attribute

2021-10-03 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. With Diff 376790, I'm seeing a similar failure to https://github.com/ClangBuiltLinux/linux/issues/1466#issue-1011472964, but from different TUs. ld.lld: error: duplicate symbol: memcpy.inline >>> defined at file.c >>>

[PATCH] D111009: Update inline builtin handling to honor gnu inline attribute

2021-10-03 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 376790. serge-sans-paille added a comment. + extra test case + avoid Playing with Twines + fix storage of external declaration of inline builtins + minor nits CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111009/new/

[PATCH] D111009: Update inline builtin handling to honor gnu inline attribute

2021-10-03 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Here's a reduced test case from the kernel. Let's add a unit test for it. const void *con_unify_unimap_p1; extern inline __attribute__((__always_inline__)) __attribute__((gnu_inline)) int memcmp(const void *p, const void *q, unsigned long size) {

[PATCH] D111009: Update inline builtin handling to honor gnu inline attribute

2021-10-03 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added inline comments. Comment at: clang/lib/CodeGen/CGExpr.cpp:4911 + if (!Clone) { +Clone = llvm::Function::Create(Fn->getFunctionType(), Fn->getLinkage(), + Fn->getAddressSpace(), given the

[PATCH] D111009: Update inline builtin handling to honor gnu inline attribute

2021-10-03 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Note: kernel tests need to have `CONFIG_FORTIFY_SOURCE=y` enabled in the config to use the fortified routines; this isn't enabled by default in an x86_64 `defconfig` build. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D111009: Update inline builtin handling to honor gnu inline attribute

2021-10-03 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. hmm...this seems to cause a bunch of ICEs building the kernel: Global is external, but doesn't have external or weak linkage! i64 (i8*)* @strlen fatal error: error in backend: Broken module found, compilation aborted! Global is external, but doesn't have

[PATCH] D111009: Update inline builtin handling to honor gnu inline attribute

2021-10-03 Thread serge via Phabricator via cfe-commits
serge-sans-paille created this revision. serge-sans-paille added reviewers: kees, nickdesaulniers. serge-sans-paille requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Per the GCC info page: If the function is declared 'extern', then this