From 8f6c1ec6345c03dce8b4a4f902f95a2f45983738 Mon Sep 17 00:00:00 2001 From: TB Schardl Date: Sun, 12 Jan 2025 13:09:03 -0500 Subject: [PATCH] [cilk2c_inlined] Add dummy function to prevent LLVM's optimizer from erasing the __cilkrts_stack_frame type when generating the bitcode ABI file. --- runtime/cilk2c_inlined.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/runtime/cilk2c_inlined.c b/runtime/cilk2c_inlined.c index 9c267bad..cf1d4055 100644 --- a/runtime/cilk2c_inlined.c +++ b/runtime/cilk2c_inlined.c @@ -371,6 +371,16 @@ __cilk_helper_epilogue_exn(__cilkrts_stack_frame *sf, __cilkrts_pause_frame(sf, parent, exn, spawner); } +// Internal helper function to ensure the __cilkrts_stack_frame type is present +// in the bitcode file. Does not end up in compiled Cilk code nor the OpenCilk +// runtime library. +CHEETAH_INTERNAL __cilkrts_stack_frame +__internal_preserve_stack_frame_type_helper(void) { + __cilkrts_stack_frame sf; + __cilkrts_enter_frame(&sf); + return sf; +} + /// Computes a grainsize for a cilk_for loop, using the following equation: /// /// grainsize = min(2048, ceil(n / (8 * nworkers)))