[llvm] [LoopRotate][coroutines] Avoid hoisting addresses of thread-local variables outside loops in coroutines (PR #81937)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 20 10:56:29 PST 2024


================
@@ -612,7 +612,15 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
       // memory (without proving that the loop doesn't write).
       if (L->hasLoopInvariantOperands(Inst) && !Inst->mayReadFromMemory() &&
           !Inst->mayWriteToMemory() && !Inst->isTerminator() &&
-          !isa<DbgInfoIntrinsic>(Inst) && !isa<AllocaInst>(Inst)) {
+          !isa<DbgInfoIntrinsic>(Inst) && !isa<AllocaInst>(Inst) &&
+          // FIXME: It is not safe to cache the value of these instructions in
----------------
aeubanks wrote:

```
It is not safe to hoist instructions in presplit coroutines, as otherwise we may reuse addresses of thread local globals across suspend points.
FIXME: This should be reverted once...
```

https://github.com/llvm/llvm-project/pull/81937


More information about the llvm-commits mailing list