[llvm] d933c89 - [GVN] Simplify presplit coroutine handling. NFC.
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Fri May 19 07:49:47 PDT 2023
Author: Jay Foad
Date: 2023-05-19T15:46:29+01:00
New Revision: d933c895348b79a28cdb9e330e0ee5146bac5adf
URL: https://github.com/llvm/llvm-project/commit/d933c895348b79a28cdb9e330e0ee5146bac5adf
DIFF: https://github.com/llvm/llvm-project/commit/d933c895348b79a28cdb9e330e0ee5146bac5adf.diff
LOG: [GVN] Simplify presplit coroutine handling. NFC.
Added:
Modified:
llvm/lib/Transforms/Scalar/GVN.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 3f94cae876a9..3e30f1582715 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -461,30 +461,26 @@ void GVNPass::ValueTable::add(Value *V, uint32_t num) {
}
uint32_t GVNPass::ValueTable::lookupOrAddCall(CallInst *C) {
- if (AA->doesNotAccessMemory(C) &&
- // FIXME: Currently the calls which may access the thread id may
- // be considered as not accessing the memory. But this is
- // problematic for coroutines, since coroutines may resume in a
- //
diff erent thread. So we disable the optimization here for the
- // correctness. However, it may block many other correct
- // optimizations. Revert this one when we detect the memory
- // accessing kind more precisely.
- !C->getFunction()->isPresplitCoroutine()) {
+ // FIXME: Currently the calls which may access the thread id may
+ // be considered as not accessing the memory. But this is
+ // problematic for coroutines, since coroutines may resume in a
+ //
diff erent thread. So we disable the optimization here for the
+ // correctness. However, it may block many other correct
+ // optimizations. Revert this one when we detect the memory
+ // accessing kind more precisely.
+ if (C->getFunction()->isPresplitCoroutine()) {
+ valueNumbering[C] = nextValueNumber;
+ return nextValueNumber++;
+ }
+
+ if (AA->doesNotAccessMemory(C)) {
Expression exp = createExpr(C);
uint32_t e = assignExpNewValueNum(exp).first;
valueNumbering[C] = e;
return e;
}
- if (MD && AA->onlyReadsMemory(C) &&
- // FIXME: Currently the calls which may access the thread id may
- // be considered as not accessing the memory. But this is
- // problematic for coroutines, since coroutines may resume in a
- //
diff erent thread. So we disable the optimization here for the
- // correctness. However, it may block many other correct
- // optimizations. Revert this one when we detect the memory
- // accessing kind more precisely.
- !C->getFunction()->isPresplitCoroutine()) {
+ if (MD && AA->onlyReadsMemory(C)) {
Expression exp = createExpr(C);
auto ValNum = assignExpNewValueNum(exp);
if (ValNum.second) {
More information about the llvm-commits
mailing list