Commit Graph

50799 Commits

Author SHA1 Message Date
Chris Lattner 3d5d5f2c6d REmove an old fixme, resolve another fixme by adding liberal
comments about what this class does.

llvm-svn: 60264
2008-11-30 01:17:08 +00:00
Chris Lattner ada1f87988 remove a bit of incorrect code that tried to be tricky about speeding up
dependencies.  The basic situation was this: consider if we had:

  store1
  ...
  store2
  ...
  store3

Where memdep thinks that store3 depends on store2 and store2 depends 
on store1.  The problem happens when we delete store2: The code in 
question was updating dep info for store3 to be store1.  This is a
spiffy optimization, but is not safe at all, because aliasing isn't
transitive.  This bug isn't exposed today with DSE because DSE will only
zap store2 if it is identifical to store 3, and in this case, it is 
safe to update it to depend on store1.  However, memcpyopt is not so
fortunate, which is presumably why the "dropInstruction" code used to
exist.

Since this doesn't actually provide a speedup in practice, just rip the
code out.

llvm-svn: 60263
2008-11-30 01:09:30 +00:00
Chris Lattner 424d2d8d86 fix indentation. std::pair is "isPod" if the first/second are both isPod.
llvm-svn: 60262
2008-11-30 00:50:20 +00:00
Nick Lewycky 7450a7cbf5 Remove warning about declaration does not declare anything. This class was
already declared in the other headers.

llvm-svn: 60261
2008-11-30 00:36:34 +00:00
Chris Lattner 63bd586d35 Eliminate the dropInstruction method, which is not needed any more.
Fix a subtle iterator invalidation bug I introduced in the last commit.

llvm-svn: 60258
2008-11-29 23:30:39 +00:00
Nick Lewycky af67df5881 Add protected visibility to libLTO.
llvm-svn: 60257
2008-11-29 22:49:59 +00:00
Chris Lattner e7d7e13bf7 implement some fixme's: when deleting an instruction with
an entry in the nonlocal deps map, don't reset entries
referencing that instruction to [dirty, null], instead, set
them to [dirty,next] where next is the instruction after the
deleted one.  Use this information in the non-local deps
code to avoid rescanning entire blocks.

This speeds up GVN slightly by avoiding pointless work.  On
403.gcc this makes GVN 1.5% faster. 

llvm-svn: 60256
2008-11-29 22:02:15 +00:00
Chris Lattner 1c6b62eb4d Change MemDep::getNonLocalDependency to return its results as
a smallvector instead of a DenseMap.  This speeds up GVN by 5%
on 403.gcc.

llvm-svn: 60255
2008-11-29 21:33:22 +00:00
Chris Lattner b8ec75bc35 move MemoryDependenceAnalysis::verifyRemoved to the end of the file,
no functionality/code change.

llvm-svn: 60254
2008-11-29 21:25:10 +00:00
Chris Lattner f280b0c729 reimplement getNonLocalDependency with a simpler worklist
formulation that is faster and doesn't require nonLazyHelper.
Much less code.

llvm-svn: 60253
2008-11-29 21:22:42 +00:00
Chris Lattner c40039c736 don't require GVN to work on dead values, just make the
test return the loaded value.

llvm-svn: 60252
2008-11-29 21:21:48 +00:00
Chris Lattner 8c5ff516c6 Fix a thinko that manifested as a crash on clamav last night.
llvm-svn: 60251
2008-11-29 20:29:04 +00:00
Nick Lewycky 35847809b7 Fix spelling mistake.
llvm-svn: 60250
2008-11-29 20:13:25 +00:00
Anders Carlsson 77b5df6313 CXXFunctionalCastExpr inherits from ExplicitCastExpr.
llvm-svn: 60249
2008-11-29 19:58:11 +00:00
Zhongxing Xu 452273d9c6 To be consistent, make the index of the ElementRegion always signed.
llvm-svn: 60248
2008-11-29 12:05:04 +00:00
Chris Lattner 5661fead0b tidy up some variable names.
llvm-svn: 60243
2008-11-29 09:22:14 +00:00
Chris Lattner 9f1988ab6c rename some maps.
llvm-svn: 60242
2008-11-29 09:20:15 +00:00
Chris Lattner 5cd1cfad11 rename some variables.
llvm-svn: 60241
2008-11-29 09:15:21 +00:00
Chris Lattner 80c081828f eliminate a bunch of code in favor of using AliasAnalysis::getModRefInfo.
Put a some code back to handle buggy behavior that GVN expects: it wants
loads to depend on each other, and accesses to depend on their allocations.

llvm-svn: 60240
2008-11-29 09:09:48 +00:00
Torok Edwin 96ce5a0bdf protect against negative values that would exceed allowed bit width
llvm-svn: 60239
2008-11-29 08:52:45 +00:00
Chris Lattner 81f19e9aa4 simplify some code and rename some variables. Reduce nesting.
Use getTypeStoreSize instead of ABITypeSize for in-memory size
in a couple places.

llvm-svn: 60238
2008-11-29 08:51:16 +00:00
Chris Lattner e1822ef660 apparently GCC doesn't believe that I understand C
precedence rules.  Pacify it.

llvm-svn: 60237
2008-11-29 08:36:39 +00:00
Duncan Sands 4f96a92145 Typo fix.
llvm-svn: 60236
2008-11-29 08:03:35 +00:00
Douglas Gregor 3be4b122d3 Implement the GNU __null extension
llvm-svn: 60235
2008-11-29 04:51:27 +00:00
Chris Lattner 51ba8d0630 Split getDependency into getDependency and getDependencyFrom, the
former does caching, the later doesn't.  This dramatically simplifies
the logic in getDependency and getDependencyFrom.

