Nick Lewycky
0f87ca7733
Add spliceFunction to the CallGraph interface. This allows users to efficiently
...
update a callGraph when performing the common operation of splicing the body to
a new function and updating all callers (such as via RAUW).
No users yet, though this is intended for DeadArgumentElimination as part of
PR8887.
llvm-svn: 122728
2011-01-03 03:19:35 +00:00
Chris Lattner
bf0aa927cc
split dom frontier handling stuff out to its own DominanceFrontier header,
...
so that Dominators.h is *just* domtree. Also prune #includes a bit.
llvm-svn: 122714
2011-01-02 22:09:33 +00:00
Duncan Sands
772749aea1
Revert commit 122654 at the request of Chris, who reckons that instsimplify
...
is the wrong hammer for this nail, and is probably right.
llvm-svn: 122661
2011-01-01 20:08:02 +00:00
Duncan Sands
e3c539581c
Fix a README item by having InstructionSimplify do a mild form of value
...
numbering, in which it considers (for example) "%a = add i32 %x, %y" and
"%b = add i32 %x, %y" to be equal because the operands are equal and the
result of the instructions only depends on the values of the operands.
This has almost no effect (it removes 4 instructions from gcc-as-one-file),
and perhaps slows down compilation: I measured a 0.4% slowdown on the large
gcc-as-one-file testcase, but it wasn't statistically significant.
llvm-svn: 122654
2011-01-01 16:12:09 +00:00
Benjamin Kramer
b6d52b8b64
Cast away "comparison between signed and unsigned integer" warnings.
...
llvm-svn: 122598
2010-12-28 13:52:52 +00:00
Chris Lattner
9cb1035f94
move isBytewiseValue out to ValueTracking.h/cpp
...
llvm-svn: 122565
2010-12-26 20:15:01 +00:00
Jeffrey Yasskin
9b43f33620
Change all self assignments X=X to (void)X, so that we can turn on a
...
new gcc warning that complains on self-assignments and
self-initializations.
llvm-svn: 122458
2010-12-23 00:58:24 +00:00
Duncan Sands
a45cfbd405
When determining whether the new instruction was already present in
...
the original instruction, half the cases were missed (making it not
wrong but suboptimal). Also correct a typo (A <-> B) in the second
chunk.
llvm-svn: 122414
2010-12-22 17:15:25 +00:00
Duncan Sands
3547d2ebd8
Add some statistics, good for understanding how much more powerful
...
instcombine is compared to instsimplify.
llvm-svn: 122397
2010-12-22 09:40:51 +00:00
Duncan Sands
fecc642224
While I don't think any later transforms can fire, it seems cleaner to
...
not assume this (for example in case more transforms get added below
it). Suggested by Frits van Bommel.
llvm-svn: 122332
2010-12-21 15:03:43 +00:00
Duncan Sands
5def0d6791
Fix inverted condition noticed by Frits van Bommel.
...
llvm-svn: 122331
2010-12-21 14:48:48 +00:00
Duncan Sands
d0eb6d39f8
Pull a few more simplifications out of instcombine (there are still
...
plenty left though!), in particular for multiplication.
llvm-svn: 122330
2010-12-21 14:00:22 +00:00
Duncan Sands
ee3ec6eb94
Teach InstructionSimplify about distributive laws. These transforms fire
...
quite often, but don't make much difference in practice presumably because
instcombine also knows them and more.
llvm-svn: 122328
2010-12-21 13:32:22 +00:00
Duncan Sands
f64e690c4f
Move checking of the recursion limit into the various Thread methods.
...
No functionality change.
llvm-svn: 122327
2010-12-21 09:09:15 +00:00
Duncan Sands
6c7a52cf80
Add generic simplification of associative operations, generalizing
...
a couple of existing transforms. This fires surprisingly often, for
example when compiling gcc "(X+(-1))+1->X" fires quite a lot as well
as various "and" simplifications (usually with a phi node operand).
Most of the time this doesn't make a real difference since the same
thing would have been done elsewhere anyway, eg: by instcombine, but
there are a few places where this results in simplifications that we
were not doing before.
llvm-svn: 122326
2010-12-21 08:49:00 +00:00
Owen Anderson
c6beda80ff
Speculatively revert the use of DenseMap in LazyValueInfo, which may be causing Linux self-host failures.
...
llvm-svn: 122291
2010-12-20 23:53:19 +00:00
Owen Anderson
9be3ec6264
Attempt to appease the DragonEgg buildbots.
...
llvm-svn: 122288
2010-12-20 23:23:18 +00:00
Owen Anderson
813a2c45a8
Convert one of LVI's primary maps to a DenseMap, now that we know are more assured of iterator stability.
...
llvm-svn: 122273
2010-12-20 21:30:54 +00:00
Owen Anderson
d83f98a51e
More LVI cleanups, including trying to simplify the process of maintaining the OverDefinedCache.
...
llvm-svn: 122256
2010-12-20 19:33:41 +00:00
Owen Anderson
64c2c5798a
Reuse the reference into the LVI cache throughout the solver subsystem. This is much easier to
...
verify as being safe thanks its recent de-recursivization.
llvm-svn: 122254
2010-12-20 18:18:16 +00:00
Duncan Sands
ed6d6c33dd
Have SimplifyBinOp dispatch Xor, Add and Sub to the corresponding methods
...
(they had just been forgotten before). Adding Xor causes "main" in the
existing testcase 2010-11-01-lshr-mask.ll to be hugely more simplified.
llvm-svn: 122245
2010-12-20 14:47:04 +00:00
Nick Lewycky
55a700b0cf
Make LazyValueInfo non-recursive.
...
llvm-svn: 122120
2010-12-18 01:00:40 +00:00
Nate Begeman
7aa18bf46a
Add vector versions of some existing scalar transforms to aid codegen in matching psign & pblend operations to the IR produced by clang/gcc for their C idioms.
...
llvm-svn: 122105
2010-12-17 23:12:19 +00:00
Dan Gohman
91ab4ffd96
Update a comment.
...
llvm-svn: 121946
2010-12-16 02:55:10 +00:00
Dan Gohman
e1a17a3473
Make memcpyopt TBAA-aware.
...
llvm-svn: 121944
2010-12-16 02:51:19 +00:00
Dan Gohman
2c9d342f04
Enable TBAA by default.
...
llvm-svn: 121923
2010-12-15 23:58:44 +00:00
Dan Gohman
05b18f143f
Reapply r121886, and also update DecomposeGEPExpression to keep
...
it in sync.
llvm-svn: 121895
2010-12-15 20:49:55 +00:00
Dan Gohman
d02b65982e
Revert r121886. DecomposeGEPExpression needs to be kept
...
in sync.
llvm-svn: 121892
2010-12-15 20:39:25 +00:00
Dan Gohman
949ab7889c
Strengthen GetUnderlyingObject using InstructionSimplify.
...
While LLVM's main design is that analysis code shouldn't
go out of its way to understand code which hasn't been
InstCombined, analysis utility routines like this can
find themselves being called in the middle of transform
passes when instcombine hasn't had a chance to run.
llvm-svn: 121886
2010-12-15 20:10:26 +00:00
Dan Gohman
a4fcd2418d
Move Value::getUnderlyingObject to be a standalone
...
function so that it can live in Analysis instead of
VMCore.
llvm-svn: 121885
2010-12-15 20:02:24 +00:00
Nick Lewycky
11678bd299
Clean up some of LVI:
...
* mergeIn now uses constant folding for constants that are provably not-equal.
* sink some sanity checks from the get*() methods into the mark*() methods, to ensure that we never have a constant/notconstant ConstantInt
* some textual cleanups, whitespace changes, removing "else" after return, that sort of thing.
llvm-svn: 121877
2010-12-15 18:57:18 +00:00
Duncan Sands
0a2c416894
Move Sub simplifications and additional Add simplifications out of
...
instcombine and into InstructionSimplify.
llvm-svn: 121861
2010-12-15 14:07:39 +00:00
Duncan Sands
019a418808
If we detect that the instruction we are simplifying is unreachable, arrange for
...
it to be replaced by undef rather than not replaced at all, the idea being that
this may reduce the amount of work done by whoever called InstructionSimplify.
llvm-svn: 121860
2010-12-15 11:02:22 +00:00
Dan Gohman
3cb55a1d23
Update a comment.
...
llvm-svn: 121727
2010-12-13 22:53:18 +00:00
Dan Gohman
c4bf5cac9f
Reapply r121520, PartialAlias implementation for BasicAA, now that
...
memdep is updated to handle it.
llvm-svn: 121725
2010-12-13 22:50:24 +00:00
Dan Gohman
ba5d0abe39
Update memdep to handle PartialAlias as MayAlias.
...
llvm-svn: 121723
2010-12-13 22:47:57 +00:00
Tobias Grosser
f3e1ada522
Remove useless dynamic_cast<>().
...
Thanks Peter for pointing me to something that should have never been
committed to the llvm code base.
llvm-svn: 121648
2010-12-12 21:58:28 +00:00
Dan Gohman
39de62348f
Revert r121520, which may have introduced miscompilations.
...
llvm-svn: 121573
2010-12-10 21:48:28 +00:00
Dan Gohman
041f74e762
Implement PartialAlias checking in BasicAA.
...
llvm-svn: 121520
2010-12-10 20:47:03 +00:00
Dan Gohman
704e7c2332
Minimally update this code to handle PartialAlias.
...
llvm-svn: 121518
2010-12-10 20:14:49 +00:00
Dan Gohman
201acdb6db
Use PartialAlias to do better noalias lint checking.
...
llvm-svn: 121514
2010-12-10 20:04:06 +00:00
Dan Gohman
4431e31df0
Teach AliasAnalysisCounter about PartialAlias.
...
llvm-svn: 121513
2010-12-10 19:53:05 +00:00
Dan Gohman
105d60a5ef
Teach AliasAnalysisEvaluator about PartialAlias.
...
llvm-svn: 121512
2010-12-10 19:52:40 +00:00
Dan Gohman
fb0a3754f5
Update this code to handle PartialAlias as MayAlias.
...
llvm-svn: 121508
2010-12-10 19:40:47 +00:00
Owen Anderson
c7ed4dc932
Take the first step towards making LVI non-recursive: get rid of the LVIQuery abstraction.
...
llvm-svn: 121357
2010-12-09 06:14:58 +00:00
Devang Patel
8817135cb9
Use type's file info while describing inheritance relationship.
...
llvm-svn: 121289
2010-12-08 21:46:37 +00:00
Devang Patel
b68c6231e9
Add support to create debug info for functions and methods.
...
llvm-svn: 121281
2010-12-08 20:42:44 +00:00
Devang Patel
81c3c87717
Add support to create class type.
...
llvm-svn: 121279
2010-12-08 20:18:20 +00:00
Devang Patel
89ea4f27a8
Add support to create vector, array, enums etc...
...
llvm-svn: 121224
2010-12-08 01:50:15 +00:00
Devang Patel
dd261afdd9
Global variable does not need linkage name.
...
llvm-svn: 121212
2010-12-08 00:06:22 +00:00