Skip to content

Commit 3ea7e6f

Browse files
authored
[NFC] Update a comment about synchronization in GUFA (#7312)
The comment mentioned that in principle we might be able to optimize atomic struct.gets when we know what the stored value we are loading will be. This is not correct because the write and the read would still create a synchronization edge in that case. Update the comment accordingly.
1 parent 54abcfe commit 3ea7e6f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/passes/GUFA.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,7 @@ struct GUFAOptimizer
153153
if (Properties::getMemoryOrder(curr) != MemoryOrder::Unordered) {
154154
// This load might synchronize with some store, and if we replaced the
155155
// load with a constant or with a load from a global, it would not
156-
// synchronize with that store anymore. Since we know what value the store
157-
// must write, and we know it is the same as every other store to the same
158-
// location, it's possible that optimizing here would be allowable, but
159-
// for now be conservative and do not optimize.
156+
// synchronize with that store anymore.
160157
return;
161158
}
162159

test/lit/passes/gufa-refs.wast

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6171,19 +6171,22 @@
61716171
)
61726172
(drop
61736173
;; This is optimizable. It reads from shared memory, but there is only one
6174-
;; possible value that can be read.
6174+
;; possible value that can be read and it is not atomic, so does not form
6175+
;; a synchronization edge.
61756176
(struct.get $A 0
61766177
(local.get 0)
61776178
)
61786179
)
61796180
(drop
6180-
;; We do not (yet) optimize atomic gets.
6181+
;; We do not optimize atomic gets, since they might synchronize with a
6182+
;; write.
61816183
(struct.atomic.get acqrel $A 0
61826184
(local.get 0)
61836185
)
61846186
)
61856187
(drop
6186-
;; We do not (yet) optimize atomic gets.
6188+
;; We do not optimize atomic gets, since they might synchronize with a
6189+
;; write.
61876190
(struct.atomic.get $A 0
61886191
(local.get 0)
61896192
)

0 commit comments

Comments
 (0)