#include "VPlan.h"
#include "VPlanValue.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.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>
usingnamespacellvm;
#define DEBUG_TYPE …
static unsigned LookaheadMaxDepth = …;
VPInstruction *VPlanSlp::markFailed() { … }
void VPlanSlp::addCombined(ArrayRef<VPValue *> Operands, VPInstruction *New) { … }
bool VPlanSlp::areVectorizable(ArrayRef<VPValue *> Operands) const { … }
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<unsigned> getOpcode(ArrayRef<VPValue *> Values) { … }
static bool areConsecutiveOrMatch(VPInstruction *A, VPInstruction *B,
VPInterleavedAccessInfo &IAI) { … }
static unsigned getLAScore(VPValue *V1, VPValue *V2, unsigned MaxLevel,
VPInterleavedAccessInfo &IAI) { … }
std::pair<VPlanSlp::OpMode, VPValue *>
VPlanSlp::getBest(OpMode Mode, VPValue *Last,
SmallPtrSetImpl<VPValue *> &Candidates,
VPInterleavedAccessInfo &IAI) { … }
SmallVector<VPlanSlp::MultiNodeOpTy, 4> VPlanSlp::reorderMultiNodeOps() { … }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void VPlanSlp::dumpBundle(ArrayRef<VPValue *> Values) {
dbgs() << " Ops: ";
for (auto *Op : Values) {
if (auto *VPInstr = cast_or_null<VPInstruction>(Op))
if (auto *Instr = VPInstr->getUnderlyingInstr()) {
dbgs() << *Instr << " | ";
continue;
}
dbgs() << " nullptr | ";
}
dbgs() << "\n";
}
#endif
VPInstruction *VPlanSlp::buildGraph(ArrayRef<VPValue *> Values) { … }