[llvm-branch-commits] [clang] [llvm] [mlir] [OMPIRBuilder] Add support for explicit deallocation points (PR #154752)

Sergio Afonso via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Aug 26 02:19:18 PDT 2025


https://github.com/skatrak commented:

Thank you Michael for the review!

> Clang uses a pattern that uses only a single block for multiple exits

I'm not too familiar with this, but in any case there is at least one situation in Flang where multiple exits are used. If you look at `findAllocInsertPoints`, there you can see that whenever there are no eligible `OpenMPAllocStackFrame`s, it will use the function entry block as allocation insert point. In that case, we need to make every exit out of the function a deallocation point because there is nothing to prevent that function from having multiple returns and we have no control in the OpenMP dialect over how the body of a function as a whole gets translated to LLVM IR.

So, I'd say the vast majority of the time it will be empty or a single point, but we need to support multiple exits for at least that situation.

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


More information about the llvm-branch-commits mailing list