[llvm] [VPlan] Handle some VPInstructions in mayReadFromMemory (PR #120058)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 22 05:06:45 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:
Hmmm, I think it should be part of `VPInstruction`, VPRecipeBase `mayReadFromMemory/mayWriteToMemory` can call it after casting to VPInstruction, and through those VPRecipeBase `mayReadOrWriteMemory` will also return the correct result?
> Alternatively, would these end up diverging at some point? Assuming we'll never have a VPInstruction with an ordered load or store we could mark those as free from writes and stores respectively. Or is that out of the scope of this PR?
Not sure what you mean with diverging? The VPInstruction version should only mark opcodes as non writing/reading if we are sure they won't access memory
https://github.com/llvm/llvm-project/pull/120058
More information about the llvm-commits
mailing list