[flang-commits] [flang] [Flang][OpenMP] Remove omp.simd reduction block args (PR #111523)

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Wed Oct 9 02:19:04 PDT 2024


skatrak wrote:

> I'm okay with you merging this to fix the test runner but I have some questions.
> 
> Why did adding block arguments break some tests? Do we have a broken index calculation somewhere returning the wrong block arguments?

If you check the builder for `omp.simd` based on the operand structure, you see that reduction operands are not being added to the operation. If we added the corresponding block arguments, there would be a mismatch that results in some assertions being triggered while binding them. I'd say index calculation is fine, it's just that it's based on the arguments the operation itself has (0 in this case).

> 
> Why do we get this far with an unsupported clause? Shouldn't it have a TODO?

I'm not sure, my guess is to let `do simd reduction(...)` work by only processing the reduction at the `do` level. If we triggered a TODO for `simd reduction(...)`, we would hit it in that other case as well. `omp.simd` with `reduction` does trigger an error in translation to LLVM IR, so another option is to fully support it in flang lowering and let it complain later in the process (which wouldn't currently trigger for `do simd` because `omp.wsloop` lowering skips other nested wrappers).


https://github.com/llvm/llvm-project/pull/111523


More information about the flang-commits mailing list