Skip to content

Commit 9ffa90d

Browse files
committed
[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.
1 parent 600624a commit 9ffa90d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6119,6 +6119,12 @@ bool LoopVectorizationCostModel::isCandidateForEpilogueVectorization(
61196119
}))
61206120
return false;
61216121

6122+
// Epilogue vectorization code has not been auditted to ensure it handles
6123+
// non-latch exits properly. It may be fine, but it needs auditted and
6124+
// tested.
6125+
if (L.getExitingBlock() != L.getLoopLatch())
6126+
return false;
6127+
61226128
return true;
61236129
}
61246130

0 commit comments

Comments
 (0)