[llvm] fba3e06 - [VPlan] Remove overlapping VPInstruction::mayWriteToMemory. NFCI (#120039)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 16 19:02:58 PST 2024


Author: Luke Lau
Date: 2024-12-17T11:02:55+08:00
New Revision: fba3e069b4ed38b16754d5e45837bfec9d5a372a

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

LOG: [VPlan] Remove overlapping VPInstruction::mayWriteToMemory. NFCI (#120039)

VPInstruction has a definition of mayWriteToMemory, which seems to only
be used by VPlanSLP. However VPInstructions are already handled in
VPRecipeBase::mayWriteToMemory, and everywhere else seems to use this
definition. I think these should be the same for all intents and
purposes. The VPRecipeBase definition is more conservative but returns
true for stores/calls/invokes/SLPStores.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlan.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index a83bf25f81a270..790566113fef5c 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -1347,14 +1347,6 @@ class VPInstruction : public VPRecipeWithIRFlags,
   LLVM_DUMP_METHOD void dump() const;
 #endif
 
-  /// Return true if this instruction may modify memory.
-  bool mayWriteToMemory() const {
-    // TODO: we can use attributes of the called function to rule out memory
-    //       modifications.
-    return Opcode == Instruction::Store || Opcode == Instruction::Call ||
-           Opcode == Instruction::Invoke || Opcode == SLPStore;
-  }
-
   bool hasResult() const {
     // CallInst may or may not have a result, depending on the called function.
     // Conservatively return calls have results for now.


        


More information about the llvm-commits mailing list