Evan Cheng
25dd4a2daf
Commit CodeGenPrepare.cpp changes which was accidentially left out of 56526.
...
llvm-svn: 56549
2008-09-24 06:48:55 +00:00
Eric Christopher
c1ea149dcd
Fix fallout in CodeGenPrepare from 56526. Will likely need more work.
...
llvm-svn: 56546
2008-09-24 05:32:41 +00:00
Devang Patel
6402c7236f
s/ParamAttrsWithIndex/FnAttributeWithIndex/g
...
llvm-svn: 56535
2008-09-24 00:55:02 +00:00
Devang Patel
e15607b7bb
Put FN_NOTE_AlwaysInline and others in FnAttr namespace.
...
llvm-svn: 56527
2008-09-24 00:06:15 +00:00
Devang Patel
e87abd26ba
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
ba3fa6c6e1
s/ParameterAttributes/Attributes/g
...
llvm-svn: 56513
2008-09-23 23:03:40 +00:00
Devang Patel
82fed6702b
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
329fe728b5
Add hasNote() to check note associated with a function.
...
llvm-svn: 56477
2008-09-22 22:32:29 +00:00
Oscar Fuentes
a229b3c9a7
Initial support for the CMake build system.
...
llvm-svn: 56419
2008-09-22 01:08:49 +00:00
Duncan Sands
e1dc84be64
Implement review feedback from Devang: make use
...
of mayReadFromMemory and mayWriteToMemory.
llvm-svn: 56387
2008-09-20 16:45:58 +00:00
Duncan Sands
310077034a
Remove the MarkModRef pass (use AddReadAttrs instead).
...
Unfortunately this means removing one regression test
of GlobalsModRef because I couldn't work out how to
perform it without MarkModRef.
llvm-svn: 56342
2008-09-19 08:23:44 +00:00
Duncan Sands
af25ee7ffc
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
Devang Patel
c25be3b2de
splitLoop does not handle split condition EQ.
...
Fixes PR 2805
llvm-svn: 56321
2008-09-18 23:45:14 +00:00
Bill Wendling
a00fa322b1
Decrementing the iterator here could be wrong if the worklist is empty after the "erase".
...
Thanks to Ji Young Park for the patch!
llvm-svn: 56316
2008-09-18 23:04:18 +00:00
Devang Patel
76b22c1420
Try to place hoisted instructions befoe icmp instruction.
...
llvm-svn: 56315
2008-09-18 22:50:42 +00:00
Devang Patel
7f9671ba37
Do not hoist instruction above branch condition. The instruction may use branch condition.
...
llvm-svn: 56286
2008-09-17 18:21:49 +00:00
Devang Patel
dca8d3b183
Do not ignore iv uses outside the loop.
...
This one slipped through cracks very well.
llvm-svn: 56284
2008-09-17 17:53:47 +00:00
Dan Gohman
dafa9c6e85
Improve instcombine's handling of integer min and max in two ways:
...
- Recognize expressions like "x > -1 ? x : 0" as min/max and turn them
into expressions like "x < 0 ? 0 : x", which is easily recognizable
as a min/max operation.
- Refrain from folding expression like "y/2 < 1" to "y < 2" when the
comparison is being used as part of a min or max idiom, like
"y/2 < 1 ? 1 : y/2". In that case, the division has another use, so
folding doesn't eliminate it, and obfuscates the min/max, making it
harder to recognize as a min/max operation.
These benefit ScalarEvolution, CodeGen, and anything else that wants to
recognize integer min and max.
llvm-svn: 56246
2008-09-16 18:46:06 +00:00
Dan Gohman
68e7735a38
Teach LSR to optimize away SMAX operations for tripcounts in common
...
cases. See the comment above OptimizeSMax for the full story, and
the testcase for an example. This cancels out a pessimization
commonly attributed to indvars, and will allow us to lift some of
the artificial throttles in indvars, rather than add new ones.
llvm-svn: 56230
2008-09-15 21:22:06 +00:00
Dan Gohman
eff71f2953
On 64-bit targets, change 32-bit getelementptr indices to be 64-bit
...
getelementptr indices, inserting an explicit cast if necessary.
This helps expose the sign-extension operation to other optimizations.
llvm-svn: 56133
2008-09-11 23:06:38 +00:00
Dan Gohman
7d01c0654c
Fix a vectorshuffle instcombine bug introduced by r55995.
...
Patch by Nicolas Capens!
llvm-svn: 56129
2008-09-11 22:47:57 +00:00
Dan Gohman
9b9d547a5c
Fix a copy+paste bug that Duncan spotted. For several
...
cases it was still getting lucky and detecting overflow
but it was clearly incorrect.
llvm-svn: 56113
2008-09-11 18:53:02 +00:00
Dan Gohman
9d9a4be588
In my analysis for r56076 I missed the case where the original
...
multiplication overflows.
llvm-svn: 56082
2008-09-11 00:25:00 +00:00
Dan Gohman
c1ae01688f
Fix an icmp+sdiv optimization to check for and handle an overflow
...
condition. This fixes PR2740.
llvm-svn: 56076
2008-09-10 23:30:57 +00:00
Devang Patel
728c44ab56
fix white spaces.
...
llvm-svn: 56056
2008-09-10 14:49:55 +00:00
Dan Gohman
97f0a0f28d
Fix a warning about comparing signed and unsigned values.
...
llvm-svn: 56040
2008-09-10 01:09:32 +00:00
Devang Patel
92b032f3e6
if loop induction variable is always sign or zero extended then
...
extend the type of induction variable.
llvm-svn: 56017
2008-09-09 21:41:07 +00:00
Devang Patel
92c5367705
fix overflow check.
...
llvm-svn: 56011
2008-09-09 20:54:34 +00:00
Anton Korobeynikov
1a1140429e
Make safer variant of alias resolution routine to be default
...
llvm-svn: 56005
2008-09-09 20:05:04 +00:00
Anton Korobeynikov
a9b60ee0fc
Resolve aliases, when possible
...
llvm-svn: 56001
2008-09-09 19:04:59 +00:00
Dan Gohman
86fb5b48de
Make SimplifyDemandedVectorElts simplify vectors with multiple
...
users, and teach it about shufflevector instructions.
Also, fix a subtle bug in SimplifyDemandedVectorElts'
insertelement code.
This is a patch that was originally written by Eli Friedman,
with some fixes and cleanup by me.
llvm-svn: 55995
2008-09-09 18:11:14 +00:00
Devang Patel
0f7a3507cf
Fix simplifycfg crash in handing block merge.
...
llvm-svn: 55971
2008-09-09 01:06:56 +00:00
Devang Patel
3d56051f70
s/RemoveUnreachableBlocks/RemoveUnreachableBlocksFromFn/g
...
llvm-svn: 55965
2008-09-08 22:14:17 +00:00
Devang Patel
7518f250b9
Remove unused counter.
...
llvm-svn: 55924
2008-09-08 17:14:54 +00:00
Devang Patel
538a7f479a
Remove OptimizeIVType()
...
llvm-svn: 55913
2008-09-08 16:13:27 +00:00
Duncan Sands
b9a6f861b4
Update the callgraph correctly.
...
llvm-svn: 55896
2008-09-08 11:08:09 +00:00
Duncan Sands
3cf7d86556
Update the callgraph correctly in ArgumentPromotion.
...
llvm-svn: 55895
2008-09-08 11:07:35 +00:00
Duncan Sands
46911f1271
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
1ea0d2e6db
Correct a comment and strip trailing whitespace.
...
llvm-svn: 55883
2008-09-07 09:54:09 +00:00
Nuno Lopes
421f488cb7
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
95c2a7848a
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
1dd2e40521
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
Devang Patel
d94269f906
Remove unused map.
...
llvm-svn: 55861
2008-09-05 21:55:33 +00:00
Duncan Sands
9e23602849
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
3a52056d4d
Use removeAllCalledFunctions rather than removing
...
edges one by one by hand.
llvm-svn: 55836
2008-09-05 14:56:53 +00:00
Duncan Sands
7c8fb1ad93
Remove trailing whitespace.
...
llvm-svn: 55835
2008-09-05 12:37:12 +00:00
Duncan Sands
6dd02b5219
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
Devang Patel
40519f0370
A loop may be unswitched multiple times. Reconstruct dom info. at the end.
...
llvm-svn: 55806
2008-09-04 22:43:59 +00:00
Devang Patel
00ec74616b
Initialize loop data first.
...
llvm-svn: 55792
2008-09-04 20:36:36 +00:00
Devang Patel
d52071540c
Do not unswitch if the function notes say we're optimizing this function for size.
...
llvm-svn: 55786
2008-09-04 18:55:13 +00:00