llvm-project
e86ad000 - [Clang][OpenMP] Fix crash on an `omp allocate` local in unreachable code (#242302)

Commit
7 hours ago
[Clang][OpenMP] Fix crash on an `omp allocate` local in unreachable code (#242302) Fixes #140336 CodeGen visits declarations even after the insertion point has been cleared, but the `omp allocate` path still emitted the `__kmpc_alloc` call there. For a declaration nothing can reach, such as a `switch` body before its first `case`, the call ended up outside any basic block and the verifier rejected the module. Both allocation hooks now return early when there is no insertion point and the variable keeps its plain alloca. Jumping into the scope of such a variable is now an error, as for `__attribute__((cleanup))` and as GCC does (Here I follow the GCC behavior, if you prefer we could change the approach in that case): the allocation would be skipped but the `__kmpc_free` at scope exit would still run. AI assisted!
Parents
Loading