History log of /external/llvm/lib/Analysis/TargetTransformInfo.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
dce4a407a24b04eebc6a376f8e62b41aaa7b071f 29-May-2014 Stephen Hines <srhines@google.com> Update LLVM for 3.5 rebase (r209712).

Change-Id: I149556c940fb7dc92d075273c87ff584f400941f
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
36b56886974eae4f9c5ebc96befd3e7bfe5de338 24-Apr-2014 Stephen Hines <srhines@google.com> Update to LLVM 3.5a.

Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
65457b679ae240c1a37da82c5484dac478c47b6d 17-Sep-2013 Arnold Schwaighofer <aschwaighofer@apple.com> Costmodel: Add support for horizontal vector reductions

Upcoming SLP vectorization improvements will want to be able to estimate costs
of horizontal reductions. Add infrastructure to support this.

We model reductions as a series of (shufflevector,add) tuples ultimately
followed by an extractelement. For example, for an add-reduction of <4 x float>
we could generate the following sequence:

(v0, v1, v2, v3)
\ \ / /
\ \ /
+ +

(v0+v2, v1+v3, undef, undef)
\ /
((v0+v2) + (v1+v3), undef, undef)

%rdx.shuf = shufflevector <4 x float> %rdx, <4 x float> undef,
<4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
%bin.rdx = fadd <4 x float> %rdx, %rdx.shuf
%rdx.shuf7 = shufflevector <4 x float> %bin.rdx, <4 x float> undef,
<4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
%bin.rdx8 = fadd <4 x float> %bin.rdx, %rdx.shuf7
%r = extractelement <4 x float> %bin.rdx8, i32 0

This commit adds a cost model interface "getReductionCost(Opcode, Ty, Pairwise)"
that will allow clients to ask for the cost of such a reduction (as backends
might generate more efficient code than the cost of the individual instructions
summed up). This interface is excercised by the CostModel analysis pass which
looks for reduction patterns like the one above - starting at extractelements -
and if it sees a matching sequence will call the cost model interface.

We will also support a second form of pairwise reduction that is well supported
on common architectures (haddps, vpadd, faddp).

(v0, v1, v2, v3)
\ / \ /
(v0+v1, v2+v3, undef, undef)
\ /
((v0+v1)+(v2+v3), undef, undef, undef)

%rdx.shuf.0.0 = shufflevector <4 x float> %rdx, <4 x float> undef,
<4 x i32> <i32 0, i32 2 , i32 undef, i32 undef>
%rdx.shuf.0.1 = shufflevector <4 x float> %rdx, <4 x float> undef,
<4 x i32> <i32 1, i32 3, i32 undef, i32 undef>
%bin.rdx.0 = fadd <4 x float> %rdx.shuf.0.0, %rdx.shuf.0.1
%rdx.shuf.1.0 = shufflevector <4 x float> %bin.rdx.0, <4 x float> undef,
<4 x i32> <i32 0, i32 undef, i32 undef, i32 undef>
%rdx.shuf.1.1 = shufflevector <4 x float> %bin.rdx.0, <4 x float> undef,
<4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
%bin.rdx.1 = fadd <4 x float> %rdx.shuf.1.0, %rdx.shuf.1.1
%r = extractelement <4 x float> %bin.rdx.1, i32 0

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190876 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
4f7e2c38e864d7eaeb407ac501478e9579624d1b 11-Sep-2013 Hal Finkel <hfinkel@anl.gov> Add getUnrollingPreferences to TTI

Allow targets to customize the default behavior of the generic loop unrolling
transformation. This will be used by the PowerPC backend when targeting the A2
core (which is in-order with a deep pipeline), and using more aggressive
defaults is important.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190542 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
f208398528efde82bc49f48d0fef0587c1f192bb 29-Aug-2013 Hal Finkel <hfinkel@anl.gov> Revert: r189565 - Add getUnrollingPreferences to TTI

Revert unintentional commit (of an unreviewed change).

Original commit message:

Add getUnrollingPreferences to TTI

