I observed a crash in device OpenMP lowering when compiling with `-fdefault-integer-8`. In `targetParallelCallback`, `NumThreads` can be `i64`, but `__kmpc_parallel_60` expects an `i32` `num_threads` parameter, which caused a bad-signature assertion during call creation. The fix is to use `CreateZExtOrTrunc(..., Int32)` for the `num_threads` argument before building the runtime call. This matches the handling used in clang in `CGOpenMPRuntimeGPU::emitParallelCall`. The problem can be seen with the following testcase whe compiled with `flang -fopenmp --offload-arch=gfx90a test.f90 -fdefault-integer-8`` ``` program test implicit none integer :: nthreads integer :: i nthreads = 137 !$omp target teams distribute parallel do num_threads(nthreads) do i = 1, 1 end do !$omp end target teams distribute parallel do end program test ```
Multi-Level Intermediate Representation
See https://mlir.llvm.org/ for more information.