[SH] Cleanup endianness macros
Hello, The attached patch adds a new macro TARGET_BIG_ENDIAN. I think it's a bit easier to read than !TARGET_LITTLE_ENDIAN. Moreover, some not so obvious looking uses of TARGET_LITTLE_ENDIAN for selecting MSW and LSW register offsets are clarified by using new macros SH_REG_MSW_OFFSET and SH_REG_LSW_OFFSET. No functional changes. Tested with make all-gcc. OK for trunk? Cheers, Oleg gcc/ChangeLog: * config/sh/sh.c (MSW, LSW): Move and rename macros to... * config/sh/sh.h (SH_REG_MSW_OFFSET, SH_REG_LSW_OFFSET): ... here. (TARGET_BIG_ENDIAN): New macro. * config/sh/sh.md: Use it instead of !TARGET_LITTLE_ENDIAN. Use SH_REG_MSW_OFFSET and SH_REG_LSW_OFFSET. * config/sh/sh.c: Likewise. * config/sh/sh.h: Likewise. Index: gcc/config/sh/sh.md === --- gcc/config/sh/sh.md (revision 204098) +++ gcc/config/sh/sh.md (working copy) @@ -670,7 +670,7 @@ (and:SI (match_operand:SI 0 "arith_reg_operand" "%r") (match_operand:SI 1 "arith_reg_operand" "r")) ) (const_int 0)))] - "TARGET_SH1 && !TARGET_LITTLE_ENDIAN" + "TARGET_SH1 && TARGET_BIG_ENDIAN" "tst %0,%1" [(set_attr "type" "mt_group")]) @@ -761,7 +761,7 @@ (match_operand:SI 3 "const_int_operand")) 3) (match_operand:SI 1 "const_int_operand") (match_operand:SI 2 "const_int_operand")))] - "TARGET_SH1 && ! TARGET_LITTLE_ENDIAN + "TARGET_SH1 && TARGET_BIG_ENDIAN && ZERO_EXTRACT_ANDMASK (operands[1], operands[2]) == (INTVAL (operands[3]) & 255) && CONST_OK_FOR_K08 (INTVAL (operands[3]) & 255)" @@ -2115,7 +2115,7 @@ (zero_extend:SI (subreg:QI (not:SI (subreg:SI (match_operand:QI 1 "general_extend_operand" "") 0)) 3)))] - "TARGET_SHMEDIA && ! TARGET_LITTLE_ENDIAN" + "TARGET_SHMEDIA && TARGET_BIG_ENDIAN" [(set (match_dup 0) (zero_extend:SI (match_dup 1))) (set (match_dup 0) (xor:SI (match_dup 0) (const_int 255)))] "") @@ -3840,7 +3840,7 @@ operands[0] = SUBREG_REG (operands[0]); } gcc_assert (REG_P (operands[0])); - if (! TARGET_LITTLE_ENDIAN) + if (TARGET_BIG_ENDIAN) offset += 8 - GET_MODE_SIZE (inmode); operands[5] = gen_rtx_SUBREG (inmode, operands[0], offset); }) @@ -7733,11 +7733,11 @@ rtx mem2 = change_address (mem, SFmode, gen_rtx_POST_INC (Pmode, operands[1])); insn = emit_insn (gen_movsf_ie (gen_rtx_REG (SFmode, - regno + !! TARGET_LITTLE_ENDIAN), + regno + SH_REG_MSW_OFFSET), mem2, operands[2])); add_reg_note (insn, REG_INC, operands[1]); insn = emit_insn (gen_movsf_ie (gen_rtx_REG (SFmode, - regno + ! TARGET_LITTLE_ENDIAN), + regno + SH_REG_LSW_OFFSET), change_address (mem, SFmode, NULL_RTX), operands[2])); DONE; @@ -7755,8 +7755,8 @@ int regno = true_regnum (operands[0]); rtx addr, insn; rtx mem2 = change_address (operands[1], SFmode, NULL_RTX); - rtx reg0 = gen_rtx_REG (SFmode, regno + (TARGET_LITTLE_ENDIAN ? 1 : 0)); - rtx reg1 = gen_rtx_REG (SFmode, regno + (TARGET_LITTLE_ENDIAN ? 0 : 1)); + rtx reg0 = gen_rtx_REG (SFmode, regno + SH_REG_MSW_OFFSET); + rtx reg1 = gen_rtx_REG (SFmode, regno + SH_REG_LSW_OFFSET); operands[1] = copy_rtx (mem2); addr = XEXP (mem2, 0); @@ -7821,8 +7821,8 @@ { int regno = true_regnum (operands[1]); rtx insn, addr; - rtx reg0 = gen_rtx_REG (SFmode, regno + (TARGET_LITTLE_ENDIAN ? 1 : 0)); - rtx reg1 = gen_rtx_REG (SFmode, regno + (TARGET_LITTLE_ENDIAN ? 0 : 1)); + rtx reg0 = gen_rtx_REG (SFmode, regno + SH_REG_MSW_OFFSET); + rtx reg1 = gen_rtx_REG (SFmode, regno + SH_REG_LSW_OFFSET); operands[0] = copy_rtx (operands[0]); PUT_MODE (operands[0], SFmode); @@ -13160,7 +13160,7 @@ (match_operand:SI 1 "immediate_operand" "") (match_operand:SI 2 "immediate_operand" "")) (match_operand:SI 3 "general_operand" ""))] - "TARGET_SH1 && ! TARGET_LITTLE_ENDIAN" + "TARGET_SH1 && TARGET_BIG_ENDIAN" { rtx addr_target, orig_address, shift_reg, qi_val; HOST_WIDE_INT bitsize, size, v = 0; @@ -14522,7 +14522,7 @@ (zero_extract:QI (not:QI (match_dup 2)) (const_int 2) (const_int 4)) (zero_extract:QI (not:QI (match_dup 2)) (const_int 2) (const_int 6))])))] - "TARGET_SHMEDIA && ! TARGET_LITTLE_ENDIAN" + "TARGET_SHMEDIA && TARGET_BIG_ENDIAN" "mperm.w %1, %N2, %0" [(set_attr "type" "arith_media")]) Index: gcc/config/sh/sh.c === --- gcc/config/sh/sh.c (revision 204096) +++ gcc/config/sh/sh.c (working copy) @@ -63,9 +63,6 @@ int code_for_indirect_jump_scratch = CODE_FOR_indirect_jump_scratch; -#define MSW (TARGET_LITTLE_ENDIAN ? 1 : 0) -#define LSW (TARGET_LITTLE_ENDIAN ? 0 : 1) - /* These are some macros to abstract register modes. */ #define CONST_OK_FOR_I10(VALUE) (((HOST_WIDE_INT)(VALUE)) >= -512 \ && ((HOST_WIDE_INT)(VALUE)) <= 511) @@ -1208,12 +1205,12 @@ i
Re: [PATCH] Enhance ifcombine to recover non short circuit branches
On Sat, Oct 26, 2013 at 2:30 PM, Andrew Pinski wrote: > On Fri, Oct 18, 2013 at 2:21 AM, Zhenqiang Chen > wrote: >> On 18 October 2013 00:58, Jeff Law wrote: >>> On 10/17/13 05:03, Richard Biener wrote: >> >> Is it OK for trunk? > > > I had a much simpler change which did basically the same from 4.7 (I > can update it if people think this is a better approach). I like that more (note you can now use is_gimple_condexpr as predicate for force_gimple_operand). >>> >>> The obvious question is whether or not Andrew's simpler change picks up as >>> many transformations as Zhenqiang's change. If not are the things missed >>> important. >>> >>> Zhenqiang, can you do some testing of your change vs Andrew P.'s change? >> >> Here is a rough compare: >> >> 1) Andrew P.'s change can not handle ssa-ifcombine-ccmp-3.c (included >> in my patch). Root cause is that it does not skip "LABEL". The guard >> to do this opt should be the same the bb_has_overhead_p in my patch. > > This should be an easy change, I am working on this right now. > >> >> 2) Andrew P.'s change always generate TRUTH_AND_EXPR, which is not >> efficient for "||". e.g. For ssa-ifcombine-ccmp-6.c, it will generate >> >> _3 = a_2(D) > 0; >> _5 = b_4(D) > 0; >> _6 = _3 | _5; >> _9 = c_7(D) <= 0; >> _10 = ~_6; >> _11 = _9 & _10; >> if (_11 == 0) >> >> With my patch, it will generate >> >> _3 = a_2(D) > 0; >> _5 = b_4(D) > 0; >> _6 = _3 | _5; >> _9 = c_7(D) > 0; >> _10 = _6 | _9; >> if (_10 != 0) > > As mentioned otherwise, this seems like a missed optimization inside > forwprop. When I originally wrote this code there used to be two > cases one for & and one for |, but this was removed sometime and I > just made the code evolve with that. Actually I can make a small patch (3 lines) to my current patch which causes tree-ssa-ifcombine.c to produce the behavior of your patch. if (result_inv) { t = fold_build1 (TRUTH_NOT_EXPR, TREE_TYPE (t), t); result_inv = false; } I will submit a new patch after some testing of my current patch which fixes items 1 and 2. Thanks, Andrew Pinski > >> >> 3) The good thing of Andrew P.'s change is that "Inverse the order of >> the basic block walk" so it can do combine recursively. >> >> But I think we need some heuristic to control the number of ifs. Move >> too much compares from >> the inner_bb to outer_bb is not good. > > > I think this depends on the target. For MIPS we don't want an upper > bound as integer comparisons go directly to GPRs. I wrote this patch > with MIPS in mind as that was the target I was working on. > >> >> 4) Another good thing of Andrew P.'s change is that it reuses some >> existing functions. So it looks much simple. > > > Thanks, > Andrew Pinski > >> With that we should be able to kill the fold-const.c transform? >>> >>> That would certainly be nice and an excellent follow-up for Zhenqiang. >> >> That's my final goal to "kill the fold-const.c transform". I think we >> may combine the two changes to make a "simple" and "good" patch. >> >> Thanks! >> -Zhenqiang
[SH, committed] Fix some formatting
Hello, I've just committed the attached obvious patch as rev 204098. Tested with make all-gcc. Cheers, Oleg gcc/ChangeLog: * config/sh/sh.md (movmemsi): Remove empty constraints and predicates. Fix formatting. (cmpstr_t, cmpstrsi): Fix formatting. Index: gcc/config/sh/sh.md === --- gcc/config/sh/sh.md (revision 204096) +++ gcc/config/sh/sh.md (working copy) @@ -11836,19 +11836,20 @@ ;; String/block move insn. (define_expand "movmemsi" - [(parallel [(set (mem:BLK (match_operand:BLK 0 "" "")) - (mem:BLK (match_operand:BLK 1 "" ""))) - (use (match_operand:SI 2 "nonmemory_operand" "")) - (use (match_operand:SI 3 "immediate_operand" "")) + [(parallel [(set (mem:BLK (match_operand:BLK 0)) + (mem:BLK (match_operand:BLK 1))) + (use (match_operand:SI 2 "nonmemory_operand")) + (use (match_operand:SI 3 "immediate_operand")) (clobber (reg:SI PR_REG)) (clobber (reg:SI R4_REG)) (clobber (reg:SI R5_REG)) (clobber (reg:SI R0_REG))])] "TARGET_SH1 && ! TARGET_SH5" { - if(expand_block_move (operands)) - DONE; - else FAIL; + if (expand_block_move (operands)) +DONE; + else +FAIL; }) (define_insn "block_move_real" @@ -11916,17 +11917,19 @@ (define_insn "cmpstr_t" [(set (reg:SI T_REG) (eq:SI (and:SI - (and:SI (and:SI - (zero_extract:SI (xor:SI (match_operand:SI 0 "arith_reg_operand" "r") - (match_operand:SI 1 "arith_reg_operand" "r")) - (const_int 8) (const_int 0)) - (zero_extract:SI (xor:SI (match_dup 0) (match_dup 1)) - (const_int 8) (const_int 8))) - (zero_extract:SI (xor:SI (match_dup 0) (match_dup 1)) - (const_int 8) (const_int 16))) - (zero_extract:SI (xor:SI (match_dup 0) (match_dup 1)) - (const_int 8) (const_int 24))) (const_int 0)))] + (and:SI + (zero_extract:SI + (xor:SI (match_operand:SI 0 "arith_reg_operand" "r") + (match_operand:SI 1 "arith_reg_operand" "r")) + (const_int 8) (const_int 0)) + (zero_extract:SI (xor:SI (match_dup 0) (match_dup 1)) + (const_int 8) (const_int 8))) + (zero_extract:SI (xor:SI (match_dup 0) (match_dup 1)) + (const_int 8) (const_int 16))) + (zero_extract:SI (xor:SI (match_dup 0) (match_dup 1)) + (const_int 8) (const_int 24))) + (const_int 0)))] "TARGET_SH1" "cmp/str %0,%1" [(set_attr "type" "mt_group")]) @@ -11938,9 +11941,10 @@ (use (match_operand 3 "immediate_operand"))] "TARGET_SH1" { - if (! optimize_insn_for_size_p () && sh_expand_cmpstr (operands)) - DONE; - else FAIL; + if (! optimize_insn_for_size_p () && sh_expand_cmpstr (operands)) +DONE; + else +FAIL; })
Re: [libiberty] Fix testsuite/test-demangle.c
On Sat, Oct 26, 2013 at 12:48 PM, Gerald Pfeifer wrote: > > 2013-10-26 Gerald Pfeifer > > * testsuite/test-demangle.c: Include unistd.h. This is OK. Thanks. Ian
Re: [PATCH] Enhance ifcombine to recover non short circuit branches
On Wed, Oct 16, 2013 at 2:12 AM, Zhenqiang Chen wrote: > Hi, > > The patch enhances ifcombine pass to recover some non short circuit > branches. Basically, it will do the following transformation: > > Case 1: > if (cond1) > if (cond2) > ==> > if (cond1 && cond2) > > Case 2: > if (cond1) > goto L1 > if (cond2) > goto L1 > ==> > if (cond1 || cond2) > goto L1 > > Case 3: > if (cond1) > goto L1 > else > goto L2 > L1: > if (cond2) > goto L2 > ==> > if (invert (cond1) || cond2) > goto L2 > > Case 4: > if (cond1) > goto L1 > if (cond2) > goto L2 > L1: > ==> > if (invert (cond1) && cond2) > goto L2 > > Bootstrap on X86-64 and ARM. > > Two new FAILs in regression tests: > gcc.dg/uninit-pred-8_b.c > gcc.dg/uninit-pred-9_b.c > uninit pass should be enhanced to handle more complex conditions. Will > submit a bug to track it and fix it later. > > Is it OK for trunk? > > Thanks! > -Zhenqiang > > ChangeLog: > 2013-10-16 Zhenqiang Chen > > * fold-const.c (simple_operand_p_2): Make it global. > * tree.h (simple_operand_p_2): Declare it. > * tree-ssa-ifcombine.c: Include rtl.h and tm_p.h. > (bb_has_overhead_p, generate_condition_node, > ifcombine_ccmp): New functions. > (ifcombine_fold_ifandif): New function, extracted from > ifcombine_ifandif. > (ifcombine_ifandif): Call ifcombine_ccmp. > (tree_ssa_ifcombine_bb): Skip optimized bb. > > testsuite/ChangeLog > 2013-10-16 Zhenqiang Chen > > * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-1.c: New test case. > * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-2.c: New test case. > * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-3.c: New test case. > * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-4.c: New test case. > * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-5.c: New test case. > * gcc.dg/tree-ssa/ssa-ifcombine-ccmp-6.c: New test case. > * gcc.dg/tree-ssa/ssa-dom-thread-3.c: Updated. One quick review of this patch, you don't don't need to test simple_operand_p_2 as in gimple, they will always be simple. So it at least reduces this patch. Also your bb_has_overhead_p can be simply: !gsi_one_before_end_p (gsi_start_nondebug_after_labels_bb (inner_cond_bb)) Where gsi_start_nondebug_after_labels_bb is defined as: /* Return a new iterator pointing to the first non-debug non-label statement in basic block BB. */ static inline gimple_stmt_iterator gsi_start_nondebug_after_labels_bb (basic_block bb) { gimple_stmt_iterator i = gsi_after_labels (bb); if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i))) gsi_next_nondebug (&i); return i; } Thanks, Andrew Pinski
Re: Minor mudflap fallout
On Sat, 26 Oct 2013, Andrew Pinski wrote: > I think you could use PRED_NORETURN which should be a reasonable replacement. I've totally missed that one, thanks. brgds, H-P
Re: [PATCH] Enhance ifcombine to recover non short circuit branches
On Fri, Oct 18, 2013 at 2:21 AM, Zhenqiang Chen wrote: > On 18 October 2013 00:58, Jeff Law wrote: >> On 10/17/13 05:03, Richard Biener wrote: > > Is it OK for trunk? I had a much simpler change which did basically the same from 4.7 (I can update it if people think this is a better approach). >>> >>> >>> I like that more (note you can now use is_gimple_condexpr as predicate >>> for force_gimple_operand). >> >> The obvious question is whether or not Andrew's simpler change picks up as >> many transformations as Zhenqiang's change. If not are the things missed >> important. >> >> Zhenqiang, can you do some testing of your change vs Andrew P.'s change? > > Here is a rough compare: > > 1) Andrew P.'s change can not handle ssa-ifcombine-ccmp-3.c (included > in my patch). Root cause is that it does not skip "LABEL". The guard > to do this opt should be the same the bb_has_overhead_p in my patch. This should be an easy change, I am working on this right now. > > 2) Andrew P.'s change always generate TRUTH_AND_EXPR, which is not > efficient for "||". e.g. For ssa-ifcombine-ccmp-6.c, it will generate > > _3 = a_2(D) > 0; > _5 = b_4(D) > 0; > _6 = _3 | _5; > _9 = c_7(D) <= 0; > _10 = ~_6; > _11 = _9 & _10; > if (_11 == 0) > > With my patch, it will generate > > _3 = a_2(D) > 0; > _5 = b_4(D) > 0; > _6 = _3 | _5; > _9 = c_7(D) > 0; > _10 = _6 | _9; > if (_10 != 0) As mentioned otherwise, this seems like a missed optimization inside forwprop. When I originally wrote this code there used to be two cases one for & and one for |, but this was removed sometime and I just made the code evolve with that. > > 3) The good thing of Andrew P.'s change is that "Inverse the order of > the basic block walk" so it can do combine recursively. > > But I think we need some heuristic to control the number of ifs. Move > too much compares from > the inner_bb to outer_bb is not good. I think this depends on the target. For MIPS we don't want an upper bound as integer comparisons go directly to GPRs. I wrote this patch with MIPS in mind as that was the target I was working on. > > 4) Another good thing of Andrew P.'s change is that it reuses some > existing functions. So it looks much simple. Thanks, Andrew Pinski > >>> >>> With that we should be able to kill the fold-const.c transform? >> >> That would certainly be nice and an excellent follow-up for Zhenqiang. > > That's my final goal to "kill the fold-const.c transform". I think we > may combine the two changes to make a "simple" and "good" patch. > > Thanks! > -Zhenqiang
Re: [PATCH] Final removal of mudflap
As far as I can see, the commit left empty libmudflap directories around rather than removing them (SVN, unlike git, allows empty directories to be represented in the repository). -- Joseph S. Myers jos...@codesourcery.com
Re: Minor mudflap fallout
On 10/26/13 05:19, Paolo Carlini wrote: Hi Marek Polacek ha scritto: On Sat, Oct 26, 2013 at 12:46:41PM +0200, Paolo Carlini wrote: ... seriously, in libmudflap.c++, 41, etc But aren't all these removed in commit 204090? Ah! I didn't notice something such aggressive was going on! Excellent! The message containing the final version of the patch bounded due to size, but I didn't notice until just a short while ago. Sorry. jeff
Re: Minor mudflap fallout
On 10/26/13 07:45, Hans-Peter Nilsson wrote: On Sat, 26 Oct 2013, Jeff Law wrote: It appears that mudflap creeped into one additional file (targhooks) between the time I bootstrapped the final change and committed the change. This also elimiantes PRED_MUDFLAP which I missed the first time around. Given this is currently breaking boostrap, I'm checking it in proactively, but will allow my bootstrap and regression test to continue overnight. Yeah, cris-elf is broken too. I use PRED_MUDFLAP in cris_emit_trap_for_misalignment, which should explain its use. Is there a replacement? I'd suggest PRED_COLD_LABEL. jeff
[libiberty] Fix testsuite/test-demangle.c
This is similar to my fix for testsuite/test-expandargv.c last week. I'm still not sure why this does not trigger on GNU/Linux distributions, or earlier version of FreeBSD. On FreeBSD 10 one does need to #include to get getpagesize which is used by the test. With this, the test now compiles on my i386-unknown-freebsd10.0 tester; without it, it doesn't. Okay? Gerald 2013-10-26 Gerald Pfeifer * testsuite/test-demangle.c: Include unistd.h. Index: libiberty/testsuite/test-demangle.c === --- libiberty/testsuite/test-demangle.c (revision 204095) +++ libiberty/testsuite/test-demangle.c (working copy) @@ -32,6 +32,9 @@ #if HAVE_STDLIB_H # include #endif +#ifdef HAVE_UNISTD_H +#include +#endif struct line {
Re: [committed] Dump OpenMP version number listed for -fopenmp at doc/invoke.texi
On Fri, 25 Oct 2013, Tobias Burnus wrote: > I have committed the patch below as obvious (Rev. 204049). > Seemingly, there are a lot of places which have to be updated > for a new OpenMP version ... One way to address that is _not_ to refer to concrete versions unless specifically required. This is a bit similar to me reducing references to CVS (and then later SVN) on our web pages, or GNAT and Bugzilla, so that making a change there doesn't required that many documentation changes any more. Gerald
Re: Minor mudflap fallout
On Sat, Oct 26, 2013 at 6:45 AM, Hans-Peter Nilsson wrote: > On Sat, 26 Oct 2013, Jeff Law wrote: > >> It appears that mudflap creeped into one additional file (targhooks) between >> the time I bootstrapped the final change and committed the change. This >> also >> elimiantes PRED_MUDFLAP which I missed the first time around. >> >> Given this is currently breaking boostrap, I'm checking it in proactively, >> but >> will allow my bootstrap and regression test to continue overnight. > > Yeah, cris-elf is broken too. I use PRED_MUDFLAP in > cris_emit_trap_for_misalignment, which should explain its use. > Is there a replacement? I think you could use PRED_NORETURN which should be a reasonable replacement. Thanks, Andrew Pinski > > PRED_MUDFLAP: > -/* Branches to a mudflap bounds check are extremely unlikely. > > brgds, H-P
Fixing cris-* breakage (was: Minor mudflap fallout)
On Sat, 26 Oct 2013, Hans-Peter Nilsson wrote: > Yeah, cris-elf is broken too. I use PRED_MUDFLAP in > cris_emit_trap_for_misalignment, which should explain its use. > Is there a replacement? Actually looking at predict.def, I see PRED_COLD_LABEL, which wasn't there when I worked with this code but which mostly matches the need. Will commit the following after testing. * config/cris/cris.c (cris_emit_trap_for_misalignment): Replace removed PRED_MUDFLAP with PRED_COLD_LABEL. Index: gcc/config/cris/cris.c === --- gcc/config/cris/cris.c (revision 204094) +++ gcc/config/cris/cris.c (working copy) @@ -1996,10 +1996,10 @@ cris_emit_trap_for_misalignment (rtx mem jmp = get_last_insn (); gcc_assert (JUMP_P (jmp)); - /* While this isn't mudflap, it is a similar kind of assertion. - If PRED_MUDFLAP stops working, use something else or introduce a - more suitable assertion predication type. */ - predict_insn_def (jmp, PRED_MUDFLAP, TAKEN); + /* Actually, this is even less likely than a cold label; the program + will likely terminate. Replace with something like "almost + impossible" if such a prediction is introduced. */ + predict_insn_def (jmp, PRED_COLD_LABEL, TAKEN); expand_builtin_trap (); emit_label (ok_label); } brgds, H-P
Re: Aliasing: look through pointer's def stmt
On Fri, 25 Oct 2013, Marc Glisse wrote: On Fri, 25 Oct 2013, Richard Biener wrote: you can followup with handling POINTER_PLUS_EXPR if you like. Like this? (bootstrap+testsuite on x86_64-unknown-linux-gnu) 2013-10-26 Marc Glisse gcc/ * tree-ssa-alias.c (ao_ref_init_from_ptr_and_size): Look for a POINTER_PLUS_EXPR in the defining statement. This has some issues with the type of the offsets. First, they might overflow in some extreme cases (that could probably already happen without the patch). But mostly, negative offsets are not supported. There is a comment to that effect before ao_ref_init_from_ptr_and_size, and ranges_overlap_p takes the offsets as unsigned HOST_WIDE_INT. Currently it does indeed seem hard to produce a negative offset there, but handling POINTER_PLUS_EXPR (definitely a good thing) would obviously change that. -- Marc Glisse
reverting a LRA change
It seems one my yesterday patch created problems with mode switching: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58679 I reverted it until further investigation (committed as rev. 204094). Sorry for inconvenience. 2013-10-26 Vladimir Makarov Revert: 2013-10-25 Vladimir Makarov * lra-spills.c (lra_final_code_change): Remove useless move insns.
Re: Minor mudflap fallout
On Sat, 26 Oct 2013, Jeff Law wrote: > It appears that mudflap creeped into one additional file (targhooks) between > the time I bootstrapped the final change and committed the change. This also > elimiantes PRED_MUDFLAP which I missed the first time around. > > Given this is currently breaking boostrap, I'm checking it in proactively, but > will allow my bootstrap and regression test to continue overnight. Yeah, cris-elf is broken too. I use PRED_MUDFLAP in cris_emit_trap_for_misalignment, which should explain its use. Is there a replacement? PRED_MUDFLAP: -/* Branches to a mudflap bounds check are extremely unlikely. brgds, H-P
[C11-atomic] Miscellaneous fixes 5/n
I've applied this small patch to C11-atomic branch to fix ICEs that could occur with C_MAYBE_CONST_EXPR through lack of folding. c: 2013-10-26 Joseph Myers * c-typeck.c (build_atomic_assign): Fold RHS if not already folded. testsuite: 2013-10-26 Joseph Myers * gcc.dg/c11-atomic-1.c: Add more tests. Index: gcc/testsuite/gcc.dg/c11-atomic-1.c === --- gcc/testsuite/gcc.dg/c11-atomic-1.c (revision 204084) +++ gcc/testsuite/gcc.dg/c11-atomic-1.c (working copy) @@ -255,3 +255,13 @@ fc4b (x) { } void fc4b (_Atomic int); /* { dg-warning "follows non-prototype" } */ + +/* Test cases involving C_MAYBE_CONST_EXPR work. */ +void +func10 (_Atomic int *p) +{ + p[0 / 0] = 1; /* { dg-warning "division by zero" } */ + p[0 / 0] += 1; /* { dg-warning "division by zero" } */ + *p = 0 / 0; /* { dg-warning "division by zero" } */ + *p += 0 / 0; /* { dg-warning "division by zero" } */ +} Index: gcc/c/c-typeck.c === --- gcc/c/c-typeck.c(revision 204084) +++ gcc/c/c-typeck.c(working copy) @@ -11292,6 +11292,10 @@ build_atomic_assign (location_t loc, tree lhs, enu with a loop. */ compound_stmt = c_begin_compound_stmt (false); + /* Fold the RHS if it hasn't already been folded. */ + if (modifycode != NOP_EXPR) +rhs = c_fully_fold (rhs, false, NULL); + /* Remove the qualifiers for the rest of the expressions and create the VAL temp variable to hold the RHS. */ nonatomic_lhs_type = build_qualified_type (lhs_type, TYPE_UNQUALIFIED); -- Joseph S. Myers jos...@codesourcery.com
Re: Minor mudflap fallout
Hi Marek Polacek ha scritto: >On Sat, Oct 26, 2013 at 12:46:41PM +0200, Paolo Carlini wrote: >> ... seriously, in libmudflap.c++, 41, etc > >But aren't all these removed in commit 204090? Ah! I didn't notice something such aggressive was going on! Excellent! Thanks, Paolo
Re: Minor mudflap fallout
On Sat, Oct 26, 2013 at 12:46:41PM +0200, Paolo Carlini wrote: > ... seriously, in libmudflap.c++, 41, etc But aren't all these removed in commit 204090? Marek
Re: Minor mudflap fallout
... seriously, in libmudflap.c++, 41, etc Paolo
Re: Minor mudflap fallout
Marek Polacek ha scritto: >Which ones? All mudflap tests should be gone now. Just browse gcc-testresults ;) Paolo
Re: Minor mudflap fallout
On Sat, Oct 26, 2013 at 12:31:34PM +0200, Paolo Carlini wrote: > ... slightly out of topic, sorry Jeff, but your message made me think that we > should probably do something about the mudflap fails that we have got since > forever (at least on Linux): to your best knowledge is somebody actively > working on those? Should be just xfails for now?!? Which ones? All mudflap tests should be gone now. Marek
Re: Minor mudflap fallout
... slightly out of topic, sorry Jeff, but your message made me think that we should probably do something about the mudflap fails that we have got since forever (at least on Linux): to your best knowledge is somebody actively working on those? Should be just xfails for now?!? Thanks! Paolo
Minor mudflap fallout
It appears that mudflap creeped into one additional file (targhooks) between the time I bootstrapped the final change and committed the change. This also elimiantes PRED_MUDFLAP which I missed the first time around. Given this is currently breaking boostrap, I'm checking it in proactively, but will allow my bootstrap and regression test to continue overnight. diff --git a/gcc/predict.def b/gcc/predict.def index f8dba66..2ce135c 100644 --- a/gcc/predict.def +++ b/gcc/predict.def @@ -117,9 +117,6 @@ DEF_PREDICTOR (PRED_NEGATIVE_RETURN, "negative return", HITRATE (96), 0) /* Branch ending with return; is probably not taken */ DEF_PREDICTOR (PRED_NULL_RETURN, "null return", HITRATE (90), 0) -/* Branches to a mudflap bounds check are extremely unlikely. */ -DEF_PREDICTOR (PRED_MUDFLAP, "mudflap check", PROB_VERY_LIKELY, 0) - /* Branches to compare induction variable to a loop bound is extremely likely. */ DEF_PREDICTOR (PRED_LOOP_IV_COMPARE_GUESS, "guess loop iv compare", diff --git a/gcc/targhooks.c b/gcc/targhooks.c index bee404d..fd0d0d4 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -72,7 +72,6 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssanames.h" #include "tree-ssa-alias.h" #include "insn-codes.h" -#include "tree-mudflap.h" bool @@ -1576,10 +1575,6 @@ tree build_va_arg_indirect_ref (tree addr) { addr = build_simple_mem_ref_loc (EXPR_LOCATION (addr), addr); - - if (flag_mudflap) /* Don't instrument va_arg INDIRECT_REF. */ -mf_mark (addr); - return addr; }
Re: [Patch] Refactor regex executors
On 10/26/2013 01:35 AM, Tim Shen wrote: On Fri, Oct 25, 2013 at 10:27 AM, Paolo Carlini wrote: Uhm, cute, didn't consider the naming issue, but I'm not sure we want to do that... What about having the code in a split.h and including it from split.cc and split_bfs.cc instead? Sorry for late. Patch is great. Thanks! Paolo.
vzeroupper mode-switching pass regression (Was: Re: patch adding LRA usage for ppc)
Hello! > 2013-10-25 Vladimir Makarov > > ... > * lra-spills.c (lra_final_code_change): Remove useless move insns. This change regressed x86 AVX vzeroupper insertion pass and exposed another instance of PR 58679 [1]. The testcase: --cut here-- typedef long long __m128i __attribute__ ((__vector_size__ (16))); typedef char __v16qi __attribute__ ((__vector_size__ (16))); __m128i _mm_cmpistrm (__m128i __X, __m128i __Y, const int __M) { return (__m128i) __builtin_ia32_pcmpistrm128((__v16qi)__X, (__v16qi)__Y, 1); } --cut here-- -O2 -mavx: tt.c: In function ‘_mm_cmpistrm’: tt.c:8:1: internal compiler error: in create_pre_exit, at mode-switching.c:422 } ^ 0xe0ed41 create_pre_exit /home/uros/gcc-svn/trunk/gcc/mode-switching.c:408 0xe0ed41 optimize_mode_switching /home/uros/gcc-svn/trunk/gcc/mode-switching.c:496 0xe0ed41 rest_of_handle_mode_switching /home/uros/gcc-svn/trunk/gcc/mode-switching.c:782 0xe0ed41 execute /home/uros/gcc-svn/trunk/gcc/mode-switching.c:817 0xbcaf85 rest_of_handle_insert_vzeroupper /home/uros/gcc-svn/trunk/gcc/config/i386/i386.c:2370 The problem is in the wrong assumption of mode switching pass, which in its exit bb expects a simple register copy insn that copies return value to a return register. This is not the case anymore, since LRA now removes the null copy by itself. On a related note, gcc.c-torture/execute/pr30185.c from [1] does not fail vzeroupper insertion pass anymore, due to unnecessary return value copy insn: foo: movq%rsi, %rax cqto idivq %rcx movq%rax, %rsi <--- here (*) xorl%eax, %eax movq%rsi, %rdx ret "movq %rax, %rdx" should be emitted at (*). [1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58679 Uros.
free is a killer
Hello, this patch teaches gcc that free kills the memory its argument points to. The equality test is probably too strict, I guess we can loosen it later (unless you have suggestions?). Note that the corresponding code for BUILT_IN_MEMCPY and others seems suspicious to me, it looks like it is testing for equality between a pointer and a mem_ref, which is unlikely to happen. Bootstrap+testsuite on x86_64-unknown-linux-gnu. 2013-10-27 Marc Glisse PR tree-optimization/19831 gcc/ * tree-ssa-alias.c (stmt_kills_ref_p_1): Handle BUILT_IN_FREE. gcc/testsuite/ * gcc.dg/tree-ssa/alias-25.c: New file. -- Marc GlisseIndex: gcc/testsuite/gcc.dg/tree-ssa/alias-25.c === --- gcc/testsuite/gcc.dg/tree-ssa/alias-25.c(revision 0) +++ gcc/testsuite/gcc.dg/tree-ssa/alias-25.c(working copy) @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +void f (long *p) { + *p = 42; + p[4] = 42; + __builtin_free (p); +} + +/* { dg-final { scan-tree-dump-not "= 42" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ + Property changes on: gcc/testsuite/gcc.dg/tree-ssa/alias-25.c ___ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision URL \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: gcc/tree-ssa-alias.c === --- gcc/tree-ssa-alias.c(revision 204088) +++ gcc/tree-ssa-alias.c(working copy) @@ -2053,20 +2053,30 @@ stmt_kills_ref_p_1 (gimple stmt, ao_ref } } if (is_gimple_call (stmt)) { tree callee = gimple_call_fndecl (stmt); if (callee != NULL_TREE && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL) switch (DECL_FUNCTION_CODE (callee)) { + case BUILT_IN_FREE: + { + tree ptr = gimple_call_arg (stmt, 0); + tree base = ao_ref_base (ref); + if (base && TREE_CODE (base) == MEM_REF + && TREE_OPERAND (base, 0) == ptr) + return true; + break; + } + case BUILT_IN_MEMCPY: case BUILT_IN_MEMPCPY: case BUILT_IN_MEMMOVE: case BUILT_IN_MEMSET: case BUILT_IN_MEMCPY_CHK: case BUILT_IN_MEMPCPY_CHK: case BUILT_IN_MEMMOVE_CHK: case BUILT_IN_MEMSET_CHK: { tree dest = gimple_call_arg (stmt, 0);