[PATCH] D130466: [LICM] - Add option to allow data races
Shubham Narlawar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 29 03:33:03 PDT 2022
gsocshubham updated this revision to Diff 448572.
gsocshubham added a comment.
Add flag `-allow-data-races` in `llvm/test/Transforms/LICM/reg-promote.ll`
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130466/new/
https://reviews.llvm.org/D130466
Files:
llvm/lib/Transforms/Scalar/LICM.cpp
Index: llvm/lib/Transforms/Scalar/LICM.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LICM.cpp
+++ llvm/lib/Transforms/Scalar/LICM.cpp
@@ -109,6 +109,10 @@
"licm-control-flow-hoisting", cl::Hidden, cl::init(false),
cl::desc("Enable control flow (and PHI) hoisting in LICM"));
+static cl::opt<bool> AllowDataRaces("allow-data-races", cl::Hidden,
+ cl::init(false),
+ cl::desc("Allow data races in LICM pass"));
+
static cl::opt<uint32_t> MaxNumUsesTraversed(
"licm-max-num-uses-traversed", cl::Hidden, cl::init(8),
cl::desc("Max num uses visited for identifying load "
@@ -1851,7 +1855,8 @@
MSSAU.createMemoryAccessAfter(NewSI, nullptr, MSSAInsertPoint);
}
MSSAInsertPts[i] = NewMemAcc;
- MSSAU.insertDef(cast<MemoryDef>(NewMemAcc), true);
+ MSSAU.insertDef(cast<MemoryDef>(NewMemAcc),
+ AllowDataRaces ? false : true);
// FIXME: true for safety, false may still be correct.
}
}
@@ -2111,7 +2116,7 @@
// stores along paths which originally didn't have them without violating the
// memory model.
if (!SafeToInsertStore) {
- if (IsKnownThreadLocalObject)
+ if (IsKnownThreadLocalObject || AllowDataRaces)
SafeToInsertStore = true;
else {
Value *Object = getUnderlyingObject(SomePtr);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130466.448572.patch
Type: text/x-patch
Size: 1438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220729/02c009ff/attachment.bin>
More information about the llvm-commits
mailing list