This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH PR71503/PR71683]Fix ICE in tree-if-conv.c


On 07/15/2016 02:33 AM, Bin.Cheng wrote:
On Thu, Jul 14, 2016 at 6:49 PM, Jeff Law <law@redhat.com> wrote:
On 07/14/2016 10:12 AM, Bin Cheng wrote:

Hi,
This is a simple patch fixing ICE in tree-if-conv.c.  Existing code does
not setup a variable (cond) when predicate of basic block is true and it
asserts on the variable.  Interesting thing is dead code is not cleaned up
before ifcvt, but that's another story.
Bootstrap and test on x86_64.  Is it OK?

Thanks,
bin

2016-07-13  Bin Cheng  <bin.cheng@arm.com>

        PR tree-optimization/71503
        PR tree-optimization/71683
        * tree-if-conv.c (gen_phi_arg_condition): Set cond when predicate
        is true.

Maybe I'm missing something, but in the case where we COND is already set
and we encounter a true predicate later, shouldn't that make the result true
as well?
Yes, this is my understanding too, if the case does exist.  To my
understanding, conditions for phi arguments should be complimentary to
others.  If one argument has true predicate, then other must? be
false, then the case doesn't exist.


I don't think the code will though -- we just throw away the true condition.
ISTM that the right thing to do is

if (is_true_predicate (c))
  {
    cond = c;
    continue;
  }
Anyway, I think we can make it more robust/efficient by using:
if (is_true_predicate (c))
 {
   cond = c;
   break;
  }
What do you think?  Actually we should discard other arguments if one
has true predicate.
That sounds even better.


Can you see if you can trigger a case where we have an existing cond, then
later find a true condition to verify the right thing happens?
Failed to do so.  It should be quite rare, if no impossible,
Thanks for checking.

jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]