Nadav Rotem
436dc952aa
ARM Cost model: Use the size of vector registers and widest vectorizable instruction to determine the max vectorization factor.
...
llvm-svn: 172010
2013-01-09 22:29:00 +00:00
Nadav Rotem
9c27f36e59
Cost Model: Move the 'max unroll factor' variable to the TTI and add initial Cost Model support on ARM.
...
llvm-svn: 171928
2013-01-09 01:15:42 +00:00
Nadav Rotem
df0bfd2e95
Code cleanup: refactor the switch statements in the generation of reduction variables into an IR builder call.
...
llvm-svn: 171871
2013-01-08 17:37:45 +00:00
Nadav Rotem
5bb578a21c
Rename the enum members to match the LLVM coding style.
...
llvm-svn: 171868
2013-01-08 17:23:17 +00:00
Nadav Rotem
4aa065a2a3
LoopVectorizer: Add support for floating point reductions
...
llvm-svn: 171812
2013-01-07 23:13:00 +00:00
Nadav Rotem
5906222eab
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.
llvm-svn: 171798
2013-01-07 21:54:51 +00:00
Chandler Carruth
c894d24706
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.
llvm-svn: 171726
2013-01-07 11:12:29 +00:00
Chandler Carruth
cbf30d85b9
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.
llvm-svn: 171723
2013-01-07 10:44:06 +00:00
Chandler Carruth
7723d75e9e
Fix the enumerator names for ShuffleKind to match tho coding standards,
...
and make its comments doxygen comments.
llvm-svn: 171688
2013-01-07 03:20:02 +00:00
Chandler Carruth
3c0f5d4efb
Move TargetTransformInfo to live under the Analysis library. This no
...
longer would violate any dependency layering and it is in fact an
analysis. =]
llvm-svn: 171686
2013-01-07 03:08:10 +00:00
Chandler Carruth
7e058addc4
Switch the loop vectorizer from VTTI to just use TTI directly.
...
llvm-svn: 171620
2013-01-05 10:16:02 +00:00
Nadav Rotem
836b9a9fda
iLoopVectorize: Non commutative operators can be used as reduction variables as long as the reduction chain is used in the LHS.
...
PR14803.
llvm-svn: 171583
2013-01-05 01:15:47 +00:00
Paul Redmond
6ce33a6ae9
Do not vectorize loops with subtraction reductions
...
Since subtraction does not commute the loop vectorizer incorrectly vectorizes
reductions such as x = A[i] - x.
Disabling for now.
llvm-svn: 171537
2013-01-04 22:10:16 +00:00
Nadav Rotem
3349017273
Fix a warning
...
llvm-svn: 171525
2013-01-04 21:08:44 +00:00
Nadav Rotem
cb3562a88e
LoopVectorizer:
...
1. Add code to estimate register pressure.
2. Add code to select the unroll factor based on register pressure.
3. Add bits to TargetTransformInfo to provide the number of registers.
llvm-svn: 171469
2013-01-04 17:48:25 +00:00
Nadav Rotem
29dd0667aa
LoopVectorizer: Add support for loop-unrolling during vectorization for increasing the ILP. At the moment this feature is disabled by default and this commit should not cause any functional changes.
...
llvm-svn: 171436
2013-01-03 00:52:27 +00:00
Nadav Rotem
a7cac72b7d
Avoid vectorization when the function has the "noimplicitflot" attribute.
...
llvm-svn: 171429
2013-01-02 23:54:43 +00:00
Chandler Carruth
4c1f3c24db
Move all of the header files which are involved in modelling the LLVM IR
...
into their new header subdirectory: include/llvm/IR. This matches the
directory structure of lib, and begins to correct a long standing point
of file layout clutter in LLVM.
There are still more header files to move here, but I wanted to handle
them in separate commits to make tracking what files make sense at each
layer easier.
The only really questionable files here are the target intrinsic
tablegen files. But that's a battle I'd rather not fight today.
I've updated both CMake and Makefile build systems (I think, and my
tests think, but I may have missed something).
I've also re-sorted the includes throughout the project. I'll be
committing updates to Clang, DragonEgg, and Polly momentarily.
llvm-svn: 171366
2013-01-02 11:36:10 +00:00
Benjamin Kramer
ddae3440aa
Add IRBuilder::CreateVectorSplat and use it to simplify code.
...
llvm-svn: 171349
2013-01-01 19:55:16 +00:00
Bill Wendling
e0920e4122
Remove the Function::getFnAttributes method in favor of using the AttributeSet
...
directly.
This is in preparation for removing the use of the 'Attribute' class as a
collection of attributes. That will shift to the AttributeSet class instead.
llvm-svn: 171253
2012-12-30 10:32:01 +00:00
Nadav Rotem
0e391907a5
LoopVectorizer: Fix a bug in the code that updates the loop exiting block.
...
LCSSA PHIs may have undef values. The vectorizer updates values that are used by outside users such as PHIs.
The bug happened because undefs are not loop values. This patch handles these PHIs.
PR14725
llvm-svn: 171251
2012-12-30 07:47:00 +00:00
Nadav Rotem
4cad811734
If all of the write objects are identified then we can vectorize the loop even if the read objects are unidentified.
...
PR14719.
llvm-svn: 171124
2012-12-26 23:30:53 +00:00
Nadav Rotem
90712b89cc
LoopVectorizer: Optimize the vectorization of consecutive memory access when the iteration step is -1
...
llvm-svn: 171114
2012-12-26 19:08:17 +00:00
Hal Finkel
f9b3cb9121
LoopVectorize: Enable vectorization of the fmuladd intrinsic
...
llvm-svn: 171076
2012-12-25 23:21:29 +00:00
Nadav Rotem
ace51e510e
LoopVectorizer: When checking for vectorizable types, also check
...
the StoreInst operands.
PR14705.
llvm-svn: 171023
2012-12-24 09:14:18 +00:00
Nadav Rotem
309d628c4f
LoopVectorizer: Fix an endless loop in the code that looks for reductions.
...
The bug was in the code that detects PHIs in if-then-else block sequence.
PR14701.
llvm-svn: 171008
2012-12-24 01:22:06 +00:00
Benjamin Kramer
1add5cc571
LoopVectorize: Fix accidentaly inverted condition.
...
llvm-svn: 171001
2012-12-23 13:21:41 +00:00
Benjamin Kramer
d0a5bcaf53
LoopVectorize: For scalars and void types there is no need to compute vector insert/extract costs.
...
Fixes an assert during the build of oggenc in the test suite.
llvm-svn: 171000
2012-12-23 13:19:18 +00:00
Nadav Rotem
e237376e62
Loop Vectorizer: Update the cost model of scatter/gather operations and make
...
them more expensive.
llvm-svn: 170995
2012-12-23 07:23:55 +00:00
Bill Wendling
a16e5519db
Change 'AttrVal' to 'AttrKind' to better reflect that it's a kind of attribute instead of the value of the attribute.
...
llvm-svn: 170972
2012-12-22 00:37:52 +00:00
Roman Divacky
a299a2efa5
Remove duplicate includes.
...
llvm-svn: 170902
2012-12-21 17:06:44 +00:00
Nadav Rotem
ad3bbdd5b0
Enable if-conversion.
...
llvm-svn: 170841
2012-12-21 04:47:54 +00:00
Nadav Rotem
80fefbe978
Fix a bug in the code that checks if we can vectorize loops while using dynamic
...
memory bound checks. Before the fix we were able to vectorize this loop from
the Livermore Loops benchmark:
for ( k=1 ; k<n ; k++ )
x[k] = x[k-1] + y[k];
llvm-svn: 170811
2012-12-21 00:07:35 +00:00
Nadav Rotem
ccffd4527d
LoopVectorize: Fix a bug in the scalarization of instructions.
...
Before if-conversion we could check if a value is loop invariant
if it was declared inside the basic block. Now that loops have
multiple blocks this check is incorrect.
This fixes External/SPEC/CINT95/099_go/099_go
llvm-svn: 170756
2012-12-20 20:24:40 +00:00
Nadav Rotem
759544a715
Loop Vectorizer: turn-off if-conversion.
...
llvm-svn: 170708
2012-12-20 17:42:53 +00:00
Nadav Rotem
f79dac509d
Loop Vectorizer: Enable if-conversion.
...
llvm-svn: 170632
2012-12-20 02:00:02 +00:00
Bill Wendling
56d9c4b832
Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.
...
llvm-svn: 170502
2012-12-19 07:18:57 +00:00
Benjamin Kramer
820b613d80
LoopVectorize: Emit reductions as log2(vectorsize) shuffles + vector ops instead of scalar operations.
...
For example on x86 with SSE4.2 a <8 x i8> add reduction becomes
movdqa %xmm0, %xmm1
movhlps %xmm1, %xmm1 ## xmm1 = xmm1[1,1]
paddw %xmm0, %xmm1
pshufd $1, %xmm1, %xmm0 ## xmm0 = xmm1[1,0,0,0]
paddw %xmm1, %xmm0
phaddw %xmm0, %xmm0
pextrb $0, %xmm0, %edx
instead of
pextrb $2, %xmm0, %esi
pextrb $0, %xmm0, %edx
addb %sil, %dl
pextrb $4, %xmm0, %esi
addb %dl, %sil
pextrb $6, %xmm0, %edx
addb %sil, %dl
pextrb $8, %xmm0, %esi
addb %dl, %sil
pextrb $10, %xmm0, %edi
pextrb $14, %xmm0, %edx
addb %sil, %dil
pextrb $12, %xmm0, %esi
addb %dil, %sil
addb %sil, %dl
llvm-svn: 170439
2012-12-18 18:40:20 +00:00
Nadav Rotem
9e2542c0cb
Enable the Loop Vectorizer by default for O2 and O3. Disable if-conversion by default. I plan to revert this patch later today.
...
llvm-svn: 170157
2012-12-13 23:11:54 +00:00
Nadav Rotem
ca05f9e72b
Teach the cost model about the optimization in r169904: Truncation of induction variables costs the same as scalar trunc.
...
llvm-svn: 170051
2012-12-13 00:21:03 +00:00
Nadav Rotem
f1990abd0b
Fix indentation.
...
llvm-svn: 170005
2012-12-12 19:39:36 +00:00
Nadav Rotem
2c25a05088
LoopVectorizer: Use the "optsize" attribute to decide if we are allowed to increase the function size.
...
llvm-svn: 170004
2012-12-12 19:29:45 +00:00
Nadav Rotem
8d59a4ff51
Fix the ascii drawing that was ruined when I split the H and CPP
...
llvm-svn: 169955
2012-12-12 01:33:47 +00:00
Nadav Rotem
1696945e9d
fix a typo.
...
llvm-svn: 169953
2012-12-12 01:31:10 +00:00
Nadav Rotem
edcebe4904
LoopVectorizer: When -Os is used, vectorize only loops that dont require a tail loop. There is no testcase because I dont know of a way to initialize the loop vectorizer pass without adding an additional hidden flag.
...
llvm-svn: 169950
2012-12-12 01:11:46 +00:00
Nadav Rotem
054379720d
PR14574. Fix a bug in the code that calculates the mask the converted PHIs in if-conversion.
...
llvm-svn: 169916
2012-12-11 21:30:14 +00:00
Nadav Rotem
fb45c4d6b4
Loop Vectorize: optimize the vectorization of trunc(induction_var). The truncation is now done on scalars.
...
llvm-svn: 169904
2012-12-11 18:58:10 +00:00
Nadav Rotem
0715a221d8
Fix PR14565. Don't if-convert loops that have switch statements in them.
...
llvm-svn: 169813
2012-12-11 04:55:10 +00:00
Nadav Rotem
417eaafbc4
Split the LoopVectorizer into H and CPP.
...
llvm-svn: 169771
2012-12-10 21:39:02 +00:00
Nadav Rotem
196fc7cc8c
Add support for reverse induction variables. For example:
...
while (i--)
sum+=A[i];
llvm-svn: 169752
2012-12-10 19:25:06 +00:00