Skip to content

Conversation

@nate-chandler
Copy link
Contributor

@nate-chandler nate-chandler commented Jan 8, 2024

When an instruction mayReadOrWriteMemory, the mayAccessPointer predicate relies on the visitAccessedAddress utility to determine whether an instruction may access a pointer. That utility doesn't (and can't, without changing the representation of the builtin) visit RawPointer operands as used by memmove/memcpy builtins.

Previously, this resulted mayAccessPointer returning false for such builtins. Here, this is fixed by making the predicate handle BuiltinInsts separately. Instead of just always returning true in the face of a builtin, rely on the BuiltinInfo associated with a BuiltinInst and use mayReadOrWriteMemory.

rdar://120656227

Resolves #70813

When an instruction `mayReadOrWriteMemory`, the `mayAccessPointer`
predicate relies on the `visitAccessedAddress` utility to determine
whether an instruction may access a pointer.  That utility doesn't (and
can't, without changing the representation of the builtin) visit
`RawPointer` operands as used by memmove/memcpy builtins.

Previously, this resulted `mayAccessPointer` returning `false` for such
builtins.  Here, this is fixed by making the predicate handle
`BuiltinInsts` separately.  Instead of just always returning `true` in
the face of a builtin, rely on the BuiltinInfo associated with a
BuiltinInst and use `mayReadOrWriteMemory`.

rdar://120656227
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@nate-chandler nate-chandler marked this pull request as ready for review January 8, 2024 21:30
@nate-chandler nate-chandler merged commit ecca144 into swiftlang:main Jan 9, 2024
@nate-chandler nate-chandler deleted the rdar120656227 branch January 9, 2024 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unsafe withTaskGroup optimization

3 participants