[llvm-dev] Making loop guards part of canonical loop structure
Krzysztof Parzyszek via llvm-dev
llvm-dev at lists.llvm.org
Thu May 30 13:44:59 PDT 2019
I don't remember the details of the particular case where we encountered this, but I think the loop started with the condition check and ended with an unconditional branch back to the beginning.
--
Krzysztof Parzyszek kparzysz at quicinc.com LLVM compiler development
-----Original Message-----
From: Philip Reames <listmail at philipreames.com>
Sent: Thursday, May 30, 2019 3:00 PM
To: Krzysztof Parzyszek <kparzysz at quicinc.com>; Finkel, Hal J. <hfinkel at anl.gov>; Kit Barton <kit.barton at gmail.com>; llvm-dev at lists.llvm.org
Subject: [EXT] Re: [llvm-dev] Making loop guards part of canonical loop structure
Er, I'm missing something. Every loop header is guaranteed to execute at least once, if the preheader is reached. How is what you need anything more than a loop header with a unique predecessor (preheader)? I'm not seeing the need for a guard block in what you said.
Philip
On 5/30/19 11:28 AM, Krzysztof Parzyszek via llvm-dev wrote:
> On Hexagon, unguarded loops cannot be converted to hardware loops.
>
> If the loop's latch branch alone handles the iteration count, including the possibility of 0, then the loop cannot be converted to a hardware loop, because hardware loops must iterate at least once. If the entire loop is guarded against zero iteration count, we can put the loop setup in the preheader, since at that point the loop is guaranteed to execute at least once.
>
> I am strongly in favor of having some way to create loop guards, even if they are trivial.
>
More information about the llvm-dev
mailing list