llvm-svn: 60234
2008-11-29 03:47:00 +00:00
Bill Wendling 469e3aa696 Temporarily revert r60195. It's causing an optimized bootstrap of llvm-gcc to fail.
llvm-svn: 60233
2008-11-29 03:43:04 +00:00
Chris Lattner e4d32791ef Now that DepType is private, we can start cleaning up some of its uses:
Document the Dirty value more precisely, use it for the uninitialized
DepResultTy value.  Change reverse mappings to be from an instruction*
instead of DepResultTy, and stop tracking other forms.  This makes it more
clear that we only care about the instruction cases.

Eliminate a DepResultTy,bool pair by using Dirty in the local case as well,
shrinking the map and simplifying the code.

This speeds up GVN by ~3% on 403.gcc.

llvm-svn: 60232
2008-11-29 03:22:12 +00:00
Chris Lattner 7f9c8a0f05 Introduce and use a new MemDepResult class to hold the results of a memdep
query.  This makes it crystal clear what cases can escape from MemDep that
the clients have to handle.  This also gives the clients a nice simplified
interface to it that is easy to poke at.

This patch also makes DepResultTy and MemoryDependenceAnalysis::DepType
private, yay.

llvm-svn: 60231
2008-11-29 02:29:27 +00:00
Chris Lattner de04e1173a Reimplement the internal abstraction used by MemDep in terms
of a pointer/int pair instead of a manually bitmangled pointer.
This forces clients to think a little more about checking the 
appropriate pieces and will be useful for internal 
implementation improvements later.

I'm not particularly happy with this.  After going through this
I don't think that the clients of memdep should be exposed to
the internal type at all.  I'll fix this in a subsequent commit.

This has no functionality change.

llvm-svn: 60230
2008-11-29 01:43:36 +00:00
Chris Lattner 482713e14a Fix sentinels to use correctly 'aligned' pointers.
llvm-svn: 60229
2008-11-29 01:36:16 +00:00
Chris Lattner 2774a41b96 Fix spello, add DenseMapInfo specialization for PointerIntPair.
llvm-svn: 60228
2008-11-29 01:18:05 +00:00
Chris Lattner 06db5255c3 fix comment typo
llvm-svn: 60227
2008-11-28 23:57:26 +00:00
Chris Lattner 9d72ff710e Switch QualType to use llvm::PointerIntPair internally to do the pointer
bitmangling.

llvm-svn: 60226
2008-11-28 23:37:31 +00:00
Chris Lattner 845d731670 fix a bug.
llvm-svn: 60225
2008-11-28 23:36:15 +00:00
Chris Lattner 7602e4bdbf add a generic "bitmangled pointer" class, which allows a parameterized
pointer and integer type to be used.

llvm-svn: 60224
2008-11-28 23:31:44 +00:00
Chris Lattner d3d9111ede Fix PR3141 by ensuring that MemoryDependenceAnalysis::removeInstruction
properly updates the reverse dependency map when it installs updated 
dependencies for instructions that depend on the removed instruction.

llvm-svn: 60222
2008-11-28 22:51:08 +00:00
Chris Lattner f3f6a801cc don't revisit instructions off the beginning of the block.
llvm-svn: 60221
2008-11-28 22:50:08 +00:00
Chris Lattner 08f3c00562 comment cleanups.
llvm-svn: 60220
2008-11-28 22:41:36 +00:00
Chris Lattner 73c254593e more cleanups for MemoryDependenceAnalysis::removeInstruction,
no functionality change.

llvm-svn: 60219
2008-11-28 22:28:27 +00:00
Chris Lattner a25d3952c6 random cleanups, no functionality change.
llvm-svn: 60218
2008-11-28 22:04:47 +00:00
Chris Lattner 2916a4b589 forward declare CallSite instead of #includ'ing it.
llvm-svn: 60217
2008-11-28 21:47:19 +00:00
Chris Lattner 554d1221aa Run verifyRemoved from removeInstruction when -debug is specified.
This shows the root problem behind PR3141.

llvm-svn: 60216
2008-11-28 21:45:17 +00:00
Chris Lattner e5fd5c29de rename "ping" to "verifyRemoved". I don't know why 'ping' what chosen,
but it doesn't make any sense at all.

Also make the method const, private, and fit in 80 cols while we're at it.

llvm-svn: 60215
2008-11-28 21:42:09 +00:00
Chris Lattner cfa414fe9e comment and indentation improvements.
llvm-svn: 60214
2008-11-28 21:36:43 +00:00
Chris Lattner f2a8ba4cf0 simplify some code, remove escaped newline.
llvm-svn: 60213
2008-11-28 21:29:52 +00:00
Chris Lattner dca2cd3562 remove mysterious escaped newlines.
llvm-svn: 60211
2008-11-28 21:16:44 +00:00
Chris Lattner 8a172daa55 don't call MergeBasicBlockIntoOnlyPred on a block whose only
predecessor is itself.  This doesn't make sense, and this is
a dead infinite loop anyway.

llvm-svn: 60210
2008-11-28 19:54:49 +00:00
Duncan Sands 71ecd67b5d Add include files needed when building with
gcc 4.4 (due to use of sprintf).

llvm-svn: 60209
2008-11-28 10:20:03 +00:00
Duncan Sands 595a4423dc Fix build with gcc-4.4: it doesn't like PICStyle
being both a namespace and a variable name.

llvm-svn: 60208
2008-11-28 09:29:37 +00:00
Zhongxing Xu e31a8ebfdc Fix a serious bug.
When initialized, the index of the ElementRegion was unsigned. But the index
value of the ArraySubscriptExpr is signed. This inconsistency caused the value
of the array element retrieved to be UnknownVal despite it was initialized to
symbolic.

This is only a hack. Real fix of this problem is required.

llvm-svn: 60207
2008-11-28 08:41:39 +00:00