Bob Wilson
205385244c
The SSAUpdater should avoid recursive traversals of the CFG, since that may
...
blow out the stack for really big functions. Start by fixing an easy case.
llvm-svn: 100126
2010-04-01 18:46:59 +00:00
Bob Wilson
2a872616de
Rewrite part of the SSAUpdater to be more careful about inserting redundant
...
PHIs. The previous algorithm was unable to reliably detect when existing
PHIs in a cycle can be reused. I'm still working on reducing a testcase.
Radar 7711900.
llvm-svn: 100047
2010-03-31 20:51:00 +00:00
Bob Wilson
aae933cc81
Revert Mon Ping's change 99928, since it broke all the llvm-gcc buildbots.
...
llvm-svn: 99948
2010-03-30 22:27:04 +00:00
Mon P Wang
9351ea594a
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
...
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
A update of langref will occur in a subsequent checkin.
llvm-svn: 99928
2010-03-30 20:55:56 +00:00
Evan Cheng
4f4954b532
Add comment.
...
llvm-svn: 99284
2010-03-23 15:50:49 +00:00
Evan Cheng
031c6d2de6
Forgot this.
...
llvm-svn: 99283
2010-03-23 15:49:37 +00:00
Benjamin Kramer
19c12c8ef4
Add a virtual destructor and give vtable a home.
...
llvm-svn: 98376
2010-03-12 20:41:29 +00:00
Benjamin Kramer
0592752a53
Factor checked library call optimization into a common helper class and use it
...
to unify the almost identical code in CodeGenPrepare and InstCombineCalls.
llvm-svn: 98338
2010-03-12 09:27:41 +00:00
Benjamin Kramer
846fefb000
stpcpy is so similar to strcpy, it doesn't deserve a complete copy of the __strcpy_chk -> strcpy code.
...
llvm-svn: 98284
2010-03-11 20:45:13 +00:00
Eric Christopher
017a0a06d8
Lower stpcpy_chk when possible.
...
llvm-svn: 98274
2010-03-11 19:24:34 +00:00
Eric Christopher
c2a92dadc5
Add strncpy libcall creator. Use it when it should be used.
...
llvm-svn: 98219
2010-03-11 01:25:07 +00:00
Jakob Stoklund Olesen
189a55cc16
Try to keep the cached inliner costs around for a bit longer for big functions.
...
The Caller cost info would be reset everytime a callee was inlined. If the
caller has lots of calls and there is some mutual recursion going on, the
caller cost info could be calculated many times.
This patch reduces inliner runtime from 240s to 0.5s for a function with 20000
small function calls.
This is a more conservative version of r98089 that doesn't break the clang
test CodeGenCXX/temp-order.cpp. That test relies on rather extreme inlining
for constant folding.
llvm-svn: 98099
2010-03-09 23:02:17 +00:00
Jakob Stoklund Olesen
24bdfeee51
Revert r98089, it was breaking a clang test.
...
llvm-svn: 98094
2010-03-09 22:43:37 +00:00
Jakob Stoklund Olesen
0e8f00292c
Try to keep the cached inliner costs around for a bit longer for big functions.
...
The Caller cost info would be reset everytime a callee was inlined. If the
caller has lots of calls and there is some mutual recursion going on, the
caller cost info could be calculated many times.
This patch reduces inliner runtime from 240s to 0.5s for a function with 20000
small function calls.
llvm-svn: 98089
2010-03-09 22:17:11 +00:00
Eric Christopher
dfb465a816
Move SimplifyLibCalls's LibCall builders to a separate file so they
...
can be used in more places. Add an argument for the TargetData that
most of them need. Update for the getInt8PtrTy() change. Should be
no functionality change.
llvm-svn: 97844
2010-03-05 22:25:30 +00:00
Bob Wilson
6d8360b3d8
Revert r97245 which seems to be causing performance problems.
...
llvm-svn: 97366
2010-02-28 05:34:05 +00:00
Bob Wilson
139fdbd4d2
Move the EnableFullLoadPRE flag from a separate command-line option to an
...
argument of createGVNPass and set it automatically for -O3.
llvm-svn: 97245
2010-02-26 19:09:47 +00:00
Bob Wilson
cf20a07501
Remove unused "NoPRE" parameter in GVN and createGVNPass().
...
llvm-svn: 97235
2010-02-26 18:35:19 +00:00
Bob Wilson
86dded571f
Rename SuccessorNumber to GetSuccessorNumber.
...
llvm-svn: 96387
2010-02-16 21:06:42 +00:00
Bob Wilson
1115365fcf
Refactor to share code to find the position of a basic block successor in the
...
terminator's list of successors.
llvm-svn: 96377
2010-02-16 19:49:17 +00:00
Eric Christopher
871cf7bce2
Pull these back out, they're a little too aggressive and time
...
consuming for a simple optimization.
llvm-svn: 95671
2010-02-09 17:29:18 +00:00
Eric Christopher
428b385575
Add a new pass to do llvm.objsize lowering using SCEV.
...
Initial skeleton and SCEVUnknown lowering implemented,
the rest should come relatively quickly. Move testcase
to new directory.
Move pass to right before SimplifyLibCalls - which is
moved down a bit so we can take advantage of a few opts.
llvm-svn: 95628
2010-02-09 00:35:38 +00:00
Jakob Stoklund Olesen
83ebc265b3
Reintroduce the InlineHint function attribute.
...
This time it's for real! I am going to hook this up in the frontends as well.
The inliner has some experimental heuristics for dealing with the inline hint.
When given a -respect-inlinehint option, functions marked with the inline
keyword are given a threshold just above the default for -O3.
We need some experiments to determine if that is the right thing to do.
llvm-svn: 95466
2010-02-06 01:16:28 +00:00
Jakob Stoklund Olesen
670458b3be
Teach SimplifyCFG about magic pointer constants.
...
Weird code sometimes uses pointer constants other than null. This patch
teaches SimplifyCFG to build switch instructions in those cases.
Code like this:
void f(const char *x) {
if (!x)
puts("null");
else if ((uintptr_t)x == 1)
puts("one");
else if (x == (char*)2 || x == (char*)3)
puts("two");
else if ((intptr_t)x == 4)
puts("four");
else
puts(x);
}
Now becomes a switch:
define void @f(i8* %x) nounwind ssp {
entry:
%magicptr23 = ptrtoint i8* %x to i64 ; <i64> [#uses=1]
switch i64 %magicptr23, label %if.else16 [
i64 0, label %if.then
i64 1, label %if.then2
i64 2, label %if.then9
i64 3, label %if.then9
i64 4, label %if.then14
]
Note that LLVM's own DenseMap uses magic pointers.
llvm-svn: 95439
2010-02-05 22:03:18 +00:00
Bob Wilson
0f04082970
Check alignment of loads when deciding whether it is safe to execute them
...
unconditionally. Besides checking the offset, also check that the underlying
object is aligned as much as the load itself.
llvm-svn: 94875
2010-01-30 04:42:39 +00:00
Bob Wilson
f897b7b37e
Improve isSafeToLoadUnconditionally to recognize that GEPs with constant
...
indices are safe if the result is known to be within the bounds of the
underlying object.
llvm-svn: 94829
2010-01-29 19:19:08 +00:00
Benjamin Kramer
cfe07fadc7
Don't bother with sprintf, just pass the Twine through.
...
llvm-svn: 94684
2010-01-27 19:58:47 +00:00
Victor Hernandez
d44671b931
DbgInfoIntrinsics no longer appear in an instruction's use list; so clean up looking for them in use iterations and remove OnlyUsedByDbgInfoIntrinsics()
...
llvm-svn: 94111
2010-01-21 23:05:53 +00:00
Jakob Stoklund Olesen
ac14f3bf31
Move per-function inline threshold calculation to a method.
...
No functional change except the forgotten test for
InlineLimit.getNumOccurrences() == 0 in the CurrentThreshold2 calculation.
llvm-svn: 94007
2010-01-20 17:51:28 +00:00
Chris Lattner
87f86498c3
add a helper function.
...
llvm-svn: 93251
2010-01-12 19:40:54 +00:00
Dan Gohman
41cc1e1fc4
Make RecursivelyDeleteTriviallyDeadInstructions,
...
RecursivelyDeleteDeadPHINode, and DeleteDeadPHIs return a flag
indicating whether they made any changes.
llvm-svn: 92732
2010-01-05 15:45:31 +00:00
Chris Lattner
48618eeec3
convert various IntrinsicInst's to use class instead of struct.
...
llvm-svn: 92681
2010-01-05 05:21:26 +00:00
Devang Patel
3b08c33f33
Remove dead debug info intrinsics.
...
Intrinsic::dbg_stoppoint
Intrinsic::dbg_region_start
Intrinsic::dbg_region_end
Intrinsic::dbg_func_start
AutoUpgrade simply ignores these intrinsics now.
llvm-svn: 92557
2010-01-05 01:10:40 +00:00
Chris Lattner
07a1a284d3
remove the random sampling framework, which is not maintained anymore.
...
If there is interest, it can be resurrected from SVN. PR4912.
llvm-svn: 92422
2010-01-02 20:07:03 +00:00
Chris Lattner
41047d373d
comment fix: weakvh -> tracking vh
...
llvm-svn: 91867
2009-12-22 00:51:57 +00:00
Dan Gohman
4e04fb5ca8
Eliminate unnecessary LLVMContexts.
...
llvm-svn: 91729
2009-12-18 23:42:08 +00:00
Nick Lewycky
b3bedf4b2d
Pull LLVMContext out of PromoteMemToReg.
...
llvm-svn: 89645
2009-11-23 03:50:44 +00:00
Jim Grosbach
5787c6eb88
Make EliminateDuplicatePHINodes() available as a utility function
...
llvm-svn: 89297
2009-11-19 02:02:10 +00:00
Dan Gohman
406baaac43
Add an option for running GVN with redundant load processing disabled.
...
llvm-svn: 88742
2009-11-14 02:27:51 +00:00
Chris Lattner
36009e416c
remove the now dead condprop pass, PR3906.
...
llvm-svn: 86810
2009-11-11 05:56:35 +00:00
Devang Patel
5c983cb2ab
Implement support to debug inlined functions.
...
llvm-svn: 86748
2009-11-10 23:06:00 +00:00
Chris Lattner
ec4264fbb0
move some generally useful functions out of jump threading
...
into libanalysis and transformutils.
llvm-svn: 86735
2009-11-10 22:26:15 +00:00
Chris Lattner
9428f34d89
refactor TryToSimplifyUncondBranchFromEmptyBlock out of SimplifyCFG.
...
llvm-svn: 86666
2009-11-10 05:59:26 +00:00
Douglas Gregor
cc2c05cb75
Make a few more LLVM headers parsable as standalone headers.
...
Fix some problems with the hidden copy constructors for
ImmutableMap/ImmutableSet found by Clang++.
llvm-svn: 86186
2009-11-05 23:01:30 +00:00
Duncan Sands
555af234e6
Improve the other instance of the comment.
...
llvm-svn: 85733
2009-11-01 19:16:21 +00:00
Chris Lattner
ea1bebaa65
update the comment above llvm::SplitCriticalEdge, and make
...
it abort on IndirectBrInst as describe in the comment.
llvm-svn: 85688
2009-10-31 21:51:10 +00:00
Dan Gohman
61e806613f
Revert r85667. LoopUnroll currently can't call utility functions which
...
auto-update the DominatorTree because it doesn't keep the DominatorTree
current while it works.
llvm-svn: 85670
2009-10-31 17:33:01 +00:00
Dan Gohman
40cec16be1
Merge the enhancements from LoopUnroll's FoldBlockIntoPredecessor into
...
MergeBlockIntoPredecessor. This makes SimplifyCFG slightly more aggressive,
and makes it unnecessary for LoopUnroll to have its own copy of this code.
llvm-svn: 85667
2009-10-31 16:08:00 +00:00
Dan Gohman
04c536dff6
Remove CodeGenLICM. It's largely obsoleted by MachineLICM's new ability
...
to unfold loop-invariant loads.
llvm-svn: 85657
2009-10-31 14:35:41 +00:00
Evan Cheng
8db8f72185
Add option to createGVNPass to disable PRE.
...
llvm-svn: 85609
2009-10-30 20:12:24 +00:00