[llvm-dev] LoopSimplify pass prevents loop unrolling
Friedman, Eli via llvm-dev
llvm-dev at lists.llvm.org
Fri Jun 30 10:59:24 PDT 2017
On 6/30/2017 7:48 AM, Balaram Makam via llvm-dev wrote:
>
> Edit. Predecessor -> successor.
>
> *From:* llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] *On Behalf
> Of *Balaram Makam via llvm-dev
> *Sent:* Friday, June 30, 2017 10:47 AM
> *To:* llvm-dev at lists.llvm.org
> *Subject:* [llvm-dev] LoopSimplify pass prevents loop unrolling
>
> Hi All,
>
> In the attached test case there, is an unnested loop with 2
> iterations. The loop latch block is terminated by an unconditional
> branch, so simplifycfg folds the almost empty latch block into its
> *successor* which is the loop header. This results in an additional
> backedge in the CFG, so when LoopRotate pass is called it
> canonicalizes the loop into a nested loop. However, now the loop trip
> count is unpredictable as the BackedgeTakenCount for the outer loop is
> not loop invariant. As a result the loop cannot be unrolled. Is this
> the intended canonicalization for this loop or is the loopsimplify
> canonicalizing incorrectly? Should simplifycfg skip folding the latch
> block into the loop header if this results in additional backedges and
> let the empty blocks be folded during CGP? More details in
> https://bugs.llvm.org/show_bug.cgi?id=33605.
>
We have code that's supposed to prevent this from happening; see
https://reviews.llvm.org/rL264697 . Maybe it also needs to check
whether the destination of the branch is a loop header?
-Eli
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170630/d9a33d10/attachment.html>
More information about the llvm-dev
mailing list