Commit Graph

3904 Commits

Author SHA1 Message Date
Devang Patel 1fabbe921b Use IRBuiler while constant folding terminator.
llvm-svn: 131541
2011-05-18 17:26:46 +00:00
Duncan Sands 27bd0df352 Now that SrcBits and DestBits always represent the primitive size, rather
than either the primitive size or the element primitive size (in the case
of vectors), simplify the vector logic.  No functionality change.  There
is some distracting churn in the patch because I lined up comments better
while there - sorry about that.

llvm-svn: 131533
2011-05-18 10:59:25 +00:00
Duncan Sands 7f64656d21 Tighten up checking of the validity of casts. (1) The IR parser would
happily accept things like "sext <2 x i32> to <999 x i64>".  It would
also accept "sext <2 x i32> to i64", though the verifier would catch
that later.  Fixed by having castIsValid check that vector lengths match
except when doing a bitcast.  (2) When creating a cast instruction, check
that the cast is valid (this was already done when creating constexpr
casts).  While there, replace getScalarSizeInBits (used to allow more
vector casts) with getPrimitiveSizeInBits in getCastOpcode and isCastable
since vector to vector casts are now handled explicitly by passing to the
element types; i.e. this bit should result in no functional change.

llvm-svn: 131532
2011-05-18 09:21:57 +00:00
Duncan Sands a8514535a4 Teach getCastOpcode about element-by-element vector casts. For example, "trunc"
can be used to turn a <4 x i64> into a <4 x i32> but getCastOpcode would assert
if you passed these types to it.  Note that this strictly extends the previous
functionality: if getCastOpcode previously accepted two vector types (i.e. didn't
assert) then it still will and returns the same opcode (BitCast).  That's because
before it would only accept vectors with the same bitwidth, and the new code only
touches vectors with the same length.  However if two vectors have both the same
bitwidth and the same length then their element types have the same bitwidth, so
the new logic will return BitCast as before.

llvm-svn: 131530
2011-05-18 07:13:41 +00:00
Rafael Espindola 2050af838d Don't do tail calls in a function that call setjmp. The stack might be
corrupted when setjmp returns again.

llvm-svn: 131399
2011-05-16 03:05:33 +00:00
Rafael Espindola e53b7d1a11 Make codegen able to handle values of empty types. This is one way
to fix PR9900. I will keep it open until sable is able to comment on it.

llvm-svn: 131294
2011-05-13 15:18:06 +00:00
Rafael Espindola dc9d9f8eeb Fix cmake again.
llvm-svn: 131164
2011-05-10 22:42:41 +00:00
Nick Lewycky 1ec5c8a8bc Remove empty file.
llvm-svn: 131162
2011-05-10 22:38:17 +00:00
Rafael Espindola b361d2b2bc Fix cmake build.
llvm-svn: 131160
2011-05-10 22:19:33 +00:00
Nick Lewycky e09457b02b Revert r131155 for now. It makes VMCore depend on Analysis and Transforms
headers.

llvm-svn: 131159
2011-05-10 22:16:06 +00:00
David Chisnall c2fcb4df5e Add support for plugins add passes to the default set of passes. The standard set of passes used by front ends can now be modified by LLVM plugins, without needing to modify any front ends.
Still to do:

- Allow replacing / removing passes (infrastructure there, just needs an infrastructure exposed)
- Defining sets of passes to be added or removed as a group
- Extending the support to allow user-defined groups of optimisations
- Allow plugins to be specified for loading automatically (e.g. from plugins.conf or some similar mechanism)

Reviewed by Nick Lewycky.

llvm-svn: 131155
2011-05-10 21:36:48 +00:00
Devang Patel 1ff74141bf In debug output, clearly list new instructions without DebugLoc.
llvm-svn: 130957
2011-05-05 22:05:57 +00:00
Bill Wendling db0996c822 Replace the "movnt" intrinsics with a native store + nontemporal metadata bit.
<rdar://problem/8460511>

