llvm-6502/lib/Analysis
Chris Lattner 673e02b0c3 This nutty patch has been in my tree since before 1.3 went out, and it needs
to go in.  This patch allows us to compute the trip count of loops controlled
by values loaded from constant arrays.  The cannonnical example of this is
strlen when passed a constant argument:

for (int i = 0; "constantstring"[i]; ++i) ;
return i;

In this case, it will compute that the loop executes 14 times, which means
that the exit value of i is 14.  Because of this, the loop gets DCE'd and
we are happy.  This also applies to anything that does similar things, e.g.
loops like this:

  const float Array[] = { 0.1, 2.1, 3.2, 23.21 };
  for (int i = 0; Array[i] < 20; ++i)

and is actually fairly general.

The problem with this is that it almost never triggers.  The reason is that
we run indvars and the loop optimizer only at compile time, which is before
things like strlen and strcpy have been inlined into the program from libc.
Because of this, it almost never is used (it triggers twice in specint2k).

I'm committing it because it DOES work, may be useful in the future, and
doesn't slow us down at all.  If/when we start running the loop optimizer
at link-time (-O4?) this will be very nice indeed :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16926 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-12 01:49:27 +00:00
..
DataStructure Make this build 2004-10-11 20:53:28 +00:00
IPA Build both archive and relinked objects 2004-10-10 22:17:39 +00:00
AliasAnalysis.cpp Fix #includes of i*.h => Instructions.h as per PR403. 2004-07-29 17:30:56 +00:00
AliasAnalysisCounter.cpp 'Pass' should now not be derived from by clients. Instead, they should derive 2004-09-20 04:48:05 +00:00
AliasAnalysisEvaluator.cpp Changes For Bug 352 2004-09-01 22:55:40 +00:00
AliasSetTracker.cpp Add some assertions 2004-09-15 16:59:47 +00:00
BasicAliasAnalysis.cpp Fixes to make LLVM compile with vc7.1. 2004-09-03 18:19:51 +00:00
CFGPrinter.cpp Changes For Bug 352 2004-09-01 22:55:40 +00:00
ConstantRange.cpp Bug fixes for PR341 2004-07-15 01:29:12 +00:00
Expressions.cpp Add #include <iostream> since Value.h does not #include it any more. 2004-07-04 12:19:56 +00:00
InstCount.cpp Changes For Bug 352 2004-09-01 22:55:40 +00:00
Interval.cpp Fixes for PR341 2004-07-15 02:31:46 +00:00
IntervalPartition.cpp Fixes to make LLVM compile with vc7.1. 2004-09-03 18:19:51 +00:00
LoadValueNumbering.cpp Fixes to make LLVM compile with vc7.1. 2004-09-03 18:19:51 +00:00
LoopInfo.cpp Convert code to compile with vc7.1. 2004-09-15 17:06:42 +00:00
Makefile Live var is now in lib/Target/Sparc 2004-01-09 18:16:20 +00:00
Makefile.am Build both archive and relinked objects 2004-10-10 22:17:39 +00:00
PostDominators.cpp Changes For Bug 352 2004-09-01 22:55:40 +00:00
ProfileInfo.cpp Switch to using edge profiling information as the basic source of profile info 2004-03-08 22:04:08 +00:00
ProfileInfoLoader.cpp Add #include <iostream> since Value.h does not #include it any more. 2004-07-04 12:19:56 +00:00
ProfileInfoLoaderPass.cpp 'Pass' should now not be derived from by clients. Instead, they should derive 2004-09-20 04:48:05 +00:00
ScalarEvolution.cpp This nutty patch has been in my tree since before 1.3 went out, and it needs 2004-10-12 01:49:27 +00:00
Trace.cpp Add #include <iostream> since Value.h does not #include it any more. 2004-07-04 12:19:56 +00:00
ValueNumbering.cpp Minor efficiency improvement, finegrainify namespacification 2004-03-25 22:56:03 +00:00