Duncan Sands
e22385630e
Ignore loads from and stores to local memory (i.e. allocas)
...
when deciding whether to mark a function readnone/readonly.
Since the pass is currently run before SROA, this may be
quite helpful. Requested by Chris on IRC.
llvm-svn: 57050
2008-10-04 13:24:24 +00:00
Dan Gohman
700611dfc6
Clean up some multiple-return-value code that is no longer
...
applicable.
llvm-svn: 57033
2008-10-03 22:21:24 +00:00
Duncan Sands
5edd9b2350
Teach internalize to preserve the callgraph.
...
Why? Because it was there!
llvm-svn: 56996
2008-10-03 07:36:09 +00:00
Nuno Lopes
8bf32ebde6
revert the addition of Preverves(CallGraph), per Duncan's comments
...
llvm-svn: 56917
2008-10-01 09:13:40 +00:00
Nuno Lopes
36e7e0b190
add preserversCFG() + preservers(CallGraph)
...
llvm-svn: 56887
2008-09-30 22:04:30 +00:00
Nuno Lopes
2219758606
add AU.setPreservesCFG() since this pass only adds and removes function attributes
...
llvm-svn: 56868
2008-09-30 18:34:38 +00:00
Duncan Sands
187322048e
Speed up these passes when the callgraph has
...
huge simply connected components. Suggested
by Chris.
llvm-svn: 56787
2008-09-29 14:59:04 +00:00
Nuno Lopes
a4d69747c1
remove redundant test (mayBeOverriden() includes hasLinkOnceLinkage)
...
llvm-svn: 56786
2008-09-29 14:40:32 +00:00
Duncan Sands
60dc0b5cbe
Tweak some comments.
...
llvm-svn: 56784
2008-09-29 13:35:31 +00:00
Duncan Sands
651eeb4be2
Rename isWeakForLinker to mayBeOverridden. Use it
...
instead of hasWeakLinkage in a bunch of optimization
passes.
llvm-svn: 56782
2008-09-29 11:25:42 +00:00
Devang Patel
47a504c87c
Implement function notes as function attributes.
...
llvm-svn: 56716
2008-09-26 23:51:19 +00:00
Devang Patel
e4e6ea0728
Now Attributes are divided in three groups
...
- return attributes - inreg, zext and sext
- parameter attributes
- function attributes - nounwind, readonly, readnone, noreturn
Return attributes use 0 as the index.
Function attributes use ~0U as the index.
This patch requires corresponding changes in llvm-gcc and clang.
llvm-svn: 56704
2008-09-26 22:53:05 +00:00
Devang Patel
64dd7a2e89
Large mechanical patch.
...
s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g
This sets the stage
- to implement function notes as function attributes and
- to distinguish between function attributes and return value attributes.
This requires corresponding changes in llvm-gcc and clang.
llvm-svn: 56622
2008-09-25 21:00:45 +00:00
Devang Patel
f0bda74eca
s/ParamAttrsWithIndex/FnAttributeWithIndex/g
...
llvm-svn: 56535
2008-09-24 00:55:02 +00:00
Devang Patel
25ecdc49d9
Put FN_NOTE_AlwaysInline and others in FnAttr namespace.
...
llvm-svn: 56527
2008-09-24 00:06:15 +00:00
Devang Patel
b39defd763
Move FN_NOTE_AlwaysInline and other out of ParamAttrs namespace.
...
Do not check isDeclaration() in hasNote(). It is clients' responsibility.
llvm-svn: 56524
2008-09-23 23:52:03 +00:00
Devang Patel
a3e9bf1bca
s/ParameterAttributes/Attributes/g
...
llvm-svn: 56513
2008-09-23 23:03:40 +00:00
Devang Patel
ad8ca34acd
Use parameter attribute store (soon to be renamed) for
...
Function Notes also. Function notes are stored at index ~0.
llvm-svn: 56511
2008-09-23 22:35:17 +00:00
Devang Patel
c7fc5ed65f
Add hasNote() to check note associated with a function.
...
llvm-svn: 56477
2008-09-22 22:32:29 +00:00
Oscar Fuentes
0f25988689
Initial support for the CMake build system.
...
llvm-svn: 56419
2008-09-22 01:08:49 +00:00
Duncan Sands
38b44d2a40
Implement review feedback from Devang: make use
...
of mayReadFromMemory and mayWriteToMemory.
llvm-svn: 56387
2008-09-20 16:45:58 +00:00
Duncan Sands
c2ff9ca568
Add a new pass AddReadAttrs which works out which functions
...
can get the readnone/readonly attributes, and gives them it.
The plan is to remove markmodref (which did the same thing
by querying GlobalsModRef) and delete the analogous
functionality from GlobalsModRef.
llvm-svn: 56341
2008-09-19 08:17:05 +00:00
Anton Korobeynikov
6ad8b060d0
Make safer variant of alias resolution routine to be default
...
llvm-svn: 56005
2008-09-09 20:05:04 +00:00
Anton Korobeynikov
4676c09dc8
Resolve aliases, when possible
...
llvm-svn: 56001
2008-09-09 19:04:59 +00:00
Duncan Sands
0fcef7437c
Update the callgraph correctly.
...
llvm-svn: 55896
2008-09-08 11:08:09 +00:00
Duncan Sands
62431a29a5
Update the callgraph correctly in ArgumentPromotion.
...
llvm-svn: 55895
2008-09-08 11:07:35 +00:00
Duncan Sands
58d434d3e8
Reapply 55859. This doesn't change anything as
...
long as the callgraph is correct. It checks
for wrong callgraphs more strictly.
llvm-svn: 55894
2008-09-08 11:05:51 +00:00
Duncan Sands
ae32389a41
Correct a comment and strip trailing whitespace.
...
llvm-svn: 55883
2008-09-07 09:54:09 +00:00
Nuno Lopes
a03bc9ce10
fix crash when the malloc/free function is defined or is a declaration with 0 parameters.
...
this pass doesnt seem to be used, but still it's now a little more correct
llvm-svn: 55873
2008-09-06 17:44:06 +00:00
Duncan Sands
c4ec7871bf
When PruneEH turned an invoke into an ordinary
...
call (thus changing the call site) it didn't
inform the callgraph about this. But the
call site does matter - as shown by the testcase,
the callgraph become invalid after the inliner
ran (with an edge between two functions simply
missing), resulting in wrong deductions by
GlobalsModRef.
llvm-svn: 55872
2008-09-06 17:19:29 +00:00
Owen Anderson
453bcfcf8d
Revert r55859. This is breaking the build in the abscence of its companion commit.
...
llvm-svn: 55865
2008-09-05 23:36:01 +00:00
Duncan Sands
fdfa2d24fe
Delete the removeCallEdgeTo callgraph method,
...
because it does not maintain a correct list
of callsites. I discovered (see following
commit) that the inliner will create a wrong
callgraph if it is fed a callgraph with
correct edges but incorrect callsites. These
were created by Prune-EH, and while it wasn't
done via removeCallEdgeTo, it could have been
done via removeCallEdgeTo, which is an accident
waiting to happen. Use removeCallEdgeFor
instead.
llvm-svn: 55859
2008-09-05 21:43:04 +00:00
Duncan Sands
b63fde1edb
Use removeAllCalledFunctions rather than removing
...
edges one by one by hand.
llvm-svn: 55836
2008-09-05 14:56:53 +00:00
Duncan Sands
8de0cd8f10
Make this pass return that it made a change if
...
it modifies a functions attributes.
llvm-svn: 55831
2008-09-05 09:08:37 +00:00
Andrew Lenharth
4523deb38b
try to seperate the mechanism into something others can use
...
llvm-svn: 55785
2008-09-04 18:51:26 +00:00
Dan Gohman
e1f9be27bc
Tidy up several unbeseeming casts from pointer to intptr_t.
...
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Andrew Lenharth
9e27a7b4b0
cleanup as per Duncan's review
...
llvm-svn: 55766
2008-09-04 14:34:22 +00:00
Devang Patel
49483d797e
Update inline threshold for current function if the notes say, optimize for size.
...
llvm-svn: 55745
2008-09-03 23:06:09 +00:00
Andrew Lenharth
4a69775c64
Initial version of a Partial Specialization IPO pass. It triggers a couple hundred times on 176.gcc. I don't know the performance impact yet, the heuristic is quite simple still.
...
llvm-svn: 55734
2008-09-03 21:00:28 +00:00
Devang Patel
41331065dd
Fix typo in a comment.
...
llvm-svn: 55720
2008-09-03 20:25:40 +00:00
Devang Patel
b25dcdea78
Add parentheses to make code more readable.
...
llvm-svn: 55717
2008-09-03 19:57:15 +00:00
Devang Patel
24618c5a6a
Fix comments.
...
llvm-svn: 55716
2008-09-03 19:52:17 +00:00
Devang Patel
c70392bfcd
Add custom inliner that handles only functions that are marked as always_inline.
...
llvm-svn: 55713
2008-09-03 18:50:53 +00:00
Devang Patel
42fe8ff6e8
Handle "always inline" note during inline cost analysis.
...
llvm-svn: 55712
2008-09-03 18:47:45 +00:00
Devang Patel
dae7f0b9d7
Check noinline note and ignore other notes.
...
llvm-svn: 55711
2008-09-03 18:46:35 +00:00
Devang Patel
653bcea20d
Handle "noinline" note inside the simple inliner.
...
llvm-svn: 55708
2008-09-03 18:10:21 +00:00
Devang Patel
5659d2508e
s/FP_AlwaysInline/FN_NOTE_AlwaysInline/g
...
llvm-svn: 55676
2008-09-02 22:43:57 +00:00
Devang Patel
cda9086d29
respect inline=never and inline=always notes.
...
llvm-svn: 55673
2008-09-02 22:16:13 +00:00
Dan Gohman
027326ba3e
Use empty() instead of begin() == end().
...
llvm-svn: 54780
2008-08-14 18:13:49 +00:00
Matthijs Kooijman
3bbc2deb9c
Replace two for loops with while(!X->use_empty()) loops. This prevents
...
invalidating the iterator by deleting the current use. This fixes a segfault on
64 bit linux reported in PR2675.
Also remove an unneeded if.
llvm-svn: 54778
2008-08-14 15:03:05 +00:00