aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/BASE-VER2
-rw-r--r--gcc/ChangeLog107
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/builtins.c118
-rw-r--r--gcc/config/i386/i386.c45
-rw-r--r--gcc/config/i386/i386.md50
-rw-r--r--gcc/config/i386/sse.md2
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl2.c8
-rw-r--r--gcc/doc/install.texi20
-rw-r--r--gcc/doc/sourcebuild.texi4
-rw-r--r--gcc/fold-const.c42
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/Make-lang.in5
-rw-r--r--gcc/fortran/config-lang.in2
-rw-r--r--gcc/simplify-rtx.c4
-rw-r--r--gcc/testsuite/ChangeLog23
-rw-r--r--gcc/testsuite/g++.dg/parse/bitfield1.C2
-rw-r--r--gcc/testsuite/g++.dg/parse/bitfield2.C34
-rw-r--r--gcc/testsuite/gcc.dg/builtins-8.c6
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr26898-1.c14
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr26898-2.c12
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20031015-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr26421.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-15.c16
-rw-r--r--gcc/tree-dfa.c2
-rw-r--r--gcc/tree-flow.h5
-rw-r--r--gcc/tree-ssa-operands.c4
-rw-r--r--gcc/tree-ssa-pre.c17
-rw-r--r--gcc/tree-ssa-structalias.c175
-rw-r--r--gcc/tree.h7
33 files changed, 476 insertions, 273 deletions
diff --git a/gcc/BASE-VER b/gcc/BASE-VER
index 6aba2b245a8..80895903a15 100644
--- a/gcc/BASE-VER
+++ b/gcc/BASE-VER
@@ -1 +1 @@
-4.2.0
+4.3.0
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fb741b5d41f..8f2f384c936 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,110 @@
+2006-10-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386.md (UNSPEC_LDQQU): Renamed to ...
+ (UNSPEC_LDDQU): This.
+ * config/i386/sse.md (sse3_lddqu): Updated.
+
+2006-10-21 Richard Guenther <rguenther@suse.de>
+
+ * builtins.c (expand_builtin_int_roundingfn_2): New function.
+ (expand_builtin): Use it to expand lrint instead of
+ expand_builtin_mathfn.
+
+2006-10-21 Uros Bizjak <uros@kss-loka.si>
+
+ PR middle-end/28252
+ * builtins.c (fold_builtin): Fold pow(x,1.0/3.0) as cbrt(x) if
+ flag_unsafe_math_optimizations is set.
+
+2006-10-21 Uros Bizjak <uros@kss-loka.si>
+
+ PR target/19398
+ * config/i386/i386.md (fix_trunc?f?i_sse): Add peephole2
+ patterns to use memory input operand in x87->mem->XMM
+ reload sequences. Skip transformation for TARGET_K8.
+
+2006-10-21 Uros Bizjak <uros@kss-loka.si>
+
+ * config/i386/i386.md (extendsfdf2, extendsfxf2, extenddfxf2): Do not
+ force operand1 to register if both operands are memory operands.
+ (*extendsfdf2_mixed, *extendsfdf2_sse, *extendsfdf2_i387)
+ (*extendsfxf2_i387, *extenddfxf2_i387): Do not disable pattern
+ if both operands are memory operands.
+ (truncdfsf2): Do not force operand1 to register if both operands
+ are memory operands.
+
+2006-10-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (LIBS): Add $(GMPLIBS).
+ * doc/install.texi: Update GMP and MPFR requirements.
+ * doc/sourcebuild.texi (need_gmp): Delete.
+
+2006-10-21 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/3511
+ * tree-ssa-pre.c (phi_translate): Fold CALL_EXPRs that
+ got new invariant arguments during PHI translation.
+
+2006-10-21 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/26898
+ * fold-const.c (fold_comparison): Fold signed comparisons
+ of the form X +- C1 CMP Y +- C2.
+
+2006-10-21 Richard Guenther <rguenther@suse.de>
+
+ PR target/19116
+ * config/i386/i386.c (override_options): Do not set MASK_IEEE_FP
+ if flag_unsafe_math_optimizations is specified. We have
+ flag_finite_math_only for that.
+ * config/i386/i386.md (sqrtxf2): Do not require TARGET_IEEE_FP
+ or flag_unsafe_math_optimizations.
+
+2006-10-21 Richard Guenther <rguenther@suse.de>
+
+ * builtins.c (fold_builtin_classify): Fix typo.
+
+2006-10-21 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/28796
+ * simplify-rtx.c (simplify_const_relational_operation):
+ Do not constant-fold ORDERED and UNORDERED for
+ flag_unsafe_math_optimizations but only we do not need to
+ honor NaNs for the given mode.
+
+2006-10-21 Richard Guenther <rguenther@suse.de>
+
+ PR target/29512
+ * config/i386/i386.c (classify_argument): Remove redundant
+ walking of the BINFOs.
+ (contains_128bit_aligned_vector_p): Likewise.
+
+2006-10-20 Mark Mitchell <mark@codesourcery.com>
+
+ * BASE-VER: Set to 4.3.0.
+
+2006-10-20 Daniel Berlin <dberlin@dberlin.org>
+
+ * tree.h (DECL_PTA_ARTIFICIAL): Remove.
+ (tree_decl_with_vis): Remove artificial_pta_var flag.
+ * tree-flow.h (referenced_var_check_and_insert): Expose.
+ (nonlocal_all): New prototype.
+ * tree-ssa-structalias.c (nonlocal_for_type): Remove.
+ (nonlocal_all): Make global.
+ (nonlocal_lookup): Remove.
+ (nonlocal_insert): Ditto.
+ (create_nonlocal_var): Do not call nonlocal_insert.
+ (get_nonlocal_id_for_type): Remove.
+ (find_global_initializers): Mark new vars we find for renaming.
+ (intra_create_variable_infos): Only create one nonlocal.
+ (expand_nonlocal_solutions): Remove.
+ (compute_points_to_sets): Don't call it.
+ (ipa_pta_execute): Ditto.
+ (init_alias_heapvars): Don't create nonlocal_for_type.
+ (delete_alias_heapvars): Don't remove it.
+ * tree-ssa-operands.c (access_can_touch_variable): Don't prune
+ nonlocal_all.
+
2006-10-19 Brooks Moses <bmoses@stanford.edu>
* doc/install.texi (Downloading GCC): Clarify mention of
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 22871e991fa..ccaa6e0c35b 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20061020
+20061022
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 312ae664615..4b7100913af 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -846,7 +846,7 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY)
# How to link with both our special library facilities
# and the system's installed libraries.
-LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) $(LIBDECNUMBER)
+LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) $(LIBDECNUMBER) $(GMPLIBS)
# Any system libraries needed just for GNAT.
SYSLIBS = @GNAT_LIBEXC@
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 0d28992d2c2..ecee42b69be 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -95,6 +95,7 @@ static rtx expand_builtin_mathfn_2 (tree, rtx, rtx);
static rtx expand_builtin_mathfn_3 (tree, rtx, rtx);
static rtx expand_builtin_sincos (tree);
static rtx expand_builtin_int_roundingfn (tree, rtx, rtx);
+static rtx expand_builtin_int_roundingfn_2 (tree, rtx, rtx);
static rtx expand_builtin_args_info (tree);
static rtx expand_builtin_next_arg (void);
static rtx expand_builtin_va_start (tree);
@@ -1835,9 +1836,6 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget)
builtin_optab = nearbyint_optab; break;
CASE_FLT_FN (BUILT_IN_RINT):
builtin_optab = rint_optab; break;
- CASE_FLT_FN (BUILT_IN_LRINT):
- CASE_FLT_FN (BUILT_IN_LLRINT):
- builtin_optab = lrint_optab; break;
default:
gcc_unreachable ();
}
@@ -2210,7 +2208,9 @@ expand_builtin_sincos (tree exp)
return const0_rtx;
}
-/* Expand a call to one of the builtin rounding functions (lfloor).
+/* Expand a call to one of the builtin rounding functions gcc defines
+ as an extension (lfloor and lceil). As these are gcc extensions we
+ do not need to worry about setting errno to EDOM.
If expanding via optab fails, lower expression to (int)(floor(x)).
EXP is the expression that is a call to the builtin function;
if convenient, the result should be placed in TARGET. SUBTARGET may
@@ -2309,6 +2309,88 @@ expand_builtin_int_roundingfn (tree exp, rtx target, rtx subtarget)
return target;
}
+/* Expand a call to one of the builtin math functions doing integer
+ conversion (lrint).
+ Return 0 if a normal call should be emitted rather than expanding the
+ function in-line. EXP is the expression that is a call to the builtin
+ function; if convenient, the result should be placed in TARGET.
+ SUBTARGET may be used as the target for computing one of EXP's operands. */
+
+static rtx
+expand_builtin_int_roundingfn_2 (tree exp, rtx target, rtx subtarget)
+{
+ optab builtin_optab;
+ rtx op0, insns;
+ tree fndecl = get_callee_fndecl (exp);
+ tree arglist = TREE_OPERAND (exp, 1);
+ enum machine_mode mode;
+ tree arg, narg;
+
+ /* There's no easy way to detect the case we need to set EDOM. */
+ if (flag_errno_math)
+ return NULL_RTX;
+
+ if (!validate_arglist (arglist, REAL_TYPE, VOID_TYPE))
+ return NULL_RTX;
+
+ arg = TREE_VALUE (arglist);
+
+ switch (DECL_FUNCTION_CODE (fndecl))
+ {
+ CASE_FLT_FN (BUILT_IN_LRINT):
+ CASE_FLT_FN (BUILT_IN_LLRINT):
+ builtin_optab = lrint_optab; break;
+ default:
+ gcc_unreachable ();
+ }
+
+ /* Make a suitable register to place result in. */
+ mode = TYPE_MODE (TREE_TYPE (exp));
+
+ /* Before working hard, check whether the instruction is available. */
+ if (builtin_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
+ {
+ target = gen_reg_rtx (mode);
+
+ /* Wrap the computation of the argument in a SAVE_EXPR, as we may
+ need to expand the argument again. This way, we will not perform
+ side-effects more the once. */
+ narg = builtin_save_expr (arg);
+ if (narg != arg)
+ {
+ arg = narg;
+ arglist = build_tree_list (NULL_TREE, arg);
+ exp = build_function_call_expr (fndecl, arglist);
+ }
+
+ op0 = expand_expr (arg, subtarget, VOIDmode, 0);
+
+ start_sequence ();
+
+ /* Compute into TARGET.
+ Set TARGET to wherever the result comes back. */
+ target = expand_unop (mode, builtin_optab, op0, target, 0);
+
+ if (target != 0)
+ {
+ /* Output the entire sequence. */
+ insns = get_insns ();
+ end_sequence ();
+ emit_insn (insns);
+ return target;
+ }
+
+ /* If we were unable to expand via the builtin, stop the sequence
+ (without outputting the insns) and call to the library function
+ with the stabilized argument list. */
+ end_sequence ();
+ }
+
+ target = expand_call (exp, target, target == const0_rtx);
+
+ return target;
+}
+
/* To evaluate powi(x,n), the floating point value x raised to the
constant integer exponent n, we use a hybrid algorithm that
combines the "window method" with look-up tables. For an
@@ -5718,8 +5800,6 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
CASE_FLT_FN (BUILT_IN_ROUND):
CASE_FLT_FN (BUILT_IN_NEARBYINT):
CASE_FLT_FN (BUILT_IN_RINT):
- CASE_FLT_FN (BUILT_IN_LRINT):
- CASE_FLT_FN (BUILT_IN_LLRINT):
target = expand_builtin_mathfn (exp, target, subtarget);
if (target)
return target;
@@ -5734,6 +5814,13 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
return target;
break;
+ CASE_FLT_FN (BUILT_IN_LRINT):
+ CASE_FLT_FN (BUILT_IN_LLRINT):
+ target = expand_builtin_int_roundingfn_2 (exp, target, subtarget);
+ if (target)
+ return target;
+ break;
+
CASE_FLT_FN (BUILT_IN_POW):
target = expand_builtin_pow (exp, target, subtarget);
if (target)
@@ -7688,6 +7775,23 @@ fold_builtin_pow (tree fndecl, tree arglist, tree type)
}
}
+ /* Optimize pow(x,1.0/3.0) = cbrt(x). */
+ if (flag_unsafe_math_optimizations)
+ {
+ const REAL_VALUE_TYPE dconstroot
+ = real_value_truncate (TYPE_MODE (type), dconstthird);
+
+ if (REAL_VALUES_EQUAL (c, dconstroot))
+ {
+ tree cbrtfn = mathfn_built_in (type, BUILT_IN_CBRT);
+ if (cbrtfn != NULL_TREE)
+ {
+ tree arglist = build_tree_list (NULL_TREE, arg0);
+ return build_function_call_expr (cbrtfn, arglist);
+ }
+ }
+ }
+
/* Check for an integer exponent. */
n = real_to_integer (&c);
real_from_integer (&cint, VOIDmode, n, n < 0 ? -1 : 0, 0);
@@ -8719,7 +8823,7 @@ fold_builtin_classify (tree fndecl, tree arglist, int builtin_index)
case BUILT_IN_FINITE:
if (!MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg)))
&& !MODE_HAS_INFINITIES (TYPE_MODE (TREE_TYPE (arg))))
- return omit_one_operand (type, integer_zero_node, arg);
+ return omit_one_operand (type, integer_one_node, arg);
if (TREE_CODE (arg) == REAL_CST)
{
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index e4f711ea20b..8b2c798077c 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -1847,7 +1847,7 @@ override_options (void)
/* If we're doing fast math, we don't care about comparison order
wrt NaNs. This lets us use a shorter comparison sequence. */
- if (flag_unsafe_math_optimizations)
+ if (flag_finite_math_only)
target_flags &= ~MASK_IEEE_FP;
/* If the architecture always has an FPU, turn off NO_FANCY_MATH_387,
@@ -2951,32 +2951,6 @@ classify_argument (enum machine_mode mode, tree type,
switch (TREE_CODE (type))
{
case RECORD_TYPE:
- /* For classes first merge in the field of the subclasses. */
- if (TYPE_BINFO (type))
- {
- tree binfo, base_binfo;
- int basenum;
-
- for (binfo = TYPE_BINFO (type), basenum = 0;
- BINFO_BASE_ITERATE (binfo, basenum, base_binfo); basenum++)
- {
- int num;
- int offset = tree_low_cst (BINFO_OFFSET (base_binfo), 0) * 8;
- tree type = BINFO_TYPE (base_binfo);
-
- num = classify_argument (TYPE_MODE (type),
- type, subclasses,
- (offset + bit_offset) % 256);
- if (!num)
- return 0;
- for (i = 0; i < num; i++)
- {
- int pos = (offset + (bit_offset % 64)) / 8 / 8;
- classes[i + pos] =
- merge_classes (subclasses[i], classes[i + pos]);
- }
- }
- }
/* And now merge the fields of structure. */
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
{
@@ -3044,10 +3018,6 @@ classify_argument (enum machine_mode mode, tree type,
case QUAL_UNION_TYPE:
/* Unions are similar to RECORD_TYPE but offset is always 0.
*/
-
- /* Unions are not derived. */
- gcc_assert (!TYPE_BINFO (type)
- || !BINFO_N_BASE_BINFOS (TYPE_BINFO (type)));
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
{
if (TREE_CODE (field) == FIELD_DECL)
@@ -3735,18 +3705,7 @@ contains_128bit_aligned_vector_p (tree type)
{
tree field;
- if (TYPE_BINFO (type))
- {
- tree binfo, base_binfo;
- int i;
-
- for (binfo = TYPE_BINFO (type), i = 0;
- BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
- if (contains_128bit_aligned_vector_p
- (BINFO_TYPE (base_binfo)))
- return true;
- }
- /* And now merge the fields of structure. */
+ /* Walk all the structure fields. */
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
{
if (TREE_CODE (field) == FIELD_DECL
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 639f0b44f74..10b5eb871e4 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -104,7 +104,7 @@
(UNSPEC_MFENCE 44)
(UNSPEC_LFENCE 45)
(UNSPEC_PSADBW 46)
- (UNSPEC_LDQQU 47)
+ (UNSPEC_LDDQU 47)
; Generic math support
(UNSPEC_COPYSIGN 50)
@@ -3533,15 +3533,12 @@
}
operands[1] = validize_mem (force_const_mem (SFmode, operands[1]));
}
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
- operands[1] = force_reg (SFmode, operands[1]);
})
(define_insn "*extendsfdf2_mixed"
[(set (match_operand:DF 0 "nonimmediate_operand" "=f,m,Y")
(float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fm,f,mY")))]
- "TARGET_SSE2 && TARGET_MIX_SSE_I387
- && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
+ "TARGET_SSE2 && TARGET_MIX_SSE_I387"
{
switch (which_alternative)
{
@@ -3567,8 +3564,7 @@
(define_insn "*extendsfdf2_sse"
[(set (match_operand:DF 0 "nonimmediate_operand" "=Y")
(float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "mY")))]
- "TARGET_SSE2 && TARGET_SSE_MATH
- && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
+ "TARGET_SSE2 && TARGET_SSE_MATH"
"cvtss2sd\t{%1, %0|%0, %1}"
[(set_attr "type" "ssecvt")
(set_attr "mode" "DF")])
@@ -3576,8 +3572,7 @@
(define_insn "*extendsfdf2_i387"
[(set (match_operand:DF 0 "nonimmediate_operand" "=f,m")
(float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fm,f")))]
- "TARGET_80387
- && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
+ "TARGET_80387"
{
switch (which_alternative)
{
@@ -3615,15 +3610,12 @@
}
operands[1] = validize_mem (force_const_mem (SFmode, operands[1]));
}
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
- operands[1] = force_reg (SFmode, operands[1]);
})
(define_insn "*extendsfxf2_i387"
[(set (match_operand:XF 0 "nonimmediate_operand" "=f,m")
(float_extend:XF (match_operand:SF 1 "nonimmediate_operand" "fm,f")))]
- "TARGET_80387
- && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
+ "TARGET_80387"
{
switch (which_alternative)
{
@@ -3663,15 +3655,12 @@
}
operands[1] = validize_mem (force_const_mem (DFmode, operands[1]));
}
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
- operands[1] = force_reg (DFmode, operands[1]);
})
(define_insn "*extenddfxf2_i387"
[(set (match_operand:XF 0 "nonimmediate_operand" "=f,m")
(float_extend:XF (match_operand:DF 1 "nonimmediate_operand" "fm,f")))]
- "TARGET_80387
- && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
+ "TARGET_80387"
{
switch (which_alternative)
{
@@ -3707,9 +3696,6 @@
(match_operand:DF 1 "nonimmediate_operand" "")))]
"TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)"
{
- if (MEM_P (operands[0]) && MEM_P (operands[1]))
- operands[1] = force_reg (DFmode, operands[1]);
-
if (TARGET_SSE2 && TARGET_SSE_MATH && !TARGET_MIX_SSE_I387)
;
else if (flag_unsafe_math_optimizations)
@@ -4173,6 +4159,27 @@
(set_attr "mode" "DF")
(set_attr "athlon_decode" "double,vector")])
+;; Shorten x87->SSE reload sequences of fix_trunc?f?i_sse patterns.
+(define_peephole2
+ [(set (match_operand:DF 0 "register_operand" "")
+ (match_operand:DF 1 "memory_operand" ""))
+ (set (match_operand:SSEMODEI24 2 "register_operand" "")
+ (fix:SSEMODEI24 (match_dup 0)))]
+ "!TARGET_K8
+ && peep2_reg_dead_p (2, operands[0])"
+ [(set (match_dup 2) (fix:SSEMODEI24 (match_dup 1)))]
+ "")
+
+(define_peephole2
+ [(set (match_operand:SF 0 "register_operand" "")
+ (match_operand:SF 1 "memory_operand" ""))
+ (set (match_operand:SSEMODEI24 2 "register_operand" "")
+ (fix:SSEMODEI24 (match_dup 0)))]
+ "!TARGET_K8
+ && peep2_reg_dead_p (2, operands[0])"
+ [(set (match_dup 2) (fix:SSEMODEI24 (match_dup 1)))]
+ "")
+
;; Avoid vector decoded forms of the instruction.
(define_peephole2
[(match_scratch:DF 2 "Y")
@@ -15560,8 +15567,7 @@
(define_insn "sqrtxf2"
[(set (match_operand:XF 0 "register_operand" "=f")
(sqrt:XF (match_operand:XF 1 "register_operand" "0")))]
- "TARGET_USE_FANCY_MATH_387
- && (TARGET_IEEE_FP || flag_unsafe_math_optimizations) "
+ "TARGET_USE_FANCY_MATH_387"
"fsqrt"
[(set_attr "type" "fpspc")
(set_attr "mode" "XF")
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 8886e1f0487..3264ccfcf3f 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -261,7 +261,7 @@
(define_insn "sse3_lddqu"
[(set (match_operand:V16QI 0 "register_operand" "=x")
(unspec:V16QI [(match_operand:V16QI 1 "memory_operand" "m")]
- UNSPEC_LDQQU))]
+ UNSPEC_LDDQU))]
"TARGET_SSE3"
"lddqu\t{%1, %0|%0, %1}"
[(set_attr "type" "ssecvt")
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 356bc25d451..a0cfbc0bf39 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2006-10-20 Lee Millward <lee.millward@codesourcery.com>
+ Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/28053
+ * decl2.c (grokbitfield): Detect invalid non-integral
+ types earlier when possible.
+
2006-10-18 Mark Shinwell <shinwell@codesourcery.com>
PR c++/26884
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 42e924000f8..3b23638e71a 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -946,6 +946,14 @@ grokbitfield (const cp_declarator *declarator,
if (TREE_CODE (value) == VOID_TYPE)
return void_type_node;
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (value))
+ && (POINTER_TYPE_P (value)
+ || !dependent_type_p (TREE_TYPE (value))))
+ {
+ error ("bit-field %qD with non-integral type", value);
+ return error_mark_node;
+ }
+
if (TREE_CODE (value) == TYPE_DECL)
{
error ("cannot declare %qD to be a bit-field type", value);
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 6b69fd89632..5a32b605d8f 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -292,18 +292,20 @@ systems' @command{tar} programs will also work, only try GNU
@item GNU Multiple Precision Library (GMP) version 4.1 (or later)
-Necessary to build the Fortran frontend. If you do not have it
-installed in your library search path, you will have to configure with
-the @option{--with-gmp} or @option{--with-gmp-dir} configure option.
+Necessary to build GCC. If you do not have it installed in your
+library search path, you will have to configure with the
+@option{--with-gmp} or @option{--with-gmp-dir} configure option.
@item MPFR Library version 2.2 (or later)
-Necessary to build the Fortran frontend. It can be downloaded from
-@uref{http://www.mpfr.org/}. The version of MPFR that is bundled with
-GMP 4.1.x contains numerous bugs. Although GNU Fortran will appear
-to function with the buggy versions of MPFR, there are a few GNU Fortran
-bugs that will not be fixed when using this version. It is strongly
-recommended to upgrade to at least MPFR version 2.2.
+Necessary to build GCC. It can be downloaded from
+@uref{http://www.mpfr.org/}. If you're using version 2.2.0, You
+should also apply revision 16 (or later) of the cumulative patch from
+@uref{http://www.mpfr.org/mpfr-current/}. The version of MPFR that is
+bundled with GMP 4.1.x contains numerous bugs. Although GNU Fortran
+will appear to function with the buggy versions of MPFR, there are a
+few GNU Fortran bugs that will not be fixed when using this version.
+It is strongly recommended to upgrade to at least MPFR version 2.2.
The @option{--with-mpfr} or @option{--with-mpfr-dir} configure option should
be used if your MPFR Library is not installed in your library search path.
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 16455208c64..3162a021e4f 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -721,10 +721,6 @@ If defined, a space-separated list of files that should be scanned by
gengtype.c to generate the garbage collection tables and routines for
this language. This excludes the files that are common to all front
ends. @xref{Type Information}.
-@item need_gmp
-If defined to @samp{yes}, this frontend requires the GMP library.
-Enables configure tests for GMP, which set @code{GMPLIBS} and
-@code{GMPINC} appropriately.
@end table
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 30efccd7ea7..b04022e1086 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -7835,6 +7835,48 @@ fold_comparison (enum tree_code code, tree type, tree op0, tree op1)
}
}
+ /* Transform comparisons of the form X +- C1 CMP Y +- C2 to
+ X CMP Y +- C2 +- C1 for signed X, Y. This is valid if
+ the resulting offset is smaller in absolute value than the
+ original one. */
+ if (!(flag_wrapv || flag_trapv)
+ && !TYPE_UNSIGNED (TREE_TYPE (arg0))
+ && (TREE_CODE (arg0) == PLUS_EXPR || TREE_CODE (arg0) == MINUS_EXPR)
+ && (TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST
+ && !TREE_OVERFLOW (TREE_OPERAND (arg0, 1)))
+ && (TREE_CODE (arg1) == PLUS_EXPR || TREE_CODE (arg1) == MINUS_EXPR)
+ && (TREE_CODE (TREE_OPERAND (arg1, 1)) == INTEGER_CST
+ && !TREE_OVERFLOW (TREE_OPERAND (arg1, 1))))
+ {
+ tree const1 = TREE_OPERAND (arg0, 1);
+ tree const2 = TREE_OPERAND (arg1, 1);
+ tree variable1 = TREE_OPERAND (arg0, 0);
+ tree variable2 = TREE_OPERAND (arg1, 0);
+ tree cst;
+
+ /* Put the constant on the side where it doesn't overflow and is
+ of lower absolute value than before. */
+ cst = int_const_binop (TREE_CODE (arg0) == TREE_CODE (arg1)
+ ? MINUS_EXPR : PLUS_EXPR,
+ const2, const1, 0);
+ if (!TREE_OVERFLOW (cst)
+ && tree_int_cst_compare (const2, cst) == tree_int_cst_sgn (const2))
+ return fold_build2 (code, type,
+ variable1,
+ fold_build2 (TREE_CODE (arg1), TREE_TYPE (arg1),
+ variable2, cst));
+
+ cst = int_const_binop (TREE_CODE (arg0) == TREE_CODE (arg1)
+ ? MINUS_EXPR : PLUS_EXPR,
+ const1, const2, 0);
+ if (!TREE_OVERFLOW (cst)
+ && tree_int_cst_compare (const1, cst) == tree_int_cst_sgn (const1))
+ return fold_build2 (code, type,
+ fold_build2 (TREE_CODE (arg0), TREE_TYPE (arg0),
+ variable1, cst),
+ variable2);
+ }
+
if (FLOAT_TYPE_P (TREE_TYPE (arg0)))
{
tree targ0 = strip_float_extensions (arg0);
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index dbd01a67907..94e4d6cd013 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2006-10-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Make-lang.in (F95_LIBS): Delete.
+ * f951$(exeext): Use $(LIBS) instead of $(F95_LIBS).
+ * config-lang.in (need_gmp): Delete.
+
2006-10-19 Brooks Moses <bmoses@stanford.edu>
* invoke.texi: Fixed "denormal" typo.
diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in
index 2ee5e0d607f..cc38e69b140 100644
--- a/gcc/fortran/Make-lang.in
+++ b/gcc/fortran/Make-lang.in
@@ -76,9 +76,6 @@ F95_OBJS = $(F95_PARSER_OBJS) \
fortran/trans-intrinsic.o fortran/trans-io.o fortran/trans-openmp.o \
fortran/trans-stmt.o fortran/trans-types.o
-# GFORTRAN uses GMP for its internal arithmetics.
-F95_LIBS = $(GMPLIBS) $(LIBS)
-
#
# Define the names for selecting gfortran in LANGUAGES.
fortran: f951$(exeext)
@@ -107,7 +104,7 @@ gfortran-cross$(exeext): gfortran$(exeext)
f951$(exeext): $(F95_OBJS) \
$(BACKEND) $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
- $(F95_OBJS) $(BACKEND) $(F95_LIBS)
+ $(F95_OBJS) $(BACKEND) $(LIBS)
gt-fortran-trans.h : s-gtype; @true
#
diff --git a/gcc/fortran/config-lang.in b/gcc/fortran/config-lang.in
index ce1f9e78e21..f8006749d9e 100644
--- a/gcc/fortran/config-lang.in
+++ b/gcc/fortran/config-lang.in
@@ -16,5 +16,3 @@ target_libs=target-libgfortran
gtfiles="\$(srcdir)/fortran/f95-lang.c \$(srcdir)/fortran/trans-decl.c \$(srcdir)/fortran/trans-intrinsic.c \$(srcdir)/fortran/trans-io.c \$(srcdir)/fortran/trans-types.c \$(srcdir)/fortran/trans-types.h \$(srcdir)/fortran/trans.h \$(srcdir)/fortran/trans-const.h"
-need_gmp="yes"
-
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 3b12b20e682..fee07f9b5b8 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -3747,10 +3747,10 @@ simplify_const_relational_operation (enum rtx_code code,
return simplify_const_relational_operation (signed_condition (code),
mode, tem, const0_rtx);
- if (flag_unsafe_math_optimizations && code == ORDERED)
+ if (! HONOR_NANS (mode) && code == ORDERED)
return const_true_rtx;
- if (flag_unsafe_math_optimizations && code == UNORDERED)
+ if (! HONOR_NANS (mode) && code == UNORDERED)
return const0_rtx;
/* For modes without NaNs, if the two operands are equal, we know the
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 701c2e7ed5e..b55cd7c8f8b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,26 @@
+2006-10-21 Uros Bizjak <uros@kss-loka.si>
+
+ PR middle-end/28252
+ * gcc.dg/builtins-8.c: Also check pow(x,1.0/3.0) to cbrt(x)
+ transformation.
+
+2006-10-21 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/3511
+ * gcc.dg/tree-ssa/ssa-pre-15.c: New testcase.
+
+2006-10-21 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/26898
+ * gcc.dg/torture/pr26898-1.c: New testcase.
+ * gcc.dg/torture/pr26898-2.c: Likewise.
+
+2006-10-20 Lee Millward <lee.millward@codesourcery.com>
+
+ PR c++/28053
+ * g++.dg/parse/bitfield1.C: Adjust error markers.
+ * g++.dg/parse/bitfield2.C: New test.
+
2006-10-20 Adam Nemet <anemet@caviumnetworks.com>
* gcc.dg/tree-ssa/ivopts-2.c: Match final candidates line only.
diff --git a/gcc/testsuite/g++.dg/parse/bitfield1.C b/gcc/testsuite/g++.dg/parse/bitfield1.C
index 70fe5cbd714..2e076058508 100644
--- a/gcc/testsuite/g++.dg/parse/bitfield1.C
+++ b/gcc/testsuite/g++.dg/parse/bitfield1.C
@@ -7,5 +7,5 @@ struct A
void foo(A& a)
{
- (char)a.i;
+ (char)a.i; // { dg-error "no member" }
}
diff --git a/gcc/testsuite/g++.dg/parse/bitfield2.C b/gcc/testsuite/g++.dg/parse/bitfield2.C
new file mode 100644
index 00000000000..49aace1dc76
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/bitfield2.C
@@ -0,0 +1,34 @@
+//PR c++/28053
+
+struct X {};
+
+struct A
+{
+ X x : 2; // { dg-error "non-integral type" }
+};
+struct B : A {};
+
+template <typename T>
+struct C
+{
+ T t : 3;
+};
+
+C<int> c;
+
+template <typename T>
+struct D
+{
+ T t : 3; // { dg-error "non-integral type" }
+};
+
+D<double> d; // { dg-error "instantiated" }
+
+template <typename T>
+struct E
+{
+ typedef T* U;
+ U t : 3; // { dg-error "non-integral type" }
+};
+
+E<double> e;
diff --git a/gcc/testsuite/gcc.dg/builtins-8.c b/gcc/testsuite/gcc.dg/builtins-8.c
index c3066b41cab..be17774d526 100644
--- a/gcc/testsuite/gcc.dg/builtins-8.c
+++ b/gcc/testsuite/gcc.dg/builtins-8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation.
+/* Copyright (C) 2003, 2006 Free Software Foundation.
Verify that built-in math function constant folding of functions
with one constant argument is correctly performed by the compiler.
@@ -11,6 +11,7 @@
extern void abort(void);
extern double pow(double, double);
extern double sqrt(double);
+extern double cbrt(double);
void test(double x)
{
@@ -25,6 +26,9 @@ void test(double x)
if (pow(x,0.5) != sqrt(x))
abort ();
+
+ if (pow(x,1.0/3.0) != cbrt(x))
+ abort ();
}
int main()
diff --git a/gcc/testsuite/gcc.dg/torture/pr26898-1.c b/gcc/testsuite/gcc.dg/torture/pr26898-1.c
new file mode 100644
index 00000000000..12ca1f38a91
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr26898-1.c
@@ -0,0 +1,14 @@
+/* { dg-do link } */
+
+#include <limits.h>
+
+extern void link_error(void);
+int main()
+{
+ int i0, i1;
+ if (!(i0 + 1 < i1 + 1 == i0 < i1))
+ link_error ();
+ if (!(i0 + INT_MIN < i1 - INT_MAX == i0 < i1 - -1))
+ link_error ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr26898-2.c b/gcc/testsuite/gcc.dg/torture/pr26898-2.c
new file mode 100644
index 00000000000..508fde4ce7d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr26898-2.c
@@ -0,0 +1,12 @@
+/* { dg-do run } */
+
+#include <limits.h>
+
+int a = 0, b = INT_MAX - 1;
+extern void abort(void);
+int main()
+{
+ if (a - 1 > b + 1)
+ abort();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20031015-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20031015-1.c
index 302165608d5..a7e78a4dc70 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20031015-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20031015-1.c
@@ -14,5 +14,5 @@ main(void)
}
/* The V_*_DEF comes from the initial assignment and the asm. */
-/* { dg-final { scan-tree-dump-times "_DEF" 2 "alias1" } } */
+/* { dg-final { scan-tree-dump-times "_DEF" 3 "alias1" } } */
/* { dg-final { cleanup-tree-dump "alias1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c
index 3f3ec1a3572..e500f1178a6 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c
@@ -17,5 +17,5 @@ void bar (void)
malloc functions may clobber global memory. Only the function result
does not alias any other pointer.
Hence, we must have a VDEF for a before and after the call to foo(). */
-/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 1 "alias1"} } */
+/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 2 "alias1"} } */
/* { dg-final { cleanup-tree-dump "alias1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr26421.c b/gcc/testsuite/gcc.dg/tree-ssa/pr26421.c
index ff48b61ade6..47f622128ac 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr26421.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr26421.c
@@ -16,5 +16,5 @@ int foo(void)
return a.i;
}
-/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 1 "alias1" } } */
+/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 2 "alias1" } } */
/* { dg-final { cleanup-tree-dump "alias1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-15.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-15.c
new file mode 100644
index 00000000000..518fda854e6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-15.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+/* Verify we PRE the strlen call, as strlen("") folds to zero. */
+
+extern __SIZE_TYPE__ strlen (const char *);
+
+__SIZE_TYPE__ mystrlen (const char *s)
+{
+ if (!s)
+ s = "";
+ return strlen(s);
+}
+
+/* { dg-final { scan-tree-dump "= 0;" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 088c45ab335..5ade6455d96 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -621,7 +621,7 @@ referenced_var_lookup (unsigned int uid)
/* Check if TO is in the referenced_vars hash table and insert it if not.
Return true if it required insertion. */
-static bool
+bool
referenced_var_check_and_insert (tree to)
{
struct int_tree_map *h, in;
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index f70eb774f35..447b7328ffd 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -425,6 +425,7 @@ extern GTY((param_is (struct int_tree_map))) htab_t referenced_vars;
extern GTY((param_is (struct int_tree_map))) htab_t default_defs;
extern tree referenced_var_lookup (unsigned int);
+extern bool referenced_var_check_and_insert (tree);
#define num_referenced_vars htab_elements (referenced_vars)
#define referenced_var(i) referenced_var_lookup (i)
@@ -437,6 +438,10 @@ extern GTY(()) VEC(tree,gc) *ssa_names;
/* Artificial variable used to model the effects of function calls. */
extern GTY(()) tree global_var;
+/* Artificial variable used to model the effects of nonlocal
+ variables. */
+extern GTY(()) tree nonlocal_all;
+
/* Call clobbered variables in the function. If bit I is set, then
REFERENCED_VARS (I) is call-clobbered. */
extern bitmap call_clobbered_vars;
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index 0efbe0f3ae2..4fa876de39c 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -1053,7 +1053,9 @@ access_can_touch_variable (tree ref, tree alias, HOST_WIDE_INT offset,
if (alias == global_var)
return true;
- if (TREE_CODE (alias) == VAR_DECL && DECL_PTA_ARTIFICIAL (alias))
+ /* We cannot prune nonlocal aliases because they are not type
+ specific. */
+ if (alias == nonlocal_all)
return true;
/* If ALIAS is an SFT, it can't be touched if the offset
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 9c7b89faaf3..ba32b3cfed4 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -1076,6 +1076,7 @@ phi_translate (tree expr, value_set_t set, basic_block pred,
tree newexpr;
tree vh = get_value_handle (expr);
bool listchanged = false;
+ bool invariantarg = false;
VEC (tree, gc) *vuses = VALUE_HANDLE_VUSES (vh);
VEC (tree, gc) *tvuses;
@@ -1134,10 +1135,26 @@ phi_translate (tree expr, value_set_t set, basic_block pred,
if (newval != oldval)
{
listchanged = true;
+ invariantarg |= is_gimple_min_invariant (newval);
TREE_VALUE (newwalker) = get_value_handle (newval);
}
}
}
+
+ /* In case of new invariant args we might try to fold the call
+ again. */
+ if (invariantarg)
+ {
+ tree tmp = fold_ternary (CALL_EXPR, TREE_TYPE (expr),
+ newop0, newarglist, newop2);
+ if (tmp)
+ {
+ STRIP_TYPE_NOPS (tmp);
+ if (is_gimple_min_invariant (tmp))
+ return tmp;
+ }
+ }
+
if (listchanged)
vn_lookup_or_add (newarglist, NULL);
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index b1f125a8679..1c4a46e75ee 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -164,14 +164,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map)))
htab_t heapvar_for_stmt;
-
-/* Represents nonlocals. */
-static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map)))
-htab_t nonlocal_for_type;
-
-/* If strict aliasing is off, we only use one variable to represent
- the nonlocal types. */
-static GTY (()) tree nonlocal_all;
+/* One variable to represent all non-local accesses. */
+tree nonlocal_all;
static bool use_field_sensitive = true;
static int in_ipa_mode = 0;
@@ -2516,40 +2510,6 @@ do_deref (VEC (ce_s, heap) **constraints)
}
}
-/* Lookup a nonlocal variable for type FROM, and return it if we find
- one. */
-
-static tree
-nonlocal_lookup (tree from)
-{
- struct tree_map *h, in;
- in.from = from;
-
- h = htab_find_with_hash (nonlocal_for_type, &in,
- htab_hash_pointer (from));
- if (h)
- return h->to;
- return NULL_TREE;
-}
-
-/* Insert a mapping FROM->TO in the nonlocal variable for type
- hashtable. */
-
-static void
-nonlocal_insert (tree from, tree to)
-{
- struct tree_map *h;
- void **loc;
-
- h = ggc_alloc (sizeof (struct tree_map));
- h->hash = htab_hash_pointer (from);
- h->from = from;
- h->to = to;
- loc = htab_find_slot_with_hash (nonlocal_for_type, h, h->hash,
- INSERT);
- *(struct tree_map **) loc = h;
-}
-
/* Create a nonlocal variable of TYPE to represent nonlocals we can
alias. */
@@ -2561,61 +2521,10 @@ create_nonlocal_var (tree type)
if (referenced_vars)
add_referenced_var (nonlocal);
- DECL_PTA_ARTIFICIAL (nonlocal) = 1;
DECL_EXTERNAL (nonlocal) = 1;
- nonlocal_insert (type, nonlocal);
return nonlocal;
}
-/* Get or create a nonlocal variable for TYPE, and return its
- variable info id. */
-
-static unsigned int
-get_nonlocal_id_for_type (tree type)
-{
- tree nonlocal;
- unsigned int nonlocal_id;
- varinfo_t nonlocal_vi;
-
- /* For strict aliasing, we have one variable per type. For
- non-strict aliasing, we only need one variable. */
- if (flag_strict_aliasing != 0)
- {
- nonlocal = nonlocal_lookup (type);
- }
- else
- {
- if (!nonlocal_all)
- {
- nonlocal = create_nonlocal_var (void_type_node);
- nonlocal_all = nonlocal;
- }
- else
- nonlocal = nonlocal_all;
- }
-
- if (nonlocal && lookup_id_for_tree (nonlocal, &nonlocal_id))
- return nonlocal_id;
-
- if (!nonlocal)
- {
- gcc_assert (flag_strict_aliasing != 0);
- nonlocal = create_nonlocal_var (type);
- }
-
- /* Create variable info for the nonlocal var if it does not
- exist. */
- nonlocal_id = create_variable_info_for (nonlocal,
- get_name (nonlocal));
- nonlocal_vi = get_varinfo (nonlocal_id);
- nonlocal_vi->is_artificial_var = 1;
- nonlocal_vi->is_heap_var = 1;
- nonlocal_vi->is_unknown_size_var = 1;
- nonlocal_vi->directly_dereferenced = true;
-
- return nonlocal_id;
-}
-
/* Given a tree T, return the constraint expression for it. */
static void
@@ -2756,7 +2665,6 @@ get_constraint_for (tree t, VEC (ce_s, heap) **results)
return;
}
break;
-
default:
{
temp.type = ADDRESSOF;
@@ -4116,7 +4024,12 @@ find_global_initializers (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
case VAR_DECL:
/* We might not have walked this because we skip
DECL_EXTERNALs during the initial scan. */
- add_referenced_var (t);
+ if (referenced_vars)
+ {
+ get_var_ann (t);
+ if (referenced_var_check_and_insert (t))
+ mark_sym_for_renaming (t);
+ }
break;
default:
break;
@@ -4336,8 +4249,8 @@ intra_create_variable_infos (void)
{
tree t;
struct constraint_expr lhs, rhs;
- tree nonlocal;
varinfo_t nonlocal_vi;
+
/* For each incoming pointer argument arg, ARG = ESCAPED_VARS or a
dummy variable if flag_argument_noalias > 2. */
for (t = DECL_ARGUMENTS (current_function_decl); t; t = TREE_CHAIN (t))
@@ -4393,14 +4306,12 @@ intra_create_variable_infos (void)
make_constraint_from_escaped (p);
}
}
- nonlocal = create_tmp_var_raw (void_type_node, "NONLOCAL_ALL");
-
- DECL_EXTERNAL (nonlocal) = 1;
+ nonlocal_all = create_nonlocal_var (void_type_node);
/* Create variable info for the nonlocal var if it does not
exist. */
- nonlocal_vars_id = create_variable_info_for (nonlocal,
- get_name (nonlocal));
+ nonlocal_vars_id = create_variable_info_for (nonlocal_all,
+ get_name (nonlocal_all));
nonlocal_vi = get_varinfo (nonlocal_vars_id);
nonlocal_vi->is_artificial_var = 1;
nonlocal_vi->is_heap_var = 1;
@@ -4860,61 +4771,6 @@ find_escape_constraints (tree stmt)
VEC_free (ce_s, heap, rhsc);
}
-/* Expand the solutions that have nonlocal_id in them to include one
- variable for each type that is pointed to by nonlocal and
- dereferenced. */
-
-static void
-expand_nonlocal_solutions (void)
-{
- int i;
- varinfo_t v;
- bitmap new_nonlocal_solution = BITMAP_ALLOC (&ptabitmap_obstack);
-
- /* We could do this faster by only checking non-collapsed nodes,
- unless the node was collapsed to one we would normally ignore in the
- rest of the loop. Logic already seems complicated enough, and
- it wasn't a measurable speedup on any testcases i had. */
- for (i = 0; VEC_iterate (varinfo_t, varmap, i, v); i++)
- {
- /* Where the solution for our variable is, since it may have
- been collapsed to another varinfo. */
- varinfo_t solv = v;
-
- if (v->is_special_var
- || v->id == nonlocal_vars_id
- || v->id == escaped_vars_id
- || !POINTER_TYPE_P (TREE_TYPE (v->decl)))
- continue;
-
- if (v->node != v->id)
- solv = get_varinfo (v->node);
- if (bitmap_bit_p (solv->solution, nonlocal_vars_id))
- {
- unsigned int new_nonlocal_id;
- tree pttype = TREE_TYPE (TREE_TYPE (v->decl));
-
- new_nonlocal_id = get_nonlocal_id_for_type (pttype);
- bitmap_set_bit (new_nonlocal_solution, new_nonlocal_id);
- }
- }
-
- if (!bitmap_empty_p (new_nonlocal_solution))
- {
-
- for (i = 0; VEC_iterate (varinfo_t, varmap, i, v); i++)
- {
- if (v->node != v->id)
- continue;
- if (bitmap_bit_p (v->solution, nonlocal_vars_id))
- {
- bitmap_clear_bit (v->solution, nonlocal_vars_id);
- bitmap_ior_into (v->solution, new_nonlocal_solution);
- }
- }
- }
-}
-
/* Create points-to sets for the current function. See the comments
at the start of the file for an algorithmic overview. */
@@ -4983,8 +4839,6 @@ compute_points_to_sets (struct alias_info *ai)
solve_graph (graph);
- expand_nonlocal_solutions ();
-
if (dump_file)
dump_sa_points_to_info (dump_file);
@@ -5129,8 +4983,6 @@ ipa_pta_execute (void)
solve_graph (graph);
- expand_nonlocal_solutions ();
-
if (dump_file)
dump_sa_points_to_info (dump_file);
in_ipa_mode = 0;
@@ -5162,8 +5014,6 @@ init_alias_heapvars (void)
{
heapvar_for_stmt = htab_create_ggc (11, tree_map_hash, tree_map_eq,
NULL);
- nonlocal_for_type = htab_create_ggc (11, tree_map_hash, tree_map_eq,
- NULL);
nonlocal_all = NULL_TREE;
}
@@ -5172,7 +5022,6 @@ delete_alias_heapvars (void)
{
nonlocal_all = NULL_TREE;
htab_delete (heapvar_for_stmt);
- htab_delete (nonlocal_for_type);
}
diff --git a/gcc/tree.h b/gcc/tree.h
index dddd3863248..e6a861ca24a 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -2858,10 +2858,6 @@ extern void decl_restrict_base_insert (tree, tree);
multiple translation units should be merged. */
#define DECL_ONE_ONLY(NODE) (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.one_only)
-/* Internal to points-to analysis and operand scanning. Indicates
- that this DECL is an artificial points-to variable. */
-#define DECL_PTA_ARTIFICIAL(NODE) (VAR_DECL_CHECK (NODE)->decl_with_vis.artificial_pta_var)
-
struct tree_decl_with_vis GTY(())
{
struct tree_decl_with_rtl common;
@@ -2879,7 +2875,6 @@ struct tree_decl_with_vis GTY(())
unsigned based_on_restrict_p : 1;
/* Used by C++. Might become a generic decl flag. */
unsigned shadowed_for_var_p : 1;
- unsigned artificial_pta_var : 1;
/* Don't belong to VAR_DECL exclusively. */
unsigned in_system_header_flag : 1;
@@ -2894,7 +2889,7 @@ struct tree_decl_with_vis GTY(())
/* Belongs to VAR_DECL exclusively. */
ENUM_BITFIELD(tls_model) tls_model : 3;
- /* 10 unused bits. */
+ /* 11 unused bits. */
};
/* In a VAR_DECL that's static,