llvm-svn: 130791
2011-05-03 21:11:17 +00:00
Devang Patel 84d7eb7252 Print new instructions without DebugLoc.
llvm-svn: 130542
2011-04-29 21:36:04 +00:00
Matt Beaumont-Gay c99298ab5e Coalesce some DEBUGs (moving an only-used-in-DEBUG variable's declaration into the DEBUG)
llvm-svn: 130448
2011-04-28 22:26:05 +00:00
Devang Patel d36bdb5208 Beautify debug info probe output.
llvm-svn: 130435
2011-04-28 20:46:18 +00:00
Devang Patel b63596436f Add command line option to print debug info in human readable form as comment in llvm IR output. This, i.e -enable-debug-info-comment, is very useful if you want to easily find out which optimization pass is losing line number information.
llvm-svn: 130409
2011-04-28 17:41:38 +00:00
Duncan Sands d4ea3ec87f Another example of a static table that wasn't marked static.
llvm-svn: 130193
2011-04-26 07:30:10 +00:00
Chris Lattner f5ba0415df mark a large static table static. Pointed out by Michael Ilseman!
llvm-svn: 130160
2011-04-25 22:14:33 +00:00
Jay Foad f7adb3204e Fix an assert to check exactly what it says.
llvm-svn: 130093
2011-04-24 14:30:00 +00:00
Jay Foad 1a180156b6 Remove unused STL header includes.
llvm-svn: 130068
2011-04-23 19:53:52 +00:00
Jay Foad 5514afe6b2 PR9214: Convert Metadata API to use ArrayRef.
llvm-svn: 129932
2011-04-21 19:59:31 +00:00
Nick Lewycky f735b7b845 Structs have elements not parameters. I'm surprised this ever compiled...
llvm-svn: 129888
2011-04-20 22:52:37 +00:00
Chris Lattner 0ab5e2cded Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129558
2011-04-15 05:18:47 +00:00
Devang Patel 2772f662da Fix debug message.
llvm-svn: 129463
2011-04-13 19:47:41 +00:00
Jay Foad 0091fe8ca1 PR9214: Convert ConstantExpr::getIndices() to return an ArrayRef, plus
related tweaks to ExprMapKeyType.

llvm-svn: 129443
2011-04-13 15:22:40 +00:00
Jay Foad 47f89e0f55 Remove some redundant llvm:: prefixes.
llvm-svn: 129441
2011-04-13 14:39:42 +00:00
Jay Foad 5c984e563b PR9214: Convert ConstantExpr::getWithOperands() to use ArrayRef.
llvm-svn: 129439
2011-04-13 13:46:01 +00:00
Bill Wendling b902f1dd88 Reapply r129401 with patch for clang.
llvm-svn: 129419
2011-04-13 00:36:11 +00:00
Bill Wendling dbfde42468 Revert r129401 for now. Clang is using the old way of doing things.
llvm-svn: 129403
2011-04-12 22:59:27 +00:00
Bill Wendling 47c24875a1 Remove the unaligned load intrinsics in favor of using native unaligned loads.
Now that we have a first-class way to represent unaligned loads, the unaligned
load intrinsics are superfluous.

First part of <rdar://problem/8460511>.

llvm-svn: 129401
2011-04-12 22:46:31 +00:00
Nick Lewycky 11168326f8 Make IRBuilder support StringRef for building strings.
Also document that the global variables produced are mergable.

llvm-svn: 129330
2011-04-12 00:29:07 +00:00
Jay Foad 7c14a558fe Don't include Operator.h from InstrTypes.h.
llvm-svn: 129271
2011-04-11 09:35:34 +00:00
Jay Foad 29426e87c1 Phi nodes always use an even number of operands, so don't ever allocate
an odd number.

llvm-svn: 129270
2011-04-11 09:25:51 +00:00
Bill Wendling 35a9c3cd72 Revert r129235 pending a vetting of the EH rewrite.
--- Reverse-merging r129235 into '.':
D    test/Feature/bb_attrs.ll
U    include/llvm/BasicBlock.h
U    include/llvm/Bitcode/LLVMBitCodes.h
U    lib/VMCore/AsmWriter.cpp
U    lib/VMCore/BasicBlock.cpp
U    lib/AsmParser/LLParser.cpp
U    lib/AsmParser/LLLexer.cpp
U    lib/AsmParser/LLToken.h
U    lib/Bitcode/Reader/BitcodeReader.cpp
U    lib/Bitcode/Writer/BitcodeWriter.cpp

llvm-svn: 129259
2011-04-10 23:18:04 +00:00
Bill Wendling 3d5450d809 Beginning of the Great Exception Handling Rewrite.
* Add a "landing pad" attribute to the BasicBlock.
* Modify the bitcode reader and writer to handle said attribute.

Later: The verifier will ensure that the landing pad attribute is used in the
appropriate manner. I.e., not applied to the entry block, and applied only to
basic blocks that are branched to via a `dispatch' instruction.

(This is a work-in-progress.)

llvm-svn: 129235
2011-04-10 00:04:27 +00:00
Nick Lewycky 466d0c1f93 llvm.global_[cd]tor is defined to be either external, or appending with an array
of { i32, void ()* }. Teach the verifier to verify that, deleting copies of
checks strewn about.

llvm-svn: 129128
2011-04-08 07:30:21 +00:00
Nick Lewycky 561f1755cc Set unnamed_addr on strings created through the IRBuilder.
llvm-svn: 129040
2011-04-07 00:14:29 +00:00
Nick Lewycky e30f330393 Replace const std::vector& with ArrayRef in the type creation APIs.
llvm-svn: 129024
2011-04-06 20:28:34 +00:00
Devang Patel 8aa6c326ac face+palm
Keep track of llvm.dbg.value intrinsics with non null values.

llvm-svn: 129010
2011-04-06 17:08:15 +00:00
Nick Lewycky d4b3d29c50 Add an empty key for DebugLoc so that you can store an empty DebugLoc in a
DenseMap.

llvm-svn: 128994
2011-04-06 06:49:59 +00:00
Nick Lewycky ddc72895d0 Support using DebugLoc's in a DenseMap.
llvm-svn: 128988
2011-04-06 05:36:52 +00:00
Jay Foad 11522097be Remove some support for ReturnInsts with multiple operands, and for
returning a scalar value in a function whose return type is a single-
element structure or array.

llvm-svn: 128810
2011-04-04 07:44:02 +00:00
Eric Christopher c56d2e8fd0 Move Object.cpp out of VMCore and into Object.
llvm-svn: 128800
2011-04-03 23:07:51 +00:00
Eric Christopher 9f08a3bbf4 Add a set of C bindings for the Object interface.
Patch by Patrick Walton!

llvm-svn: 128798
2011-04-03 22:34:07 +00:00
Jay Foad e98f29df8b Various Instructions' resizeOperands() methods are only used to grow the
list of operands. Simplify and rename them accordingly.

llvm-svn: 128708
2011-04-01 08:00:58 +00:00
Duncan Sands 2d3cdd686b While testing dragonegg I noticed that isCastable and getCastOpcode
had gotten out of sync: isCastable didn't think it was possible to
cast the x86_mmx type to anything, while it did think it possible
to cast an i64 to x86_mmx.

llvm-svn: 128705
2011-04-01 03:34:54 +00:00
Jay Foad 52131344a2 Remove PHINode::reserveOperandSpace(). Instead, add a parameter to
PHINode::Create() giving the (known or expected) number of operands.

llvm-svn: 128537
2011-03-30 11:28:46 +00:00
Bill Wendling c73eda1e89 Remove dead code.
llvm-svn: 128519
2011-03-30 01:03:48 +00:00
Evan Cheng 18381b4257 Add intrinsics @llvm.arm.neon.vmulls and @llvm.arm.neon.vmullu.* back. Frontends
was lowering them to sext / uxt + mul instructions. Unfortunately the
optimization passes may hoist the extensions out of the loop and separate them.
When that happens, the long multiplication instructions can be broken into
several scalar instructions, causing significant performance issue.

Note the vmla and vmls intrinsics are not added back. Frontend will codegen them
as intrinsics vmull* + add / sub. Also note the isel optimizations for catching
mul + sext / zext are not changed either.

First part of rdar://8832507, rdar://9203134

llvm-svn: 128502
2011-03-29 23:06:19 +00:00
Bill Wendling 225d9b15b5 Spruce up the error output.
llvm-svn: 128451
2011-03-29 04:28:26 +00:00
Devang Patel 39c041cae7 Do not accidently initialize NumDbgValueLost and NumDbgLineLost counts.
llvm-svn: 127720
2011-03-16 00:27:57 +00:00
Francois Pichet 241bdc0de7 Unbreak the CMake build.
llvm-svn: 127383
2011-03-10 00:51:01 +00:00
Devang Patel fa31d38aad Introduce DebugInfoProbe. This is used to monitor how llvm optimizer is treating debugging information.
It generates output that lools like

8 times line number info lost by Scalar Replacement of Aggregates (SSAUp) 
1 times line number info lost by Simplify well-known library calls 
12 times variable info lost by Jump Threading

llvm-svn: 127381
2011-03-10 00:21:25 +00:00
Eric Christopher 787ba0bf9b Make these options hidden to reduce the amount of text -help puts on the
command line, they'll still be seen with -help-hidden.

llvm-svn: 127353
2011-03-09 19:46:51 +00:00
Justin Holewinski 0cfa737f27 ptx: Fix calling convention printing in AsmWriter.cpp
This allows LLVM IR using ptx_kernel or ptx_device calling
conventions to be properly printed when emitted in text form.

llvm-svn: 127157
2011-03-07 14:32:30 +00:00
Nick Lewycky 92db8e8e39 ConstantInt has some getters which return ConstantInt's or ConstantVector's of
the value splatted into every element. Extend this to getTrue and getFalse which
by providing new overloads that take Types that are either i1 or <N x i1>. Use
it in InstCombine to add vector support to some code, fixing PR8469!

llvm-svn: 127116
2011-03-06 03:36:19 +00:00
Devang Patel 213264c03d Add ArrayRef variant.
llvm-svn: 126978
2011-03-04 01:20:33 +00:00
Tilmann Scheller 3bc0bcf3ad Use X86_thiscall calling convention for Win64 as well.
llvm-svn: 126934
2011-03-03 07:49:07 +00:00
Tilmann Scheller a3769f8021 Add Win64 thiscall calling convention.
llvm-svn: 126862
2011-03-02 19:29:22 +00:00
Rafael Espindola 1e49a6d9bc Add a special streamer to libLTO that just records symbols definitions and
uses.

The result produced by the streamer is used to give the linker more accurate
information and to add to llvm.compiler.used. The second improvement removes
the need for the user to add __attribute__((used)) to functions only used in
inline asm. The first one lets us build firefox with LTO on Darwin :-)

llvm-svn: 126830
2011-03-02 04:14:42 +00:00
Talin de422beba4 Added missing va_end().
llvm-svn: 126759
2011-03-01 18:00:49 +00:00
Talin 3a0a30d44d Add an END_WITH_NULL accessor for ConstantStruct.
llvm-svn: 126714
2011-02-28 23:53:27 +00:00
Devang Patel 0ca3d1e980 These tags are now covered by dwarf::TagString().
llvm-svn: 125987
2011-02-18 23:13:40 +00:00
Rafael Espindola 7c0cb2bbf5 Expose getTypeName to the C API. Patch by Patrick Walton.
llvm-svn: 125845
2011-02-18 16:35:37 +00:00
Chris Lattner 8488640da7 hoist GlobalValue::removeDeadConstantUsers up to being a method on Constant.
llvm-svn: 125828
2011-02-18 04:41:42 +00:00
Nadav Rotem 7cc6d12ad0 Enhance constant folding of bitcast operations on vectors of floats.
Add getAllOnesValue of FP numbers to Constants and APFloat.
Add more tests.

llvm-svn: 125776
2011-02-17 21:22:27 +00:00
Chris Lattner 69229316aa convert ConstantVector::get to use ArrayRef.
llvm-svn: 125537
2011-02-15 00:14:00 +00:00
Chris Lattner 34442e6ebf revert my ConstantVector patch, it seems to have made the llvm-gcc
builders unhappy.

llvm-svn: 125504
2011-02-14 18:15:46 +00:00
Chris Lattner d9f5b88548 Switch ConstantVector::get to use ArrayRef instead of a pointer+size
idiom.  Change various clients to simplify their code.

llvm-svn: 125487
2011-02-14 07:55:32 +00:00
Nadav Rotem 27b848afb0 Fix a regression from r125393;
It caused a crash in MultiSource/Benchmarks/Bullet.
Opt hit an assertion with "opt -std-compile-opts" because
Constant::getAllOnesValue doesn't know how to handle floats.

This patch added a test to reproduce the problem and a check that the
destination vector is of integer type.

Thank you Benjamin!

llvm-svn: 125459
2011-02-13 15:45:34 +00:00
Nadav Rotem 10134c33f2 Fix 9173.
Add more folding patterns to constant expressions of vector selects and vector
bitcasts.

llvm-svn: 125393
2011-02-11 19:37:55 +00:00
Chris Lattner 603af18826 make ConstantExpr::replaceUsesOfWithOnConstant preserve the inbounds
flag.  Noticed by Jin Gu Kang!

llvm-svn: 125366
2011-02-11 05:37:21 +00:00
Chris Lattner 94c8d2941f make the constantexpr interfaces for inbounds GEPs follow the same style
as other constantexpr flags, reducing redundancy.

llvm-svn: 125365
2011-02-11 05:34:33 +00:00
Chris Lattner e9b4ad7391 switch the constantexpr, target folder, and IRBuilder interfaces
for NSW/NUW binops to follow the pattern of exact binops.  This
allows someone to use Builder.CreateAdd(x, y, "tmp", MaybeNUW);

llvm-svn: 125270
2011-02-10 07:01:55 +00:00
Chris Lattner 0d75eac350 refactor ConstantExpr interfaces a bit around "exactness".
llvm-svn: 125190
2011-02-09 16:43:07 +00:00
Chris Lattner e17322b3b7 fix comment change.
llvm-svn: 125047
2011-02-07 20:03:14 +00:00
Chris Lattner a676c0fc77 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 35315d065b 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 142777224c Make SwitchInst::removeCase() more efficient.
llvm-svn: 124659
2011-02-01 09:22:34 +00:00
Duncan Sands cf0ff030a8 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 c15dd6f07c Fix 'fcmp one' constant folding. Noticed by inspection.
llvm-svn: 124557
2011-01-30 01:49:58 +00:00
Nick Lewycky 7c75f0c031 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 97a2895e73 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 9f32cfd35e Fix indentation.
llvm-svn: 124375
2011-01-27 14:44:55 +00:00
Jay Foad b0c5e35929 Simplify User::operator delete().
llvm-svn: 124330
2011-01-26 21:56:10 +00:00
Nick Lewycky 91543447a6 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 563eb4bb6c Move unnamed_addr after the function arguments on Sabre's request.
llvm-svn: 124209
2011-01-25 19:09:56 +00:00
Chris Lattner 9879965f4b 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 39b12c059d 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 f07426b40d 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 050eec1d1d Update a comment.
llvm-svn: 123879
2011-01-20 03:58:43 +00:00
Cameron Zwarich dfc547d181 Remove an unnecessary #include.
llvm-svn: 123748
2011-01-18 06:07:18 +00:00
Cameron Zwarich 6b0c4c9b6c Move DominanceFrontier from VMCore to Analysis.
llvm-svn: 123747
2011-01-18 06:06:27 +00:00
Cameron Zwarich ce25e88218 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 66f3c66b9d Remove some now-unused DominanceFrontier methods.
llvm-svn: 123726
2011-01-18 04:21:57 +00:00
Jay Foad fe87364215 Remove useless Tag enumeration.
llvm-svn: 123623
2011-01-17 15:18:06 +00:00
Jay Foad bbb91f2b22 Simplify the construction and destruction of Uses. Simplify
User::dropHungOffUses().

llvm-svn: 123580
2011-01-16 15:30:52 +00:00
Jay Foad 59809c7a62 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 489e505adf Allow unnamed_addr on declarations.
llvm-svn: 123529
2011-01-15 08:15:00 +00:00
Jay Foad 1d4a8fe156 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 7f60dc1eb0 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 026d152e58 Reject uses of unnamed_addr in declarations.
llvm-svn: 123358
2011-01-13 01:30:30 +00:00
Jay Foad c8adf5f458 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 5f7734c4a5 make domtree verification print something useful on failure.
llvm-svn: 123078
2011-01-08 19:55:55 +00:00
Rafael Espindola 45e6c195d7 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 d81f3c9659 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 88b4b2794c Silence a warning from non-standard warning avoidance code.
llvm-svn: 122911
2011-01-05 21:50:21 +00:00
Duncan Sands 95c4eccbe9 These methods should be "const"; make them so.
llvm-svn: 122809
2011-01-04 12:52:29 +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
Chris Lattner 1be1fe033c 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 143a07cfee add methods to IRBuilder to create memcpy/memset/memmove.
llvm-svn: 122571
2010-12-26 22:49:25 +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
Chris Lattner 3e5fbd74ed 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 aa81496c76 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 70db5e7cb2 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 0de20af7ba Add missing standard headers. Patch by Joerg Sonnenberger!
llvm-svn: 122193
2010-12-19 20:43:38 +00:00
Nick Lewycky b71afe82bf 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 e663aeacf9 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 ec3ff9c727 Remove trailing whitespace.
llvm-svn: 122099
2010-12-17 23:06:32 +00:00
Michael J. Spencer 39a0ffc394 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 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
Michael J. Spencer 7b6fef82d4 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 f844b3b227 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 583abbc4df 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 16ebe77be0 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
Benjamin Kramer 31920b0a2a Remove unneeded zero arrays.
llvm-svn: 120910
2010-12-04 15:28:22 +00:00
Benjamin Kramer 6f88fcb16b Apparently APFloat::getZero doesn't like PPCDoubleDoubles.
llvm-svn: 120909
2010-12-04 14:43:08 +00:00
Benjamin Kramer 8ceebfaa04 Simplify code. No functionality change.
llvm-svn: 120907
2010-12-04 14:22:24 +00:00
Michael J. Spencer 447762da85 Merge System into Support.
llvm-svn: 120298
2010-11-29 18:16:10 +00:00
Chris Lattner a7e04b04c5 add a function to the C api to get the context out of a module, patch
by Eric Dobson!

llvm-svn: 120259
2010-11-28 20:03:44 +00:00
Chris Lattner 4329e078ac add a 'LLVMConstIntOfArbitraryPrecision' api to the C api,
patch by Greg Pfeil!

llvm-svn: 119989
2010-11-23 02:47:22 +00:00
Benjamin Kramer ddd1b7b801 Simplify code. No change in functionality.
llvm-svn: 119908
2010-11-20 18:43:35 +00:00
Owen Anderson 2e831897d6 Fix an order-of-deallocation issue where the AttrListImpl could be deallocated before the global
LLVMContext, causing memory errors.  Patch by Peter Collingbourne.

llvm-svn: 119721
2010-11-18 18:59:13 +00:00
Duncan Sands ec7a6ecb92 Now that hasConstantValue has been made simpler, it may return the
phi node itself if it occurs in an unreachable basic block.  Protect
against this.  Hopefully this will fix some more buildbots.

llvm-svn: 119493
2010-11-17 10:23:23 +00:00
Chris Lattner b0e36085c4 now that AsmPrinter::EmitInlineAsm is factored right, we can eliminate the
cookie argument to the SourceMgr diagnostic stuff.  This cleanly separates
LLVMContext's inlineasm handler from the sourcemgr error handling 
definition, increasing type safety and cleaning things up.

llvm-svn: 119486
2010-11-17 08:13:01 +00:00
Chris Lattner baf00151ba fix PR8613 - Copy constructor of SwitchInst does not call SwitchInst::init
llvm-svn: 119463
2010-11-17 05:41:46 +00:00
Duncan Sands 7412f6e53d Fix a layering violation: hasConstantValue, which is part of the PHINode
class, uses DominatorTree which is an analysis.  This change moves all of
the tricky hasConstantValue logic to SimplifyInstruction, and replaces it
with a very simple literal implementation.  I already taught users of
hasConstantValue that need tricky stuff to use SimplifyInstruction instead.
I didn't update InlineFunction because the IR looks like it might be in a
funky state at the point it calls hasConstantValue, which makes calling
SimplifyInstruction dangerous since it can in theory do a lot of tricky
reasoning.  This may be a pessimization, for example in the case where
all phi node operands are either undef or a fixed constant.

llvm-svn: 119459
2010-11-17 04:30:22 +00:00
Duncan Sands b99f39b9f6 If dom tree information is available, make it possible to pass
it to get better phi node simplification.

llvm-svn: 119055
2010-11-14 18:36:10 +00:00
Nick Lewycky add50b0a5d Doxygenify
llvm-svn: 118846
2010-11-11 21:51:44 +00:00
Dan Gohman a826a88755 Factor out Instruction::isSafeToSpeculativelyExecute's code for
testing for dereferenceable pointers into a helper function,
isDereferenceablePointer.  Teach it how to reason about GEPs
with simple non-zero indices.

Also eliminate ArgumentPromtion's IsAlwaysValidPointer,
which didn't check for weak externals or out of range gep
indices.

llvm-svn: 118840
2010-11-11 21:23:25 +00:00
Dan Gohman f51d06bbee Include ImmutablePass passes in -debug-pass=Arguments.
llvm-svn: 118790
2010-11-11 16:32:17 +00:00
Owen Anderson 91bfeb10b5 Last try to get this reference counting right, I swear.
llvm-svn: 118589
2010-11-09 17:47:10 +00:00
Owen Anderson 2d335436f3 Really fix the leak in the attributes list. Thanks to Benjamin Kramer for pointing out how I was being stupid.
llvm-svn: 118588
2010-11-09 17:46:38 +00:00
Owen Anderson 25e84078e3 Fix leak in my recent fix for PR8442.
llvm-svn: 118490
2010-11-09 05:17:47 +00:00
Owen Anderson 9b14a25126 Fix PR8441, a race condition in the static attributes list. While the reference counting was itself threadsafe,
the implicit removal of each object from the global list was not.  Make this operation atomic.

llvm-svn: 118461
2010-11-09 00:27:03 +00:00
Dale Johannesen e81d45d2cc Apply patch for use-after-free in InlineAsm constant handling,
PR 8522 / 8616046.  Test reduction, analysis and patch by Tim Deegan!
(However, review by someone who understands the classes here better
is welcome.  John Krum will return!)

llvm-svn: 118030
2010-11-02 17:59:27 +00:00
John Thompson e8360b7182 Inline asm multiple alternative constraints development phase 2 - improved basic logic, added initial platform support.
llvm-svn: 117667
2010-10-29 17:29:13 +00:00
Charles Davis 22fe18625d Add a new 'hotpatch' attribute. This attribute will insert a two-byte no-op
instruction at the beginning of each function that has the attribute, allowing
the function to be easily hooked and/or patched.

llvm-svn: 117264
2010-10-25 15:37:09 +00:00
Benjamin Kramer 9192e7ab12 Make some symbols static, move classes into anonymous namespaces.
llvm-svn: 117111
2010-10-22 17:35:07 +00:00