Commit Graph

9802 Commits

Author SHA1 Message Date
Nadav Rotem
14925e6b88 ARM Cost model: Use the size of vector registers and widest vectorizable instruction to determine the max vectorization factor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172010 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-09 22:29:00 +00:00
Michael Gottesman
5581115075 [ObjCARC Debug Messages] This is a squashed commit of 3x debug message commits ala echristo's suggestion.
1. Added debug messages when in OptimizeIndividualCalls we move calls into predecessors and then erase the original call.
2. Added debug messages when in the process of moving calls in ObjCARCOpt::MoveCalls we create new RR and delete old RR.
3. Added a debug message when we visit a specific retain instruction in ObjCARCOpt::PerformCodePlacement.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171988 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-09 19:23:24 +00:00
Benjamin Kramer
d9cc865787 LICM: Hoist insertvalue/extractvalue out of loops.
Fixes PR14854.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171984 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-09 18:12:03 +00:00
Nadav Rotem
83be7b0dd3 Cost Model: Move the 'max unroll factor' variable to the TTI and add initial Cost Model support on ARM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171928 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-09 01:15:42 +00:00
Shuxin Yang
935e35d2b9 Consider expression "0.0 - X" as the negation of X if
- this expression is explicitly marked no-signed-zero, or
  - no-signed-zero of this expression can be derived from some context.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171922 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-09 00:13:41 +00:00
Nadav Rotem
8327474e4b Code cleanup: refactor the switch statements in the generation of reduction variables into an IR builder call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171871 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-08 17:37:45 +00:00
Nadav Rotem
aae3d6fb53 Rename the enum members to match the LLVM coding style.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171868 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-08 17:23:17 +00:00
Bill Wendling
3cc48a0628 Make sure we don't emit instructions before a landingpad instruction.
PR14782


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171846 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-08 10:51:32 +00:00
Nadav Rotem
111e5fe7e0 LoopVectorizer: Add support for floating point reductions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171812 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 23:13:00 +00:00
Shuxin Yang
f279731b76 Cosmetical changne in order to conform to coding std.
Thank Eric Christopher for figuring out these problems!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171805 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 22:41:28 +00:00
Nadav Rotem
9a6c6a3736 LoopVectorizer: When we vectorizer and widen loops we process many elements at once. This is a good thing, except for
small loops. On small loops post-loop that handles scalars (and runs slower) can take more time to execute than the
rest of the loop. This patch disables widening of loops with a small static trip count.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171798 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 21:54:51 +00:00
Shuxin Yang
d3ae2866d1 This change is to implement following rules:
o. X/C1 * C2 => X * (C2/C1) (if C2/C1 is neither special FP nor denormal)
  o. X/C1 * C2 -> X/(C1/C2)   (if C2/C1 is either specical FP or denormal, but C1/C2 is a normal Fp)

     Let MDC denote multiplication or dividion with one & only one operand being a constant
  o. (MDC ± C1) * C2 => (MDC * C2) ± (C1 * C2)
     (so long as the constant-folding doesn't yield any denormal or special value)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171793 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 21:39:23 +00:00
Michael Gottesman
2f1bfc4c79 Fixed EOL whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171791 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 21:26:07 +00:00
Quentin Colombet
637582eaf7 When code size is the priority (Oz, MinSize attribute), help llvm
turning a code like this:

if (foo)
   free(foo)

into that:
free(foo)

Move a call to free from basic block FB into FB's predecessor, P,
when the path from P to FB is taken only if the argument of free is
not equal to NULL.

Some restrictions apply on P and FB to be sure that this code motion
is profitable. Namely:
1. FB must have only one predecessor P.
2. FB must contain only the call to free plus an unconditional
   branch to S.
3. P's successors are FB and S.

Because of 1., we will not increase the code size when moving the call
to free from FB to P.
Because of 2., FB will be empty after the move.
Because of 2. and 3., P's branch instruction becomes useless, so as FB
(simplifycfg will do the job).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171762 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 18:37:41 +00:00
Chandler Carruth
4068e1af9f Move TypeFinder.h into the IR tree, it clearly belongs with the IR library.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171749 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 15:43:51 +00:00
Chandler Carruth
3251e81d79 Move CallGraphSCCPass.h into the Analysis tree; that's where the
implementation lives already.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171746 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 15:26:48 +00:00
Chandler Carruth
1ada2ada3c Remove the long defunct 'DefaultPasses' header. We have a pass manager
builder these days, and this thing hasn't seen updates for a very long
time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171741 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 15:16:50 +00:00
Chandler Carruth
56d433dffe Sink AddrMode back into TargetLowering, removing one of the most
peculiar headers under include/llvm.

This struct still doesn't make a lot of sense, but it makes more sense
down in TargetLowering than it did before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171739 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 15:14:13 +00:00
Chandler Carruth
a07dcb1498 Remove LSR's use of the random AddrMode struct. These variables were
already in a class, just inline the four of them. I suspect that this
class could be simplified some to not always keep distinct variables for
these things, but it wasn't clear to me how given the usage so I opted
for a trivial and mechanical translation.

This removes one of the two remaining users of a header in include/llvm
which does nothing more than define a 4 member struct.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171738 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 15:04:40 +00:00
Chandler Carruth
e4ba75f43e Switch the SCEV expander and LoopStrengthReduce to use
TargetTransformInfo rather than TargetLowering, removing one of the
primary instances of the layering violation of Transforms depending
directly on Target.

This is a really big deal because LSR used to be a "special" pass that
could only be tested fully using llc and by looking at the full output
of it. It also couldn't run with any other loop passes because it had to
be created by the backend. No longer is this true. LSR is now just
a normal pass and we should probably lift the creation of LSR out of
lib/CodeGen/Passes.cpp and into the PassManagerBuilder. =] I've not done
this, or updated all of the tests to use opt and a triple, because
I suspect someone more familiar with LSR would do a better job. This
change should be essentially without functional impact for normal
compilations, and only change behvaior of targetless compilations.

