llvm-6502/lib/Analysis
Dan Gohman 4f8eea82d8 Generalize target-independent folding rules for sizeof to handle more
cases, and implement target-independent folding rules for alignof and
offsetof. Also, reassociate reassociative operators when it leads to
more folding.

Generalize ScalarEvolution's isOffsetOf to recognize offsetof on
arrays. Rename getAllocSizeExpr to getSizeOfExpr, and getFieldOffsetExpr
to getOffsetOfExpr, for consistency with analagous ConstantExpr routines.

Make the target-dependent folder promote GEP array indices to
pointer-sized integers, to make implicit casting explicit and exposed
to subsequent folding.

And add a bunch of testcases for this new functionality, and a bunch
of related existing functionality.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94987 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 18:27:38 +00:00
..
IPA make -fno-rtti the default unless a directory builds with REQUIRES_RTTI. 2010-01-24 20:43:08 +00:00
AliasAnalysis.cpp Partially address a README by having functionattrs consider calls to 2010-01-06 08:45:52 +00:00
AliasAnalysisCounter.cpp drop the pass name from the output. 2010-01-22 05:52:51 +00:00
AliasAnalysisEvaluator.cpp Change dbgs() back to errs() as Chris requested. 2009-12-23 22:49:57 +00:00
AliasDebugger.cpp adopt getAdjustedAnalysisPointer in a few more passes. 2010-01-20 20:09:02 +00:00
AliasSetTracker.cpp Change dbgs() back to errs() as Chris requested. 2009-12-23 22:49:57 +00:00
Analysis.cpp "In order to ease automatic bindings generation, it would be helpful if boolean values were distinguishable from integers. The attached patch introduces "typedef int LLVMBool;", and uses LLVMBool instead of int throughout the C API, wherever a boolean value is called for." 2010-01-09 22:27:07 +00:00
BasicAliasAnalysis.cpp add some new methods to adjust this pointers. Not used yet. 2010-01-20 19:26:14 +00:00
CaptureTracking.cpp Reuse the Threshold value to size these containers because it's 2009-12-09 18:48:53 +00:00
CFGPrinter.cpp Remove includes of Support/Compiler.h that are no longer needed after the 2009-10-25 06:57:41 +00:00
CMakeLists.txt add to cmake 2009-12-04 04:15:36 +00:00
ConstantFolding.cpp Generalize target-independent folding rules for sizeof to handle more 2010-02-01 18:27:38 +00:00
DbgInfoPrinter.cpp Remove dead debug info intrinsics. 2010-01-05 01:10:40 +00:00
DebugInfo.cpp Before inserting llvm.dbg.declare intrinsic at the end of a basic block, check whether the basic block has a terminator or not. 2010-01-29 18:30:57 +00:00
DomPrinter.cpp Create Generic DOTGraphTraits Printer/Viewer 2010-01-16 10:56:41 +00:00
InlineCost.cpp Fix inline cost predictions with SCIENCE. 2010-01-26 23:21:56 +00:00
InstCount.cpp Change dbgs() back to errs() as Chris requested. 2009-12-23 23:29:28 +00:00
InstructionSimplify.cpp factor some logic out of instcombine into a new SimplifyAddInst method. 2009-11-27 17:42:22 +00:00
Interval.cpp Change Pass::print to take a raw ostream instead of std::ostream, 2009-08-23 06:03:38 +00:00
IntervalPartition.cpp Change Pass::print to take a raw ostream instead of std::ostream, 2009-08-23 06:03:38 +00:00
IVUsers.cpp Re-implement the main strength-reduction portion of LoopStrengthReduction. 2010-01-21 02:09:26 +00:00
LazyValueInfo.cpp Convert debug messages to use dbgs(). Generally this means 2009-12-23 20:43:58 +00:00
LibCallAliasAnalysis.cpp LibCallAliasAnalysis doesn't use TargetData. 2009-07-31 20:56:29 +00:00
LibCallSemantics.cpp Remove Value::getNameLen 2009-07-26 08:34:35 +00:00
LiveValues.cpp remove redundant foward declaration. This function is already in 2009-11-11 00:21:21 +00:00
LoopDependenceAnalysis.cpp Convert debug messages to use dbgs(). Generally this means 2009-12-23 20:52:41 +00:00
LoopInfo.cpp Restore dump() methods to Loop and MachineLoop. 2010-01-05 21:08:02 +00:00
LoopPass.cpp eliminate a bunch more unneeded dynamic_cast's. 2010-01-22 05:37:10 +00:00
Makefile make -fno-rtti the default unless a directory builds with REQUIRES_RTTI. 2010-01-24 20:43:08 +00:00
MemoryBuiltins.cpp Simplify ComputeMultiple so that it doesn't depend on TargetData. 2009-11-18 00:58:27 +00:00
MemoryDependenceAnalysis.cpp The phi translated pointer can be computed when returning a partially cached result 2009-12-22 04:25:02 +00:00
PHITransAddr.cpp Change dbgs() back to errs() as Chris requested. 2009-12-23 23:27:15 +00:00
PointerTracking.cpp remove a bunch of extraneous LLVMContext arguments 2009-11-06 04:27:31 +00:00
PostDominators.cpp Convert debug messages to use dbgs(). Generally this means 2009-12-23 21:16:54 +00:00
ProfileEstimatorPass.cpp adopt getAdjustedAnalysisPointer in a few more passes. 2010-01-20 20:09:02 +00:00
ProfileInfo.cpp adopt getAdjustedAnalysisPointer in a few more passes. 2010-01-20 20:09:02 +00:00
ProfileInfoLoader.cpp Reapplied r81355 with the problems fixed. 2009-09-16 11:35:50 +00:00
ProfileInfoLoaderPass.cpp adopt getAdjustedAnalysisPointer in a few more passes. 2010-01-20 20:09:02 +00:00
ProfileVerifierPass.cpp Convert debug messages to use dbgs(). Generally this means 2009-12-23 22:10:20 +00:00
README.txt Create a README.txt for lib/Analysis, and add an entry. 2009-09-28 18:38:53 +00:00
ScalarEvolution.cpp Generalize target-independent folding rules for sizeof to handle more 2010-02-01 18:27:38 +00:00
ScalarEvolutionAliasAnalysis.cpp adopt getAdjustedAnalysisPointer in a few more passes. 2010-01-20 20:09:02 +00:00
ScalarEvolutionExpander.cpp Generalize target-independent folding rules for sizeof to handle more 2010-02-01 18:27:38 +00:00
SparsePropagation.cpp Convert debug messages to use dbgs(). Generally this means 2009-12-23 22:28:01 +00:00
Trace.cpp Convert debug messages to use dbgs(). Generally this means 2009-12-23 22:35:10 +00:00
ValueTracking.cpp It looks like the changes to the SRem logic of SimplifyDemandedUseBits 2010-01-29 06:18:37 +00:00

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.

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