[all-commits] [llvm/llvm-project] 6dbf0c: [SLC] sprintf(dst, "%s", str) -> strcpy(dst, str)

Dávid Bolvanský via All-commits all-commits at lists.llvm.org
Fri Aug 14 14:49:20 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6dbf0cfcf789365493f70ae69df8a7a59be41c75
      https://github.com/llvm/llvm-project/commit/6dbf0cfcf789365493f70ae69df8a7a59be41c75
  Author: Dávid Bolvanský <david.bolvansky at gmail.com>
  Date:   2020-08-14 (Fri, 14 Aug 2020)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
    M llvm/test/Transforms/InstCombine/2010-05-30-memcpy-Struct.ll
    M llvm/test/Transforms/InstCombine/sprintf-1.ll

  Log Message:
  -----------
  [SLC] sprintf(dst, "%s", str) -> strcpy(dst, str)

Transform sprintf(dst, "%s", str) -> strcpy(dst, str) if result is unused
Avoid sprintf(dest, "%s", str) -> llvm.memcpy(align 1 dest, align 1 str, strlen(str)+1) if optimizing for size.

Reviewed By: efriedma

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




More information about the All-commits mailing list