Chris Lattner
b641eb91a3
fix comment change.
...
llvm-svn: 125047
2011-02-07 20:03:14 +00:00
Chris Lattner
2fd09e3397
implement .ll and .bc support for nsw/nuw on shl and exact on lshr/ashr.
...
Factor some code better.
llvm-svn: 125006
2011-02-07 16:40:21 +00:00
Chris Lattner
7b6a968f5d
enhance vmcore to know that udiv's can be exact, and add a trivial
...
instcombine xform to exercise this.
Nothing forms exact udivs yet though. This is progress on PR8862
llvm-svn: 124992
2011-02-06 21:44:57 +00:00
Jay Foad
89383f48ca
Make SwitchInst::removeCase() more efficient.
...
llvm-svn: 124659
2011-02-01 09:22:34 +00:00
Duncan Sands
06e82c76ee
Have m_One also match constant vectors for which every element is 1.
...
llvm-svn: 124655
2011-02-01 08:39:12 +00:00
Nick Lewycky
abfab6156c
Fix 'fcmp one' constant folding. Noticed by inspection.
...
llvm-svn: 124557
2011-01-30 01:49:58 +00:00
Nick Lewycky
001e12d8d5
Fix some formatting and upgrade comments from llvm 1.x to 2.x syntax.
...
llvm-svn: 124556
2011-01-30 01:48:50 +00:00
Nick Lewycky
5259b6a6e2
Add the select optimization recently added to instcombine to constant folding.
...
This is the one where one of the branches of the select is another select on
the same condition.
llvm-svn: 124547
2011-01-29 20:35:06 +00:00
Jay Foad
284c5bc9bd
Fix indentation.
...
llvm-svn: 124375
2011-01-27 14:44:55 +00:00
Jay Foad
db0a7d4143
Simplify User::operator delete().
...
llvm-svn: 124330
2011-01-26 21:56:10 +00:00
Nick Lewycky
8c38fe01dd
AttrListPtr has an overloaded operator== which does this for us, we should use
...
it. No functionality change!
llvm-svn: 124286
2011-01-26 09:23:19 +00:00
Rafael Espindola
29e8317caa
Move unnamed_addr after the function arguments on Sabre's request.
...
llvm-svn: 124209
2011-01-25 19:09:56 +00:00
Chris Lattner
0277fe2039
teach Value::isDereferenceablePointer that byval arguments are always
...
dereferencable, noticed by inspection.
llvm-svn: 124085
2011-01-23 21:15:29 +00:00
Nick Lewycky
50f86f3414
Add a constant folding of casts from zero to zero. Fixes PR9011!
...
While here, I'd like to complain about how vector is not an aggregate type
according to llvm::Type::isAggregateType(), but they're listed under aggregate
types in the LangRef and zero vectors are stored as ConstantAggregateZero.
llvm-svn: 123956
2011-01-21 01:12:09 +00:00
Tobias Grosser
ea8985cc25
Implement requiredTransitive
...
The PassManager did not implement the transitivity of requiredTransitive. This
was unnoticed since 2006.
llvm-svn: 123942
2011-01-20 21:03:22 +00:00
Cameron Zwarich
bf70725ae3
Update a comment.
...
llvm-svn: 123879
2011-01-20 03:58:43 +00:00
Cameron Zwarich
ea98dd25a5
Remove an unnecessary #include.
...
llvm-svn: 123748
2011-01-18 06:07:18 +00:00
Cameron Zwarich
c8083524f8
Move DominanceFrontier from VMCore to Analysis.
...
llvm-svn: 123747
2011-01-18 06:06:27 +00:00
Cameron Zwarich
caca9a63e6
There is no point in verifying an analysis that is never updated.
...
llvm-svn: 123743
2011-01-18 05:44:04 +00:00
Cameron Zwarich
62a9d4d454
Remove some now-unused DominanceFrontier methods.
...
llvm-svn: 123726
2011-01-18 04:21:57 +00:00
Jay Foad
599c83ed66
Remove useless Tag enumeration.
...
llvm-svn: 123623
2011-01-17 15:18:06 +00:00
Jay Foad
aa0d059b67
Simplify the construction and destruction of Uses. Simplify
...
User::dropHungOffUses().
llvm-svn: 123580
2011-01-16 15:30:52 +00:00
Jay Foad
030a48213f
Move the implementation of the User class into a new source file,
...
User.cpp.
llvm-svn: 123575
2011-01-16 08:10:57 +00:00
Rafael Espindola
3b43f22391
Allow unnamed_addr on declarations.
...
llvm-svn: 123529
2011-01-15 08:15:00 +00:00
Jay Foad
fa61721cf2
Remove casts between Value** and Constant**, which won't work if a
...
static_cast from Constant* to Value* has to adjust the "this" pointer.
This is groundwork for PR889.
llvm-svn: 123435
2011-01-14 08:07:43 +00:00
Duncan Sands
44c273d907
Move some shift transforms out of instcombine and into InstructionSimplify.
...
While there, I noticed that the transform "undef >>a X -> undef" was wrong.
For example if X is 2 then the top two bits must be equal, so the result can
not be anything. I fixed this in the constant folder as well. Also, I made
the transform for "X << undef" stronger: it now folds to undef always, even
though X might be zero. This is in accordance with the LangRef, but I must
admit that it is fairly aggressive. Also, I added "i32 X << 32 -> undef"
following the LangRef and the constant folder, likewise fairly aggressive.
llvm-svn: 123417
2011-01-14 00:37:45 +00:00
Rafael Espindola
f6cae95276
Reject uses of unnamed_addr in declarations.
...
llvm-svn: 123358
2011-01-13 01:30:30 +00:00
Jay Foad
993406aaba
FixedNumOperandTraits and VariadicOperandTraits assumed that, given a
...
"this" pointer for any subclass of User, you could static_cast it to
User* and then reinterpret_cast that to Use* to get the end of the
operand list. This isn't a safe assumption in general, because the
static_cast might adjust the "this" pointer. Fixed by having these
OperandTraits classes take an extra template parameter, which is the
subclass of User. This is groundwork for PR889.
llvm-svn: 123235
2011-01-11 15:07:38 +00:00
Chris Lattner
e07601d493
make domtree verification print something useful on failure.
...
llvm-svn: 123078
2011-01-08 19:55:55 +00:00
Rafael Espindola
9f526bcf4d
First step in fixing PR8927:
...
Add a unnamed_addr bit to global variables and functions. This will be used
to indicate that the address is not significant and therefore the constant
or function can be merged with others.
If an optimization pass can show that an address is not used, it can set this.
Examples of things that can have this set by the FE are globals created to
hold string literals and C++ constructors.
Adding unnamed_addr to a non-const global should have no effect unless
an optimization can transform that global into a constant.
Aliases are not allowed to have unnamed_addr since I couldn't figure
out any use for it.
llvm-svn: 123063
2011-01-08 16:42:36 +00:00
Jay Foad
a87f52d780
Simplify the allocation and freeing of Users' operand lists, now that
...
every BranchInst has a fixed number of operands.
llvm-svn: 123027
2011-01-07 20:29:02 +00:00
Jakob Stoklund Olesen
bd9910dbe2
Silence a warning from non-standard warning avoidance code.
...
llvm-svn: 122911
2011-01-05 21:50:21 +00:00
Duncan Sands
d252c6dae7
These methods should be "const"; make them so.
...
llvm-svn: 122809
2011-01-04 12:52:29 +00:00
Chris Lattner
e396e846b4
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
Chris Lattner
2f774c1246
fix PR8867: a crash handling fp128. Thanks to Nick for the testcase.
...
llvm-svn: 122613
2010-12-29 01:33:36 +00:00
Chris Lattner
a46fd80777
add methods to IRBuilder to create memcpy/memset/memmove.
...
llvm-svn: 122571
2010-12-26 22:49:25 +00:00
Jeffrey Yasskin
a199652a3e
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
Chris Lattner
65c5243bd6
rename MVT::Flag to MVT::Glue. "Flag" is a terrible name for
...
something that just glues two nodes together, even if it is
sometimes used for flags.
llvm-svn: 122310
2010-12-21 02:38:05 +00:00
Owen Anderson
c1eee5ac49
Revert r122114 (CallbackVH observing use-list changes) because it caused severe slowdowns on the Linux self-host configuration.
...
llvm-svn: 122279
2010-12-20 22:28:03 +00:00
Duncan Sands
a37d282962
There is no need for isAssociative to take the type as an argument anymore.
...
llvm-svn: 122242
2010-12-20 13:10:23 +00:00
Nick Lewycky
c85935836b
Add missing standard headers. Patch by Joerg Sonnenberger!
...
llvm-svn: 122193
2010-12-19 20:43:38 +00:00
Nick Lewycky
e718af6c63
Add missing std:: prefixes to some calls. C++ doesn't require that <cfoo>
...
headers provide symbols outside namespace std and the LLVM coding standards
state that we should prefix all of them.
llvm-svn: 122192
2010-12-19 20:42:43 +00:00
Owen Anderson
702d715185
Add support to CallbackVH to receive notification when a Value's use-list changes.
...
llvm-svn: 122114
2010-12-18 00:07:15 +00:00
Bob Wilson
21981d44ce
Remove trailing whitespace.
...
llvm-svn: 122099
2010-12-17 23:06:32 +00:00
Michael J. Spencer
86f6a9ac6e
MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> via an out parm.
...
llvm-svn: 121958
2010-12-16 03:29:14 +00:00
Dan Gohman
295ba3ab26
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
Michael J. Spencer
15483143ec
Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec. And fix clients.
...
llvm-svn: 121379
2010-12-09 17:36:48 +00:00
Dan Gohman
54a78a9787
Remove the code from Function::dropAllReferences which replaced
...
uses of the function's blocks with undef. This code isn't needed,
because BasicBlock's destructor handles such uses. Also, undef isn't
correct, since blockaddresses may still be used for comparisons
with null.
llvm-svn: 121170
2010-12-07 19:56:51 +00:00
Jay Foad
79e18ed269
PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
...
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method
trunc(), to be const and to return a new value instead of modifying the
object in place.
llvm-svn: 121120
2010-12-07 08:25:19 +00:00
Frits van Bommel
e390b379ae
Fix PR 4170 by having ExtractValueInst::getIndexedType() reject out-of-bounds indexing.
...
Also add asserts that the indices are valid in InsertValueInst::init(). ExtractValueInst already asserts when constructed with invalid indices.
llvm-svn: 120956
2010-12-05 20:50:26 +00:00