[llvm] r211103 - Fixed jump threading going to infinite loop.

Dinesh Dwivedi dinesh.d at samsung.com
Thu Jun 19 00:11:48 PDT 2014


How about this

  // Remove unreachable blocks from function as they may result in infinite loop
  // We do threading if we found something profitable. Jump threading a branch
  // can create other opportunities. If these opportunities form a cycle i.e. if
  // any jump treading is undoing previous threading in the path, then we will
  // forever. We take care of this issue by not jump threading for back edges.
  // This works for normal cases but not for unreachable blocks as they may have
  // cycle with no back edge.
  removeUnreachableBlocks(F);

Regards
Dinesh Dwivedi

------- Original Message -------
Sender : Rafael EspĂ­ndola<rafael.espindola at gmail.com> 
Date   : Jun 18, 2014 17:44 (GMT+05:30)
Title  : Re: Re: [llvm] r211103 - Fixed jump threading going to infinite loop.

On 18 June 2014 02:23, Dinesh Dwivedi <dinesh.d at samsung.com> wrote:
> Sorry, committed this patch too soon. How about changing comment as follows.

No, that is fine. In llvm the code review process does continue after commit.

>   // Remove unreachable blocks from function as they may result in infinite loop
>   // We do threading if we found something profitable. But there may be two or
>   // more conflicting cases where both are profitable and one results in undoing
>   // other. This issue will not come for reachable blocks as we don't jump
>   // thread back edges. Unreachable blocks having cycle with no back edge may
>   // result in infinite loop.
>   removeUnreachableBlocks(F);

Close. I wouldn't call the optimizations conflicting since they don't
exist at the same time. It is just that jump threading a branch can
create another opportunity. If the blocks for a cycle, we would loop
forever, except that we avoid that by looking at back edges. The
problem with unreachable code is that there will be a loop, but not
back edge.

Cheers,
Rafael




More information about the llvm-commits mailing list