Commit Graph

51028 Commits

Author SHA1 Message Date
Anders Carlsson bd1df8e866 EvalInfo now holds a reference to an EvalResult struct.
llvm-svn: 60296
2008-11-30 16:38:33 +00:00
Anders Carlsson 6c5887ce16 Add Expr::EvalResult struct. (Not used just yet)
llvm-svn: 60295
2008-11-30 16:19:46 +00:00
Bill Wendling de89bc275c Add instruction combining for ((A&~B)|(~A&B)) -> A^B and all permutations.
llvm-svn: 60291
2008-11-30 13:52:49 +00:00
Bill Wendling 9eef421e12 Implement (A&((~A)|B)) -> A&B transformation in the instruction combiner. This
takes care of all permutations of this pattern.

llvm-svn: 60290
2008-11-30 13:08:13 +00:00
Bill Wendling 2fe3229824 Forgot one remaining call to getSExtValue().
llvm-svn: 60289
2008-11-30 12:41:09 +00:00
Bill Wendling 2d2e7861b5 getSExtValue() doesn't work for ConstantInts with bitwidth > 64 bits. Use all
APInt calls instead.

This fixes PR3144.

llvm-svn: 60288
2008-11-30 12:38:24 +00:00
Eli Friedman 09bc610945 Optimize memmove and memset into the LLVM builtins. Note that these
only show up in code from front-ends besides llvm-gcc, like clang.

llvm-svn: 60287
2008-11-30 08:32:11 +00:00
Eli Friedman e9ef170d4a A couple small cleanups, plus a new potential optimization.
llvm-svn: 60286
2008-11-30 07:52:27 +00:00
Eli Friedman e16c0ff1d3 Moving potential optimizations out of PR2330 into lib/Target/README.txt.
Hopefully this isn't too much stuff to dump into this file.

llvm-svn: 60285
2008-11-30 07:36:04 +00:00
Eli Friedman c8228d263b Followup to r60283: optimize arbitrary width signed divisions as well
as unsigned divisions.  Same caveats as before.

llvm-svn: 60284
2008-11-30 06:35:39 +00:00
Eli Friedman 1b7fc154a5 Fix for PR2164: allow transforming arbitrary-width unsigned divides into
multiplies.

Some more cleverness would be nice, though. It would be nice if we 
could do this transformation on illegal types.  Also, we would 
prefer a narrower constant when possible so that we can use a narrower
multiply, which can be cheaper.

llvm-svn: 60283
2008-11-30 06:02:26 +00:00
Zhongxing Xu 9cc7cba848 remove a test case that causes compiler warning.
llvm-svn: 60282
2008-11-30 05:59:27 +00:00
Zhongxing Xu 5c75919093 Add test for initializing array with string literal.
llvm-svn: 60281
2008-11-30 05:51:19 +00:00
Zhongxing Xu d2fa1e0999 Add support for initializing array with string literal.
This fixes PR3127
http://llvm.org/bugs/show_bug.cgi?id=3127

llvm-svn: 60280
2008-11-30 05:49:49 +00:00
Bill Wendling 7abf352f44 Don't make TwoToExp signed by default.
llvm-svn: 60279
2008-11-30 05:29:33 +00:00
Bill Wendling af200e9237 From Hacker's Delight:
"For signed integers, the determination of overflow of x*y is not so simple. If
x and y have the same sign, then overflow occurs iff xy > 2**31 - 1. If they
have opposite signs, then overflow occurs iff xy < -2**31."

In this case, x == -1.

llvm-svn: 60278
2008-11-30 05:01:05 +00:00
Eli Friedman bd0f57821a APIntify a test which is potentially unsafe otherwise, and fix the
nearby FIXME.

I'm not sure what the right way to fix the Cell test was; if the 
approach I used isn't okay, please let me know.

llvm-svn: 60277
2008-11-30 04:59:26 +00:00
Bill Wendling 361c0e5f9c Strengthen check for div inst-combining.
llvm-svn: 60276
2008-11-30 04:33:53 +00:00
Bill Wendling 70635adea3 Instcombine was illegally transforming -X/C into X/-C when either X or C
overflowed on negation. This commit checks to make sure that neithe C nor X
overflows. This requires that the RHS of X (a subtract instruction) be a
constant integer.

llvm-svn: 60275
2008-11-30 03:42:12 +00:00
Chris Lattner 441042796d Two changes: Make getDependency remove QueryInst for a dirty record's
ReverseLocalDeps when we update it.  This fixes a regression test
failure from my last commit.

Second, for each non-local cached information structure, keep a bit that
indicates whether it is dirty or not.  This saves us a scan over the whole
thing in the common case when it isn't dirty.

llvm-svn: 60274
2008-11-30 02:52:26 +00:00
Eli Friedman 9ccf574ea0 Fix a link issue I ran into trying compiling LLVM on MinGW with CMake.
Hopefully this doesn't break anyone else's build... it shouldn't unless 
the MinGW variable means something other than compiling with MinGW.

llvm-svn: 60273
2008-11-30 02:42:05 +00:00
Chris Lattner fc678e2af5 introduce a typedef, no functionality change.
llvm-svn: 60272
2008-11-30 02:30:50 +00:00
Chris Lattner 1b810bd5e6 Change NonLocalDeps to be a densemap of pointers to densemap
instead of containing them by value.  This increases the density
(!) of NonLocalDeps as well as making the reallocation case 
faster.  This speeds up gvn on 403.gcc by 2% and makes room for
future improvements.

I'm not super thrilled with having to explicitly manage the new/delete
of the map, but it is necesary for the next change.

llvm-svn: 60271
2008-11-30 02:28:25 +00:00
Eli Friedman c59bb48e80 Fix for PR2969: generate a memcpy from a constant for constant
initializers.  llvm-gcc appears to be more aggressive, but incorrect, 
for constructs like "const int a[] = {1,2,3};"; that said, current 
optimizers will do the appropriate optimizations when safe.

llvm-svn: 60270
2008-11-30 02:11:09 +00:00
Eli Friedman 79ceb0947b Minor update to CMake build system.
llvm-svn: 60269
2008-11-30 01:46:21 +00:00
Chris Lattner ff862c4e88 calls never depend on allocations.
llvm-svn: 60268
2008-11-30 01:44:00 +00:00
Chris Lattner 3ff6d01586 Fix a fixme by making memdep's handling of allocations more logical.
If we see that a load depends on the allocation of its memory with no
intervening stores, we now return a 'None' depedency instead of "Normal".
This tweaks GVN to do its optimization with the new result.

llvm-svn: 60267
2008-11-30 01:39:32 +00:00
Chris Lattner 60444f8aa5 implement a fixme by introducing a new getDependencyFromInternal
method that returns its result as a DepResultTy instead of as a
MemDepResult.  This reduces conversion back and forth.

llvm-svn: 60266
2008-11-30 01:26:32 +00:00
Chris Lattner 2059753e66 Move the getNonLocalDependency method to a more logical place in
the file, no functionality change.

llvm-svn: 60265
2008-11-30 01:18:27 +00:00
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