Bill Wendling
698e84fc4f
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
0b37f14371
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
5350cd314b
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
3f7c4f36ba
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
b44f890133
LoopVectorize: Enable vectorization of the fmuladd intrinsic
...
llvm-svn: 171076
2012-12-25 23:21:29 +00:00
Nadav Rotem
5f7c12cfbd
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
bd5d1d832a
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
28691400dd
LoopVectorize: Fix accidentaly inverted condition.
...
llvm-svn: 171001
2012-12-23 13:21:41 +00:00
Benjamin Kramer
855ba03408
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
2cade68025
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
c79e42c5ce
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
a229186a82
Remove duplicate includes.
...
llvm-svn: 170902
2012-12-21 17:06:44 +00:00
Nadav Rotem
3b850b70b3
Enable if-conversion.
...
llvm-svn: 170841
2012-12-21 04:47:54 +00:00
Nadav Rotem
e7785686a5
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
2ababf68d7
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
8b20c0a814
Loop Vectorizer: turn-off if-conversion.
...
llvm-svn: 170708
2012-12-20 17:42:53 +00:00
Nadav Rotem
7bdc45b570
Loop Vectorizer: Enable if-conversion.
...
llvm-svn: 170632
2012-12-20 02:00:02 +00:00
Bill Wendling
3d7b0b8ac7
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
f0e5d2f032
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
e5e28b48c8
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
36510f7194
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
6027bdf898
Fix indentation.
...
llvm-svn: 170005
2012-12-12 19:39:36 +00:00
Nadav Rotem
d0bb22bba3
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
6798a04b15
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
4fa2e3d5af
fix a typo.
...
llvm-svn: 169953
2012-12-12 01:31:10 +00:00
Nadav Rotem
aeb17df802
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
f707bf4ca3
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
e266efb70b
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
dbb3328194
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
07df5ac1a1
Split the LoopVectorizer into H and CPP.
...
llvm-svn: 169771
2012-12-10 21:39:02 +00:00
Nadav Rotem
7b5b55c195
Add support for reverse induction variables. For example:
...
while (i--)
sum+=A[i];
llvm-svn: 169752
2012-12-10 19:25:06 +00:00
Paul Redmond
2adb13c100
LoopVectorize: support vectorizing intrinsic calls
...
- added function to VectorTargetTransformInfo to query cost of intrinsics
- vectorize trivially vectorizable intrinsic calls such as sin, cos, log, etc.
Reviewed by: Nadav
llvm-svn: 169711
2012-12-09 20:42:17 +00:00
Paul Redmond
f7cd6b391a
test commit.
...
llvm-svn: 169709
2012-12-09 19:46:31 +00:00
Nadav Rotem
a8f026e2d4
LoopVectorizer: Increase the number of pointers that can be tested at runtime. If we cant prove statically that the pointers are disjoint then we add the runtime check.
...
llvm-svn: 169334
2012-12-04 23:25:24 +00:00
Nadav Rotem
87fc988c5d
Enable if-conversion during vectorization.
...
llvm-svn: 169331
2012-12-04 22:59:52 +00:00
Nadav Rotem
93fa5ef957
Fix a bug in vectorization of if-converted reduction variables. If the
...
reduction variable is not used outside the loop then we ran into an
endless loop. This change checks if we found the original PHI.
llvm-svn: 169324
2012-12-04 22:40:22 +00:00
Nadav Rotem
a10b311aec
Add support for reduction variables when IF-conversion is enabled.
...
llvm-svn: 169288
2012-12-04 18:17:33 +00:00
Nadav Rotem
07674cb566
Give scalar if-converted blocks half the score because they are not always executed due to CF.
...
llvm-svn: 169223
2012-12-04 07:11:52 +00:00
Nadav Rotem
628c2dba60
Add the last part that is needed for vectorization of if-converted code.
...
Added the code that actually performs the if-conversion during vectorization.
We can now vectorize this code:
for (int i=0; i<n; ++i) {
unsigned k = 0;
if (a[i] > b[i]) <------ IF inside the loop.
k = k * 5 + 3;
a[i] = k; <---- K is a phi node that becomes vector-select.
}
llvm-svn: 169217
2012-12-04 06:15:11 +00:00
NAKAMURA Takumi
f99b535fdb
LoopVectorize.cpp: Suppress a warning. [-Wunused-variable]
...
llvm-svn: 169195
2012-12-04 00:49:34 +00:00
NAKAMURA Takumi
8b07bc579b
Fix whitespace.
...
llvm-svn: 169194
2012-12-04 00:49:28 +00:00
Nadav Rotem
d479a57f68
minor renaming, documentation and cleanups.
...
llvm-svn: 169175
2012-12-03 22:57:09 +00:00
Nadav Rotem
fad16be973
IF-conversion: teach the cost-model how to grade if-converted loops.
...
llvm-svn: 169171
2012-12-03 22:46:31 +00:00
Nadav Rotem
eee203d885
Now that we have a basic if-conversion infrastructure we can rename the
...
"single basic block loop vectorizer" to "innermost loop vectorizer".
llvm-svn: 169158
2012-12-03 21:33:08 +00:00
Nadav Rotem
a30aba7a01
Add initial support for IF-conversion. This patch implements the first 1/3,
...
which is the legality of the if-conversion transformation. The next step is to
implement the cost-model for the if-converted code as well as the
vectorization itself.
llvm-svn: 169152
2012-12-03 21:06:35 +00:00
Chandler Carruth
ed0881b2a6
Use the new script to sort the includes of every file under lib.
...
Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.
Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]
llvm-svn: 169131
2012-12-03 16:50:05 +00:00
Nadav Rotem
3ae24ee08a
minor cleanups
...
llvm-svn: 169048
2012-11-30 22:37:11 +00:00
Nadav Rotem
6b494be886
Remove the use of LPPassManager. We can remove LPM because we dont need to run any additional loop passes on the new vector loop.
...
llvm-svn: 169016
2012-11-30 17:27:53 +00:00
Nadav Rotem
8dd6ee8df5
When broadcasting invariant scalars into vectors, place the broadcast code in the preheader.
...
llvm-svn: 168927
2012-11-29 19:25:41 +00:00
Nadav Rotem
caf5acfd14
Move the code that uses SCEVs prior to creating the new loops.
...
llvm-svn: 168601
2012-11-26 19:51:46 +00:00