brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · da240f4 Raw
38 lines · plain
1// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s2 3// Test that we don't crash when there is a call operation in the combiner4 5omp.declare_reduction @add_f32 : f326init {7^bb0(%arg: f32):8  %0 = llvm.mlir.constant(0.0 : f32) : f329  omp.yield (%0 : f32)10}11combiner {12^bb1(%arg0: f32, %arg1: f32):13// test this call here:14  llvm.call @test_call() : () -> ()15  %1 = llvm.fadd %arg0, %arg1 : f3216  omp.yield (%1 : f32)17}18 19llvm.func @simple_reduction(%lb : i64, %ub : i64, %step : i64) {20  %c1 = llvm.mlir.constant(1 : i32) : i3221  %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr22  omp.parallel reduction(@add_f32 %0 -> %prv : !llvm.ptr) {23    %1 = llvm.mlir.constant(2.0 : f32) : f3224    %2 = llvm.load %prv : !llvm.ptr -> f3225    %3 = llvm.fadd %1, %2 : f3226    llvm.store %3, %prv : f32, !llvm.ptr27    omp.terminator28  }29  llvm.return30}31 32llvm.func @test_call() -> ()33 34// Call to the troublesome function will have been inlined twice: once into35// main and once into the outlined function36// CHECK: call void @test_call()37// CHECK: call void @test_call()38