[llvm] 9ffa90d - [LV] Disable epilogue vectorization for non-latch exits
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 6 10:57:26 PDT 2021
Author: Philip Reames
Date: 2021-07-06T10:57:10-07:00
New Revision: 9ffa90d6c27e583bec9656a0aae5062ea5499094
URL: https://github.com/llvm/llvm-project/commit/9ffa90d6c27e583bec9656a0aae5062ea5499094
DIFF: https://github.com/llvm/llvm-project/commit/9ffa90d6c27e583bec9656a0aae5062ea5499094.diff
LOG: [LV] Disable epilogue vectorization for non-latch exits
When skimming through old review discussion, I noticed a post commit comment on an earlier patch which had gone unaddressed. Better late (4 months), than never right?
I'm not aware of an active problem with the combination of non-latch exits and epilogue vectorization, but the interaction was not considered and I'm not modivated to make epilogue vectorization work with early exits. If there were a bug in the interaction, it would be pretty hard to hit right now (as we canonicalize towards bottom tested loops), but an upcoming change to allow multiple exit loops will greatly increase the chance for error. Thus, let's play it safe for now.
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 7e3a8ead04ae..6c1800d21412 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -6119,6 +6119,12 @@ bool LoopVectorizationCostModel::isCandidateForEpilogueVectorization(
}))
return false;
+ // Epilogue vectorization code has not been auditted to ensure it handles
+ // non-latch exits properly. It may be fine, but it needs auditted and
+ // tested.
+ if (L.getExitingBlock() != L.getLoopLatch())
+ return false;
+
return true;
}
More information about the llvm-commits
mailing list