llvm-6502/lib/Analysis
Victor Hernandez 9d0b704e3e Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions.
Here is the original commit message:

This commit updates malloc optimizations to operate on malloc calls that have constant int size arguments.

Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses.  The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses.  The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86311 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 00:16:28 +00:00
..
IPA Reverting 85714, 85715, 85716, which are breaking the build 2009-11-01 16:42:53 +00:00
AliasAnalysis.cpp
AliasAnalysisCounter.cpp
AliasAnalysisEvaluator.cpp
AliasDebugger.cpp
AliasSetTracker.cpp remove unneeded checks of isFreeCall 2009-11-03 05:35:19 +00:00
Analysis.cpp
BasicAliasAnalysis.cpp remove a bunch of extraneous LLVMContext arguments 2009-11-06 04:27:31 +00:00
CaptureTracking.cpp remove a check of isFreeCall: the argument to free is already nocapture so the generic call code works fine. 2009-11-03 05:34:51 +00:00
CFGPrinter.cpp
CMakeLists.txt Rename MallocFreeHelper as MemoryBuiltins 2009-10-27 20:05:49 +00:00
ConstantFolding.cpp remove a bunch of extraneous LLVMContext arguments 2009-11-06 04:27:31 +00:00
DbgInfoPrinter.cpp
DebugInfo.cpp Tolerate invalid derived type. 2009-11-06 18:24:05 +00:00
DomPrinter.cpp
InlineCost.cpp Add a missing closing parenthesis, and tweak to fit in 80 2009-11-01 19:12:43 +00:00
InstCount.cpp Remove FreeInst. 2009-10-26 23:43:48 +00:00
Interval.cpp
IntervalPartition.cpp
IVUsers.cpp Fix IVUsers to avoid assuming that the loop has a unique backedge. 2009-11-05 19:41:37 +00:00
LibCallAliasAnalysis.cpp
LibCallSemantics.cpp
LiveValues.cpp
LoopDependenceAnalysis.cpp
LoopInfo.cpp Factor out the predicate code for loopsimplify form exit blocks into 2009-11-05 19:21:41 +00:00
LoopPass.cpp
Makefile
MemoryBuiltins.cpp Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions. 2009-11-07 00:16:28 +00:00
MemoryDependenceAnalysis.cpp Treat lifetime begin/end markers as allocations/frees respectively for the 2009-10-28 07:05:35 +00:00
PointerTracking.cpp remove a bunch of extraneous LLVMContext arguments 2009-11-06 04:27:31 +00:00
PostDominators.cpp
ProfileEstimatorPass.cpp
ProfileInfo.cpp
ProfileInfoLoader.cpp
ProfileInfoLoaderPass.cpp Apply fix for PR5135, Credit to Andreas Neustifter. 2009-11-02 02:55:39 +00:00
ProfileVerifierPass.cpp Apply fix for PR5135, Credit to Andreas Neustifter. 2009-11-02 02:55:39 +00:00
README.txt
ScalarEvolution.cpp remove a bunch of extraneous LLVMContext arguments 2009-11-06 04:27:31 +00:00
ScalarEvolutionAliasAnalysis.cpp Make ScalarEvolutionAliasAnalysis slightly more aggressive, by making an 2009-10-31 14:32:25 +00:00
ScalarEvolutionExpander.cpp
SparsePropagation.cpp rename indbr -> indirectbr to appease the residents of #llvm. 2009-10-28 00:19:10 +00:00
Trace.cpp
ValueTracking.cpp

Analysis Opportunities:

//===---------------------------------------------------------------------===//

In test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll, the
ScalarEvolution expression for %r is this:

  {1,+,3,+,2}<loop>

Outside the loop, this could be evaluated simply as (%n * %n), however
ScalarEvolution currently evaluates it as

  (-2 + (2 * (trunc i65 (((zext i64 (-2 + %n) to i65) * (zext i64 (-1 + %n) to i65)) /u 2) to i64)) + (3 * %n))

In addition to being much more complicated, it involves i65 arithmetic,
which is very inefficient when expanded into code.

//===---------------------------------------------------------------------===//