LLVM 22.0.0git
VPlanSLP.cpp File Reference
#include "VPlanSLP.h"
#include "VPlan.h"
#include "VPlanCFG.h"
#include "VPlanValue.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/VectorUtils.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <optional>
#include <utility>

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "vplan-slp"

Functions

static SmallVector< VPValue *, 4 > getOperands (ArrayRef< VPValue * > Values, unsigned OperandIndex)
static bool areCommutative (ArrayRef< VPValue * > Values)
static SmallVector< SmallVector< VPValue *, 4 >, 4 > getOperands (ArrayRef< VPValue * > Values)
static std::optional< unsignedgetOpcode (ArrayRef< VPValue * > Values)
 Returns the opcode of Values or ~0 if they do not all agree.
static bool areConsecutiveOrMatch (VPInstruction *A, VPInstruction *B, VPInterleavedAccessInfo &IAI)
 Returns true if A and B access sequential memory if they are loads or stores or if they have identical opcodes otherwise.
static unsigned getLAScore (VPValue *V1, VPValue *V2, unsigned MaxLevel, VPInterleavedAccessInfo &IAI)
 Implements getLAScore from Listing 7 in the paper.

Variables

static unsigned LookaheadMaxDepth = 5

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "vplan-slp"

Definition at line 40 of file VPlanSLP.cpp.

Function Documentation

◆ areCommutative()

bool areCommutative ( ArrayRef< VPValue * > Values)
static

Definition at line 221 of file VPlanSLP.cpp.

References llvm::cast(), getOpcode(), and llvm::Instruction::isCommutative().

Referenced by llvm::VPlanSlp::buildGraph().

◆ areConsecutiveOrMatch()

bool areConsecutiveOrMatch ( VPInstruction * A,
VPInstruction * B,
VPInterleavedAccessInfo & IAI )
static

Returns true if A and B access sequential memory if they are loads or stores or if they have identical opcodes otherwise.

Definition at line 258 of file VPlanSLP.cpp.

References A(), B(), and llvm::VPInterleavedAccessInfo::getInterleaveGroup().

Referenced by getLAScore().

◆ getLAScore()

unsigned getLAScore ( VPValue * V1,
VPValue * V2,
unsigned MaxLevel,
VPInterleavedAccessInfo & IAI )
static

Implements getLAScore from Listing 7 in the paper.

Traverses and compares operands of V1 and V2 to MaxLevel.

Definition at line 274 of file VPlanSLP.cpp.

References areConsecutiveOrMatch(), llvm::dyn_cast(), getLAScore(), and I.

Referenced by getLAScore().

◆ getOpcode()

std::optional< unsigned > getOpcode ( ArrayRef< VPValue * > Values)
static

Returns the opcode of Values or ~0 if they do not all agree.

Definition at line 247 of file VPlanSLP.cpp.

References llvm::any_of(), and llvm::cast().

Referenced by llvm::R600InstrInfo::analyzeBranch(), areCommutative(), llvm::VPlanSlp::buildGraph(), buildNew(), canonicalHeaderAndLatch(), canSplitIdx(), llvm::VPWidenRecipe::clone(), combineExtractWithShuffle(), combineINSERT_SUBVECTOR(), combineSelect(), combineToHorizontalAddSub(), llvm::VPWidenRecipe::computeCost(), llvm::slpvectorizer::BoUpSLP::computeMinimumValueSizes(), llvm::ConstantExprKeyType::ConstantExprKeyType(), llvm::ConstantExprKeyType::ConstantExprKeyType(), llvm::ConstantFoldBinaryInstruction(), FoldBUILD_VECTOR(), llvm::SelectionDAG::FoldConstantArithmetic(), llvm::InstCombinerImpl::freelyInvertAllUsersOf(), llvm::RISCVMatInt::generateInstSeq(), getAltInstrMask(), llvm::Instruction::getOpcodeName(), getVFScaleFactor(), llvm::VPInstruction::hasResult(), llvm::Instruction::isArithmeticShift(), llvm::Instruction::isBinaryOp(), llvm::Instruction::isBitwiseLogicOp(), llvm::Instruction::isCast(), llvm::Instruction::isEHPad(), llvm::Instruction::isFenceLike(), llvm::Instruction::isFPDivRem(), llvm::Instruction::isFuncletPad(), llvm::Instruction::isIdempotent(), llvm::Instruction::isIntDivRem(), llvm::Instruction::isLogicalShift(), llvm::Instruction::isNilpotent(), llvm::Instruction::isShift(), isSignedMinMaxClamp(), llvm::Instruction::isSpecialTerminator(), llvm::Instruction::isTerminator(), llvm::Instruction::isUnaryOp(), LinearizeExprTree(), LLVMGetConstOpcode(), lowerV8I16Shuffle(), llvm::slpvectorizer::BoUpSLP::reorderTopToBottom(), ReorganizeVector(), scalarize(), llvm::InstCombinerImpl::visitCallInst(), and llvm::InstCombinerImpl::visitShl().

◆ getOperands() [1/2]

SmallVector< SmallVector< VPValue *, 4 >, 4 > getOperands ( ArrayRef< VPValue * > Values)
static

◆ getOperands() [2/2]

SmallVector< VPValue *, 4 > getOperands ( ArrayRef< VPValue * > Values,
unsigned OperandIndex )
static

Definition at line 210 of file VPlanSLP.cpp.

References llvm::cast(), and Operands.

Referenced by llvm::VPlanSlp::buildGraph(), getInvertibleOperands(), and getOperands().

Variable Documentation

◆ LookaheadMaxDepth

unsigned LookaheadMaxDepth = 5
static

Definition at line 43 of file VPlanSLP.cpp.