[llvm] [Coroutines] Make CoroElide actually work for (trivial) C++ coroutines (PR #92969)

via llvm-commits llvm-commits at lists.llvm.org
Mon May 27 21:59:17 PDT 2024


================
@@ -253,6 +283,44 @@ void CoroIdElider::elideHeapAllocations(uint64_t FrameSize, Align FrameAlign) {
   removeTailCallAttribute(Frame, AA);
 }
 
+static BasicBlock *getNullCheckerPredecessor(Value *Handle,
----------------
WenleiHe wrote:

> However, we need to think about more robust ways other than brute force pattern matching.

I actually that the way it's handle is okay. At least I don't see correctness issue IIUC. 

To formulate the problem/solution, we are essentially trying to mark paths safe/non-escape that are either 1) destroyed, or 2) null. null is okay obviously as nothing is escaping. The way you implement this is by hoisting the the safe/visited marking to the dominator of 1) and 2), not the most elegant, but does its job IMHO. 

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


More information about the llvm-commits mailing list