cse.c (delete_trivially_dead_insns): Delete the libcall block when return value is...
authorJan Hubicka <jh@suse.cz>
Wed, 18 Jul 2001 16:36:33 +0000 (18:36 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 18 Jul 2001 16:36:33 +0000 (16:36 +0000)
* cse.c (delete_trivially_dead_insns): Delete the libcall block
when return value is unused.

From-SVN: r44112

gcc/ChangeLog
gcc/cse.c

index 251dddeceb6b67ccabc77b1fd22a66452215c727..066b41200d8bd1e4d4d1df4b156842374f5a40dc 100644 (file)
@@ -1,3 +1,8 @@
+Wed Jul 18 18:35:01 CEST 2001  Jan Hubicka  <jh@suse.cz>
+
+       * cse.c (delete_trivially_dead_insns): Delete the libcall block
+       when return value is unused.
+
 Wed Jul 18 18:28:16 CEST 2001  Jan Hubicka  <jh@suse.cz>
 
        * gcse.c (pre_insert_copy_insn): Call update_ld_motion_stores.
index 266b1076c755dd93ae9de5874d11440ee2dce78a..73cbb880f2d9888ab03980840cd7afa4353b7877 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -7488,7 +7488,7 @@ count_reg_usage (x, counts, dest, incr)
 static bool
 set_live_p (set, insn, counts)
      rtx set;
-     rtx insn;
+     rtx insn ATTRIBUTE_UNUSED;
      int *counts;
 {
 #ifdef HAVE_cc0
@@ -7630,8 +7630,19 @@ delete_trivially_dead_insns (insns, nreg, preserve_basic_blocks)
        if (find_reg_note (insn, REG_RETVAL, NULL_RTX))
          {
            in_libcall = 1;
-           live_insn = 1;
-           dead_libcall = dead_libcall_p (insn);
+           /* If the insn storing return value is dead, whole libcall is dead.
+              Otherwise attempt to eliminate libcall by doing an direct
+              operation.  */
+           if (!insn_live_p (insn, counts))
+             {
+               live_insn = 0;
+               dead_libcall = 1;
+             }
+           else
+             {
+               live_insn = 1;
+               dead_libcall = dead_libcall_p (insn);
+             }
          }
        else if (in_libcall)
          live_insn = ! dead_libcall;
@@ -7671,8 +7682,19 @@ delete_trivially_dead_insns (insns, nreg, preserve_basic_blocks)
          if (find_reg_note (insn, REG_RETVAL, NULL_RTX))
            {
              in_libcall = 1;
-             live_insn = 1;
-             dead_libcall = dead_libcall_p (insn);
+           /* If the insn storing return value is dead, whole libcall is dead.
+              Otherwise attempt to eliminate libcall by doing an direct
+              operation.  */
+           if (!insn_live_p (insn, counts))
+             {
+               live_insn = 0;
+               dead_libcall = 1;
+             }
+           else
+             {
+               live_insn = 1;
+               dead_libcall = dead_libcall_p (insn);
+             }
            }
          else if (in_libcall)
            live_insn = ! dead_libcall;