https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77826

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ideally we'd do operand_equal_p's job in the pattern but there is no reliable
way to get at the type of the (convert? @0) operand.  So I'm thinking of
amending operand_equal_p () with a types_match () check instead...

Index: gcc/genmatch.c
===================================================================
--- gcc/genmatch.c      (revision 240739)
+++ gcc/genmatch.c      (working copy)
@@ -2593,8 +2601,10 @@ dt_operand::gen_match_op (FILE *f, int i
 {
   char match_opname[20];
   match_dop->get_name (match_opname);
-  fprintf_indent (f, indent, "if (%s == %s || operand_equal_p (%s, %s, 0))\n",
-                 opname, match_opname, opname, match_opname);
+  fprintf_indent (f, indent, "if (%s == %s || (operand_equal_p (%s, %s, 0) "
+                 "&& types_match (%s, %s)))\n",
+                 opname, match_opname, opname, match_opname,
+                 opname, match_opname);
   fprintf_indent (f, indent + 2, "{\n");
   return 1;
 }

Reply via email to