26#define DEBUG_PREFIX_LOCAL DEBUG_PREFIX "LoadStoreVec: "
39 if (!Sched.trySchedule(Bndl))
47 SmallPtrSet<Instruction *, 8> DeadCandidates;
48 for (
auto *SI : Stores) {
51 DeadCandidates.insert(PtrI);
52 SI->eraseFromParent();
54 for (
auto *
Op : Operands) {
58 DeadCandidates.insert(PtrI);
62 for (
auto *PtrI : DeadCandidates)
63 if (!PtrI->hasNUsesOrMore(1))
64 PtrI->eraseFromParent();
71 Function &
F = *Bndl[0]->getParent()->getParent();
72 DL = &
F.getParent()->getDataLayout();
73 auto &Ctx =
F.getContext();
76 Bndl,
A.getScalarEvolution(), *DL))
78 if (!canVectorize(Bndl,
Sched))
86 for (
auto *
I : Bndl) {
99 if (LI->getParent() != BB)
101 if (LI->hasNUsesOrMore(2))
107 if (!AllLoads && !AllConstants)
114 Value *VecOp =
nullptr;
123 Loads,
A.getScalarEvolution(), *DL);
128 if (!canVectorize(Loads,
Sched)) {
140 }
else if (AllConstants) {
147 for (
Value *Elm : AggrCOp->operands())
151 Constants.push_back(SeqCOp->getElementAsConstant(ElmIdx));
153 auto *ZeroElm = Zero->getSequentialElement();
154 for ([[maybe_unused]]
auto Cnt :
156 Constants.push_back(ZeroElm);
159 for ([[maybe_unused]]
auto Cnt :
163 Constants.push_back(Elm);
166 for ([[maybe_unused]]
auto Cnt :
170 Constants.push_back(Elm);
172 Constants.push_back(COp);
185 tryEraseDeadInstrs(Bndl, Operands);
191 <<
" (After=" << CostAfter <<
" Before=" << CostBefore
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file defines an InstructionCost class that is used when calculating the cost of an instruction,...
static constexpr Value * getValue(Ty &ValueOrUse)
#define DEBUG_PREFIX_LOCAL
PostRA Machine Instruction Scheduler
void reserve(size_type N)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
static LLVM_ABI Constant * get(Type *Ty, double V)
This returns a ConstantFP, or a vector containing a splat of a ConstantFP, for the specified value in...
static LLVM_ABI Constant * get(Type *Ty, uint64_t V, bool IsSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
static LLVM_ABI Constant * get(ArrayRef< Constant * > V)
static bool differentBlock(ArrayRef< ValueT * > Instrs)
static bool areUnique(ArrayRef< ValueT * > Values)
static LLVM_ABI LoadInst * create(Type *Ty, Value *Ptr, MaybeAlign Align, InsertPosition Pos, bool IsVolatile, Context &Ctx, const Twine &Name="")
bool runOnRegion(Region &Rgn, const Analyses &A) final
\Returns true if it modifies R.
const SmallVector< Instruction * > & getAux() const
\Returns the auxiliary vector.
static LLVM_ABI StoreInst * create(Value *V, Value *Ptr, MaybeAlign Align, InsertPosition Pos, bool IsVolatile, Context &Ctx)
Just like llvm::Type these are immutable, unique, never get freed and can only be created via static ...
A SandboxIR Value has users. This is the base class.
static Instruction * getLowest(ArrayRef< Instruction * > Instrs)
\Returns the instruction in Instrs that is lowest in the BB.
static Type * getCombinedVectorTypeFor(ArrayRef< Instruction * > Bndl, const DataLayout &DL)
\Returns the combined vector type for Bndl, even when the element types differ.
static bool areConsecutive(LoadOrStoreT *I1, LoadOrStoreT *I2, ScalarEvolution &SE, const DataLayout &DL)
\Returns true if I1 and I2 are load/stores accessing consecutive memory addresses.
BasicBlock(llvm::BasicBlock *BB, Context &SBCtx)
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
const Value * getPointerOperand(const Value *V)
A helper function that returns the pointer operand of a load, store or GEP instruction.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
static cl::opt< unsigned > CostThreshold("dfa-cost-threshold", cl::desc("Maximum cost accepted for the transformation"), cl::Hidden, cl::init(50))
auto seq(T Begin, T End)
Iterate over an integral type from Begin up to - but not including - End.
This struct is a compact representation of a valid (non-zero power of two) alignment.