[llvm] [VPlan] Handle some VPInstructions in mayReadFromMemory (PR #120058)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 17 08:56:13 PST 2024
================
@@ -115,6 +115,25 @@ bool VPRecipeBase::mayWriteToMemory() const {
bool VPRecipeBase::mayReadFromMemory() const {
switch (getVPDefID()) {
+ case VPInstructionSC:
+ if (Instruction::isBinaryOp(cast<VPInstruction>(this)->getOpcode()))
+ return false;
+ switch (cast<VPInstruction>(this)->getOpcode()) {
+ case Instruction::Or:
+ case Instruction::ICmp:
+ case Instruction::Select:
+ case VPInstruction::AnyOf:
+ case VPInstruction::Not:
+ case VPInstruction::CalculateTripCountMinusVF:
+ case VPInstruction::CanonicalIVIncrementForPart:
+ case VPInstruction::ExtractFromEnd:
+ case VPInstruction::FirstOrderRecurrenceSplice:
+ case VPInstruction::LogicalAnd:
+ case VPInstruction::PtrAdd:
+ return false;
+ default:
+ return true;
+ }
----------------
fhahn wrote:
Those effectively check if the VPInstruction access memory (either reading or writing). Could you move it to something like `VPInstruction::mayReadOrWriteFromMemory()` and use it for both `VPRecipeBase::mayReadFromMemory` and `VPRecipeBase::mayWriteToMemory`, so it is automatically keept in sync?
https://github.com/llvm/llvm-project/pull/120058
More information about the llvm-commits
mailing list