[PATCH] D101374: [LV] Consider Loop Unroll Hints When Making Interleave Decisions

Bardia Mahjour via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 27 09:16:16 PDT 2021


bmahjour created this revision.
bmahjour added reviewers: SjoerdMeijer, fhahn, Ayal, Meinersbur.
bmahjour added projects: LLVM, PowerPC.
Herald added subscribers: zzheng, hiraditya.
bmahjour requested review of this revision.
Herald added a subscriber: llvm-commits.

Currently the `#pragma clang loop unroll(disable)` directive has no impact on loop vectorizer's decision to interleave or not. This results in unintended codegen when users explicitly asked for no unrolling to take place.
This patch causes the loop vectorizer to not interleave loops that have nounroll loop hints (`llvm.loop.unroll.disable`, `llvm.loop.unroll.runtime.disable` and `llvm.loop.unroll_count(1)`). Note that if a particular interleave count is being requested (through `llvm.loop.interleave_count`), it will still be honoured, regardless of the presence of nounroll hints.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101374

Files:
  llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
  llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/X86/no_fpmath.ll
  llvm/test/Transforms/LoopVectorize/explicit_outer_detection.ll
  llvm/test/Transforms/LoopVectorize/nounroll.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101374.340865.patch
Type: text/x-patch
Size: 14260 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210427/0d42c91a/attachment.bin>


More information about the llvm-commits mailing list