LLVM  10.0.0
Macros | Functions | Variables
MVETailPredication.cpp File Reference

Armv8.1m introduced MVE, M-Profile Vector Extension, and low-overhead branches to help accelerate DSP applications. More...

#include "ARM.h"
#include "ARMSubtarget.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionExpander.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicsARM.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/Support/Debug.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
Include dependency graph for MVETailPredication.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "mve-tail-predication"
 
#define DESC   "Transform predicated vector loops to use MVE tail predication"
 

Functions

static bool IsDecrement (Instruction &I)
 
static bool IsMasked (Instruction *I)
 
static VectorType * getVectorType (IntrinsicInst *I)
 
static void Cleanup (DenseMap< Instruction *, Instruction *> &NewPredicates, SetVector< Instruction *> &MaybeDead, Loop *L)
 

Variables

cl::opt< bool > DisableTailPredication ("disable-mve-tail-predication", cl::Hidden, cl::init(true), cl::desc("Disable MVE Tail Predication"))
 

Detailed Description

Armv8.1m introduced MVE, M-Profile Vector Extension, and low-overhead branches to help accelerate DSP applications.

These two extensions can be combined to provide implicit vector predication within a low-overhead loop. The HardwareLoops pass inserts intrinsics identifying loops that the backend will attempt to convert into a low-overhead loop. The vectorizer is responsible for generating a vectorized loop in which the lanes are predicated upon the iteration counter. This pass looks at these predicated vector loops, that are targets for low-overhead loops, and prepares it for code generation. Once the vectorizer has produced a masked loop, there's a couple of final forms:

This pass inserts the inserts the VCTP intrinsic to represent the effect of tail predication. This will be picked up by the ARM Low-overhead loop pass, which performs the final transformation to a DLSTP or WLSTP tail-predicated loop.

Definition in file MVETailPredication.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "mve-tail-predication"

Definition at line 47 of file MVETailPredication.cpp.

Referenced by llvm::createMVETailPredicationPass().

◆ DESC

#define DESC   "Transform predicated vector loops to use MVE tail predication"

Definition at line 48 of file MVETailPredication.cpp.

Referenced by llvm::createMVETailPredicationPass().

Function Documentation

◆ Cleanup()

static void Cleanup ( DenseMap< Instruction *, Instruction *> &  NewPredicates,
SetVector< Instruction *> &  MaybeDead,
Loop *  L 
)
static

Definition at line 410 of file MVETailPredication.cpp.

References llvm::PHINode::addIncoming(), llvm::LoopBase< BlockT, LoopT >::blocks(), llvm::Instruction::clone(), llvm::SetVector< T, Vector, Set >::count(), llvm::dbgs(), llvm::RegState::Dead, llvm::DeleteDeadPHIs(), llvm::User::dropAllReferences(), llvm::Value::dump(), llvm::dyn_cast(), llvm::SetVector< T, Vector, Set >::empty(), llvm::Instruction::eraseFromParent(), llvm::SetVector< T, Vector, Set >::front(), llvm::IntegerType::get(), llvm::ConstantInt::get(), llvm::IRBuilderBase::getContext(), llvm::Intrinsic::getDeclaration(), llvm::BasicBlock::getFirstNonPHI(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), llvm::LoopBase< BlockT, LoopT >::getLoopPreheader(), llvm::BasicBlock::getModule(), llvm::SequentialType::getNumElements(), llvm::LoopBase< BlockT, LoopT >::getUniqueExitBlock(), getVectorType(), llvm::Value::hasNUsesOrMore(), llvm::SetVector< T, Vector, Set >::insert(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::Instruction::insertBefore(), llvm::Instruction::isSameOperationAs(), LLVM_DEBUG, llvm_unreachable, llvm::User::operands(), llvm::SetVector< T, Vector, Set >::remove(), and llvm::Value::replaceAllUsesWith().

Referenced by llvm::MachineFunction::addSEHCleanupHandler(), llvm::calculateClrEHStateNumbers(), llvm::AArch64FrameLowering::emitEpilogue(), llvm::AArch64FrameLowering::emitPrologue(), llvm::formDedicatedExitBlocks(), getCondFromFCMOV(), llvm::MachineFunction::getLandingPads(), and isPromotedResultSafe().

◆ getVectorType()

static VectorType* getVectorType ( IntrinsicInst *  I)
static

◆ IsDecrement()

static bool IsDecrement ( Instruction &  I)
static

Definition at line 104 of file MVETailPredication.cpp.

References llvm::dyn_cast(), and I.

Referenced by IsMasked().

◆ IsMasked()

static bool IsMasked ( Instruction *  I)
static

Variable Documentation

◆ DisableTailPredication

cl::opt<bool> DisableTailPredication("disable-mve-tail-predication", cl::Hidden, cl::init(true), cl::desc("Disable MVE Tail Predication"))

Referenced by IsMasked().