[llvm-dev] LoopStrengthReduce.cpp
Krzysztof Parzyszek via llvm-dev
llvm-dev at lists.llvm.org
Tue Mar 29 09:05:55 PDT 2016
On 3/29/2016 3:05 AM, Jonas Paulsson via llvm-dev wrote:
> Could this be done somehow, or is it really so that all targets have to
> have their own passes to do this?
In the Hexagon backend we also have a separate pass that converts
compare+branch loops into hardware loops. We recognize several
different patterns of the controlling induction variable, including
cases where the increment is not 1 or -1. If we decide to generate a
hardware loop, we may add some instructions to calculate the iteration
count, if it's not already available.
The general problem for us is that not every loop can be converted to a
hardware loop. At the same time, making each loop iterate over a
counter that decrements down to 0 may add extra code that may end up
being unnecessary. It is easier for us to recognize cases where we want
a hardware loop and do work to make it happen.
On that note, I think that in general it would be useful to have some
target-independent (CodeGen) pass that would do the majority of the work
for hardware loop generation. I have thought about it, but I won't be
able to do anything in the short term.
-Krzysztof
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
More information about the llvm-dev
mailing list