[PATCH] D66217: [BuildLibCalls] Noalias annotation
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 14 08:41:36 PDT 2019
xbolva00 marked an inline comment as done.
xbolva00 added inline comments.
================
Comment at: lib/Transforms/Utils/BuildLibCalls.cpp:263
Changed |= setDoesNotCapture(F, 0);
+ Changed |= setDoesNotAlias(F, 0);
Changed |= setDoesNotCapture(F, 1);
----------------
jdoerfert wrote:
> xbolva00 wrote:
> > jdoerfert wrote:
> > > I'm not sure what this means or what this is going to help, but maybe I just miss something.
> > Target buffer may not overlap with other args.
> >
> > I can remove it, but some future optimizations based on noalias info would be weaker.
> I was wrong, if that is the `sprintf` semantics, keep it.
Yea :)
man sprintf
Some programs imprudently rely on code such as the following
sprintf(buf, "%s some further text", buf);
to append text to buf. However, the standards explicitly note that the
results are undefined if source and destination buffers overlap when
calling sprintf(), snprintf(), vsprintf(), and vsnprintf()...
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66217/new/
https://reviews.llvm.org/D66217
More information about the llvm-commits
mailing list