}
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
- // different 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
+ // different 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
- // different 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) {