Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/CodeGen/ExpandReductions.cpp
Show First 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | case Intrinsic::experimental_vector_reduce_fmin: | ||||
Vec = II->getArgOperand(0); | Vec = II->getArgOperand(0); | ||||
MRK = getMRK(ID); | MRK = getMRK(ID); | ||||
break; | break; | ||||
default: | default: | ||||
continue; | continue; | ||||
} | } | ||||
if (!TTI->shouldExpandReduction(II)) | if (!TTI->shouldExpandReduction(II)) | ||||
continue; | continue; | ||||
// Propagate FMF using the builder. | |||||
FastMathFlags FMF = | FastMathFlags FMF = | ||||
isa<FPMathOperator>(II) ? II->getFastMathFlags() : FastMathFlags{}; | isa<FPMathOperator>(II) ? II->getFastMathFlags() : FastMathFlags{}; | ||||
IRBuilder<>::FastMathFlagGuard FMFGuard(Builder); | |||||
Builder.setFastMathFlags(FMF); | |||||
Value *Rdx = | Value *Rdx = | ||||
IsOrdered ? getOrderedReduction(Builder, Acc, Vec, getOpcode(ID), MRK) | IsOrdered ? getOrderedReduction(Builder, Acc, Vec, getOpcode(ID), MRK) | ||||
: getShuffleReduction(Builder, Vec, getOpcode(ID), MRK, FMF); | : getShuffleReduction(Builder, Vec, getOpcode(ID), MRK); | ||||
II->replaceAllUsesWith(Rdx); | II->replaceAllUsesWith(Rdx); | ||||
II->eraseFromParent(); | II->eraseFromParent(); | ||||
Changed = true; | Changed = true; | ||||
} | } | ||||
return Changed; | return Changed; | ||||
} | } | ||||
class ExpandReductions : public FunctionPass { | class ExpandReductions : public FunctionPass { | ||||
Show All 38 Lines |