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

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 21 04:46:02 PDT 2021


xbolva00 accepted this revision.
xbolva00 added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:2383
+        OperandStr.empty())
       return nullptr;
+    // printf("%s", "a") --> putchar('a')
----------------
We could even handle printf("%s", "");

if (OperandStr.empty())
    return ConstantInt::get(CI->getType(), 0);

https://godbolt.org/z/Ke5bcxWPK


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100724



More information about the llvm-commits mailing list