[PATCH] D100724: [SimplifyLibCalls] Transform printf("%s", str"\n") --> puts(str).

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 18 07:07:46 PDT 2021


xbolva00 added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:2397
   // printf("foo\n") --> puts("foo")
   if (FormatStr[FormatStr.size() - 1] == '\n' &&
       FormatStr.find('%') == StringRef::npos) { // No format characters.
----------------
xbolva00 wrote:
> yurai007 wrote:
> > xbolva00 wrote:
> > > Can you change this to FormatStr.back() ?
> > Sure.
> Thanks, otherwise it is OK from me.
> 
> Mayybe @spatel / @fhahn / @efriedma take a second look?
I was wondering if we can check content of "str.1" and yes! with --check-globals flag

Can you run ./update_test_checks.py --check-globals /home/xbolva00/p.ll llvm/test/Transforms/InstCombine/printf-2.ll ? It would be ideal to have check for content of str.1 too.


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

https://reviews.llvm.org/D100724



More information about the llvm-commits mailing list