* loop-invariant.c: Include target.h.
(check_dependency): Return false for an uninitialized argument register
that is likely to be spilled.
* Makefile.in (loop-invariant.o): Add $(TARGET_H).
From-SVN: r192566
+2012-10-18 Eric Botcazou <ebotcazou@adacore.com>
+
+ * loop-invariant.c: Include target.h.
+ (check_dependency): Return false for an uninitialized argument register
+ that is likely to be spilled.
+ * Makefile.in (loop-invariant.o): Add $(TARGET_H).
+
2012-10-18 Eric Botcazou <ebotcazou@adacore.com>
* except.c (sjlj_emit_function_enter): Remove unused variable.
intl.h $(DIAGNOSTIC_CORE_H) $(DF_H) $(HASHTAB_H)
loop-invariant.o : loop-invariant.c $(CONFIG_H) $(SYSTEM_H) coretypes.h dumpfile.h \
$(RTL_H) $(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(EXPR_H) $(RECOG_H) \
- $(TM_H) $(TM_P_H) $(FUNCTION_H) $(FLAGS_H) $(DF_H) \
+ $(TM_H) $(TM_P_H) $(FUNCTION_H) $(FLAGS_H) $(DF_H) $(TARGET_H) \
$(OBSTACK_H) $(HASHTAB_H) $(EXCEPT_H) $(PARAMS_H) $(REGS_H) ira.h
cfgloopmanip.o : cfgloopmanip.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
$(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) \
#include "cfgloop.h"
#include "expr.h"
#include "recog.h"
+#include "target.h"
#include "function.h"
#include "flags.h"
#include "df.h"
defs = DF_REF_CHAIN (use);
if (!defs)
- return true;
+ {
+ unsigned int regno = DF_REF_REGNO (use);
+
+ /* If this is the use of an uninitialized argument register that is
+ likely to be spilled, do not move it lest this might extend its
+ lifetime and cause reload to die. This can occur for a call to
+ a function taking complex number arguments and moving the insns
+ preparing the arguments without moving the call itself wouldn't
+ gain much in practice. */
+ if ((DF_REF_FLAGS (use) & DF_HARD_REG_LIVE)
+ && FUNCTION_ARG_REGNO_P (regno)
+ && targetm.class_likely_spilled_p (REGNO_REG_CLASS (regno)))
+ return false;
+
+ return true;
+ }
if (defs->next)
return false;
+2012-10-18 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/loop_optimization13.ad[sb]: New test.
+ * gnat.dg/loop_optimization13_pkg.ads: New helper.
+
2012-10-18 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* gcc.target/arm/neon/vfmaQf32.c: New testcase.
--- /dev/null
+-- { dg-do compile }\r
+-- { dg-options "-O" }\r
+\r
+with Loop_Optimization13_Pkg; use Loop_Optimization13_Pkg;\r
+\r
+package body Loop_Optimization13 is\r
+\r
+ function F (A : Rec) return Rec is\r
+ N : constant Integer := A.V'Length / L;\r
+ Res : Rec\r
+ := (True, new Complex_Vector' (0 .. A.V'Length / L - 1 => (0.0, 0.0)));\r
+ begin\r
+ for I in 0 .. L - 1 loop\r
+ for J in 0 .. N - 1 loop\r
+ Res.V (J) := Res.V (J) + A.V (I * N + J);\r
+ end loop;\r
+ end loop;\r
+ return Res;\r
+ end;\r
+\r
+end Loop_Optimization13;\r
--- /dev/null
+with Ada.Numerics.Complex_Types; use Ada.Numerics.Complex_Types;\r
+\r
+package Loop_Optimization13 is\r
+\r
+ type Complex_Vector is array (Integer range <>) of Complex;\r
+ type Complex_Vector_Ptr is access Complex_Vector;\r
+\r
+ type Rec (Kind : Boolean := False) is record\r
+ case Kind is\r
+ when True => V : Complex_Vector_Ptr;\r
+ when False => null;\r
+ end case;\r
+ end record;\r
+\r
+ function F (A : Rec) return Rec;\r
+\r
+end Loop_Optimization13;\r
--- /dev/null
+package Loop_Optimization13_Pkg is
+
+ L : Integer;
+
+end Loop_Optimization13_Pkg;