[all-commits] [llvm/llvm-project] 4f0112: [LV] Parallel annotated loop does not imply all lo...

fodinabor via All-commits all-commits at lists.llvm.org
Thu Jun 10 14:35:06 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4f01122c3f6c70beee8f736f196a09976602685f
      https://github.com/llvm/llvm-project/commit/4f01122c3f6c70beee8f736f196a09976602685f
  Author: Joachim Meyer <joachim at joameyer.de>
  Date:   2021-06-10 (Thu, 10 Jun 2021)

  Changed paths:
    M llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
    M llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
    R llvm/test/Transforms/LoopVectorize/X86/force-ifcvt.ll
    M llvm/test/Transforms/LoopVectorize/X86/tail_folding_and_assume_safety.ll

  Log Message:
  -----------
  [LV] Parallel annotated loop does not imply all loads can be hoisted.

As noted in https://bugs.llvm.org/show_bug.cgi?id=46666, the current behavior of assuming if-conversion safety if a loop is annotated parallel (`!llvm.loop.parallel_accesses`), is not expectable, the documentation for this behavior was since removed from the LangRef again, and can lead to invalid reads.
This was observed in POCL (https://github.com/pocl/pocl/issues/757) and would require similar workarounds in current work at hipSYCL.

The question remains why this was initially added and what the implications of removing this optimization would be.
Do we need an alternative mechanism to propagate the information about legality of if-conversion?
Or is the idea that conditional loads in `#pragma clang loop vectorize(assume_safety)` can be executed unmasked without additional checks flawed in general?
I think this implication is not part of what a user of that pragma (and corresponding metadata) would expect and thus dangerous.

Only two additional tests failed, which are adapted in this patch. Depending on the further direction force-ifcvt.ll should be removed or further adapted.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D103907




More information about the All-commits mailing list