Allow targets to customize the default behavior of the generic loop unrolling
transformation. This will be used by the PowerPC backend when targeting the A2
core (which is in-order with a deep pipeline), and using more aggressive
defaults is important.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189566 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
32f258b96a723b771eb44a2c0689b8bf4dd871ee 29-Aug-2013 Hal Finkel <hfinkel@anl.gov> Add getUnrollingPreferences to TTI

Allow targets to customize the default behavior of the generic loop unrolling
transformation. This will be used by the PowerPC backend when targeting the A2
core (which is in-order with a deep pipeline), and using more aggressive
defaults is important.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189565 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
f9355c80d55110ebef66475717b4400f6bb0ad4e 29-Aug-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Handle address spaces in TargetTransformInfo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189527 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
a8a7099c1849fcbb4a68642a292fd0250aa46505 23-Aug-2013 Richard Sandiford <rsandifo@linux.vnet.ibm.com> Turn MipsOptimizeMathLibCalls into a target-independent scalar transform

...so that it can be used for z too. Most of the code is the same.
The only real change is to use TargetTransformInfo to test when a sqrt
instruction is available.

The pass is opt-in because at the moment it only handles sqrt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189097 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
57e6b2d1f3de0bf459e96f7038e692d624f7e580 27-Jul-2013 Tom Stellard <thomas.stellard@amd.com> SimplifyCFG: Use parallel-and and parallel-or mode to consolidate branch conditions

Merge consecutive if-regions if they contain identical statements.
Both transformations reduce number of branches. The transformation
is guarded by a target-hook, and is currently enabled only for +R600,
but the correctness has been tested on X86 target using a variety of
CPU benchmarks.

Patch by: Mei Ye

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187278 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
c0a11edba6ea46c782672ab3fb4e4ab3dc267a22 12-Jul-2013 Arnold Schwaighofer <aschwaighofer@apple.com> TargetTransformInfo: address calculation parameter for gather/scather

Address calculation for gather/scather in vectorized code can incur a
significant cost making vectorization unbeneficial. Add infrastructure to add
cost.
Tests and cost model for targets will be in follow-up commits.

radar://14351991

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186187 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
06f5ebc5a1604b01689cf2d482dd05f956538af6 31-May-2013 Quentin Colombet <qcolombet@apple.com> Loop Strength Reduce: Scaling factor cost.

Account for the cost of scaling factor in Loop Strength Reduce when rating the
formulae. This uses a target hook.

The default implementation of the hook is: if the addressing mode is legal, the
scaling factor is free.

<rdar://problem/13806271>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183045 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
6bf4f676413b8f7d97aaff289997aab344180957 05-Apr-2013 Arnold Schwaighofer <aschwaighofer@apple.com> CostModel: Add parameter to instruction cost to further classify operand values

On certain architectures we can support efficient vectorized version of
instructions if the operand value is uniform (splat) or a constant scalar.
An example of this is a vector shift on x86.

We can efficiently support

for (i = 0 ; i < ; i += 4)
w[0:3] = v[0:3] << <2, 2, 2, 2>

but not

for (i = 0; i < ; i += 4)
w[0:3] = v[0:3] << x[0:3]

This patch adds a parameter to getArithmeticInstrCost to further qualify operand
values as uniform or uniform constant.

Targets can then choose to return a different cost for instructions with such
operand values.

A follow-up commit will test this feature on x86.

radar://13576547

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178807 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
ac5b3915aa64d287057752c2c90cfe04adacfa11 12-Mar-2013 Patrik Hagglund <patrik.h.hagglund@ericsson.com> Small fix for cost analysis of ptrtoint.

This seems to be a "copy-paste error" introducecd in r156140.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176863 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
fb55a8fd7c38aa09d9c243d48a8a72d890f36a3d 08-Feb-2013 Arnold Schwaighofer <aschwaighofer@apple.com> ARM cost model: Address computation in vector mem ops not free

Adds a function to target transform info to query for the cost of address
computation. The cost model analysis pass now also queries this interface.
The code in LoopVectorize adds the cost of address computation as part of the
memory instruction cost calculation. Only there, we know whether the instruction
will be scalarized or not.
Increase the penality for inserting in to D registers on swift. This becomes
necessary because we now always assume that address computation has a cost and
three is a closer value to the architecture.

