Skip to content

Commit 980531c

Browse files
authored
[VPlan] Fix MayReadFromMemory/MayWriteToMemory on VPWidenIntrinsicRecipe (#136684)
These seem to be the wrong way round, e.g. see the definition at Instruction::mayReadFromMemory(). If an instruction only writes to memory then it's known to not read memory, and so on. Only noticed this when using VPWidenIntrinsicRecipe in a local patch and wondered why it kept on getting DCEd despite the intrinsic writing to memory.
1 parent d51b278 commit 980531c

File tree

1 file changed

+2
-2
lines changed
  • llvm/lib/Transforms/Vectorize

1 file changed

+2
-2
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,8 +1322,8 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags {
13221322
LLVMContext &Ctx = Ty->getContext();
13231323
AttributeSet Attrs = Intrinsic::getFnAttributes(Ctx, VectorIntrinsicID);
13241324
MemoryEffects ME = Attrs.getMemoryEffects();
1325-
MayReadFromMemory = ME.onlyWritesMemory();
1326-
MayWriteToMemory = ME.onlyReadsMemory();
1325+
MayReadFromMemory = !ME.onlyWritesMemory();
1326+
MayWriteToMemory = !ME.onlyReadsMemory();
13271327
MayHaveSideEffects = MayWriteToMemory ||
13281328
!Attrs.hasAttribute(Attribute::NoUnwind) ||
13291329
!Attrs.hasAttribute(Attribute::WillReturn);

0 commit comments

Comments
 (0)