[all-commits] [llvm/llvm-project] 5f5974: [SimplifyLibCalls] Transform printf("%s", str) -->...

yurai007 via All-commits all-commits at lists.llvm.org
Wed Apr 28 07:29:33 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5f5974aeacac979de81713332ff80e5928e408b7
      https://github.com/llvm/llvm-project/commit/5f5974aeacac979de81713332ff80e5928e408b7
  Author: Dawid Jurczak <dawid_jurek at vp.pl>
  Date:   2021-04-28 (Wed, 28 Apr 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
    M llvm/test/Transforms/InstCombine/printf-2.ll

  Log Message:
  -----------
  [SimplifyLibCalls] Transform printf("%s", str) --> puts(str)/noop

Before this change LLVM cannot simplify printf in following cases:

printf("%s", "") --> noop
printf("%s", str"\n") --> puts(str)

>From the other hand GCC can perform such transformations for many years:
https://godbolt.org/z/7nnqbedfe

Differential Revision: https://reviews.llvm.org/D100724




More information about the All-commits mailing list