llvm-6502/include/llvm/Transforms
Ahmed Bougacha 37be0d7c43 [SimplifyLibCalls] Don't confuse strcpy_chk for stpcpy_chk.
This was introduced in a faulty refactoring (r225640, mea culpa):
the tests weren't testing the return values, so, for both
__strcpy_chk and __stpcpy_chk, we would return the end of the
buffer (matching stpcpy) instead of the beginning (for strcpy).

The root cause was the prefix "__" being ignored when comparing,
which made us always pick LibFunc::stpcpy_chk.
Pass the LibFunc::Func directly to avoid this kind of error.
Also, make the testcases as explicit as possible to prevent this.

The now-useful testcases expose another, entangled, stpcpy problem,
with the further simplification.  This was introduced in a
refactoring (r225640) to match the original behavior.

However, this leads to problems when successive simplifications
generate several similar instructions, none of which are removed
by the custom replaceAllUsesWith.

For instance, InstCombine (the main user) doesn't erase the
instruction in its custom RAUW.  When trying to simplify say
__stpcpy_chk:
- first, an stpcpy is created (fortified simplifier),
- second, a memcpy is created (normal simplifier), but the
  stpcpy call isn't removed.
- third, InstCombine later revisits the instructions,
  and simplifies the first stpcpy to a memcpy.  We now have
  two memcpys.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227250 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 21:52:16 +00:00
..
InstCombine [PM] Remove the restricted visibility from the instcombine worklist. Now 2015-01-25 00:30:05 +00:00
IPO [PM] Rework how the TargetLibraryInfo pass integrates with the new pass 2015-01-24 02:06:09 +00:00
Scalar [PM] Port LowerExpectIntrinsic to the new pass manager. 2015-01-24 11:13:02 +00:00
Utils [SimplifyLibCalls] Don't confuse strcpy_chk for stpcpy_chk. 2015-01-27 21:52:16 +00:00
Instrumentation.h InstrProf: An intrinsic and lowering for instrumentation based profiling 2014-12-08 18:02:35 +00:00
IPO.h Move -verify-use-list-order into llvm-uselistorder 2014-07-25 17:13:03 +00:00
ObjCARC.h Reformat linefeeds. 2014-05-26 00:25:26 +00:00
Scalar.h Add a new pass "inductive range check elimination" 2015-01-16 01:03:22 +00:00
Vectorize.h