[VPlan] Mark VPScalarIVStepsRecipe as not reading/writing memory.

The recipe only computes the inductions steps using its operands. It
does neither read nor write memory.

Split of from D133760.
This commit is contained in:
Florian Hahn 2022-12-04 12:58:46 +00:00
parent cf28e6b2f1
commit 3c5f07349f
No known key found for this signature in database
GPG Key ID: EEF712BB5E80EBBA
2 changed files with 5 additions and 3 deletions

View File

@ -49,6 +49,7 @@ bool VPRecipeBase::mayWriteToMemory() const {
return cast<Instruction>(getVPSingleValue()->getUnderlyingValue())
->mayWriteToMemory();
case VPBranchOnMaskSC:
case VPScalarIVStepsSC:
return false;
case VPWidenIntOrFpInductionSC:
case VPWidenCanonicalIVSC:
@ -80,6 +81,7 @@ bool VPRecipeBase::mayReadFromMemory() const {
return cast<Instruction>(getVPSingleValue()->getUnderlyingValue())
->mayReadFromMemory();
case VPBranchOnMaskSC:
case VPScalarIVStepsSC:
return false;
case VPWidenIntOrFpInductionSC:
case VPWidenCanonicalIVSC:

View File

@ -1080,9 +1080,9 @@ TEST(VPRecipeTest, MayHaveSideEffectsAndMayReadWriteMemory) {
InductionDescriptor IndDesc;
VPScalarIVStepsRecipe Recipe(IndDesc, &Op1, &Op2);
EXPECT_FALSE(Recipe.mayHaveSideEffects());
EXPECT_TRUE(Recipe.mayReadFromMemory());
EXPECT_TRUE(Recipe.mayWriteToMemory());
EXPECT_TRUE(Recipe.mayReadOrWriteMemory());
EXPECT_FALSE(Recipe.mayReadFromMemory());
EXPECT_FALSE(Recipe.mayWriteToMemory());
EXPECT_FALSE(Recipe.mayReadOrWriteMemory());
}
// The initial implementation is conservative with respect to VPInstructions.