LLVM  13.0.0git
Macros | Functions | Variables
VectorCombine.cpp File Reference
#include "llvm/Transforms/Vectorize/VectorCombine.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/Loads.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Analysis/VectorUtils.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Vectorize.h"
Include dependency graph for VectorCombine.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "vector-combine"
 

Functions

 STATISTIC (NumVecLoad, "Number of vector loads formed")
 
 STATISTIC (NumVecCmp, "Number of vector compares formed")
 
 STATISTIC (NumVecBO, "Number of vector binops formed")
 
 STATISTIC (NumVecCmpBO, "Number of vector compare + binop formed")
 
 STATISTIC (NumShufOfBitcast, "Number of shuffles moved after bitcast")
 
 STATISTIC (NumScalarBO, "Number of scalar binops formed")
 
 STATISTIC (NumScalarCmp, "Number of scalar compares formed")
 
static void replaceValue (Value &Old, Value &New)
 
static ValuecreateShiftShuffle (Value *Vec, unsigned OldIndex, unsigned NewIndex, IRBuilder<> &Builder)
 Create a shuffle that translates (shifts) 1 element from the input vector to a new element location. More...
 
static ExtractElementInsttranslateExtract (ExtractElementInst *ExtElt, unsigned NewIndex, IRBuilder<> &Builder)
 Given an extract element instruction with constant index operand, shuffle the source vector (shift the scalar element) to a NewIndex for extraction. More...
 
 INITIALIZE_PASS_BEGIN (VectorCombineLegacyPass, "vector-combine", "Optimize scalar/vector ops", false, false) INITIALIZE_PASS_END(VectorCombineLegacyPass
 

Variables

static cl::opt< bool > DisableVectorCombine ("disable-vector-combine", cl::init(false), cl::Hidden, cl::desc("Disable all vector combine transforms"))
 
static cl::opt< bool > DisableBinopExtractShuffle ("disable-binop-extract-shuffle", cl::init(false), cl::Hidden, cl::desc("Disable binop extract to shuffle transforms"))
 
static const unsigned InvalidIndex = std::numeric_limits<unsigned>::max()
 
vector combine
 
vector Optimize scalar vector ops
 
vector Optimize scalar vector false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "vector-combine"

Definition at line 36 of file VectorCombine.cpp.

Function Documentation

◆ createShiftShuffle()

static Value* createShiftShuffle ( Value Vec,
unsigned  OldIndex,
unsigned  NewIndex,
IRBuilder<> &  Builder 
)
static

Create a shuffle that translates (shifts) 1 element from the input vector to a new element location.

Definition at line 367 of file VectorCombine.cpp.

References Builder, llvm::Value::getType(), and llvm::UndefMaskElem.

Referenced by translateExtract().

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( VectorCombineLegacyPass  ,
"vector-combine ,
"Optimize scalar/vector ops ,
false  ,
false   
)

◆ replaceValue()

static void replaceValue ( Value Old,
Value New 
)
static

Definition at line 89 of file VectorCombine.cpp.

References llvm::Value::replaceAllUsesWith().

◆ STATISTIC() [1/7]

STATISTIC ( NumScalarBO  ,
"Number of scalar binops formed"   
)

◆ STATISTIC() [2/7]

STATISTIC ( NumScalarCmp  ,
"Number of scalar compares formed"   
)

◆ STATISTIC() [3/7]

STATISTIC ( NumShufOfBitcast  ,
"Number of shuffles moved after bitcast"   
)

◆ STATISTIC() [4/7]

STATISTIC ( NumVecBO  ,
"Number of vector binops formed"   
)

◆ STATISTIC() [5/7]

STATISTIC ( NumVecCmp  ,
"Number of vector compares formed"   
)

◆ STATISTIC() [6/7]

STATISTIC ( NumVecCmpBO  ,
"Number of vector compare + binop formed"   
)

◆ STATISTIC() [7/7]

STATISTIC ( NumVecLoad  ,
"Number of vector loads formed"   
)

◆ translateExtract()

static ExtractElementInst* translateExtract ( ExtractElementInst ExtElt,
unsigned  NewIndex,
IRBuilder<> &  Builder 
)
static

Given an extract element instruction with constant index operand, shuffle the source vector (shift the scalar element) to a NewIndex for extraction.

Return null if the input can be constant folded, so that we are not creating unnecessary instructions.

Definition at line 382 of file VectorCombine.cpp.

References assert(), Builder, createShiftShuffle(), llvm::ExtractElementInst::getIndexOperand(), llvm::ExtractElementInst::getVectorOperand(), and X.

Variable Documentation

◆ combine

vector combine

Definition at line 831 of file VectorCombine.cpp.

◆ DisableBinopExtractShuffle

cl::opt<bool> DisableBinopExtractShuffle("disable-binop-extract-shuffle", cl::init(false), cl::Hidden, cl::desc("Disable binop extract to shuffle transforms"))
static

◆ DisableVectorCombine

cl::opt<bool> DisableVectorCombine("disable-vector-combine", cl::init(false), cl::Hidden, cl::desc("Disable all vector combine transforms"))
static

◆ false

vector Optimize scalar vector false

Definition at line 832 of file VectorCombine.cpp.

◆ InvalidIndex

const unsigned InvalidIndex = std::numeric_limits<unsigned>::max()
static

Definition at line 53 of file VectorCombine.cpp.

◆ ops

vector Optimize scalar vector ops

Definition at line 832 of file VectorCombine.cpp.