[PATCH] D130466: [LICM] - Add option to allow data races

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 3 09:50:08 PDT 2022


xbolva00 added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LICM.cpp:2119
   if (!SafeToInsertStore) {
-    if (IsKnownThreadLocalObject)
+    if (IsKnownThreadLocalObject || AllowDataRaces)
       SafeToInsertStore = true;
----------------
fhahn wrote:
> gsocshubham wrote:
> > efriedma wrote:
> > > I think you need a few more safety checks, even if you're assuming the program is single-threaded.  Just because it's legal to load from a memory location, doesn't mean it's legal to store to it.  For example, you can't write to a constant.
> > I am not sure about writing to a constant. Can you elaborate with an example where it would fail?
> This doesn't like quite right. You are just comparing the enum value, not the actual configured ThreadModel I think. You likely have to check the value returned by `getThreadModel`.
and no tests?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130466/new/

https://reviews.llvm.org/D130466



More information about the llvm-commits mailing list