radar://13097204

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174713 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
13086a658ae06046ded902229f9918b8bad505bd 22-Jan-2013 Chandler Carruth <chandlerc@gmail.com> Begin fleshing out an interface in TTI for modelling the costs of
generic function calls and intrinsics. This is somewhat overlapping with
an existing intrinsic cost method, but that one seems targetted at
vector intrinsics. I'll merge them or separate their names and use cases
in a separate commit.

This sinks the test of 'callIsSmall' down into TTI where targets can
control it. The whole thing feels very hack-ish to me though. I've left
a FIXME comment about the fundamental design problem this presents. It
isn't yet clear to me what the users of this function *really* care
about. I'll have to do more analysis to figure that out. Putting this
here at least provides it access to proper analysis pass tools and other
such. It also allows us to more cleanly implement the baseline cost
interfaces in TTI.

With this commit, it is now theoretically possible to simplify much of
the inline cost analysis's handling of calls by calling through to this
interface. That conversion will have to happen in subsequent commits as
it requires more extensive restructuring of the inline cost analysis.

The CodeMetrics class is now really only in the business of running over
a block of code and aggregating the metrics on that block of code, with
the actual cost evaluation done entirely in terms of TTI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173148 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
a5157e68d183e1bdf010e94a15dc0c44b65f889b 21-Jan-2013 Chandler Carruth <chandlerc@gmail.com> Switch CodeMetrics itself over to use TTI to determine if an instruction
is free. The whole CodeMetrics API should probably be reworked more, but
this is enough to allow deleting the duplicate code there for computing
whether an instruction is free.

All of the passes using this have been updated to pull in TTI and hand
it to the CodeMetrics stuff. Further, a dead CodeMetrics API
(analyzeFunction) is nuked for lack of users.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173036 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
1e05bd9e714934a71ff933ad15f0b884808b405f 21-Jan-2013 Chandler Carruth <chandlerc@gmail.com> Introduce a generic interface for querying an operation's expected
lowered cost.

Currently, this is a direct port of the logic implementing
isInstructionFree in CodeMetrics. The hope is that the interface can be
improved (f.ex. supporting un-formed instruction queries) and the
implementation abstracted so that as we have test cases and target
knowledge we can expose increasingly accurate heuristics to clients.

I'll start switching existing consumers over and kill off the routine in
CodeMetrics in subsequent commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172998 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
053a2119835ac6ca3484f1b496cabd43c37e4279 20-Jan-2013 Renato Golin <renato.golin@linaro.org> Revert CostTable algorithm, will re-write

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172992 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
065db2347f4df7a92f18221bd7288ebcd4c38c35 19-Jan-2013 Renato Golin <renato.golin@linaro.org> Fix 80-col and early exit in cost model

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172877 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
d3c965d6251e6d939f7797f8704d4e3a82f7e274 16-Jan-2013 Renato Golin <renato.golin@linaro.org> Change CostTable model to be global to all targets

Moving the X86CostTable to a common place, so that other back-ends
can share the code. Also simplifying it a bit and commoning up
tables with one and two types on operations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172658 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
14925e6b885f8bd8cf448627386d412831f4bf1b 09-Jan-2013 Nadav Rotem <nrotem@apple.com> 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
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
83be7b0dd3ae9a3cb22d36ae4c1775972553b94b 09-Jan-2013 Nadav Rotem <nrotem@apple.com> 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
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
e4ba75f43e2ab1480d119d2d4eb878256274e0fb 07-Jan-2013 Chandler Carruth <chandlerc@gmail.com> 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
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
d1b8ef97c47d347f2a2261a0d6de4872f248321f 07-Jan-2013 Chandler Carruth <chandlerc@gmail.com> 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
/external/llvm/lib/Analysis/TargetTransformInfo.cpp
be04929f7fd76a921540e9901f24563e51dc1219 07-Jan-2013 Chandler Carruth <chandlerc@gmail.com> 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
/external/llvm/lib/Analysis/TargetTransformInfo.cpp