[llvm] cb56ba6 - [VPlan] Unswitch cond in replaceUsesWithIf in optimizeInductions (NFC)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 15 12:27:33 PST 2023
Author: Florian Hahn
Date: 2023-12-15T20:26:36Z
New Revision: cb56ba635017500d6e0d7bb2a2a708b0161b8602
URL: https://github.com/llvm/llvm-project/commit/cb56ba635017500d6e0d7bb2a2a708b0161b8602
DIFF: https://github.com/llvm/llvm-project/commit/cb56ba635017500d6e0d7bb2a2a708b0161b8602.diff
LOG: [VPlan] Unswitch cond in replaceUsesWithIf in optimizeInductions (NFC)
As suggested post-commit for a00227197, unswitch the condition in
replaceUsesWithIf to simplify the check.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index 570da97c3cfaf9..33132880d5a444 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -529,10 +529,12 @@ void VPlanTransforms::optimizeInductions(VPlan &Plan, ScalarEvolution &SE) {
WideIV->getStartValue(), WideIV->getStepValue());
// Update scalar users of IV to use Step instead.
- WideIV->replaceUsesWithIf(
- Steps, [HasOnlyVectorVFs, WideIV](VPUser &U, unsigned) {
- return !HasOnlyVectorVFs || U.usesScalars(WideIV);
- });
+ if (!HasOnlyVectorVFs)
+ WideIV->replaceAllUsesWith(Steps);
+ else
+ WideIV->replaceUsesWithIf(Steps, [WideIV](VPUser &U, unsigned) {
+ return U.usesScalars(WideIV);
+ });
}
}
More information about the llvm-commits
mailing list