Hi Rohit,

[ Please CC: me on combine patches ].

On Tue, Feb 16, 2016 at 05:02:30AM +0000, Rohit Arul Raj D wrote:
> This is related to the following bug:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60818
> 
> Test case:
> unsigned int ou;
> int jv(void)
> {
>   unsigned int rg;
>   return rg < ou;
> }

> a) The test case passes with '-mno-isel' option.
>      The bug description has 2 test cases (comment #4) and both of them pass 
> with this option.

It needs -m32 -misel -mno-mfcrf to fail.

> Corresponding content of "op" which causes the ICE:
> gdb) p debug_rtx (op)
> (gtu:SI (reg:CC 166)  ---------------------- (operator and mode doesn't match)
>     (const_int 0 [0]))

That is invalid RTL for this target (should be CCUNS).  Invalid RTL
should not be passed to recog.

> My initial fix was to have signed_scc_comparison_operator and 
> unsigned_scc_comparison_operator but that led to ICE from another stage of 
> combiner pass. So I thought it would be better to fix this at the stage where 
> the conditional mode is being wrongly set.

Yes.  Btw, please try to send email with lines < 76 chars or so.

> (gdb) p debug_rtx (other_insn)
> (insn 11 10 16 2 (set (reg:SI 165 [ D.2339+-3 ])
>         (if_then_else:SI (ne (reg:CC 166)
>                 (const_int 0 [0]))
>             (reg:SI 168)
>             (reg:SI 167))) test.c:7 317 {isel_unsigned_si}
>      (expr_list:REG_DEAD (reg:SI 168)
>         (expr_list:REG_DEAD (reg:SI 167)
>             (expr_list:REG_DEAD (reg:CC 166)
>                 (expr_list:REG_EQUAL (gtu:SI (reg:CC 166)
>                         (const_int 0 [0]))
>                     (nil))))))

The REG_EQUAL there is bad already.  Where does that come from?

> +                           else
> +                              {
> +                                SUBST_MODE (regno_reg_rtx[regno], new_mode);
> +                                new_dest = regno_reg_rtx[regno];
> +                              }
> +                            SUBST (SET_DEST (i2mod_new_rhs), new_dest);
> +                         }

Let's not SUBST outside of try_combine please.  It probably works, but
there is enough action-at-a-distance as it is.


Segher

Reply via email to