Chad Rosier
e6de63dfc5
Last bit of TargetLibraryInfo propagation. Also fixed a case for TargetData
...
where it appeared beneficial to pass.
More of rdar://10500969
llvm-svn: 145630
2011-12-01 21:29:16 +00:00
Eli Friedman
1923a330e6
Refactor code from inlining and globalopt that checks whether a function definition is unused, and enhance it so it can tell that functions which are only used by a blockaddress are in fact dead. This probably doesn't happen much on most code, but the Linux kernel's _THIS_IP_ can trigger this issue with blockaddress. (GlobalDCE can also handle the given tescase, but we only run that at -O3.) Found while looking at PR11180.
...
llvm-svn: 142572
2011-10-20 05:23:42 +00:00
Benjamin Kramer
547b6c5ecd
Stop emitting instructions with the name "tmp" they eat up memory and have to be uniqued, without any benefit.
...
If someone prefers %tmp42 to %42, run instnamer.
llvm-svn: 140634
2011-09-27 20:39:19 +00:00
Eli Friedman
b8f30de527
Minor comment fixes.
...
llvm-svn: 137693
2011-08-16 00:20:11 +00:00
Eli Friedman
211e348eaa
Update inter-procedural optimizations for atomic load/store.
...
llvm-svn: 137667
2011-08-15 22:16:46 +00:00
Bill Wendling
f891bf8b30
Add the 'resume' instruction for the new EH rewrite.
...
This adds the 'resume' instruction class, IR parsing, and bitcode reading and
writing. The 'resume' instruction resumes propagation of an existing (in-flight)
exception whose unwinding was interrupted with a 'landingpad' instruction (to be
added later).
llvm-svn: 136589
2011-07-31 06:30:59 +00:00
Bill Wendling
ad088e6724
Revert r136253, r136263, r136269, r136313, r136325, r136326, r136329, r136338,
...
r136339, r136341, r136369, r136387, r136392, r136396, r136429, r136430, r136444,
r136445, r136446, r136253 pending review.
llvm-svn: 136556
2011-07-30 05:42:50 +00:00
Bill Wendling
6c923bb8d9
Merge the contents from exception-handling-rewrite to the mainline.
...
This adds the new instructions 'landingpad' and 'resume'.
llvm-svn: 136253
2011-07-27 20:18:04 +00:00
Jay Foad
d1b7849d49
Convert GetElementPtrInst to use ArrayRef.
...
llvm-svn: 135904
2011-07-25 09:48:08 +00:00
Jay Foad
17bab44308
Fix more MSVC warnings caused by a cases I missed when converting
...
ConstantExpr::getGetElementPtr to use ArrayRef.
llvm-svn: 135762
2011-07-22 08:52:50 +00:00
Jay Foad
2f5fc8c67d
Make better use of ConstantExpr::getGetElementPtr's InBounds parameter.
...
llvm-svn: 135676
2011-07-21 15:15:37 +00:00
Jay Foad
ed8db7d9df
Convert ConstantExpr::getGetElementPtr and
...
ConstantExpr::getInBoundsGetElementPtr to use ArrayRef.
llvm-svn: 135673
2011-07-21 14:31:17 +00:00
Chris Lattner
5cf753c95e
move tier out of an anonymous namespace, it doesn't make sense
...
to for it to be an an anon namespace and be in a header.
Eliminate some extraenous uses of tie.
llvm-svn: 135669
2011-07-21 06:21:31 +00:00
Jay Foad
f4b14a2b0d
Use ArrayRef in ConstantFoldInstOperands and ConstantFoldCall.
...
llvm-svn: 135477
2011-07-19 13:32:40 +00:00
Chris Lattner
229907cd11
land David Blaikie's patch to de-constify Type, with a few tweaks.
...
llvm-svn: 135375
2011-07-18 04:54:35 +00:00
Chris Lattner
cc19efaa97
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
Nick Lewycky
c66d455e50
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
a3bb03e400
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
1a1acc2191
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
Nick Lewycky
0f85789800
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
7c14a558fe
Don't include Operator.h from InstrTypes.h.
...
llvm-svn: 129271
2011-04-11 09:35:34 +00:00
Eli Friedman
9cca0715aa
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
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
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
Jay Foad
e0938d8a87
(Almost) always call reserveOperandSpace() on newly created PHINodes.
...
llvm-svn: 128535
2011-03-30 11:19:20 +00:00
Anders Carlsson
1cc8073bb3
Handle another case that Frits suggested.
...
llvm-svn: 128068
2011-03-22 03:21:01 +00:00
Anders Carlsson
4dd420f193
More cleanups to the OptimizeEmptyGlobalCXXDtors GlobalOpt function.
...
llvm-svn: 127997
2011-03-21 14:54:40 +00:00
Anders Carlsson
701822a48e
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
d078183725
Fix comments
...
llvm-svn: 127984
2011-03-21 02:26:01 +00:00
Anders Carlsson
336fd90f4d
Don't try to eliminate invokes to __cxa_atexit.
...
llvm-svn: 127976
2011-03-20 20:21:33 +00:00
Anders Carlsson
fcec2f519a
Don't segfault on mutual recursion, as pointed out by Frits.
...
llvm-svn: 127975
2011-03-20 20:16:43 +00:00
Anders Carlsson
48a44911d3
Address comments from Frits van Bommel.
...
llvm-svn: 127974
2011-03-20 19:51:13 +00:00
Anders Carlsson
ee6bc70d2f
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
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
Rafael Espindola
fc355bc070
Add unnamed_addr when we can show that address of a global is not used.
...
llvm-svn: 123834
2011-01-19 16:32:21 +00:00
Rafael Espindola
ecd5b9abe9
Reduce indentation and remove commented out code.
...
llvm-svn: 123729
2011-01-18 04:36:06 +00:00
Owen Anderson
4e54efd625
Improve the safety of my globalopt enhancement by ensuring that the bitcast
...
of the stored value to the new store type is always. Also, add a testcase.
llvm-svn: 123563
2011-01-16 04:33:33 +00:00
Chris Lattner
8b4952fcf7
simplify this code, it is still broken but will follow up on llvm-commits.
...
llvm-svn: 123558
2011-01-16 02:05:10 +00:00
Benjamin Kramer
ed5f2e504e
Try to unbreak selfhost.
...
llvm-svn: 123537
2011-01-15 11:25:34 +00:00
Owen Anderson
3e2f6cf7ae
Fix a false-positive warning.
...
llvm-svn: 123480
2011-01-14 22:31:13 +00:00
Owen Anderson
9eb7cb48e4
Enhance GlobalOpt to be able evaluate initializers that involve stores through
...
bitcasts, at least in simple cases. This fixes clang's CodeGenCXX/virtual-base-dtor.cpp
llvm-svn: 123477
2011-01-14 22:19:20 +00:00
Chris Lattner
1903c42b97
fix a globalopt crash on two Adobe-C++ testcases that the recent
...
loop idiom pass exposed.
llvm-svn: 122674
2011-01-01 22:31:46 +00:00
Chris Lattner
0d71c4f564
reapply r121100 with a tweak to constant fold ConstExprs with TargetData
...
(if available) as we go so that we get simple constantexprs not insane ones.
This fixes the failure of clang/test/CodeGenCXX/virtual-base-ctor.cpp
that the previous iteration of this patch had.
llvm-svn: 121111
2010-12-07 04:33:29 +00:00
Eric Christopher
f10dcfb9fb
Temporarily revert r121100 as it's causing clang to fail
...
CodeGenCXX/virtual-base-ctor.cpp.
llvm-svn: 121102
2010-12-07 02:41:11 +00:00
Chris Lattner
287f4366c1
fix PR8710 - teach global opt that some constantexprs are too complex to
...
put in a global variable's initializer.
llvm-svn: 121100
2010-12-07 01:59:32 +00:00
Chris Lattner
7ff0ba41bd
replace a linear scan with a symtab lookup, reduce indentation.
...
No functionality change.
llvm-svn: 121042
2010-12-06 21:53:07 +00:00
Owen Anderson
6c18d1aac0
Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which
...
must be called in the pass's constructor. This function uses static dependency declarations to recursively initialize
the pass's dependencies.
Clients that only create passes through the createFooPass() APIs will require no changes. Clients that want to use the
CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h
before parsing commandline arguments.
I have tested this with all standard configurations of clang and llvm-gcc on Darwin. It is possible that there are problems
with the static dependencies that will only be visible with non-standard options. If you encounter any crash in pass
registration/creation, please send the testcase to me directly.
llvm-svn: 116820
2010-10-19 17:21:58 +00:00
Mikhail Glushenkov
2072db24ed
GlobalOpt: EvaluateFunction() must not evaluate stores to weak_odr globals.
...
Fixes PR8389.
llvm-svn: 116812
2010-10-19 16:47:23 +00:00