2012-02-01 04:51:43 +01:00
|
|
|
//===-- Vectorize.h - Vectorization Transformations -------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This header file defines prototypes for accessor functions that expose passes
|
|
|
|
// in the Vectorize transformations library.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_TRANSFORMS_VECTORIZE_H
|
|
|
|
#define LLVM_TRANSFORMS_VECTORIZE_H
|
|
|
|
|
|
|
|
namespace llvm {
|
2012-04-05 10:05:16 +02:00
|
|
|
class BasicBlock;
|
2012-02-01 04:51:43 +01:00
|
|
|
class BasicBlockPass;
|
2012-12-03 17:50:05 +01:00
|
|
|
class Pass;
|
2012-02-01 04:51:43 +01:00
|
|
|
|
2012-04-05 17:46:55 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
/// @brief Vectorize configuration.
|
|
|
|
struct VectorizeConfig {
|
|
|
|
//===--------------------------------------------------------------------===//
|
|
|
|
// Target architecture related parameters
|
|
|
|
|
|
|
|
/// @brief The size of the native vector registers.
|
|
|
|
unsigned VectorBits;
|
|
|
|
|
2012-06-24 15:28:01 +02:00
|
|
|
/// @brief Vectorize boolean values.
|
|
|
|
bool VectorizeBools;
|
|
|
|
|
2012-04-07 05:56:23 +02:00
|
|
|
/// @brief Vectorize integer values.
|
|
|
|
bool VectorizeInts;
|
2012-04-05 17:46:55 +02:00
|
|
|
|
2012-04-07 05:56:23 +02:00
|
|
|
/// @brief Vectorize floating-point values.
|
|
|
|
bool VectorizeFloats;
|
2012-04-05 17:46:55 +02:00
|
|
|
|
2012-04-14 09:32:43 +02:00
|
|
|
/// @brief Vectorize pointer values.
|
|
|
|
bool VectorizePointers;
|
|
|
|
|
2012-04-07 05:56:23 +02:00
|
|
|
/// @brief Vectorize casting (conversion) operations.
|
|
|
|
bool VectorizeCasts;
|
2012-04-05 17:46:55 +02:00
|
|
|
|
2012-04-07 05:56:23 +02:00
|
|
|
/// @brief Vectorize floating-point math intrinsics.
|
|
|
|
bool VectorizeMath;
|
2012-04-05 17:46:55 +02:00
|
|
|
|
2014-04-25 05:33:48 +02:00
|
|
|
/// @brief Vectorize bit intrinsics.
|
|
|
|
bool VectorizeBitManipulations;
|
|
|
|
|
2012-04-07 05:56:23 +02:00
|
|
|
/// @brief Vectorize the fused-multiply-add intrinsic.
|
|
|
|
bool VectorizeFMA;
|
2012-04-05 17:46:55 +02:00
|
|
|
|
2012-04-13 22:45:45 +02:00
|
|
|
/// @brief Vectorize select instructions.
|
|
|
|
bool VectorizeSelect;
|
|
|
|
|
2012-06-23 23:52:50 +02:00
|
|
|
/// @brief Vectorize comparison instructions.
|
|
|
|
bool VectorizeCmp;
|
|
|
|
|
2012-04-14 09:32:43 +02:00
|
|
|
/// @brief Vectorize getelementptr instructions.
|
|
|
|
bool VectorizeGEP;
|
|
|
|
|
2012-04-07 05:56:23 +02:00
|
|
|
/// @brief Vectorize loads and stores.
|
|
|
|
bool VectorizeMemOps;
|
2012-04-05 17:46:55 +02:00
|
|
|
|
|
|
|
/// @brief Only generate aligned loads and stores.
|
|
|
|
bool AlignedOnly;
|
|
|
|
|
|
|
|
//===--------------------------------------------------------------------===//
|
|
|
|
// Misc parameters
|
|
|
|
|
|
|
|
/// @brief The required chain depth for vectorization.
|
|
|
|
unsigned ReqChainDepth;
|
|
|
|
|
|
|
|
/// @brief The maximum search distance for instruction pairs.
|
|
|
|
unsigned SearchLimit;
|
|
|
|
|
|
|
|
/// @brief The maximum number of candidate pairs with which to use a full
|
|
|
|
/// cycle check.
|
|
|
|
unsigned MaxCandPairsForCycleCheck;
|
|
|
|
|
|
|
|
/// @brief Replicating one element to a pair breaks the chain.
|
|
|
|
bool SplatBreaksChain;
|
|
|
|
|
|
|
|
/// @brief The maximum number of pairable instructions per group.
|
|
|
|
unsigned MaxInsts;
|
|
|
|
|
BBVectorize: Cap the number of candidate pairs in each instruction group
For some basic blocks, it is possible to generate many candidate pairs for
relatively few pairable instructions. When many (tens of thousands) of these pairs
are generated for a single instruction group, the time taken to generate and
rank the different vectorization plans can become quite large. As a result, we now
cap the number of candidate pairs within each instruction group. This is done by
closing out the group once the threshold is reached (set now at 3000 pairs).
Although this will limit the overall compile-time impact, this may not be the best
way to achieve this result. It might be better, for example, to prune excessive
candidate pairs after the fact the prevent the generation of short, but highly-connected
groups. We can experiment with this in the future.
This change reduces the overall compile-time slowdown of the csa.ll test case in
PR15222 to ~5x. If 5x is still considered too large, a lower limit can be
used as the default.
This represents a functionality change, but only for very large inputs
(thus, there is no regression test).
llvm-svn: 175251
2013-02-15 05:28:42 +01:00
|
|
|
/// @brief The maximum number of candidate instruction pairs per group.
|
|
|
|
unsigned MaxPairs;
|
|
|
|
|
2012-04-05 17:46:55 +02:00
|
|
|
/// @brief The maximum number of pairing iterations.
|
|
|
|
unsigned MaxIter;
|
|
|
|
|
2012-06-28 07:42:42 +02:00
|
|
|
/// @brief Don't try to form odd-length vectors.
|
|
|
|
bool Pow2LenOnly;
|
|
|
|
|
2012-04-05 17:46:55 +02:00
|
|
|
/// @brief Don't boost the chain-depth contribution of loads and stores.
|
|
|
|
bool NoMemOpBoost;
|
|
|
|
|
|
|
|
/// @brief Use a fast instruction dependency analysis.
|
|
|
|
bool FastDep;
|
|
|
|
|
|
|
|
/// @brief Initialize the VectorizeConfig from command line options.
|
|
|
|
VectorizeConfig();
|
|
|
|
};
|
|
|
|
|
2012-02-01 04:51:43 +01:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// BBVectorize - A basic-block vectorization pass.
|
|
|
|
//
|
2012-04-05 17:46:55 +02:00
|
|
|
BasicBlockPass *
|
|
|
|
createBBVectorizePass(const VectorizeConfig &C = VectorizeConfig());
|
2012-02-01 04:51:43 +01:00
|
|
|
|
2012-10-17 20:25:06 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// LoopVectorize - Create a loop vectorization pass.
|
|
|
|
//
|
2013-12-05 22:20:02 +01:00
|
|
|
Pass *createLoopVectorizePass(bool NoUnrolling = false,
|
|
|
|
bool AlwaysVectorize = true);
|
2012-10-17 20:25:06 +02:00
|
|
|
|
2013-04-09 21:44:35 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// SLPVectorizer - Create a bottom-up SLP vectorizer pass.
|
|
|
|
//
|
|
|
|
Pass *createSLPVectorizerPass();
|
|
|
|
|
2012-04-05 10:05:16 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
/// @brief Vectorize the BasicBlock.
|
|
|
|
///
|
|
|
|
/// @param BB The BasicBlock to be vectorized
|
|
|
|
/// @param P The current running pass, should require AliasAnalysis and
|
|
|
|
/// ScalarEvolution. After the vectorization, AliasAnalysis,
|
|
|
|
/// ScalarEvolution and CFG are preserved.
|
|
|
|
///
|
|
|
|
/// @return True if the BB is changed, false otherwise.
|
|
|
|
///
|
2012-04-05 17:46:55 +02:00
|
|
|
bool vectorizeBasicBlock(Pass *P, BasicBlock &BB,
|
|
|
|
const VectorizeConfig &C = VectorizeConfig());
|
2012-04-05 10:05:16 +02:00
|
|
|
|
2016-07-01 01:11:38 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// LoadStoreVectorizer - Create vector loads and stores, but leave scalar
|
|
|
|
// operations.
|
|
|
|
//
|
2016-07-01 04:07:22 +02:00
|
|
|
Pass *createLoadStoreVectorizerPass();
|
2016-07-01 01:11:38 +02:00
|
|
|
|
2015-06-23 11:49:53 +02:00
|
|
|
} // End llvm namespace
|
2012-02-01 04:51:43 +01:00
|
|
|
|
|
|
|
#endif
|