OSDN Git Service

* sched-deps.c (sched_analyze_insn): Make clobber insns depend
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 Sep 2002 01:07:52 +0000 (01:07 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 Sep 2002 01:07:52 +0000 (01:07 +0000)
        on call insns.
* gcc.c-torture/compile/20020926-1.c: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57566 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/sched-deps.c
gcc/testsuite/gcc.c-torture/compile/20020926-1.c [new file with mode: 0644]

index 6c9702a..f836df4 100644 (file)
@@ -1,5 +1,11 @@
 2002-09-26  Richard Henderson  <rth@redhat.com>
 
+       PR c/7160
+       * sched-deps.c (sched_analyze_insn): Make clobber insns depend
+       on call insns.
+
+2002-09-26  Richard Henderson  <rth@redhat.com>
+
        * emit-rtl.c (const_double_htab_eq): Remove unused variable.
 
 2002-09-26  Chris Lattner  <sabre@nondot.org>
index 32260a8..cf762cc 100644 (file)
@@ -922,7 +922,15 @@ sched_analyze_insn (deps, x, insn, loop_notes)
       code = GET_CODE (x);
     }
   if (code == SET || code == CLOBBER)
-    sched_analyze_1 (deps, x, insn);
+    {
+      sched_analyze_1 (deps, x, insn);
+
+      /* Bare clobber insns are used for letting life analysis, reg-stack
+        and others know that a value is dead.  Depend on the last call
+        instruction so that reg-stack won't get confused.  */
+      if (code == CLOBBER)
+       add_dependence_list (insn, deps->last_function_call, REG_DEP_OUTPUT);
+    }
   else if (code == PARALLEL)
     {
       int i;
diff --git a/gcc/testsuite/gcc.c-torture/compile/20020926-1.c b/gcc/testsuite/gcc.c-torture/compile/20020926-1.c
new file mode 100644 (file)
index 0000000..260e844
--- /dev/null
@@ -0,0 +1,21 @@
+/* PR c/7160 */
+/* Verify that the register-to-stack converter properly handles
+   branches without return value containing function calls.  */
+   
+extern int gi;
+
+extern int foo1(int, int);
+extern void foo2(int, int);
+extern float foo3(int);
+
+float bar(int i1, int i2)
+{
+  int i3;
+    
+  if (i2) {
+    i3 = foo1(i1, gi);
+    foo2(i1, i3);
+  }
+  else
+    return foo3(i2);
+}