34 return Instruction::FAdd;
36 return Instruction::FMul;
40 return Instruction::Mul;
42 return Instruction::And;
44 return Instruction::Or;
46 return Instruction::Xor;
51 return Instruction::ICmp;
54 return Instruction::FCmp;
83 if (
auto II = dyn_cast<IntrinsicInst>(&*
I))
86 for (
auto *II : Worklist) {
88 bool IsOrdered =
false;
91 auto ID = II->getIntrinsicID();
98 if (!II->getFastMathFlags().isFast())
100 Acc = II->getArgOperand(0);
101 Vec = II->getArgOperand(1);
114 Vec = II->getArgOperand(0);
126 II->eraseFromParent();
140 const auto *TTI =&getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F);
141 return expandReductions(F, TTI);
153 "Expand reduction intrinsics",
false,
false)
159 return new ExpandReductions();
165 if (!expandReductions(F, &TTI))
FunctionPass * createExpandReductionsPass()
This pass expands the experimental reduction intrinsics into sequences of shuffles.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
This class represents lattice values for constants.
void push_back(const T &Elt)
Analysis pass providing the TargetTransformInfo.
expand Expand reduction intrinsics
Value * getShuffleReduction(IRBuilder<> &Builder, Value *Src, unsigned Op, RecurrenceDescriptor::MinMaxRecurrenceKind MinMaxKind=RecurrenceDescriptor::MRK_Invalid, ArrayRef< Value *> RedOps=None)
Generates a vector reduction using shufflevectors to reduce the value.
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
void initializeExpandReductionsPass(PassRegistry &)
inst_iterator inst_begin(Function *F)
static Optional< unsigned > getOpcode(ArrayRef< VPValue *> Values)
Returns the opcode of Values or ~0 if they do not all agree.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Value * getOrderedReduction(IRBuilder<> &Builder, Value *Acc, Value *Src, unsigned Op, RecurrenceDescriptor::MinMaxRecurrenceKind MinMaxKind=RecurrenceDescriptor::MRK_Invalid, ArrayRef< Value *> RedOps=None)
Generates an ordered vector reduction using extracts to reduce the value.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
static bool runOnFunction(Function &F, bool PostInlining)
A set of analyses that are preserved following a run of a transformation pass.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Straight line strength reduction
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
static Expected< BitVector > expand(StringRef S, StringRef Original)
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
Represents analyses that only rely on functions' control flow.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
void preserveSet()
Mark an analysis set as preserved.
INITIALIZE_PASS_BEGIN(ExpandReductions, "expand-reductions", "Expand reduction intrinsics", false, false) INITIALIZE_PASS_END(ExpandReductions
LLVM Value Representation.
inst_iterator inst_end(Function *F)
A container for analyses that lazily runs them and caches their results.