Revert "[SLC] sprintf(dst, "%s", str) -> strcpy(dst, str)"
authorMartin Storsjö <martin@martin.st>
Sat, 15 Aug 2020 06:19:54 +0000 (09:19 +0300)
committerMartin Storsjö <martin@martin.st>
Sat, 15 Aug 2020 06:35:11 +0000 (09:35 +0300)
commit3e7403a1346f9644511170e0b29b5adf68996309
treec68d41b27bb4d55d19ab82910deae35bd4b1c06d
parent7208cb1ac43e4be806bcb91c622fc1f8641e010b
Revert "[SLC] sprintf(dst, "%s", str) -> strcpy(dst, str)"

This reverts commit 6dbf0cfcf789365493f70ae69df8a7a59be41c75.

That commit caused failed assertions, e.g. like this:

$ cat sprintf-strcpy.c
char *ptr; void func(void) { ptr += sprintf(ptr, "%s", ""); }

$ clang -c sprintf-strcpy.c -O2 -target x86_64-linux-gnu
clang: ../lib/IR/Value.cpp:473: void llvm::Value::doRAUW(llvm::Value*,
llvm::Value::ReplaceMetadataUses): Assertion `New->getType() ==
getType() && "replaceAllUses of value with new value of different
type!"' failed.
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
llvm/test/Transforms/InstCombine/2010-05-30-memcpy-Struct.ll
llvm/test/Transforms/InstCombine/sprintf-1.ll