The conversion required changing all of the LSR code to refer to the TTI
interfaces, which fortunately are very similar to TargetLowering's
interfaces. However, it also allowed us to *always* expect to have some
implementation around. I've pushed that simplification through the pass,
and leveraged it to simplify code somewhat. It required some test
updates for one of two things: either we used to skip some checks
altogether but now we get the default "no" answer for them, or we used
to have no information about the target and now we do have some.

I've also started the process of removing AddrMode, as the TTI interface
doesn't use it any longer. In some cases this simplifies code, and in
others it adds some complexity, but I think it's not a bad tradeoff even
there. Subsequent patches will try to clean this up even further and use
other (more appropriate) abstractions.

Yet again, almost all of the formatting changes brought to you by
clang-format. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171735 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 14:41:08 +00:00
Silviu Baranga
e97165901e Make the MergeGlobals pass correctly handle the address space qualifiers of the global variables. We partition the set of globals by their address space, and apply the same the trasnformation as before to merge them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171730 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 12:31:25 +00:00
Chandler Carruth
1cbeaeb194 Simplify LoopVectorize to require target transform info and rely on it
being present. Make a member of one of the helper classes a reference as
part of this.

Reformatting goodness brought to you by clang-format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171726 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 11:12:29 +00:00
Chandler Carruth
f3252b12e0 Merge the unused header file for LoopVectorizer into the source file.
This makes the loop vectorizer match the pattern followed by roughly all
other passses. =]

Notably, this header file was braken in several regards: it contained
a using namespace directive, global #define's that aren't globaly
appropriate, and global constants defined directly in the header file.

As a side benefit, lots of the types in this file become internal, which
will cause the optimizer to chew on this pass more effectively.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171723 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 10:44:06 +00:00
Chandler Carruth
8bd6c52396 Switch BBVectorize to directly depend on having a TTI analysis.
This could be simplified further, but Hal has a specific feature for
ignoring TTI, and so I preserved that.

Also, I needed to use it because a number of tests fail when switching
from a null TTI to the NoTTI nonce implementation. That seems suspicious
to me and so may be something that you need to look into Hal. I worked
it by preserving the old behavior for these tests with the flag that
ignores all target info.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171722 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 10:22:36 +00:00
Chandler Carruth
cf8814f975 Fix a slew of indentation and parameter naming style issues. This 80% of
this patch brought to you by the tool clang-format.

I wanted to fix up the names of constructor parameters because they
followed a bit of an anti-pattern by naming initialisms with CamelCase:
'Tti', 'Se', etc. This appears to have been in an attempt to not overlap
with the names of member variables 'TTI', 'SE', etc. However,
constructor arguments can very safely alias members, and in fact that's
the conventional way to pass in members. I've fixed all of these I saw,
along with making some strang abbreviations such as 'Lp' be simpler 'L',
or 'Lgl' be the word 'Legal'.

However, the code I was touching had indentation and formatting somewhat
all over the map. So I ran clang-format and fixed them.

I also fixed a few other formatting or doxygen formatting issues such as
using ///< on trailing comments so they are associated with the correct
entry.

There is still a lot of room for improvement of the formating and
cleanliness of this code. ;] At least a few parts of the coding
standards or common practices in LLVM's code aren't followed, the enum
naming rules jumped out at me. I may mix some of these while I'm here,
but not all of them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171719 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 09:57:00 +00:00
Chandler Carruth
d12aae6c05 Switch LoopIdiom pass to directly require target transform information.
I'm sorry for duplicating bad style here, but I wanted to keep
consistency. I've pinged the code review thread where this style was
reviewed and changes were requested.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171714 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 09:17:41 +00:00
Chandler Carruth
5f46c3c2e8 Make SimplifyCFG simply depend upon TargetTransformInfo and pass it
through as a reference rather than a pointer. There is always *some*
implementation of this available, so this simplifies code by not having
to test for whether it is available or not.

