instcombine: Split out the __stpcpy_chk simplifications from StrCpyChkOpt
authorMeador Inge <meadori@codesourcery.com>
Wed, 31 Oct 2012 00:20:51 +0000 (00:20 +0000)
committerMeador Inge <meadori@codesourcery.com>
Wed, 31 Oct 2012 00:20:51 +0000 (00:20 +0000)
commitfa9d1372c99e5b74406a606756ba77d620d575bb
treeb605e77740003a65986cedbaa89bc8c3eda01639
parentdfd0b9b460686ca9491e49dd3647beec5e748a1a
instcombine: Split out the __stpcpy_chk simplifications from StrCpyChkOpt

r166198 migrated the strcpy optimization to instcombine.  The strcpy
simplifier that was migrated from Transforms/Scalar/SimplifyLibCalls.cpp
was also doing some __strcpy_chk simplifications.  Those fortified
simplifications were migrated as well, but introduced a bug in the
__stpcpy_chk simplifier in the process.  This happened because the
__strcpy_chk and __stpcpy_chk simplifiers were both mapped to StrCpyChkOpt
which was updated with simplifications that worked for __strcpy_chk, but
not __stpcpy_chk.

This patch fixes the problem by adding proper test coverage and creating a
new simplifier for __stpcpy_chk (instead of sharing one with __strcpy_chk).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167082 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyLibCalls.cpp
test/Transforms/InstCombine/stpcpy_chk-1.ll [new file with mode: 0644]
test/Transforms/InstCombine/stpcpy_chk-2.ll [new file with mode: 0644]