[llvm-dev] [PATCHish] IfConversion; lost edges for some diamonds

Kyle Butt via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 10 12:22:12 PST 2017


On Tue, Jan 10, 2017 at 2:31 AM, Peter A Jonsson <pj at sics.se> wrote:

> Hi Kyle,
>
> my apologies for mailing you directly but it seems new user creation is
> disabled on the llvm bugzilla.
>
> We sometime lose edges during IfConversion of diamonds and it’s not
> obvious how to reproduce on an upstream target. The documentation for
> HasFallThrough says *may* fallthrough which I interpret as “this will be
> true whenever we aren’t sure” but IfConverter::AnalyzeBranches() contains
> the code:
>
> BBI.HasFallThrough = BBI.IsBrAnalyzable && BBI.FalseBB == nullptr;
>

BBI.HasFallThrough really means "Has Analyzable fallthrough." So this line
is correct.


>
> So HasFallThrough is false whenever IsBrAnalyzable is false. That is
> common because IsBrAnalyzable is false when analyzeBranch() is true (its
> default implementation). Is it possible that HasFallThrough should also be
> true when IsBrAnalyzable is false? In other words, instead initialized as:
>
> BBI.HasFallThrough = !BBI.IsBrAnalyzable || BBI.FalseBB == nullptr;
>
> ? That change makes my test pass so it would be wonderfully simple if that
> is all that it takes.


I suspect there is a simple change, but you're looking in the wrong place.
Can you let me know if the attached patch works for you?


>
> Best Wishes,
>
> Peter
>
>> Peter A. Jonsson, Ph.D.
> Swedish Institute of Computer Science
> Box 1263, SE-164 29 Kista, Sweden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170110/37432f16/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: if-try.patch
Type: text/x-patch
Size: 678 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170110/37432f16/attachment.bin>


More information about the llvm-dev mailing list