1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
Commit Graph

4507 Commits

Author SHA1 Message Date
Chris Lattner
107e8f8b60 rewrite bswap matching to be more general, allowing arbitrary
shifting and masking inside a bswap expr.  This allows it to handle
the cases from PR2842, which involve the intermediate 'or' 
expressions being shifted, not just the input value.

llvm-svn: 57095
2008-10-05 02:13:19 +00:00
Chris Lattner
6fae76bbf3 fix a bug where the bswap matcher could match a case involving
ashr.  It should only apply to lshr.

llvm-svn: 57089
2008-10-05 00:50:57 +00:00
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
Devang Patel
55401473f9 Nick Lewycky's patch.
While hosting instruction check PHI node.

llvm-svn: 57025
2008-10-03 18:57:37 +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
Owen Anderson
e98ca283b0 SplitBlock should only attempt to update LoopInfo if it is actually being used.
llvm-svn: 56994
2008-10-03 06:55:35 +00:00
Duncan Sands
88d8323743 Factorize code: remove variants of "strip off
pointer bitcasts and GEP's", and centralize the
logic in Value::getUnderlyingObject.  The
difference with stripPointerCasts is that
stripPointerCasts only strips GEPs if all
indices are zero, while getUnderlyingObject
strips GEPs no matter what the indices are.

llvm-svn: 56922
2008-10-01 15:25:41 +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
Dan Gohman
b6d0fe7797 Call ScalarEvolution's deleteValueFromRecords before deleting an
instruction, not after. This fixes some uses of free'd memory.

llvm-svn: 56908
2008-10-01 02:02:03 +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
Nick Lewycky
9e918179c8 Fix misoptimization of: xor i1 (icmp eq (X, C1), icmp s[lg]t (X, C2))
llvm-svn: 56834
2008-09-30 06:08:34 +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
Evan Cheng
99c7d558a5 Commit CodeGenPrepare.cpp changes which was accidentially left out of 56526.
llvm-svn: 56549
2008-09-24 06:48:55 +00:00
Eric Christopher
463646c8aa Fix fallout in CodeGenPrepare from 56526. Will likely need more work.
llvm-svn: 56546
2008-09-24 05:32:41 +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
b2b5ddfaf6 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
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
Devang Patel
1e7ddf5d31 splitLoop does not handle split condition EQ.
Fixes PR 2805

llvm-svn: 56321
2008-09-18 23:45:14 +00:00
Bill Wendling
aadf9b22a7 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
201223af46 Try to place hoisted instructions befoe icmp instruction.
llvm-svn: 56315
2008-09-18 22:50:42 +00:00
Devang Patel
88efee2dcc 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
50c22bf69b 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
c598e29a1c 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
faa15214e0 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
0b6d3a9a9b 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
5e154a591d 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
4ae5fa57b4 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
36e01356ec 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
ebfb483309 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
092285d4e4 fix white spaces.
llvm-svn: 56056
2008-09-10 14:49:55 +00:00
Dan Gohman
3809753d3b Fix a warning about comparing signed and unsigned values.
llvm-svn: 56040
2008-09-10 01:09:32 +00:00
Devang Patel
7365754925 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
36ad68421e fix overflow check.
llvm-svn: 56011
2008-09-09 20:54:34 +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