This is an archive of the discontinued LLVM Phabricator instance.

Fix a data race reported by TSan on allowsUnregisteredDialects
AbandonedPublic

Authored by Benoit on Mar 3 2022, 7:57 PM.

Details

Reviewers
rriddle
Summary

To fix this without introducing a big lock or breaking compatibility,
this variable is turned into an atomic, and a restriction is introduced
on its mutability: it may only be mutated from false to true, not
from true to false. This allows to ensure that threads can't set this
back to false under the feet of other threads relying on this being
true.

Diff Detail

Event Timeline

Benoit created this revision.Mar 3 2022, 7:57 PM
Herald added a project: Restricted Project. · View Herald Transcript
Benoit requested review of this revision.Mar 3 2022, 7:57 PM
rriddle requested changes to this revision.EditedMar 3 2022, 7:59 PM

This is going to turn into an assert soon, whenever I get around to landing: https://reviews.llvm.org/D112021

This revision now requires changes to proceed.Mar 3 2022, 7:59 PM
Benoit updated this revision to Diff 412916.Mar 3 2022, 8:03 PM

clarify comment

Benoit added a comment.Mar 3 2022, 8:07 PM

Thanks for the quick reply! Great to hear this is going to be resolved in the principled way. I'll switch to fixing the faulty call sites in IREE, then.

Benoit abandoned this revision.Mar 3 2022, 8:07 PM