Skip to content

ScalarEvolution can't find iteration count without tail duplication #1473

@llvmbot

Description

@llvmbot
Bugzilla Link 1101
Resolution FIXED
Resolved on Feb 22, 2010 12:46
Version trunk
OS All
Attachments A simple loop without tail duplication., A simple loop with tail duplication.
Reporter LLVM Bugzilla Contributor

Extended Description

Hi, the TOT llvm can't find the iteration count without tail duplication, I
guess it's caused by the following code in

ScalaEvoluation.cpp:
// Currently we check for this by checking to see if the Exit branch goes to
// the loop header. If so, we know it will always execute the same number of
// times as the loop. More extensive analysis could be done to handle more
// cases here.
if (ExitBr->getSuccessor(0) != L->getHeader() &&
ExitBr->getSuccessor(1) != L->getHeader())
return UnknownValue;

I need to disable tail duplication because it changes a while loop to a do-
while loop by moving the exiting branch to the end of the loop body.

I attached two files: (1) foo.bc : a simple loop without tail duplication
(2) foo.taildup.bc: a simple loop with tail duplication. I ran "opt -indvar" on
these two files, llvm failed to find trip count on the first example; but if I
comment those three lines, it works fine and report the correct iteration
count. Based on my understanding, those checking are not necessary since
scalarevoluation works normally even the checking fails.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions