[PATCH] D91677: Avoid simplification of library functions when callee has an implementation

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 02:54:29 PST 2020


serge-sans-paille added a comment.

Interestingly, gcc and clang have different behavior here: https://godbolt.org/z/hdadhY
And clang already honors the user-defined `bcopy` why is -D_FORTIFY_SOURCE different from the example here?



================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:3076-3079
+  // Simplification is for external library calls, so bail out if the callee
+  // has an implementation.
+  if (!Callee->empty())
+    return nullptr;
----------------
siddhesh wrote:
> lebedev.ri wrote:
> > And if it happens to be in another TU?
> It does the simplification; it is not relevant for fortify-source since those implementations are always inline.
Would it make sense to check that the function is marked inline?
Redefining a libc function locally is probably not a good thing?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91677/new/

https://reviews.llvm.org/D91677



More information about the llvm-commits mailing list