C++: Fix conflation in barrier guards #21171
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While working on MaD support for barriers/barrier guards for C/C++ I discovered a bug related to indirect barrier guards. This PR fixes that bug at the cost of:
privatein the sharedGuardslibrary, andThe problem is that (as @aschackmull also discovered when we were porting C++ to the shared SSA library's dataflow integration layer) we cannot relate an
SsaDefinitionto anInstructionwithout an indirection index. So on something like:So when guardChecksInstr says that
pis a barrier guard with indirection1guardChecksDef finds the associated Ssa definition forp(and not its indirection,*p, sinceguardReadsSsaVardoesn't have access to the indirection index) and places a barrier on&p,p, and*pinstead of just*plike it was intended.I can imagine better fixes for this. In particular:
Guardslibrary withAstNode = (Instruction, int)instead ofAstNode = Instructionlike we do currently. This should be totally doable (albeit with another breaking change to the the barrier guards library for C/C++ 😭)@aschackmull do you have any thoughts on this?