mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[LV] Simplify tryToWiden as recipes are not re-used (NFC).
After 49d00824bbbb, VPWidenRecipe only stores a single instruction. tryToWiden can simply return the widen recipe, like other helpers in VPRecipeBuilder.
This commit is contained in:
parent
b34315963f
commit
16f85870fd
@ -6884,14 +6884,13 @@ VPBlendRecipe *VPRecipeBuilder::tryToBlend(Instruction *I, VPlanPtr &Plan) {
|
||||
return new VPBlendRecipe(Phi, Masks);
|
||||
}
|
||||
|
||||
bool VPRecipeBuilder::tryToWiden(Instruction *I, VPBasicBlock *VPBB,
|
||||
VFRange &Range) {
|
||||
VPWidenRecipe *VPRecipeBuilder::tryToWiden(Instruction *I, VFRange &Range) {
|
||||
|
||||
bool IsPredicated = LoopVectorizationPlanner::getDecisionAndClampRange(
|
||||
[&](unsigned VF) { return CM.isScalarWithPredication(I, VF); }, Range);
|
||||
|
||||
if (IsPredicated)
|
||||
return false;
|
||||
return nullptr;
|
||||
|
||||
auto IsVectorizableOpcode = [](unsigned Opcode) {
|
||||
switch (Opcode) {
|
||||
@ -6940,13 +6939,13 @@ bool VPRecipeBuilder::tryToWiden(Instruction *I, VPBasicBlock *VPBB,
|
||||
};
|
||||
|
||||
if (!IsVectorizableOpcode(I->getOpcode()))
|
||||
return false;
|
||||
return nullptr;
|
||||
|
||||
if (CallInst *CI = dyn_cast<CallInst>(I)) {
|
||||
Intrinsic::ID ID = getVectorIntrinsicIDForCall(CI, TLI);
|
||||
if (ID && (ID == Intrinsic::assume || ID == Intrinsic::lifetime_end ||
|
||||
ID == Intrinsic::lifetime_start || ID == Intrinsic::sideeffect))
|
||||
return false;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto willWiden = [&](unsigned VF) -> bool {
|
||||
@ -6975,13 +6974,10 @@ bool VPRecipeBuilder::tryToWiden(Instruction *I, VPBasicBlock *VPBB,
|
||||
};
|
||||
|
||||
if (!LoopVectorizationPlanner::getDecisionAndClampRange(willWiden, Range))
|
||||
return false;
|
||||
return nullptr;
|
||||
|
||||
// Success: widen this instruction.
|
||||
VPWidenRecipe *WidenRecipe = new VPWidenRecipe(*I);
|
||||
setRecipe(I, WidenRecipe);
|
||||
VPBB->appendRecipe(WidenRecipe);
|
||||
return true;
|
||||
return new VPWidenRecipe(*I);
|
||||
}
|
||||
|
||||
VPBasicBlock *VPRecipeBuilder::handleReplication(
|
||||
@ -7085,8 +7081,11 @@ bool VPRecipeBuilder::tryToCreateRecipe(Instruction *Instr, VFRange &Range,
|
||||
|
||||
// Check if Instr is to be widened by a general VPWidenRecipe, after
|
||||
// having first checked for specific widening recipes.
|
||||
if (tryToWiden(Instr, VPBB, Range))
|
||||
if ((Recipe = tryToWiden(Instr, Range))) {
|
||||
setRecipe(Instr, Recipe);
|
||||
VPBB->appendRecipe(Recipe);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -108,12 +108,10 @@ public:
|
||||
VPBlendRecipe *tryToBlend(Instruction *I, VPlanPtr &Plan);
|
||||
|
||||
/// Check if \p I can be widened within the given VF \p Range. If \p I can be
|
||||
/// widened for \p Range.Start, check if the last recipe of \p VPBB can be
|
||||
/// extended to include \p I or else build a new VPWidenRecipe for it and
|
||||
/// append it to \p VPBB. Return true if \p I can be widened for Range.Start,
|
||||
/// false otherwise. Range.End may be decreased to ensure same decision from
|
||||
/// \p Range.Start to \p Range.End.
|
||||
bool tryToWiden(Instruction *I, VPBasicBlock *VPBB, VFRange &Range);
|
||||
/// widened for \p Range.Start, build a new VPWidenRecipe and return it.
|
||||
/// Range.End may be decreased to ensure same decision from \p Range.Start to
|
||||
/// \p Range.End.
|
||||
VPWidenRecipe *tryToWiden(Instruction *I, VFRange &Range);
|
||||
|
||||
/// Create a replicating region for instruction \p I that requires
|
||||
/// predication. \p PredRecipe is a VPReplicateRecipe holding \p I.
|
||||
|
Loading…
x
Reference in New Issue
Block a user