Further, it turns out there were piles of places where SimplifyCFG was
recursing and not passing down either TD or TTI. These are fixed to be
more pedantically consistent even though I don't have any particular
cases where it would matter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171691 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 03:53:25 +00:00
Chandler Carruth
bb00800ff4 Fix the enumerator names for ShuffleKind to match tho coding standards,
and make its comments doxygen comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171688 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 03:20:02 +00:00
Chandler Carruth
d1b8ef97c4 Make the popcnt support enums and methods have more clear names and
follow the conding conventions regarding enumerating a set of "kinds" of
things.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171687 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 03:16:03 +00:00
Chandler Carruth
be04929f7f Move TargetTransformInfo to live under the Analysis library. This no
longer would violate any dependency layering and it is in fact an
analysis. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171686 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 03:08:10 +00:00
Michael Gottesman
916d52a03e [ObjCARC Debug Message] - Added debug message when fuse a retain/autorelease pair in ObjCARCContract::ContractAutorelease.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171679 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 00:31:26 +00:00
Michael Gottesman
f93109a9b6 [ObjCARC Debug Message] - Added debug message when we zap a matching retain/autorelease pair in ObjCARCOpt::OptimizeReturns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171678 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 00:04:56 +00:00
Michael Gottesman
fbe4d6b1fa [ObjCARC Debug Message] - Added debug message when we erase ARC calls with null since they are no-ops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171677 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 00:04:52 +00:00
Michael Gottesman
38bc25a52e [ObjCARC Debug Message] - Added debug message when we add a nounwind keyword to a function which can not throw.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171676 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-06 23:39:13 +00:00
Michael Gottesman
817d4e942b [ObjCARC Debug Message] - Added debug message when we add a tail keyword to a function which can never be passed stack args.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171675 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-06 23:39:09 +00:00
Michael Gottesman
795612702e [ObjCARC Debug Messages] - Added missing newline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171674 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-06 22:56:54 +00:00
Michael Gottesman
20d9fff206 Added debug statement to ObjCARC when we replace objc_autorelease(x) with objc_release(x) when x is otherwise unused.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171673 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-06 22:56:50 +00:00
Michael Gottesman
e549492c36 Added 2x Debug statements to ObjCARC that log when we handle the two undefined pointer-to-weak-pointer is NULL cases by replacing the given call inst with an undefined value.
The reason that there are two cases is that the first case handles the unary cases and the second the binary cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171672 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-06 21:54:30 +00:00
Michael Gottesman
4680abec92 Added debug message in ObjCARC when we remove a no-op cast which has only special semantic meaning in the frontend and thus in the optimizer can be deleted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171670 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-06 21:07:15 +00:00
Michael Gottesman
48239c753a Added debug message to ObjCARC when we transform an objc_autoreleaseReturnValue => objc_autorelease due to its operand not being used as a return value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171669 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-06 21:07:11 +00:00
Andrew Trick
c6b4936a59 Fix a crash in LSR replaceCongruentIVs.
Indirect branch in the preheader crashes replaceCongruentIVs.
Fixes rdar://12910141.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171653 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-06 05:59:39 +00:00
Michael Gottesman
36e4bc406c Added debug message to ObjCARC when we transform objc_retainAutorelasedReturnValue => objc_retain since the operand to said function is not a return value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171629 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 17:55:42 +00:00
Michael Gottesman
87a0f02953 Added debug message for ObjCARC when we zap an objc_autoreleaseReturnValue/objc_retainAutoreleasedValue pair.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171628 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 17:55:35 +00:00
Chris Lattner
261304248f switch from pointer equality comparison to MDNode::getMostGenericTBAA
when merging two TBAA tags, pointed out by Nuno.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171627 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 16:44:07 +00:00
Chandler Carruth
be73c7b903 Switch the loop vectorizer from VTTI to just use TTI directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171620 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 10:16:02 +00:00
Chandler Carruth
abc227d9b3 Switch the BB vectorizer from the VTTI interface to the simple TTI
interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171618 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 10:05:28 +00:00
Chandler Carruth
b8f6cb7c49 Switch SimplifyCFG over to the TargetTransformInfo interface rather than
the ScalarTargetTransformInfo interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171617 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 10:05:26 +00:00
Chandler Carruth
9980b8a0bd Switch LoopIdiomRecognize to directly use the TargetTransformInfo
interface rather than the ScalarTargetTransformInterface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171616 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 10:00:09 +00:00
Chandler Carruth
b1a429fd1c Sink the AddressingModeMatcher helper class into an anonymous namespace
next to its only user. This helper relies on TargetLowering information
that shouldn't be generally used throughout the Transfoms library, and
so it made little sense as a generic utility.

This also consolidates the file where we need to remove the remaining
uses of TargetLowering in favor of the IR-layer abstract interface in
TargetTransformInfo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171590 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 02:09:22 +00:00
Nadav Rotem
d5b92c3891 iLoopVectorize: Non commutative operators can be used as reduction variables as long as the reduction chain is used in the LHS.
PR14803.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171583 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 01:15:47 +00:00