Chris Lattner
d456ff35d1
Revamp the "ConstantStruct::get" methods. Previously, these were scattered
...
all over the place in different styles and variants. Standardize on two
preferred entrypoints: one that takes a StructType and ArrayRef, and one that
takes StructType and varargs.
In cases where there isn't a struct type convenient, we now add a
ConstantStruct::getAnon method (whose name will make more sense after a few
more patches land).
It would be "really really nice" if the ConstantStruct::get and
ConstantVector::get methods didn't make temporary std::vectors.
llvm-svn: 133412
2011-06-20 04:01:31 +00:00
John McCall
1cf92d93f0
When deleting a basic block, remove call edges only for non-intrinsics.
...
llvm-svn: 132803
2011-06-09 20:31:09 +00:00
Rafael Espindola
0cab70db0d
Improve the handling of available_externally and llvm.global_ctors.
...
llvm-svn: 132775
2011-06-09 14:38:09 +00:00
Nick Lewycky
58d87d5490
Don't crash owhen ComputeLoadResult can't compute the result of the load.
...
llvm-svn: 132290
2011-05-29 19:33:36 +00:00
Nick Lewycky
07ed4434b8
Obey the isVolatile bit on memory intrinsics when analyzing uses of a global
...
variable. Noticed by inspection.
Simulate memset in EvaluateFunction where the target of the memset and the
value we're setting are both the null value. Fixes PR10047!
llvm-svn: 132288
2011-05-29 18:41:56 +00:00
Chris Lattner
98ce5cd957
fix PR9856, an incorrectly conservative assertion: a global can be
...
"stored once" even if its address is compared.
llvm-svn: 131849
2011-05-22 07:15:13 +00:00
Julien Lerouge
b2c1721752
Fix a source of non determinism in FindUsedTypes, use a SetVector instead of a
...
set.
rdar://9423996
llvm-svn: 131283
2011-05-13 05:20:42 +00:00
Devang Patel
ca956d0334
Preserve line number information.
...
llvm-svn: 131112
2011-05-10 00:03:11 +00:00
Jay Foad
c146569beb
Remove unused STL header includes.
...
llvm-svn: 130068
2011-04-23 19:53:52 +00:00
Chris Lattner
0304b82f80
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
Chris Lattner
2e4621a4a6
remove the StructRetPromotion pass. It is unused, not maintained and
...
has some bugs. If this is interesting functionality, it should be
reimplemented in the argpromotion pass.
llvm-svn: 129314
2011-04-11 23:09:44 +00:00
Nick Lewycky
75e67d4dc2
Just because a GlobalVariable's initializer is [N x { i32, void ()* }] doesn't
...
mean that it has to be ConstantArray of ConstantStruct. We might have
ConstantAggregateZero, at either level, so don't crash on that.
Also, semi-deprecate the sentinal value. The linker isn't aware of sentinals so
we end up with the two lists appended, each with their "sentinals" on them.
Different parts of LLVM treated sentinals differently, so make them all just
ignore the single entry and continue on with the rest of the list.
llvm-svn: 129307
2011-04-11 22:11:20 +00:00
Jay Foad
0d5ca4cf44
Don't include Operator.h from InstrTypes.h.
...
llvm-svn: 129271
2011-04-11 09:35:34 +00:00
Eli Friedman
f0ba0c54ec
Add back a couple checks removed by r129128; the fact that an intitializer
...
is an array of structures doesn't imply it's a ConstantArray of
ConstantStruct.
llvm-svn: 129207
2011-04-09 09:11:09 +00:00
Nick Lewycky
ac1fe011df
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
Jay Foad
fc232f270b
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
Jay Foad
53632b7c03
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
Jay Foad
dc5a008237
(Almost) always call reserveOperandSpace() on newly created PHINodes.
...
llvm-svn: 128535
2011-03-30 11:19:20 +00:00
Nick Lewycky
3772213010
No functionality change, just adjust some whitespace for coding style compliance.
...
llvm-svn: 128257
2011-03-25 06:05:50 +00:00
Anders Carlsson
8f934f6652
Handle another case that Frits suggested.
...
llvm-svn: 128068
2011-03-22 03:21:01 +00:00
Anders Carlsson
41cc428751
More cleanups to the OptimizeEmptyGlobalCXXDtors GlobalOpt function.
...
llvm-svn: 127997
2011-03-21 14:54:40 +00:00
Anders Carlsson
59d24b6777
As suggested by Nick Lewycky, ignore debugging intrinsics when trying to decide whether a destructor is empty or not.
...
llvm-svn: 127985
2011-03-21 02:42:27 +00:00
Nick Lewycky
2f6da949e9
Fix comments
...
llvm-svn: 127984
2011-03-21 02:26:01 +00:00
Anders Carlsson
097f3f44a8
Don't try to eliminate invokes to __cxa_atexit.
...
llvm-svn: 127976
2011-03-20 20:21:33 +00:00
Anders Carlsson
07922b7344
Don't segfault on mutual recursion, as pointed out by Frits.
...
llvm-svn: 127975
2011-03-20 20:16:43 +00:00
Anders Carlsson
1b29d560bf
Address comments from Frits van Bommel.
...
llvm-svn: 127974
2011-03-20 19:51:13 +00:00
Anders Carlsson
afcc55f09c
Add an optimization to GlobalOpt that eliminates calls to __cxa_atexit, if the function passed is empty.
...
llvm-svn: 127970
2011-03-20 17:59:11 +00:00
Devang Patel
c969bd2ff1
These llvm.dbg.* constants are not used anymore.
...
llvm-svn: 127352
2011-03-09 19:41:33 +00:00
Rafael Espindola
6535a2911b
Don't internalize available_externally functions. We already did the right
...
thing for variables.
llvm-svn: 127138
2011-03-06 23:41:34 +00:00
Eli Friedman
c00dc3f262
Add an obvious missing safety check to DAE::RemoveDeadArgumentsFromCallers.
...
llvm-svn: 126720
2011-03-01 00:33:47 +00:00
Nick Lewycky
cd05f2a659
Instead of keeping two Value*->id# mappings, keep one Value->Value mapping and
...
one Value set. This is faster because we only need to use the set when there
isn't already an entry in the map. No functionality change!
llvm-svn: 126076
2011-02-20 08:11:03 +00:00
Chris Lattner
db204cbe42
convert ConstantVector::get to use ArrayRef.
...
llvm-svn: 125537
2011-02-15 00:14:00 +00:00
Chris Lattner
ee7f7c2494
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
34f32cb4c2
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
Nick Lewycky
b162446cda
When removing a function from the function set and adding it to deferred, we
...
could end up removing a different function than we intended because it was
functionally equivalent, then end up with a comparison of a function against
itself in the next round of comparisons (the one in the function set and the
one on the deferred list). To fix this, I introduce a choice in the form of
comparison for ComparableFunctions, either normal or "pointer only" used to
find exact Function*'s in lookups.
Also add some debugging statements.
llvm-svn: 125180
2011-02-09 06:32:02 +00:00
Nick Lewycky
7e863fb906
Simplify away redundant test, and document what's going on.
...
llvm-svn: 124977
2011-02-06 05:04:00 +00:00
Nick Lewycky
fb03aee332
Remove specialized comparison of InlineAsm objects. They're uniqued on creation
...
now, and this wasn't comparing some of their relevant bits anyhow.
llvm-svn: 124976
2011-02-06 04:33:50 +00:00
Nick Lewycky
4f38aaec24
Remove wasteful caching. This isn't needed for correctness because any function
...
that might have changed been affected by a merge elsewhere will have been
removed from the function set, and it isn't needed for performance because we
call grow() ahead of time to prevent reallocations.
llvm-svn: 124717
2011-02-02 05:31:01 +00:00
Nick Lewycky
f9a384e203
Rename functions to follow coding standard. Also rejiggers comments. No
...
functionality change.
llvm-svn: 124482
2011-01-28 08:43:14 +00:00
Nick Lewycky
edbe62c10d
Add a doxygen comment for this class.
...
llvm-svn: 124480
2011-01-28 08:19:00 +00:00
Nick Lewycky
28f2b64333
Reorder for readability. (Chris, is this what you meant?)
...
llvm-svn: 124479
2011-01-28 07:36:21 +00:00
Nick Lewycky
744bd3872f
Reduce the number of functions we look at in the first pass, and preallocate
...
the function equality set.
llvm-svn: 124475
2011-01-28 05:48:15 +00:00
Benjamin Kramer
114c20e190
Unbreak the build.
...
llvm-svn: 124426
2011-01-27 20:30:54 +00:00
Nick Lewycky
675f10c258
Expound upon this comparison!
...
llvm-svn: 124406
2011-01-27 19:51:31 +00:00
Nick Lewycky
af3989a145
Use dyn_cast instead of isa+cast.
...
llvm-svn: 124404
2011-01-27 19:42:43 +00:00
Nick Lewycky
864a35740a
Fix surprising missed optimization in mergefunc where we forgot to consider
...
that relationships like "i8* null" is equivalent to "i32* null".
llvm-svn: 124368
2011-01-27 08:38:19 +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
Nick Lewycky
e4eac7ff9a
Teach mergefunc that intptr_t is the same width as a pointer. We still can't
...
merge vector<intptr_t>::push_back() and vector<void*>::push_back() because
Enumerate() doesn't realize that "i64* null" and "i8** null" are equivalent.
llvm-svn: 124285
2011-01-26 09:13:58 +00:00
Nick Lewycky
41fa5796ca
There are no vectors of pointer or arrays, so we don't need to check vector
...
elements for type equivalence.
llvm-svn: 124284
2011-01-26 08:50:18 +00:00
Nick Lewycky
b20b284b35
Teach mergefunc how to emit aliases safely again -- but keep it turned it off
...
for now. It's controlled by the HasGlobalAliases variable which is not attached
to any flag yet.
llvm-svn: 124182
2011-01-25 08:56:50 +00:00