@@ -137,60 +137,6 @@ void testOmpCreation(void) {
137137 mlirContextDestroy (ctx );
138138}
139139
140- // Helper variable to track callback invocations
141- static int initCnt = 0 ;
142-
143- // Callback function that will be called during JIT initialization
144- static void initCallback (void ) { initCnt += 1 ; }
145-
146- // CHECK-LABEL: Running test 'testGlobalCtorJitCallback'
147- void testGlobalCtorJitCallback (void ) {
148- MlirContext ctx = mlirContextCreate ();
149- registerAllUpstreamDialects (ctx );
150-
151- // Create module with global constructor that calls our callback
152- MlirModule module = mlirModuleCreateParse (
153- ctx , mlirStringRefCreateFromCString (
154- // clang-format off
155- "module { \n"
156- " llvm.mlir.global_ctors ctors = [@ctor], priorities = [0 : i32], data = [#llvm.zero] \n"
157- " llvm.func @ctor() { \n"
158- " func.call @init_callback() : () -> () \n"
159- " llvm.return \n"
160- " } \n"
161- " func.func private @init_callback() attributes { llvm.emit_c_interface } \n"
162- "} \n"
163- // clang-format on
164- ));
165-
166- lowerModuleToLLVM (ctx , module );
167- mlirRegisterAllLLVMTranslations (ctx );
168-
169- // Create execution engine with initialization disabled
170- MlirExecutionEngine jit = mlirExecutionEngineCreate (
171- module , /*optLevel=*/ 2 , /*numPaths=*/ 0 , /*sharedLibPaths=*/ NULL ,
172- /*enableObjectDump=*/ false);
173-
174- if (mlirExecutionEngineIsNull (jit )) {
175- fprintf (stderr , "Execution engine creation failed" );
176- exit (2 );
177- }
178-
179- // Register callback symbol before initialization
180- mlirExecutionEngineRegisterSymbol (
181- jit , mlirStringRefCreateFromCString ("_mlir_ciface_init_callback" ),
182- (void * )(uintptr_t )initCallback );
183-
184- mlirExecutionEngineInitialize (jit );
185-
186- // CHECK: Init count: 1
187- printf ("Init count: %d\n" , initCnt );
188-
189- mlirExecutionEngineDestroy (jit );
190- mlirModuleDestroy (module );
191- mlirContextDestroy (ctx );
192- }
193-
194140int main (void ) {
195141
196142#define _STRINGIFY (x ) #x
@@ -201,6 +147,5 @@ int main(void) {
201147
202148 TEST (testSimpleExecution );
203149 TEST (testOmpCreation );
204- TEST (testGlobalCtorJitCallback );
205150 return 0 ;
206151}
0 commit comments