-
Notifications
You must be signed in to change notification settings - Fork 15k
[LV] Strip outdated code in cost-model-matching #154935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Since c97c686 ([VPlan] Allow folding not (cmp eq) -> icmp ne with other select users), the code is no longer needed.
|
@llvm/pr-subscribers-llvm-transforms Author: Ramkumar Ramachandra (artagnon) ChangesSince c97c686 ([VPlan] Allow folding not (cmp eq) -> icmp ne with other select users), the code is no longer needed. Full diff: https://github.com/llvm/llvm-project/pull/154935.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index c4110582da1ef..888437bf42b23 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -6953,15 +6953,6 @@ static bool planContainsAdditionalSimplifications(VPlan &Plan,
VPCostContext &CostCtx,
Loop *TheLoop,
ElementCount VF) {
- // First collect all instructions for the recipes in Plan.
- auto GetInstructionForCost = [](const VPRecipeBase *R) -> Instruction * {
- if (auto *S = dyn_cast<VPSingleDefRecipe>(R))
- return dyn_cast_or_null<Instruction>(S->getUnderlyingValue());
- if (auto *WidenMem = dyn_cast<VPWidenMemoryRecipe>(R))
- return &WidenMem->getIngredient();
- return nullptr;
- };
-
DenseSet<Instruction *> SeenInstrs;
auto Iter = vp_depth_first_deep(Plan.getVectorLoopRegion()->getEntry());
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(Iter)) {
@@ -6999,17 +6990,6 @@ static bool planContainsAdditionalSimplifications(VPlan &Plan,
RepR->getUnderlyingInstr(), VF))
return true;
}
- if (Instruction *UI = GetInstructionForCost(&R)) {
- // If we adjusted the predicate of the recipe, the cost in the legacy
- // cost model may be different.
- if (auto *WidenCmp = dyn_cast<VPWidenRecipe>(&R)) {
- if ((WidenCmp->getOpcode() == Instruction::ICmp ||
- WidenCmp->getOpcode() == Instruction::FCmp) &&
- WidenCmp->getPredicate() != cast<CmpInst>(UI)->getPredicate())
- return true;
- }
- SeenInstrs.insert(UI);
- }
}
}
|
|
@llvm/pr-subscribers-vectorizers Author: Ramkumar Ramachandra (artagnon) ChangesSince c97c686 ([VPlan] Allow folding not (cmp eq) -> icmp ne with other select users), the code is no longer needed. Full diff: https://github.com/llvm/llvm-project/pull/154935.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index c4110582da1ef..888437bf42b23 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -6953,15 +6953,6 @@ static bool planContainsAdditionalSimplifications(VPlan &Plan,
VPCostContext &CostCtx,
Loop *TheLoop,
ElementCount VF) {
- // First collect all instructions for the recipes in Plan.
- auto GetInstructionForCost = [](const VPRecipeBase *R) -> Instruction * {
- if (auto *S = dyn_cast<VPSingleDefRecipe>(R))
- return dyn_cast_or_null<Instruction>(S->getUnderlyingValue());
- if (auto *WidenMem = dyn_cast<VPWidenMemoryRecipe>(R))
- return &WidenMem->getIngredient();
- return nullptr;
- };
-
DenseSet<Instruction *> SeenInstrs;
auto Iter = vp_depth_first_deep(Plan.getVectorLoopRegion()->getEntry());
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(Iter)) {
@@ -6999,17 +6990,6 @@ static bool planContainsAdditionalSimplifications(VPlan &Plan,
RepR->getUnderlyingInstr(), VF))
return true;
}
- if (Instruction *UI = GetInstructionForCost(&R)) {
- // If we adjusted the predicate of the recipe, the cost in the legacy
- // cost model may be different.
- if (auto *WidenCmp = dyn_cast<VPWidenRecipe>(&R)) {
- if ((WidenCmp->getOpcode() == Instruction::ICmp ||
- WidenCmp->getOpcode() == Instruction::FCmp) &&
- WidenCmp->getPredicate() != cast<CmpInst>(UI)->getPredicate())
- return true;
- }
- SeenInstrs.insert(UI);
- }
}
}
|
| if (Instruction *UI = GetInstructionForCost(&R)) { | ||
| // If we adjusted the predicate of the recipe, the cost in the legacy | ||
| // cost model may be different. | ||
| if (auto *WidenCmp = dyn_cast<VPWidenRecipe>(&R)) { | ||
| if ((WidenCmp->getOpcode() == Instruction::ICmp || | ||
| WidenCmp->getOpcode() == Instruction::FCmp) && | ||
| WidenCmp->getPredicate() != cast<CmpInst>(UI)->getPredicate()) | ||
| return true; | ||
| } | ||
| SeenInstrs.insert(UI); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure if there will be some cost-model-mismatch due to Luke's patch, but this code doesn't seem to match anything anymore: there was a regression test committed along with the change that introduced this in 043b04a by Florian which seems to pass without this change.
|
Oops, I removed SeenInstrs.insert -- we don't seem to have great test coverage, but this seems wrong. |
Since c97c686 ([VPlan] Allow folding not (cmp eq) -> icmp ne with other select users), the code is no longer needed.