llvm-6502/include/llvm/Transforms/Utils
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
..
ASanStackFrameLayout.h Fix known typos 2014-01-24 17:20:08 +00:00
BasicBlockUtils.h [PM] Replace the Pass argument to SplitEdge with specific analyses used 2015-01-19 12:36:53 +00:00
BuildLibCalls.h [SimplifyLibCalls] Factor out fortified libcall handling. 2015-01-12 17:22:43 +00:00
BypassSlowDivision.h
Cloning.h [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
CmpInstAnalysis.h Whitespace. 2014-05-19 04:43:03 +00:00
CodeExtractor.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
CtorUtils.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
GlobalStatus.h Optimize more linkonce_odr values during LTO. 2013-10-21 17:14:55 +00:00
IntegerDivision.h Whitespace. 2014-05-19 04:43:03 +00:00
Local.h [PM] Replace the Pass argument in MergeBasicBlockIntoOnlyPred with 2015-01-20 01:37:09 +00:00
LoopUtils.h [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
ModuleUtils.h Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needing to mention the size. 2014-08-21 05:55:13 +00:00
PromoteMemToReg.h [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
SimplifyIndVar.h Reformat blank lines. 2014-05-19 04:43:26 +00:00
SimplifyLibCalls.h [SimplifyLibCalls] Don't confuse strcpy_chk for stpcpy_chk. 2015-01-27 21:52:16 +00:00
SSAUpdater.h Reformat blank lines. 2014-05-19 04:43:26 +00:00
SSAUpdaterImpl.h [Modules] Make Support/Debug.h modular. This requires it to not change 2014-04-21 22:55:11 +00:00
SymbolRewriter.h Transform: add SymbolRewriter pass 2014-11-07 21:32:08 +00:00
UnifyFunctionExitNodes.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
UnrollLoop.h [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
ValueMapper.h Rename MapValue(Metadata*) to MapMetadata() 2014-12-19 06:06:18 +00:00
VectorUtils.h [PM] Move TargetLibraryInfo into the Analysis library. 2015-01-15 02:16:27 +00:00