[llvm] 0fc6213 - [LV] Clarify nature of legacy CSE (NFC) (#160855)

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 28 02:02:25 PDT 2025


Author: Ramkumar Ramachandra
Date: 2025-09-28T10:02:22+01:00
New Revision: 0fc6213aee05b07e670bee5a25a31119c563227e

URL: https://github.com/llvm/llvm-project/commit/0fc6213aee05b07e670bee5a25a31119c563227e
DIFF: https://github.com/llvm/llvm-project/commit/0fc6213aee05b07e670bee5a25a31119c563227e.diff

LOG: [LV] Clarify nature of legacy CSE (NFC) (#160855)

In order to avoid conflating the legacy CSE with the VPlan-based one,
rename the legacy CSE and insert a FIXME to clarify the nature of the
legacy CSE.

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 93a5f22bd0976..96f52076b1837 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -2438,8 +2438,9 @@ struct CSEDenseMapInfo {
 
 } // end anonymous namespace
 
-///Perform cse of induction variable instructions.
-static void cse(BasicBlock *BB) {
+/// FIXME: This legacy common-subexpression-elimination routine is scheduled for
+/// removal, in favor of the VPlan-based one.
+static void legacyCSE(BasicBlock *BB) {
   // Perform simple cse.
   SmallDenseMap<Instruction *, Instruction *, 4, CSEDenseMapInfo> CSEMap;
   for (Instruction &In : llvm::make_early_inc_range(*BB)) {
@@ -2543,7 +2544,7 @@ void InnerLoopVectorizer::fixVectorizedLoop(VPTransformState &State) {
   BasicBlock *HeaderBB = State.CFG.VPBB2IRBB[HeaderVPBB];
 
   // Remove redundant induction instructions.
-  cse(HeaderBB);
+  legacyCSE(HeaderBB);
 }
 
 void InnerLoopVectorizer::fixNonInductionPHIs(VPTransformState &State) {


        


More information about the llvm-commits mailing list