Re: aarch64 simd index out of range message not correct on 32 bit host
On Fri, May 29, 2015 at 3:46 PM, Shiva Chen shiva0...@gmail.com wrote: Hi, Andrew You are right, it's much simpler. Could you give me a tip how %wd works on GCC ? the w modifier is the GCC diagnostic format modifier that specifies HOST_WIDE_INT. Could you send a new patch to fix the message since you have better solution ? I don't build using a 32bit host so I can't test it. Thanks, Andrew Thanks, Shiva 2015-05-29 15:13 GMT+08:00 Andrew Pinski pins...@gmail.com: On Fri, May 29, 2015 at 2:33 PM, Shiva Chen shiva0...@gmail.com wrote: Hi, I notice that aarch64 simd index range message not correct on 32 bit host. The message print by the function aarch64_simd_lane_bounds in aarch64.c. The function print HOST_WIDE_INT variable by %ld which is correct on 64 bit host. However, on 32 bit host HOST_WIDE_INT would be long long. Therefore, print out incorrect message on 32 bit host. Fix the message by printing HOST_WIDE_INT variables on 32 bit host by %lld. Actually there is a simpler way. Since this is error which uses the GCC diagnostic format you can just use %wd instead. So: error (%Klane %ld out of range %ld - %ld, exp, lane, low, high - 1); Becomes: error (%Klane %wd out of range %wd - %wd, exp, lane, low, high - 1); Thanks, Andrew Pinski Shiva
Re: [PATCH, testsuite]: Cleanup dumps
On 31 January 2015 at 22:10, Bernhard Reutner-Fischer rep.dot@gmail.com wrote: On January 31, 2015 9:17:57 PM GMT+01:00, Mike Stump mikest...@comcast.net wrote: On Jan 31, 2015, at 11:50 AM, Bernhard Reutner-Fischer rep.dot@gmail.com wrote: On January 31, 2015 10:53:39 AM GMT+01:00, Uros Bizjak ubiz...@gmail.com wrote: Hello! Reminds me of just auto-wiping dump files: https://gcc.gnu.org/ml/gcc-patches/2013-10/msg02506.html Mike, WDYT? Ok. My only concern of speed isn’t founded, as you stated it was faster to scan the flags. I think I’m fine with it going in now, but, if you do, you have to watch for and resolve any fallout. Watch for RM comments, I’d defer to them on timing. If you want to wait until stage 1, that’s fine too. I'd only want that to go in in stage 1. I have applied this now as r223858. Please CC me on fallout. Thanks,
Re: aarch64 simd index out of range message not correct on 32 bit host
Hi, Andrew I modify the patch as you suggestion and testing on 32/64 bit host. Thanks your tips. I really appreciate for your help. Shiva 2015-05-29 15:57 GMT+08:00 Andrew Pinski pins...@gmail.com: On Fri, May 29, 2015 at 3:46 PM, Shiva Chen shiva0...@gmail.com wrote: Hi, Andrew You are right, it's much simpler. Could you give me a tip how %wd works on GCC ? the w modifier is the GCC diagnostic format modifier that specifies HOST_WIDE_INT. Could you send a new patch to fix the message since you have better solution ? I don't build using a 32bit host so I can't test it. Thanks, Andrew Thanks, Shiva 2015-05-29 15:13 GMT+08:00 Andrew Pinski pins...@gmail.com: On Fri, May 29, 2015 at 2:33 PM, Shiva Chen shiva0...@gmail.com wrote: Hi, I notice that aarch64 simd index range message not correct on 32 bit host. The message print by the function aarch64_simd_lane_bounds in aarch64.c. The function print HOST_WIDE_INT variable by %ld which is correct on 64 bit host. However, on 32 bit host HOST_WIDE_INT would be long long. Therefore, print out incorrect message on 32 bit host. Fix the message by printing HOST_WIDE_INT variables on 32 bit host by %lld. Actually there is a simpler way. Since this is error which uses the GCC diagnostic format you can just use %wd instead. So: error (%Klane %ld out of range %ld - %ld, exp, lane, low, high - 1); Becomes: error (%Klane %wd out of range %wd - %wd, exp, lane, low, high - 1); Thanks, Andrew Pinski Shiva diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 083b9b4..5343d09 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -8903,9 +8903,9 @@ aarch64_simd_lane_bounds (rtx operand, HOST_WIDE_INT low, HOST_WIDE_INT high, if (lane low || lane = high) { if (exp) - error (%Klane %ld out of range %ld - %ld, exp, lane, low, high - 1); + error (%Klane %wd out of range %wd - %wd, exp, lane, low, high - 1); else - error (lane %ld out of range %ld - %ld, lane, low, high - 1); + error (lane %wd out of range %wd - %wd, lane, low, high - 1); } } ChangeLog.fix_simd_index_message Description: Binary data
Re: [Patch]: libbacktrace - add support of PE/COFF
On 28 May 2015, at 17:14, Ian Lance Taylor i...@google.com wrote: On Thu, May 28, 2015 at 5:01 AM, Tristan Gingold ging...@adacore.com wrote: On 28 May 2015, at 02:26, Ian Lance Taylor i...@google.com wrote: The #include windows.h will break cross-compilers. It's not OK for trunk until that is fixed. I am confused by this comment, for two reasons: - I don’t see how that would break cross-compilers. Cross compilers hosted on windows are not impacted by this include when the library is used for the tools. When then backtrace library is used for the target, pecoff is not used unless the target is windows. So I don’t see a case where the include breaks cross-compilers. The way you have written the code, I'm fairly sure that it will be compiled for an i386-coff target. And the only coff target supported is djgpp, right ? - If the case exists, I don’t see how to implement backtrace within shared libraries: I need a windows specific function to get the list of DLL. I would be OK with a #include windows.h that is conditional on something that indicates that the host (from the point of view of libbacktrace) really is Windows. Is it ok to test if the _WIN32 macro is defined (like in libiberty) ? The new version of the patch is OK. Thanks, now committed. Tristan.
Re: arm memcpy of aligned data
Hi Mike, On 28/05/15 22:15, Mike Stump wrote: So, the arm memcpy code of aligned data isn’t as good as it can be. void *memcpy(void *dest, const void *src, unsigned int n); void foo(char *dst, int i) { memcpy (dst, i, sizeof (i)); } generates horrible code, but, it we are willing to notice the src or the destination are aligned, we can do much better: $ ./cc1 -fschedule-fusion -fdump-tree-all-all -da -march=armv7ve -mcpu=cortex-m4 -fomit-frame-pointer -quiet -O2 /tmp/t.c -o t.s $ cat t.s [ … ] foo: @ args = 0, pretend = 0, frame = 4 @ frame_needed = 0, uses_anonymous_args = 0 @ link register save eliminated. sub sp, sp, #4 str r1, [r0]@ unaligned add sp, sp, #4 I think there's something to do with cpu tuning here as well. For the code you've given compiled with -O2 -mcpu=cortex-a53 I get: sub sp, sp, #8 mov r2, r0 add r3, sp, #8 str r1, [r3, #-4]! ldr r0, [r3]@ unaligned str r0, [r2]@ unaligned add sp, sp, #8 @ sp needed bx lr whereas for -O2 -mcpu=cortex-a57 I get the much better: sub sp, sp, #8 str r1, [r0]@ unaligned add sp, sp, #8 @ sp needed bx lr Kyrill Index: gcc/config/arm/arm.c === --- gcc/config/arm/arm.c(revision 223842) +++ gcc/config/arm/arm.c(working copy) @@ -14376,7 +14376,10 @@ arm_block_move_unaligned_straight (rtx d srcoffset + j * UNITS_PER_WORD - src_autoinc); mem = adjust_automodify_address (srcbase, SImode, addr, srcoffset + j * UNITS_PER_WORD); - emit_insn (gen_unaligned_loadsi (regs[j], mem)); + if (src_aligned) + emit_move_insn (regs[j], mem); + else + emit_insn (gen_unaligned_loadsi (regs[j], mem)); } srcoffset += words * UNITS_PER_WORD; } @@ -14395,7 +14398,10 @@ arm_block_move_unaligned_straight (rtx d dstoffset + j * UNITS_PER_WORD - dst_autoinc); mem = adjust_automodify_address (dstbase, SImode, addr, dstoffset + j * UNITS_PER_WORD); - emit_insn (gen_unaligned_storesi (mem, regs[j])); + if (dst_aligned) + emit_move_insn (mem, regs[j]); + else + emit_insn (gen_unaligned_storesi (mem, regs[j])); } dstoffset += words * UNITS_PER_WORD; } Ok? Can someone spin this through an arm test suite run for me, I was doing this by inspection and cross compile on a system with no arm bits. Bonus points if you can check it in with the test case above marked up as appropriate.
Re: [PATCH, testsuite]: Cleanup dumps
On 29 May 2015 at 10:21, Bernhard Reutner-Fischer rep.dot@gmail.com wrote: On 31 January 2015 at 22:10, Bernhard Reutner-Fischer rep.dot@gmail.com wrote: On January 31, 2015 9:17:57 PM GMT+01:00, Mike Stump mikest...@comcast.net wrote: If you want to wait until stage 1, that’s fine too. I'd only want that to go in in stage 1. I have applied this now as r223858. Please CC me on fallout. To recap: The idea is to automatically delete dump-files in the testsuite instead of annotating alot of testcases in their dg-final. To quote sourcebuild.texi, Clean up generated test files: --- 8 --- Usually the test-framework removes files that were generated during testing. If a testcase, for example, uses any dumping mechanism to inspect a passes dump file, the testsuite recognized the dumping option passed to the tool and schedules a final cleanup to remove these files. --- 8 --- The following TCL procs were deleted from the test framework and CANNOT be used anymore in dg-final: - cleanup-ipa-dump - cleanup-rtl-dump - cleanup-tree-dump - cleanup-saved-temps These dump-files are now automatically deleted in the testsuite, via a schedule-cleanups in some basic .exp helpers. Just delete any // dg-final { cleanup-see-above-list } from your new testcases. The .plan is to gradually do the same for the remaining dumps like stack etc. See remaining parts in sourcebuild.texi and this comment in schedule-cleanups: +# TODO +# -fprofile-generate - cleanup-coverage-files() +# -fstack-usage - cleanup-stack-usage() Mike, just so i do not forget: I have retained the cleanup-saved-temps proc for now since it's used in lto.exp. I want to rename it later on to prevent people from using it in their dg-final since this is now done automatically. cheers,
Re: aarch64 simd index out of range message not correct on 32 bit host
Hi, Andrew You are right, it's much simpler. Could you give me a tip how %wd works on GCC ? Could you send a new patch to fix the message since you have better solution ? Thanks, Shiva 2015-05-29 15:13 GMT+08:00 Andrew Pinski pins...@gmail.com: On Fri, May 29, 2015 at 2:33 PM, Shiva Chen shiva0...@gmail.com wrote: Hi, I notice that aarch64 simd index range message not correct on 32 bit host. The message print by the function aarch64_simd_lane_bounds in aarch64.c. The function print HOST_WIDE_INT variable by %ld which is correct on 64 bit host. However, on 32 bit host HOST_WIDE_INT would be long long. Therefore, print out incorrect message on 32 bit host. Fix the message by printing HOST_WIDE_INT variables on 32 bit host by %lld. Actually there is a simpler way. Since this is error which uses the GCC diagnostic format you can just use %wd instead. So: error (%Klane %ld out of range %ld - %ld, exp, lane, low, high - 1); Becomes: error (%Klane %wd out of range %wd - %wd, exp, lane, low, high - 1); Thanks, Andrew Pinski Shiva
Re: [PATCH] Don't instrument DECL_INITIAL of statics (PR sanitizer/66190)
Ping. On Thu, May 21, 2015 at 09:36:59PM +0200, Marek Polacek wrote: In this PR, we find ourselves instrumenting a static initializer and then crashing when expanding an unlowered UBSAN_NULL. Jakub suggests to not instrument DECL_INITIAL of a static variable. The following patch is an attempt to do that. Note that we're still able to sanitize similar cases (they don't have DECL_INITIAL but something else). Bootstrap/regtest/bootstrap-ubsan passed on x86_64-linux, ok for trunk? 2015-05-21 Marek Polacek pola...@redhat.com PR sanitizer/66190 * cp-gimplify.c (struct cp_genericize_data): Add no_sanitize_p. (cp_genericize_r): Don't instrument static initializers. (cp_genericize_tree): Initialize wtd.no_sanitize_p. * g++.dg/ubsan/static-init-1.C: New test. * g++.dg/ubsan/static-init-2.C: New test. * g++.dg/ubsan/static-init-3.C: New test. diff --git gcc/cp/cp-gimplify.c gcc/cp/cp-gimplify.c index d5a64fc..778d8f3 100644 --- gcc/cp/cp-gimplify.c +++ gcc/cp/cp-gimplify.c @@ -906,6 +906,7 @@ struct cp_genericize_data vectree bind_expr_stack; struct cp_genericize_omp_taskreg *omp_ctx; tree try_block; + bool no_sanitize_p; }; /* Perform any pre-gimplification lowering of C++ front end trees to @@ -1150,6 +1151,21 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) *stmt_p = build1 (NOP_EXPR, void_type_node, integer_zero_node); *walk_subtrees = 0; } + else if ((flag_sanitize + (SANITIZE_NULL | SANITIZE_ALIGNMENT | SANITIZE_VPTR)) + TREE_CODE (stmt) == DECL_EXPR + VAR_P (DECL_EXPR_DECL (stmt)) + TREE_STATIC (DECL_EXPR_DECL (stmt)) + DECL_INITIAL (DECL_EXPR_DECL (stmt))) +{ + *walk_subtrees = 0; + /* The point here is to not sanitize static initializers. */ + bool no_sanitize_p = wtd-no_sanitize_p; + wtd-no_sanitize_p = true; + cp_walk_tree (DECL_INITIAL (DECL_EXPR_DECL (stmt)), cp_genericize_r, + data, NULL); + wtd-no_sanitize_p = no_sanitize_p; +} else if (TREE_CODE (stmt) == OMP_PARALLEL || TREE_CODE (stmt) == OMP_TASK) { struct cp_genericize_omp_taskreg omp_ctx; @@ -1275,9 +1291,10 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) if (*stmt_p == error_mark_node) *stmt_p = size_one_node; return NULL; -} - else if (flag_sanitize - (SANITIZE_NULL | SANITIZE_ALIGNMENT | SANITIZE_VPTR)) +} + else if ((flag_sanitize + (SANITIZE_NULL | SANITIZE_ALIGNMENT | SANITIZE_VPTR)) + !wtd-no_sanitize_p) { if ((flag_sanitize (SANITIZE_NULL | SANITIZE_ALIGNMENT)) TREE_CODE (stmt) == NOP_EXPR @@ -1319,6 +1336,7 @@ cp_genericize_tree (tree* t_p) wtd.bind_expr_stack.create (0); wtd.omp_ctx = NULL; wtd.try_block = NULL_TREE; + wtd.no_sanitize_p = false; cp_walk_tree (t_p, cp_genericize_r, wtd, NULL); delete wtd.p_set; wtd.bind_expr_stack.release (); diff --git gcc/testsuite/g++.dg/ubsan/static-init-1.C gcc/testsuite/g++.dg/ubsan/static-init-1.C index e69de29..0b424c0 100644 --- gcc/testsuite/g++.dg/ubsan/static-init-1.C +++ gcc/testsuite/g++.dg/ubsan/static-init-1.C @@ -0,0 +1,21 @@ +// PR sanitizer/66190 +// { dg-do compile } +// { dg-options -fsanitize=null -std=c++11 } + +class A { +public: + void fn1 (int); +}; + +class G { + ~G (); + A t; + virtual void fn2 () { +static int a; +static int b = a; +static int c (a); +static int d {a}; +t.fn1 (b); + } +}; +G ::~G () {} diff --git gcc/testsuite/g++.dg/ubsan/static-init-2.C gcc/testsuite/g++.dg/ubsan/static-init-2.C index e69de29..d046b33 100644 --- gcc/testsuite/g++.dg/ubsan/static-init-2.C +++ gcc/testsuite/g++.dg/ubsan/static-init-2.C @@ -0,0 +1,17 @@ +// PR sanitizer/66190 +// { dg-do run } +// { dg-options -fsanitize=null -std=c++11 } + +int +main () +{ + static int *a; + static int b = *a; + static int c (*a); + static int d {*a}; + return 0; +} + +// { dg-output reference binding to null pointer of type 'int'(\n|\r\n|\r) } +// { dg-output \[^\n\r]*reference binding to null pointer of type 'int'(\n|\r\n|\r) } +// { dg-output \[^\n\r]*reference binding to null pointer of type 'int' } diff --git gcc/testsuite/g++.dg/ubsan/static-init-3.C gcc/testsuite/g++.dg/ubsan/static-init-3.C index e69de29..7fd6cbd 100644 --- gcc/testsuite/g++.dg/ubsan/static-init-3.C +++ gcc/testsuite/g++.dg/ubsan/static-init-3.C @@ -0,0 +1,19 @@ +// PR sanitizer/66190 +// { dg-do run } +// { dg-options -fsanitize=null -std=c++11 } + +int *fn (void) { return 0; } + +int +main () +{ + static int a; + static int b = *fn (); + static int c (*fn ()); + static int d {*fn ()}; + return 0; +} + +// { dg-output reference binding to null pointer of type 'int'(\n|\r\n|\r) } +// { dg-output \[^\n\r]*reference
Re: [PR65768] Check rtx_cost when propagating constant
On 29/05/15 07:31, Jeff Law wrote: On 05/13/2015 11:46 PM, Kugan wrote: ping? Thanks, Kugan On 15/04/15 17:53, Kugan wrote: As mentioned in PR65768, ARM gcc generates suboptimal code for constant Uses in loop. Part of the reason is cprop is undoing what loop invariant code motion did. Zhenqiang posted a patch at to fix this based on rtx costs: https://gcc.gnu.org/ml/gcc-patches/2014-06/msg01321.html I cleaned it up and bootstrapped, regression tested on x86_64-linux-gnu; no new regressions. Is this OK for trunk? Thanks, Kugan gcc/ChangeLog: 2015-04-15 Kugan Vivekanandarajah kug...@linaro.org Zhenqiang Chen zhenqiang.c...@linaro.org PR target/65768 * cprop.c (try_replace_reg): Check cost of constants before propagating. I should have also noted, fresh bootstrap regression test is needed too. Thanks Jeff for the comments. I did a fresh bootstrap and regression testing on x86_64-linux-gnu with no new regression. I will wait for you ACK. Thanks, Kugan
aarch64 simd index out of range message not correct on 32 bit host
Hi, I notice that aarch64 simd index range message not correct on 32 bit host. The message print by the function aarch64_simd_lane_bounds in aarch64.c. The function print HOST_WIDE_INT variable by %ld which is correct on 64 bit host. However, on 32 bit host HOST_WIDE_INT would be long long. Therefore, print out incorrect message on 32 bit host. Fix the message by printing HOST_WIDE_INT variables on 32 bit host by %lld. Shiva diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 083b9b4..49b007e 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -8903,9 +8903,21 @@ aarch64_simd_lane_bounds (rtx operand, HOST_WIDE_INT low, HOST_WIDE_INT high, if (lane low || lane = high) { if (exp) - error (%Klane %ld out of range %ld - %ld, exp, lane, low, high - 1); + { +#if INT64_T_IS_LONG +error (%Klane %ld out of range %ld - %ld, exp, lane, low, high - 1); +#else +error (%Klane %lld out of range %lld - %lld, exp, lane, low, high - 1); +#endif + } else - error (lane %ld out of range %ld - %ld, lane, low, high - 1); + { +#if INT64_T_IS_LONG +error (lane %ld out of range %ld - %ld, lane, low, high - 1); +#else +error (lane %lld out of range %lld - %lld, lane, low, high - 1); +#endif + } } } ChangeLog.fix_simd_index_message Description: Binary data
Re: [RFC][PATCH][X86_64] Eliminate PLT stubs for specified external functions via -fno-plt=
On Thu, May 28, 2015 at 5:05 PM, H.J. Lu hjl.to...@gmail.com wrote: On Thu, May 28, 2015 at 4:54 PM, Sriraman Tallam tmsri...@google.com wrote: On Thu, May 28, 2015 at 2:52 PM, H.J. Lu hjl.to...@gmail.com wrote: On Thu, May 28, 2015 at 2:27 PM, Sriraman Tallam tmsri...@google.com wrote: On Thu, May 28, 2015 at 2:01 PM, H.J. Lu hjl.to...@gmail.com wrote: On Thu, May 28, 2015 at 1:54 PM, Sriraman Tallam tmsri...@google.com wrote: On Thu, May 28, 2015 at 12:05 PM, H.J. Lu hjl.to...@gmail.com wrote: On Thu, May 28, 2015 at 11:50 AM, Sriraman Tallam tmsri...@google.com wrote: On Thu, May 28, 2015 at 11:42 AM, H.J. Lu hjl.to...@gmail.com wrote: On Thu, May 28, 2015 at 11:34 AM, Sriraman Tallam tmsri...@google.com wrote: I have attached a patch that adds the new attribute noplt. Please review. * config/i386/i386.c (avoid_plt_to_call): New function. (ix86_output_call_insn): Generate indirect call for functions marked with noplt attribute. (attribute_spec ix86_attribute_): Define new attribute noplt. * doc/extend.texi: Document new attribute noplt. * gcc.target/i386/noplt-1.c: New testcase. * gcc.target/i386/noplt-2.c: New testcase. 2 comments: 1. Don't remove %! prefix before call/jmp. It is needed for MPX. 2. Don't you need to check !TARGET_MACHO !TARGET_SEH !TARGET_PECOFF since it only works for ELF. Ok, I will make this change. OTOH, is it just better to piggy-back on existing -fno-plt change by Alex in calls.c and do this: Index: calls.c === --- calls.c (revision 223720) +++ calls.c (working copy) @@ -226,9 +226,11 @@ prepare_call_address (tree fndecl_or_type, rtx fun targetm.small_register_classes_for_mode_p (FUNCTION_MODE)) ? force_not_mem (memory_address (FUNCTION_MODE, funexp)) : memory_address (FUNCTION_MODE, funexp)); - else if (flag_pic !flag_plt fndecl_or_type + else if (fndecl_or_type TREE_CODE (fndecl_or_type) == FUNCTION_DECL -!targetm.binds_local_p (fndecl_or_type)) +!targetm.binds_local_p (fndecl_or_type) +((flag_pic !flag_plt) + || (lookup_attribute (noplt, DECL_ATTRIBUTES(fndecl_or_type) { funexp = force_reg (Pmode, funexp); } Does it work on non-PIC calls? You are right, it doesnt work. I have attached the patch with the changes you mentioned. Since direct_p is true, do wee need + if (GET_CODE (call_op) != SYMBOL_REF + || SYMBOL_REF_LOCAL_P (call_op)) +return false; We do need it right because for this case below, I do not want an indirect call: __attribute__((noplt)) int foo() { return 0; } int main() { return foo(); } Assuming foo is not inlined, if I remove the lines you mentioned, I will get an indirect call which is unnecessary. I meant the GET_CODE (call_op) != SYMBOL_REF part isn't needed. I should have realized that :), sorry. Patch fixed. --- testsuite/gcc.target/i386/noplt-1.c (revision 0) +++ testsuite/gcc.target/i386/noplt-1.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile { target x86_64-*-* } } */ ... +/* { dg-final { scan-assembler call\[ \t\]\\*.*foo.*@GOTPCREL\\(%rip\\) } } */ The test will fail on Windows and Darwin. Changed to use x86_64-*-linux* target. -- H.J. * config/i386/i386.c (avoid_plt_to_call): New function. (ix86_output_call_insn): Generate indirect call for functions marked with noplt attribute. (attribute_spec ix86_attribute_): Define new attribute noplt. * doc/extend.texi: Document new attribute noplt. * gcc.target/i386/noplt-1.c: New testcase. * gcc.target/i386/noplt-2.c: New testcase. Index: config/i386/i386.c === --- config/i386/i386.c (revision 223720) +++ config/i386/i386.c (working copy) @@ -25599,6 +25599,24 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx call return call; } +/* Return true if the function being called was marked with attribute + noplt. If this function is defined, this should return false. */ +static bool +avoid_plt_to_call (rtx call_op) +{ + if (SYMBOL_REF_LOCAL_P (call_op)) +return false; + + tree symbol_decl = SYMBOL_REF_DECL (call_op); + + if (symbol_decl != NULL_TREE + TREE_CODE (symbol_decl) == FUNCTION_DECL + lookup_attribute (noplt, DECL_ATTRIBUTES (symbol_decl))) +return true; + + return false; +} + /* Output the assembly for a call instruction. */ const char * @@ -25611,7 +25629,13 @@ ix86_output_call_insn (rtx_insn *insn, rtx call_op if (SIBLING_CALL_P (insn)) { if (direct_p) - xasm = %!jmp\t%P0; + { + if (!TARGET_MACHO !TARGET_SEH !TARGET_PECOFF + TARGET_64BIT avoid_plt_to_call (call_op)) + xasm = %!jmp\t*%p0@GOTPCREL(%%rip); + else + xasm = %!jmp\t%P0; + } /* SEH epilogue detection
Re: arm memcpy of aligned data
On 28 May 2015, at 23:15, Mike Stump mikest...@comcast.net wrote: So, the arm memcpy code of aligned data isn’t as good as it can be. void *memcpy(void *dest, const void *src, unsigned int n); void foo(char *dst, int i) { memcpy (dst, i, sizeof (i)); } generates horrible code, but, it we are willing to notice the src or the destination are aligned, we can do much better: This looks like PR 50417, doesn't it? Cheers, Oleg $ ./cc1 -fschedule-fusion -fdump-tree-all-all -da -march=armv7ve -mcpu=cortex-m4 -fomit-frame-pointer -quiet -O2 /tmp/t.c -o t.s $ cat t.s [ … ] foo: @ args = 0, pretend = 0, frame = 4 @ frame_needed = 0, uses_anonymous_args = 0 @ link register save eliminated. sub sp, sp, #4 str r1, [r0]@ unaligned add sp, sp, #4 Index: gcc/config/arm/arm.c === --- gcc/config/arm/arm.c (revision 223842) +++ gcc/config/arm/arm.c (working copy) @@ -14376,7 +14376,10 @@ arm_block_move_unaligned_straight (rtx d srcoffset + j * UNITS_PER_WORD - src_autoinc); mem = adjust_automodify_address (srcbase, SImode, addr, srcoffset + j * UNITS_PER_WORD); - emit_insn (gen_unaligned_loadsi (regs[j], mem)); + if (src_aligned) + emit_move_insn (regs[j], mem); + else + emit_insn (gen_unaligned_loadsi (regs[j], mem)); } srcoffset += words * UNITS_PER_WORD; } @@ -14395,7 +14398,10 @@ arm_block_move_unaligned_straight (rtx d dstoffset + j * UNITS_PER_WORD - dst_autoinc); mem = adjust_automodify_address (dstbase, SImode, addr, dstoffset + j * UNITS_PER_WORD); - emit_insn (gen_unaligned_storesi (mem, regs[j])); + if (dst_aligned) + emit_move_insn (mem, regs[j]); + else + emit_insn (gen_unaligned_storesi (mem, regs[j])); } dstoffset += words * UNITS_PER_WORD; } Ok? Can someone spin this through an arm test suite run for me, I was doing this by inspection and cross compile on a system with no arm bits. Bonus points if you can check it in with the test case above marked up as appropriate. arm.diffs.txt
Re: aarch64 simd index out of range message not correct on 32 bit host
On Fri, May 29, 2015 at 2:33 PM, Shiva Chen shiva0...@gmail.com wrote: Hi, I notice that aarch64 simd index range message not correct on 32 bit host. The message print by the function aarch64_simd_lane_bounds in aarch64.c. The function print HOST_WIDE_INT variable by %ld which is correct on 64 bit host. However, on 32 bit host HOST_WIDE_INT would be long long. Therefore, print out incorrect message on 32 bit host. Fix the message by printing HOST_WIDE_INT variables on 32 bit host by %lld. Actually there is a simpler way. Since this is error which uses the GCC diagnostic format you can just use %wd instead. So: error (%Klane %ld out of range %ld - %ld, exp, lane, low, high - 1); Becomes: error (%Klane %wd out of range %wd - %wd, exp, lane, low, high - 1); Thanks, Andrew Pinski Shiva
Re: [Patch, fortran, PR44672, v6] [F08] ALLOCATE with SOURCE and no array-spec
Hi Mikael, comments inline below: On Thu, 28 May 2015 20:06:57 +0200 Mikael Morin mikael.mo...@sfr.fr wrote: Le 28/05/2015 17:29, Andre Vehreschild a écrit : *** resolve_allocate_expr (gfc_expr *e, gfc_ *** 7103,7112 --- 7103,7123 if (!ref2 || ref2-type != REF_ARRAY || ref2-u.ar.type == AR_FULL || (dimension ref2-u.ar.dimen == 0)) { + /* F08:C633. */ + if (code-expr3) + { + if (!gfc_notify_std (GFC_STD_F2008, Array specification required + in ALLOCATE statement at %L, e-where)) + goto failure; + *array_alloc_wo_spec = true; + } + else + { gfc_error (Array specification required in ALLOCATE statement at %L, e-where); goto failure; } + } /* Make sure that the array section reference makes sense in the context of an ALLOCATE specification. */ I think we can be a little be more user friendly with the gfc_notify_std error message. Something like: ALLOCATE without array spec at %L ALLOCATE with array bounds determined from SOURCE or MOLD at %L I didn't want to mess with the error messages to prevent issues for translations. So how is the policy on this? *** gfc_array_init_size (tree descriptor, in *** 5044,5053 lower == NULL= lbound = 1, ubound = upper[n] upper[n] = NULL = lbound = 1, ubound = lower[n] upper[n] != NULL = lbound = lower[n], ubound = upper[n] */ - ubound = upper[n]; /* Set lower bound. */ gfc_init_se (se, NULL); if (lower == NULL) se.expr = gfc_index_one_node; else --- 5050,5063 lower == NULL= lbound = 1, ubound = upper[n] upper[n] = NULL = lbound = 1, ubound = lower[n] upper[n] != NULL = lbound = lower[n], ubound = upper[n] */ /* Set lower bound. */ gfc_init_se (se, NULL); + if (expr3_desc != NULL_TREE) + se.expr = gfc_index_one_node; + else + { + ubound = upper[n]; if (lower == NULL) se.expr = gfc_index_one_node; else *** gfc_array_init_size (tree descriptor, in *** 5064,5069 --- 5074,5080 ubound = lower[n]; } } + } gfc_conv_descriptor_lbound_set (descriptor_block, descriptor, gfc_rank_cst[n], se.expr); conv_lbound = se.expr; You can avoid reindenting if the ubound = upper[n] statement is kept at its original place. Fixed. *** gfc_array_init_size (tree descriptor, in *** 5076,5085 /* Set upper bound. */ gfc_init_se (se, NULL); gcc_assert (ubound); gfc_conv_expr_type (se, ubound, gfc_array_index_type); gfc_add_block_to_block (pblock, se.pre); ! gfc_conv_descriptor_ubound_set (descriptor_block, descriptor, gfc_rank_cst[n], se.expr); conv_ubound = se.expr; --- 5087,5111 /* Set upper bound. */ gfc_init_se (se, NULL); + if (expr3_desc != NULL_TREE) + { + /* Set the upper bound to be (desc.ubound - desc.lbound)+ 1. */ + tmp = fold_build2_loc (input_location, MINUS_EXPR, +gfc_array_index_type, +gfc_conv_descriptor_ubound_get ( + expr3_desc, gfc_rank_cst[n]), +gfc_conv_descriptor_lbound_get ( + expr3_desc, gfc_rank_cst[n])); + se.expr = fold_build2_loc (input_location, PLUS_EXPR, +gfc_array_index_type, tmp, +gfc_index_one_node); + } + else + { gcc_assert (ubound); gfc_conv_expr_type (se, ubound, gfc_array_index_type); gfc_add_block_to_block (pblock, se.pre); ! } gfc_conv_descriptor_ubound_set (descriptor_block, descriptor, gfc_rank_cst[n], se.expr); conv_ubound = se.expr; Your one-based-ness problem was here, wasn't it? Correct. I would rather copy directly lbound and ubound from expr3_desc to descriptor. It was that way in the previous version of the patch, which does *not* work any longer. When gfc_trans_allocate () is responsible for the creating a temporary variable for the source=-expression, then it does so using zero based expressions. If the source has non-one-based bounds, the above would produce wrong bounds. Counterexample? Note, the expr3_desc is guaranteed to be an artificial variable created by conv_expr_descriptor, aka zero-based. snipp *** gfc_trans_allocate (gfc_code * code) *** 5229,5235 } else tmp = se.expr; ! if (!code-expr3-mold)
Re: [PATCH] Tiny if-conv improvement (PR tree-optimization/66142)
On Fri, 29 May 2015, Jakub Jelinek wrote: Hi! On the following testcase from the PR, dce2 turns # .MEM_21 = PHI .MEM_20(5), .MEM_4(D)(2) into # .MEM_21 = PHI .MEM_21(5), .MEM_4(D)(2) because all writes in the loop have been dead code eliminated. But only the phicprop2 pass much later is able to optimize this out (by changing all .MEM_21 vuses into .MEM_4(D) vuses and removing the virtual phi stmt). In between those passes is if-conversion though, and that just gives up when it sees it. I think the test only wants to detect conditional stores, so the above useless virtual phis don't really pose a problem to it. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? Ok. Thanks, Richard. 2015-05-29 Jakub Jelinek ja...@redhat.com PR tree-optimization/66142 * tree-if-conv.c (if_convertible_phi_p): Don't give up on virtual phis that feed themselves. * gcc.dg/vect/pr66142.c: New test. --- gcc/tree-if-conv.c.jj 2015-05-21 21:16:18.0 +0200 +++ gcc/tree-if-conv.c2015-05-29 11:24:06.726448462 +0200 @@ -594,7 +594,8 @@ if_convertible_phi_p (struct loop *loop, FOR_EACH_IMM_USE_FAST (use_p, imm_iter, gimple_phi_result (phi)) { - if (gimple_code (USE_STMT (use_p)) == GIMPLE_PHI) + if (gimple_code (USE_STMT (use_p)) == GIMPLE_PHI +USE_STMT (use_p) != (gimple) phi) { if (dump_file (dump_flags TDF_DETAILS)) fprintf (dump_file, Difficult to handle this virtual phi.\n); --- gcc/testsuite/gcc.dg/vect/pr66142.c.jj2015-05-29 11:31:21.563628051 +0200 +++ gcc/testsuite/gcc.dg/vect/pr66142.c 2015-05-29 11:31:00.0 +0200 @@ -0,0 +1,44 @@ +/* PR middle-end/66142 */ +/* { dg-do compile } */ +/* { dg-additional-options -ffast-math -fopenmp-simd } */ +/* { dg-additional-options -mavx { target avx_runtime } } */ + +struct A { float x, y; }; +struct B { struct A t, w; }; + +static inline float +bar (const struct B *x) +{ + struct A r; + float b, c, d; + r.x = x-t.x; + r.y = x-t.y; + b = r.x * x-w.x + r.y * x-w.y; + c = b + r.x * r.x + r.y * r.y; + if (c 0.0f) +return c + 3.0f; + return 0.0f; +} + +void +foo (float *a, float *b, float *c) +{ + int i; + float z = 0.0f; + float u = *a; +#pragma omp simd + for (i = 0; i 32; i++) +{ + float x = b[i]; + float y = c[i]; + struct B r; + r.t.x = 1.0f; + r.t.y = u; + r.w.x = x; + r.w.y = y; + z += bar (r); +} + *a = z; +} + +/* { dg-final { scan-tree-dump-times vectorized 1 loops in function 1 vect { target vect_condition } } } */ Jakub -- Richard Biener rguent...@suse.de SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nuernberg)
Re: [PATCH] PR 66215: S390: Fix placement of post-label NOPs with -mhotpatch
On Fri, May 29, 2015 at 11:57:00AM +0100, Dominik Vogt wrote: 2015-05-29 Dominik Vogt v...@linux.vnet.ibm.com PR target0/66215 Please remove the 0 above. * gcc.target/s390/hotpatch-1.c: Improve to detect multi-line patterns. * gcc.target/s390/hotpatch-2.c: Likewise. * gcc.target/s390/hotpatch-3.c: Likewise. * gcc.target/s390/hotpatch-4.c: Likewise. * gcc.target/s390/hotpatch-5.c: Likewise. * gcc.target/s390/hotpatch-6.c: Likewise. * gcc.target/s390/hotpatch-7.c: Likewise. * gcc.target/s390/hotpatch-8.c: Likewise. * gcc.target/s390/hotpatch-9.c: Likewise. * gcc.target/s390/hotpatch-14.c: Likewise. * gcc.target/s390/hotpatch-15.c: Likewise. * gcc.target/s390/hotpatch-16.c: Likewise. * gcc.target/s390/hotpatch-19.c:Likewise. * gcc.target/s390/hotpatch-25.c:Likewise. Missing spaces after : . Furthermore, it is very unusual to list the same file more than once in the ChangeLog of the same patch. And the descriptions really don't match the changes in the tests (e.g. hotpatch-1.c only has the -O* removal, and -13 has also a dg-final line removal, ditto -25). From what I can see, some tests are new, those are ok in the ChangeLog as is (except that hotpatch-28.c is missing), in other tests you've removed optimization options from dg-options, and in some tests tweaked scan-assembler regexps, and in others removed some dg-final directives. So IMHO you want: * gcc.target/s390/hotpatch-1.c: Remove optimization options from dg-options. * gcc.target/s390/hotpatch-10.c: Likewise. * gcc.target/s390/hotpatch-11.c: Likewise. * gcc.target/s390/hotpatch-12.c: Likewise. * gcc.target/s390/hotpatch-17.c: Likewise. * gcc.target/s390/hotpatch-18.c: Likewise. * gcc.target/s390/hotpatch-20.c: Likewise. * gcc.target/s390/hotpatch-21.c: Likewise. * gcc.target/s390/hotpatch-22.c: Likewise. * gcc.target/s390/hotpatch-23.c: Likewise. * gcc.target/s390/hotpatch-24.c: Likewise. * gcc.target/s390/hotpatch-2.c: Likewise. Adjust scan-assembler to check for the exact nops too. * gcc.target/s390/hotpatch-3.c: Likewise. * gcc.target/s390/hotpatch-4.c: Likewise. * gcc.target/s390/hotpatch-5.c: Likewise. * gcc.target/s390/hotpatch-6.c: Likewise. * gcc.target/s390/hotpatch-7.c: Likewise. * gcc.target/s390/hotpatch-8.c: Likewise. * gcc.target/s390/hotpatch-9.c: Likewise. * gcc.target/s390/hotpatch-14.c: Likewise. * gcc.target/s390/hotpatch-15.c: Likewise. * gcc.target/s390/hotpatch-16.c: Likewise. * gcc.target/s390/hotpatch-19.c: Likewise. * gcc.target/s390/hotpatch-25.c: Likewise. Remove scan-assembler-times counting number of .align directives. * gcc.target/s390/hotpatch-13.c: Remove optimization options from dg-options. Remove scan-assembler-times counting number of .align directives. * gcc.target/s390/hotpatch-26.c: New file. * gcc.target/s390/hotpatch-27.c: New file. * gcc.target/s390/hotpatch-28.c: New file. * gcc.target/s390/s390.exp: Run hotpatch-*.c tests as torture tests using -Os -O0 -O1 -O2 -O3 options. + /* Emit NOPs + * 1. inside the area covered by debug information to allow setting + * breakpoints at the NOPs, + * 2. before any insn which results in an asm instruction, + * 3. before in-function labels to avoid jumping to the NOPs, for + * example as part of a loop, + * 4. before any barrier in case the function is completely empty + * (gcc_unreachable ()) and has neither internal labels nor active + * insns. */ I believe the the above comment isn't formatted like comments in GCC usually are, can you please replace the *s at the beginning of lines (after whitespace) with spaces? Also, please use __builtin_unreachable () instead of gcc_unreachable (). No need to retest the patch for ChangeLog and comment only changes. And I'll defer the final ack to s390 maintainers. Jakub
[PATCH] Tiny if-conv improvement (PR tree-optimization/66142)
Hi! On the following testcase from the PR, dce2 turns # .MEM_21 = PHI .MEM_20(5), .MEM_4(D)(2) into # .MEM_21 = PHI .MEM_21(5), .MEM_4(D)(2) because all writes in the loop have been dead code eliminated. But only the phicprop2 pass much later is able to optimize this out (by changing all .MEM_21 vuses into .MEM_4(D) vuses and removing the virtual phi stmt). In between those passes is if-conversion though, and that just gives up when it sees it. I think the test only wants to detect conditional stores, so the above useless virtual phis don't really pose a problem to it. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2015-05-29 Jakub Jelinek ja...@redhat.com PR tree-optimization/66142 * tree-if-conv.c (if_convertible_phi_p): Don't give up on virtual phis that feed themselves. * gcc.dg/vect/pr66142.c: New test. --- gcc/tree-if-conv.c.jj 2015-05-21 21:16:18.0 +0200 +++ gcc/tree-if-conv.c 2015-05-29 11:24:06.726448462 +0200 @@ -594,7 +594,8 @@ if_convertible_phi_p (struct loop *loop, FOR_EACH_IMM_USE_FAST (use_p, imm_iter, gimple_phi_result (phi)) { - if (gimple_code (USE_STMT (use_p)) == GIMPLE_PHI) + if (gimple_code (USE_STMT (use_p)) == GIMPLE_PHI + USE_STMT (use_p) != (gimple) phi) { if (dump_file (dump_flags TDF_DETAILS)) fprintf (dump_file, Difficult to handle this virtual phi.\n); --- gcc/testsuite/gcc.dg/vect/pr66142.c.jj 2015-05-29 11:31:21.563628051 +0200 +++ gcc/testsuite/gcc.dg/vect/pr66142.c 2015-05-29 11:31:00.0 +0200 @@ -0,0 +1,44 @@ +/* PR middle-end/66142 */ +/* { dg-do compile } */ +/* { dg-additional-options -ffast-math -fopenmp-simd } */ +/* { dg-additional-options -mavx { target avx_runtime } } */ + +struct A { float x, y; }; +struct B { struct A t, w; }; + +static inline float +bar (const struct B *x) +{ + struct A r; + float b, c, d; + r.x = x-t.x; + r.y = x-t.y; + b = r.x * x-w.x + r.y * x-w.y; + c = b + r.x * r.x + r.y * r.y; + if (c 0.0f) +return c + 3.0f; + return 0.0f; +} + +void +foo (float *a, float *b, float *c) +{ + int i; + float z = 0.0f; + float u = *a; +#pragma omp simd + for (i = 0; i 32; i++) +{ + float x = b[i]; + float y = c[i]; + struct B r; + r.t.x = 1.0f; + r.t.y = u; + r.w.x = x; + r.w.y = y; + z += bar (r); +} + *a = z; +} + +/* { dg-final { scan-tree-dump-times vectorized 1 loops in function 1 vect { target vect_condition } } } */ Jakub
Re: [patch] fix bootstrap on FreeBSD i386/arm
Only Solaris 10, actually: Solaris 11 isn't affected since it has clearenv(3C). That's not the only problem AFAICS: /usr/include/sys/resource.h: At global scope: /usr/include/sys/resource.h:79:25: error: declaration does not declare anything [-fpermissive] /homes/botcazou/gcc-head/src/gcc/system.h:469:48: error: 'char* strstr(const char*, const char*)' conflicts with previous using declaration 'const char* std::strstr(const char*, const char*)' and so on. It's SPARC/Solaris 10. OTOH, why use sun in this place instead of __sun__ (or rather __sun__ __svr4__) like any other platform? Yes, I can change that, but it's probably not the only case. -- Eric Botcazou
Commit: MSP430: Add multilibs for different types of hardware multiply
Hi Guys, I am applying the patch below to the MSP430 backend to add new multilibs based upon the type of hardware multiply support used. Cheers Nick gcc/ChangeLog 2015-05-29 Nick Clifton ni...@redhat.com * config/msp430/t-msp430 (MULTILIB_OPTIONS): Add multilibs for the different types of hardware multiply available on the MSP430. (MULTILIB_DIRNAMES): Likewise. (MULTILIB_EXCEPTIONS): Add exceptions for incompatible cpus and hardware multiply types. (MULTILIB_MATCHES): Add matches for known MCU names and hardware multiply types. Index: gcc/config/msp430/t-msp430 === RCS file: /cvs/cvsfiles/gnupro/gcc/config/msp430/t-msp430,v retrieving revision 1.2 diff -u -3 -p -r1.2 t-msp430 --- gcc/config/msp430/t-msp430 10 Mar 2014 09:18:19 - 1.2 +++ gcc/config/msp430/t-msp430 29 May 2015 08:38:50 - @@ -251,6 +251,392 @@ MULTILIB_MATCHES += mcpu?msp430=mmcu?msp MULTILIB_EXCEPTIONS = mcpu=msp430/mlarge + +# Multilibs for different types of hardware multiply support: + +MULTILIB_OPTIONS += mhwmult=none/mhwmult=32bit/mhwmult=f5series +MULTILIB_DIRNAMES +=nomul/32mul/f5mul + +MULTILIB_EXCEPTIONS += mcpu=msp430/mlarge/mhwmult=none +MULTILIB_EXCEPTIONS += mcpu=msp430/mlarge/mhwmult=32bit +MULTILIB_EXCEPTIONS += mcpu=msp430/mlarge/mhwmult=f5series +MULTILIB_EXCEPTIONS += mcpu=msp430/mhwmult=f5series + +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c091 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c091 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c092 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c111 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c112 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c1121 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c1331 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c1351 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c311s +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c312 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c313 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c314 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c315 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c323 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c325 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c412 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430c413 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430e112 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430e313 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430e315 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430e325 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f110 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f1101 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f1101a +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430fa +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f112 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f1121 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f1121a +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f1122 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f1132 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f122 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f1222 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f123 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f1232 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f133 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f135 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f155 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f156 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f157 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2001 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2002 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2003 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2011 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2012 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2013 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2101 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2111 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2112 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2121 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2122 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2131 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2132 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2232 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2234 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2252 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2254 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2272 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f2274 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f412 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f413 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f4132 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f415 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f4152 +MULTILIB_MATCHES += mhwmult?none=mmcu?msp430f417 +MULTILIB_MATCHES +=
Re: arm memcpy of aligned data
On 29/05/15 10:08, Kyrill Tkachov wrote: Hi Mike, On 28/05/15 22:15, Mike Stump wrote: So, the arm memcpy code of aligned data isn’t as good as it can be. void *memcpy(void *dest, const void *src, unsigned int n); void foo(char *dst, int i) { memcpy (dst, i, sizeof (i)); } generates horrible code, but, it we are willing to notice the src or the destination are aligned, we can do much better: $ ./cc1 -fschedule-fusion -fdump-tree-all-all -da -march=armv7ve -mcpu=cortex-m4 -fomit-frame-pointer -quiet -O2 /tmp/t.c -o t.s $ cat t.s [ … ] foo: @ args = 0, pretend = 0, frame = 4 @ frame_needed = 0, uses_anonymous_args = 0 @ link register save eliminated. sub sp, sp, #4 str r1, [r0]@ unaligned add sp, sp, #4 I think there's something to do with cpu tuning here as well. That being said, I do think this is a good idea. I'll give it a test. Kyrill For the code you've given compiled with -O2 -mcpu=cortex-a53 I get: sub sp, sp, #8 mov r2, r0 add r3, sp, #8 str r1, [r3, #-4]! ldr r0, [r3]@ unaligned str r0, [r2]@ unaligned add sp, sp, #8 @ sp needed bx lr whereas for -O2 -mcpu=cortex-a57 I get the much better: sub sp, sp, #8 str r1, [r0]@ unaligned add sp, sp, #8 @ sp needed bx lr Kyrill Index: gcc/config/arm/arm.c === --- gcc/config/arm/arm.c(revision 223842) +++ gcc/config/arm/arm.c(working copy) @@ -14376,7 +14376,10 @@ arm_block_move_unaligned_straight (rtx d srcoffset + j * UNITS_PER_WORD - src_autoinc); mem = adjust_automodify_address (srcbase, SImode, addr, srcoffset + j * UNITS_PER_WORD); - emit_insn (gen_unaligned_loadsi (regs[j], mem)); + if (src_aligned) + emit_move_insn (regs[j], mem); + else + emit_insn (gen_unaligned_loadsi (regs[j], mem)); } srcoffset += words * UNITS_PER_WORD; } @@ -14395,7 +14398,10 @@ arm_block_move_unaligned_straight (rtx d dstoffset + j * UNITS_PER_WORD - dst_autoinc); mem = adjust_automodify_address (dstbase, SImode, addr, dstoffset + j * UNITS_PER_WORD); - emit_insn (gen_unaligned_storesi (mem, regs[j])); + if (dst_aligned) + emit_move_insn (mem, regs[j]); + else + emit_insn (gen_unaligned_storesi (mem, regs[j])); } dstoffset += words * UNITS_PER_WORD; } Ok? Can someone spin this through an arm test suite run for me, I was doing this by inspection and cross compile on a system with no arm bits. Bonus points if you can check it in with the test case above marked up as appropriate.
Re: [PATCH] Don't instrument DECL_INITIAL of statics (PR sanitizer/66190)
On Fri, May 29, 2015 at 10:41:34AM +0200, Marek Polacek wrote: Ping. On Thu, May 21, 2015 at 09:36:59PM +0200, Marek Polacek wrote: In this PR, we find ourselves instrumenting a static initializer and then crashing when expanding an unlowered UBSAN_NULL. Jakub suggests to not instrument DECL_INITIAL of a static variable. The following patch is an attempt to do that. Note that we're still able to sanitize similar cases (they don't have DECL_INITIAL but something else). Bootstrap/regtest/bootstrap-ubsan passed on x86_64-linux, ok for trunk? 2015-05-21 Marek Polacek pola...@redhat.com PR sanitizer/66190 * cp-gimplify.c (struct cp_genericize_data): Add no_sanitize_p. (cp_genericize_r): Don't instrument static initializers. (cp_genericize_tree): Initialize wtd.no_sanitize_p. This seems strange. Normally DECL_INITIAL of vars isn't walked when processing DECL_EXPRs, so IMHO you shouldn't either. I think it would be much better to handle this case where the tree.c code handles it, thus in cp_genericize_r's BIND_EXPR handling. Just do there something along the lines: if (flag_sanitize (SANITIZE_NULL | SANITIZE_ALIGNMENT | SANITIZE_VPTR)) { bool no_sanitize_p = wtd-no_sanitize_p; wtd-no_sanitize_p = true; for (tree decl = BIND_EXPR_VARS (*tp); decl; decl = DECL_CHAIN (decl)) if (VAR_P (decl) TREE_STATIC (decl) DECL_INITIAL (decl)) cp_walk_tree (DECL_INITIAL (decl), cp_genericize_r, data, NULL); wtd-no_sanitize_p = no_sanitize_p; } with some appripriate comments. As cp_genericize_r gives up early for expressions it has walked already, this should DTRT then. Jakub
Re: [patch] fix bootstrap on FreeBSD i386/arm
Eric Botcazou ebotca...@adacore.com writes: Only Solaris 10, actually: Solaris 11 isn't affected since it has clearenv(3C). That's not the only problem AFAICS: /usr/include/sys/resource.h: At global scope: /usr/include/sys/resource.h:79:25: error: declaration does not declare anything [-fpermissive] I didn't see this: my sys/resource.h has typedef u_longlong_trlim_t; on line 79. /homes/botcazou/gcc-head/src/gcc/system.h:469:48: error: 'char* strstr(const char*, const char*)' conflicts with previous using declaration 'const char* std::strstr(const char*, const char*)' and so on. It's SPARC/Solaris 10. Not during a Solaris 10/x86 bootstrap: iso/string_iso.h has extern const char *strstr(const char *, const char *); #if __cplusplus = 199711L. Maybe this changed sometime after S10 FCS. OTOH, why use sun in this place instead of __sun__ (or rather __sun__ __svr4__) like any other platform? Yes, I can change that, but it's probably not the only case. Possibly not. Still, it would be good to be consistent here. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Re: debug mode maintenance patch
On 28/05/15 22:32 +0200, François Dumont wrote: Sorry, I saw it used so many times for macros that I though it was the right way to report macro modifications. The changelog style is fairly complicated :-) I also replicate Copyrights from debug.h to assertions.h. * include/debug/debug.h (_GLIBCXX_DEBUG_ASSERT, _GLIBCXX_DEBUG_PEDASSERT, _GLIBCXX_DEBUG_ONLY): Move definition... * include/debug/assertions.h: ...here, new. * include/debug/formatter.h (struct _Error_formatter::_Is_iterator_value_type): New. (struct _Error_formatter::_Is_instance): New. (struct _Error_formatter::_Parameter): Make public and not friend anymore. (_Error_formatter::_Parameter::__instance): New _M_kind enum entry. (_Error_formatter::_Parameter::__iterator_value_type): New _M_kind enum entry. (struct _Error_formatter::_Parameter::_Type): New. (struct _Error_formatter::_Parameter::_Instance): New, inherit from latter. (union _Error_formatter::_Parameter::_M_variant): Reorganize. I don't think we need to say 'struct' or 'union' either, because we're not writing C, and they aren't needed in C++, but no big deal. Ok to commit ? Yes, looks good, thanks.
Re: [patch 10/10] debug-early merge: compiler proper
On Thu, May 28, 2015 at 10:35 PM, Jason Merrill ja...@redhat.com wrote: On 05/28/2015 02:53 PM, Aldy Hernandez wrote: On 05/27/2015 08:39 AM, Jason Merrill wrote: On 05/20/2015 11:50 AM, Aldy Hernandez wrote: + /* Fill in the size of variable-length fields in late dwarf. */ + if (TREE_ASM_WRITTEN (type) + !early_dwarf_dumping) +{ + tree member; + for (member = TYPE_FIELDS (type); member; member = DECL_CHAIN (member)) +fill_variable_array_bounds (TREE_TYPE (member)); + return; +} Why is this happening in late dwarf? I'm concerned that front-end information that is necessary to do this might be lost by that point. I thought only after the optimizations had run their course would we be guaranteed to have accurate bound information. At least, that's what my experience showed. Hmm, I'm don't know why optimizations would change the representation of the array type. Correct. It works fine with the LTO prototype I did apart from gdb not really getting the association between the early DIEs 0166: Abbrev Number: 1 (DW_TAG_compile_unit) ... 11e5: Abbrev Number: 6 (DW_TAG_subprogram) ... 21fc: Abbrev Number: 8 (DW_TAG_variable) 1fd DW_AT_type: 0x1d7 201 DW_AT_artificial : 1 201 DW_AT_declaration : 1 2201: Abbrev Number: 3 (DW_TAG_variable) 202 DW_AT_name: a 204 DW_AT_decl_file : 1 205 DW_AT_decl_line : 15 206 DW_AT_type: 0x20b 220a: Abbrev Number: 0 120b: Abbrev Number: 9 (DW_TAG_array_type) 20c DW_AT_type: 0x21e 210 DW_AT_sibling : 0x21e 2214: Abbrev Number: 10 (DW_TAG_subrange_type) 215 DW_AT_type: 0x1d7 219 DW_AT_upper_bound : 0x1fc and the late DIEs annotating the above 024c: Abbrev Number: 1 (DW_TAG_compile_unit) ... 130c: Abbrev Number: 3 (DW_TAG_subprogram) 30d DW_AT_abstract_origin: 0x1e5 ... 232e: Abbrev Number: 4 (DW_TAG_variable) 32f DW_AT_abstract_origin: 0x1fc 333 DW_AT_location: 11 byte block: 75 1 8 20 24 8 20 26 31 1c 9f(DW_OP_breg5 (rdi): 1; DW_OP_const1u: 32; DW_OP_shl; DW_OP_const1u: 32; DW_OP_shra; DW_OP_lit1; DW_OP_minus; DW_OP_stack_value) 233f: Abbrev Number: 11 (DW_TAG_variable) 340 DW_AT_abstract_origin: 0x201 2344: Abbrev Number: 0 1345: Abbrev Number: 12 (DW_TAG_subprogram) so it fails to jump through hoops when looking up the type of 'a' seeing the annotation to the variable used in the array types upper bound... (probably expected, I'd probably need to pull down the type, and the subrange-type as well, even though I do not annotate them). Or we can teach gdb to jump through the hoops (basically collect all additional info that a subprogram DIE children provide to the subprogram abstract origin children DIEs somewhen in advance...) It would be a shame if I really had to create empty references to all the dependence chain formed via types from the array variable to the array subrange type upper bound. Richard. + /* Variable-length types may be incomplete even if + TREE_ASM_WRITTEN. For such types, fall through to + gen_array_type_die() and possibly fill in + DW_AT_{upper,lower}_bound attributes. */ + if ((TREE_CODE (type) != ARRAY_TYPE +TREE_CODE (type) != RECORD_TYPE +TREE_CODE (type) != UNION_TYPE +TREE_CODE (type) != QUAL_UNION_TYPE) + || (TYPE_SIZE (type) + TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)) Similarly, why check for INTEGER_CST here? The INTEGER_CST check was supposed to mean we have bound information already, no need to look further. I guess we could have a variable length bound that does not decay to a constant. Right. I would expect that to usually be the case with VLAs. Perhaps I could check the presence of a cached DIE with a type DIE containing a DW_TAG_subrange_type *and* DW_AT_{lower,upper}_bound ??. Basically I just want to add bound information, if available and not already present. Suggestions? I'm still not sure why we can't just emit bound info in early dwarf. Can you be more specific about the optimization thing? Jason
Re: [patch] fix bootstrap on FreeBSD i386/arm
Eric Botcazou ebotca...@adacore.com writes: This patch restores bootstrap on i386-*-freebsd*. The build was failing after the introduction of -std=c++98 configure/build flag. The -std=c++98 enables strict_ansi and on FreeBSD the libc function atoll is not defined for this. Solaris (x86 and SPARC) is also broken in various ways: for example, the sun preprocessor macro is no more defined. Why do we need strict ANSI exactly? Only Solaris 10, actually: Solaris 11 isn't affected since it has clearenv(3C). OTOH, why use sun in this place instead of __sun__ (or rather __sun__ __svr4__) like any other platform? Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
[PATCH] Fix PR66314
This fixes jump threading which fails to update the loop ownership of duplicated blocks (and was probably just lucky that loops were fixed up usually). The blocks of the jump thread path always belong to the loop of the final threading destination. Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Richard. 2015-05-29 Richard Biener rguent...@suse.de PR tree-optimization/66314 * tree-ssa-threadupdate.c (create_block_for_threading): Add parameter that says which loop the new block belongs to. (ssa_create_duplicates): Blocks duplicated for the threaded path belong to the loop of the thread destination. * gcc.dg/asan/pr66314.c: New testcase. Index: gcc/tree-ssa-threadupdate.c === *** gcc/tree-ssa-threadupdate.c (revision 223818) --- gcc/tree-ssa-threadupdate.c (working copy) *** remove_ctrl_stmt_and_useless_edges (basi *** 312,324 } /* Create a duplicate of BB. Record the duplicate block in an array !indexed by COUNT stored in RD. */ static void create_block_for_threading (basic_block bb, struct redirection_data *rd, unsigned int count, ! bitmap *duplicate_blocks) { edge_iterator ei; edge e; --- 312,326 } /* Create a duplicate of BB. Record the duplicate block in an array !indexed by COUNT stored in RD. LOOP is the loop the block should !belong to, if not NULL, in which case it will belong to the same !loop as BB. */ static void create_block_for_threading (basic_block bb, struct redirection_data *rd, unsigned int count, ! bitmap *duplicate_blocks, loop_p loop) { edge_iterator ei; edge e; *** create_block_for_threading (basic_block *** 326,331 --- 328,338 /* We can use the generic block duplication code and simply remove the stuff we do not need. */ rd-dup_blocks[count] = duplicate_block (bb, NULL, NULL); + if (loop rd-dup_blocks[count]-loop_father != loop) + { + remove_bb_from_loops (rd-dup_blocks[count]); + add_bb_to_loop (rd-dup_blocks[count], loop); + } FOR_EACH_EDGE (e, ei, rd-dup_blocks[count]-succs) e-aux = NULL; *** ssa_create_duplicates (struct redirectio *** 1303,1308 --- 1310,1319 ssa_local_info_t *local_info) { struct redirection_data *rd = *slot; + vecjump_thread_edge * *path = rd-path; + + /* Check to which loop the threading destination belongs to. */ + loop_p dest_loop = (*path).last ()-e-dest-loop_father; /* The second duplicated block in a jump threading path is specific to the path. So it gets stored in RD rather than in LOCAL_DATA. *** ssa_create_duplicates (struct redirectio *** 1313,1326 Note the search starts with the third edge on the path. The first edge is the incoming edge, the second edge always has its source duplicated. Thus we start our search with the third edge. */ - vecjump_thread_edge * *path = rd-path; for (unsigned int i = 2; i path-length (); i++) { if ((*path)[i]-type == EDGE_COPY_SRC_BLOCK || (*path)[i]-type == EDGE_COPY_SRC_JOINER_BLOCK) { create_block_for_threading ((*path)[i]-e-src, rd, 1, ! local_info-duplicate_blocks); break; } } --- 1324,1336 Note the search starts with the third edge on the path. The first edge is the incoming edge, the second edge always has its source duplicated. Thus we start our search with the third edge. */ for (unsigned int i = 2; i path-length (); i++) { if ((*path)[i]-type == EDGE_COPY_SRC_BLOCK || (*path)[i]-type == EDGE_COPY_SRC_JOINER_BLOCK) { create_block_for_threading ((*path)[i]-e-src, rd, 1, ! local_info-duplicate_blocks, dest_loop); break; } } *** ssa_create_duplicates (struct redirectio *** 1330,1336 if (local_info-template_block == NULL) { create_block_for_threading ((*path)[1]-e-src, rd, 0, ! local_info-duplicate_blocks); local_info-template_block = rd-dup_blocks[0]; /* We do not create any outgoing edges for the template. We will --- 1340,1346 if (local_info-template_block == NULL) { create_block_for_threading ((*path)[1]-e-src, rd, 0, ! local_info-duplicate_blocks, dest_loop); local_info-template_block = rd-dup_blocks[0]; /* We do not create any outgoing edges for the template. We will *** ssa_create_duplicates (struct redirectio *** 1340,1346
Re: [PATCH][ARM/AArch64 Testsuite] Cleanup advsimd-intrinsics.exp, removing unnecessary loop
Christophe Lyon wrote: This looks OK, but why can't you also drop the other torture-related lines as you did in your previous patch? I mean: load_lib c-torture.exp load_lib torture-options.exp etc... We need c-torture.exp in order to set-torture-options; we need to set-torture-options to get the right list of variants, as otherwise we lose -Og -g (as I did in my original patch 13/14 for float16). However, I think we can drop the rest - here's v2, which I've cross-tested on aarch64-none-elf, aarch64_be-none-elf and arm-none-eabi: diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/advsimd-intrins index 583832a..4679a73 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp @@ -27,8 +27,6 @@ load_lib gcc-dg.exp # Initialize `dg'. load_lib c-torture.exp -load_lib target-supports.exp -load_lib torture-options.exp dg-init @@ -48,29 +46,15 @@ if {[istarget arm*-*-*]} then { } } -torture-init set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS # Make sure Neon flags are provided, if necessary. set additional_flags [add_options_for_arm_neon ] # Main loop. -foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { -# If we're only testing specific files and this isn't one of them, skip it. -if ![runtest_file_p $runtests $src] then { - continue -} - -# runtest_file_p is already run above, and the code below can run -# runtest_file_p again, make sure everything for this test is -# performed if the above runtest_file_p decided this runtest -# instance should execute the test -gcc_parallel_test_enable 0 -gcc-dg-runtest $src $additional_flags -gcc_parallel_test_enable 1 -} +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] \ + ${additional_flags} # All done. set dg-do-what-default ${save-dg-do-what-default}
[PATCH] PR 66215: S390: Fix placement of post-label NOPs with -mhotpatch
The attached patch fixes the problem reported in PR 66215. Patches for gcc-4.8, 4.9 and 5.1 will follow. Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany gcc/ChangeLog 2015-05-29 Dominik Vogt v...@linux.vnet.ibm.com PR target/66215 * config/s390/s390.c (s390_reorg): Fix placement of post-label NOPs with -mhotpatch=. gcc/testsuite/ChangeLog 2015-05-29 Dominik Vogt v...@linux.vnet.ibm.com PR target0/66215 * gcc.target/s390/hotpatch-1.c: Improve to detect multi-line patterns. * gcc.target/s390/hotpatch-2.c: Likewise. * gcc.target/s390/hotpatch-3.c: Likewise. * gcc.target/s390/hotpatch-4.c: Likewise. * gcc.target/s390/hotpatch-5.c: Likewise. * gcc.target/s390/hotpatch-6.c: Likewise. * gcc.target/s390/hotpatch-7.c: Likewise. * gcc.target/s390/hotpatch-8.c: Likewise. * gcc.target/s390/hotpatch-9.c: Likewise. * gcc.target/s390/hotpatch-14.c: Likewise. * gcc.target/s390/hotpatch-15.c: Likewise. * gcc.target/s390/hotpatch-16.c: Likewise. * gcc.target/s390/hotpatch-19.c:Likewise. * gcc.target/s390/hotpatch-25.c:Likewise. * gcc.target/s390/hotpatch-26.c: New file. * gcc.target/s390/hotpatch-27.c: New file. * gcc.target/s390/s390.exp: Enable torture test. * gcc.target/s390/hotpatch-1.c: Likewise. * gcc.target/s390/hotpatch-2.c: Likewise. * gcc.target/s390/hotpatch-3.c: Likewise. * gcc.target/s390/hotpatch-4.c: Likewise. * gcc.target/s390/hotpatch-5.c: Likewise. * gcc.target/s390/hotpatch-6.c: Likewise. * gcc.target/s390/hotpatch-7.c: Likewise. * gcc.target/s390/hotpatch-8.c: Likewise. * gcc.target/s390/hotpatch-9.c: Likewise. * gcc.target/s390/hotpatch-10.c: Likewise. * gcc.target/s390/hotpatch-11.c: Likewise. * gcc.target/s390/hotpatch-12.c: Likewise. * gcc.target/s390/hotpatch-13.c: Likewise. * gcc.target/s390/hotpatch-14.c: Likewise. * gcc.target/s390/hotpatch-15.c: Likewise. * gcc.target/s390/hotpatch-16.c: Likewise. * gcc.target/s390/hotpatch-17.c: Likewise. * gcc.target/s390/hotpatch-18.c: Likewise. * gcc.target/s390/hotpatch-19.c: Likewise. * gcc.target/s390/hotpatch-20.c: Likewise. * gcc.target/s390/hotpatch-21.c: Likewise. * gcc.target/s390/hotpatch-22.c: Likewise. * gcc.target/s390/hotpatch-23.c: Likewise. * gcc.target/s390/hotpatch-24.c: Likewise. * gcc.target/s390/hotpatch-25.c: Likewise. From c4fc2eb77035ff4f8cd78f48fa8f7b2731c19ade Mon Sep 17 00:00:00 2001 From: Dominik Vogt v...@linux.vnet.ibm.com Date: Fri, 22 May 2015 09:03:26 +0100 Subject: [PATCH] PR 66215: S390: Fix placement of post-label NOPs with -mhotpatch=. --- gcc/config/s390/s390.c | 27 --- gcc/testsuite/gcc.target/s390/hotpatch-1.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-10.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-11.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-12.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-13.c | 3 +-- gcc/testsuite/gcc.target/s390/hotpatch-14.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-15.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-16.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-17.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-18.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-19.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-2.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-20.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-21.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-22.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-23.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-24.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-25.c | 9 - gcc/testsuite/gcc.target/s390/hotpatch-26.c | 17 + gcc/testsuite/gcc.target/s390/hotpatch-27.c | 17 + gcc/testsuite/gcc.target/s390/hotpatch-28.c | 18 ++ gcc/testsuite/gcc.target/s390/hotpatch-3.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-4.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-5.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-6.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-7.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-8.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-9.c | 4 ++-- gcc/testsuite/gcc.target/s390/s390.exp | 13 +++-- 30 files changed, 119 insertions(+), 55 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-26.c create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-27.c create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-28.c diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 6648597..bab9460 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -12843,31 +12843,36 @@ s390_reorg (void)
[PATCH] Fix PR66280
In addition to the required backport of PR66251 (testing right now) we need to fix hybrid stmt detection for trunk and for a related testcase also on the branch. Bootstrap and regtest running on x86_64-unknown-linux-gnu. Richard. 2015-05-29 Richard Biener rguent...@suse.de PR tree-optimization/66280 * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Fix pattern def-use walking. * g++.dg/torture/pr66280.C: New testcase. * g++.dg/torture/pr66280-2.C: Likewise. Index: gcc/tree-vect-slp.c === *** gcc/tree-vect-slp.c (revision 223860) --- gcc/tree-vect-slp.c (working copy) *** vect_detect_hybrid_slp_stmts (slp_tree n *** 2031,2036 --- 2031,2041 { /* Check if a pure SLP stmt has uses in non-SLP stmts. */ gcc_checking_assert (PURE_SLP_STMT (stmt_vinfo)); + /* We always get the pattern stmt here, but for immediate +uses we have to use the LHS of the original stmt. */ + gcc_checking_assert (!STMT_VINFO_IN_PATTERN_P (stmt_vinfo)); + if (STMT_VINFO_RELATED_STMT (stmt_vinfo)) + stmt = STMT_VINFO_RELATED_STMT (stmt_vinfo); if (TREE_CODE (gimple_op (stmt, 0)) == SSA_NAME) FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, gimple_op (stmt, 0)) if (gimple_bb (use_stmt) Index: gcc/testsuite/g++.dg/torture/pr66280.C === *** gcc/testsuite/g++.dg/torture/pr66280.C (revision 0) --- gcc/testsuite/g++.dg/torture/pr66280.C (working copy) *** *** 0 --- 1,25 + // { dg-do compile } + + typedef struct + { + short re; + short im; + } cint16_T; + typedef struct + { + int re; + int im; + } cint32_T; + int a; + short b; + cint16_T *c; + cint32_T *d, *e; + void + fn1 () + { + for (; a; a++) + { + d[a].re = d[a].im = e[a].re = c[a].re * b; + e[a].im = c[a].im * b; + } + } Index: gcc/testsuite/g++.dg/torture/pr66280-2.C === *** gcc/testsuite/g++.dg/torture/pr66280-2.C(revision 0) --- gcc/testsuite/g++.dg/torture/pr66280-2.C(working copy) *** *** 0 --- 1,25 + // { dg-do compile } + + typedef struct + { + short re; + short im; + } cint16_T; + typedef struct + { + int re; + int im; + } cint32_T; + int a; + short b; + cint16_T *c; + cint32_T *d, *e; + void + fn1 () + { + for (; a; a++) + { + d[a].re = d[a].im = e[a].im = c[a].im * b; + e[a].re = c[a].re * b; + } + }
Re: [PATCH] TLC to reassoc get_rank
On Fri, May 29, 2015 at 02:41:28PM +0200, Richard Biener wrote: @@ -525,7 +498,11 @@ get_rank (tree e) return (rank + 1); } - /* Globals, etc, are rank 0 */ + /* Constants have rank 0. */ + if (is_gimple_min_invariant (e)) +return 0; + + /* Constants, globals, etc., are rank 0 */ return 0; } This looks weird. No reason to test is_gimple_min_invariant if it returns 0 no matter whether it is true or false. Jakub
Re: [PATCH, testsuite]: Cleanup dumps
On 29/05/15 09:21, Bernhard Reutner-Fischer wrote: On 31 January 2015 at 22:10, Bernhard Reutner-Fischer rep.dot@gmail.com wrote: On January 31, 2015 9:17:57 PM GMT+01:00, Mike Stump mikest...@comcast.net wrote: On Jan 31, 2015, at 11:50 AM, Bernhard Reutner-Fischer rep.dot@gmail.com wrote: On January 31, 2015 10:53:39 AM GMT+01:00, Uros Bizjak ubiz...@gmail.com wrote: Hello! Reminds me of just auto-wiping dump files: https://gcc.gnu.org/ml/gcc-patches/2013-10/msg02506.html Mike, WDYT? Ok. My only concern of speed isn’t founded, as you stated it was faster to scan the flags. I think I’m fine with it going in now, but, if you do, you have to watch for and resolve any fallout. Watch for RM comments, I’d defer to them on timing. If you want to wait until stage 1, that’s fine too. I'd only want that to go in in stage 1. I have applied this now as r223858. Please CC me on fallout. Hi Bernhard, You asked to be CC'ed ;) Applied this as obvious with r223864 to. Kyrill 2015-05-29 Kyrylo Tkachov kyrylo.tkac...@arm.com * gcc.target/aarch64/vdup_lane_2.c: Close comment on final line. Thanks, diff --git a/gcc/testsuite/gcc.target/aarch64/vdup_lane_2.c b/gcc/testsuite/gcc.target/aarch64/vdup_lane_2.c index e87d780..a49db3e 100644 --- a/gcc/testsuite/gcc.target/aarch64/vdup_lane_2.c +++ b/gcc/testsuite/gcc.target/aarch64/vdup_lane_2.c @@ -338,5 +338,5 @@ main () /* Asm check for vdupd_lane_f64, vdupd_lane_s64, vdupd_lane_u64. */ /* Attempts to make the compiler generate vdupd are not practical. */ -/* { dg-final { scan-assembler-not dup\\td\[0-9\]+, v\[0-9\]+\.d\\\[0\\\] } } +/* { dg-final { scan-assembler-not dup\\td\[0-9\]+, v\[0-9\]+\.d\\\[0\\\] } } */
Re: [PATCH 10/35] Change use to type-based pool allocator in cfg.c.
On 05/27/2015 07:57 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * cfg.c (initialize_original_copy_tables):Use new type-based pool allocator. (free_original_copy_tables) Likewise. (copy_original_table_clear) Likewise. (copy_original_table_set) Likewise. OK. jeff v2 From 6facfc84e89ec3a887e7db342493e7656fb29dc4 Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:47 +0200 Subject: [PATCH 09/32] Change use to type-based pool allocator in cfg.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * cfg.c (initialize_original_copy_tables):Use new type-based pool allocator. (free_original_copy_tables) Likewise. (copy_original_table_clear) Likewise. (copy_original_table_set) Likewise. --- gcc/cfg.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/gcc/cfg.c b/gcc/cfg.c index cdcc01c..ddfecdc 100644 --- a/gcc/cfg.c +++ b/gcc/cfg.c @@ -1066,18 +1066,16 @@ static hash_tablebb_copy_hasher *bb_copy; /* And between loops and copies. */ static hash_tablebb_copy_hasher *loop_copy; -static alloc_pool original_copy_bb_pool; - +static pool_allocatorhtab_bb_copy_original_entry *original_copy_bb_pool; /* Initialize the data structures to maintain mapping between blocks and its copies. */ void initialize_original_copy_tables (void) { - gcc_assert (!original_copy_bb_pool); - original_copy_bb_pool -= create_alloc_pool (original_copy, - sizeof (struct htab_bb_copy_original_entry), 10); + + original_copy_bb_pool = new pool_allocatorhtab_bb_copy_original_entry +(original_copy, 10); bb_original = new hash_tablebb_copy_hasher (10); bb_copy = new hash_tablebb_copy_hasher (10); loop_copy = new hash_tablebb_copy_hasher (10); @@ -1095,7 +1093,7 @@ free_original_copy_tables (void) bb_copy = NULL; delete loop_copy; loop_copy = NULL; - free_alloc_pool (original_copy_bb_pool); + delete original_copy_bb_pool; original_copy_bb_pool = NULL; } @@ -1117,7 +1115,7 @@ copy_original_table_clear (hash_tablebb_copy_hasher *tab, unsigned obj) elt = *slot; tab-clear_slot (slot); - pool_free (original_copy_bb_pool, elt); + original_copy_bb_pool-remove (elt); } /* Sets the value associated with OBJ in table TAB to VAL. @@ -1137,8 +1135,7 @@ copy_original_table_set (hash_tablebb_copy_hasher *tab, slot = tab-find_slot (key, INSERT); if (!*slot) { - *slot = (struct htab_bb_copy_original_entry *) - pool_alloc (original_copy_bb_pool); + *slot = original_copy_bb_pool-allocate (); (*slot)-index1 = obj; } (*slot)-index2 = val; -- 2.1.4
Re: [PATCH 09/35] Change use to type-based pool allocator in c-format.c.
On 05/27/2015 07:55 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/c-family/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * c-format.c (check_format_arg):Use new type-based pool allocator. (check_format_info_main) Likewise. OK. jeff v2 From c9d58f9d3e3b16b9ed588a1009efbaf1cb4ad72e Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:47 +0200 Subject: [PATCH 08/32] Change use to type-based pool allocator in c-format.c. gcc/c-family/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * c-format.c (check_format_arg):Use new type-based pool allocator. (check_format_info_main) Likewise. --- gcc/c-family/c-format.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c index 145bbfd..a6c2500 100644 --- a/gcc/c-family/c-format.c +++ b/gcc/c-family/c-format.c @@ -191,7 +191,7 @@ handle_format_arg_attribute (tree *node, tree ARG_UNUSED (name), if (prototype_p (type)) { /* The format arg can be any string reference valid for the language and - target. We cannot be more specific in this case. */ + target. We cannot be more specific in this case. */ if (!check_format_string (type, format_num, flags, no_add_attrs, -1)) return NULL_TREE; } @@ -1031,7 +1031,8 @@ static void check_format_arg (void *, tree, unsigned HOST_WIDE_INT); static void check_format_info_main (format_check_results *, function_format_info *, const char *, int, tree, -unsigned HOST_WIDE_INT, alloc_pool); +unsigned HOST_WIDE_INT, +pool_allocatorformat_wanted_type ); static void init_dollar_format_checking (int, tree); static int maybe_read_dollar_number (const char **, int, @@ -1518,7 +1519,6 @@ check_format_arg (void *ctx, tree format_tree, const char *format_chars; tree array_size = 0; tree array_init; - alloc_pool fwt_pool; if (TREE_CODE (format_tree) == VAR_DECL) { @@ -1587,7 +1587,7 @@ check_format_arg (void *ctx, tree format_tree, { bool objc_str = (info-format_type == gcc_objc_string_format_type); /* We cannot examine this string here - but we can check that it is - a valid type. */ + a valid type. */ if (TREE_CODE (format_tree) != CONST_DECL || !((objc_str objc_string_ref_type_p (TREE_TYPE (format_tree))) || (*targetcm.string_object_ref_type_p) @@ -1605,9 +1605,9 @@ check_format_arg (void *ctx, tree format_tree, ++arg_num; } /* So, we have a valid literal string object and one or more params. - We need to use an external helper to parse the string into format - info. For Objective-C variants we provide the resource within the - objc tree, for target variants, via a hook. */ + We need to use an external helper to parse the string into format + info. For Objective-C variants we provide the resource within the + objc tree, for target variants, via a hook. */ if (objc_str) objc_check_format_arg (format_tree, params); else if (targetcm.check_string_object_format_arg) @@ -1694,11 +1694,9 @@ check_format_arg (void *ctx, tree format_tree, will decrement it if it finds there are extra arguments, but this way need not adjust it for every return. */ res-number_other++; - fwt_pool = create_alloc_pool (format_wanted_type pool, -sizeof (format_wanted_type), 10); + pool_allocator format_wanted_type fwt_pool (format_wanted_type pool, 10); check_format_info_main (res, info, format_chars, format_length, - params, arg_num, fwt_pool); - free_alloc_pool (fwt_pool); + params, arg_num, fwt_pool); } @@ -1713,7 +1711,8 @@ static void check_format_info_main (format_check_results *res, function_format_info *info, const char *format_chars, int format_length, tree params, -unsigned HOST_WIDE_INT arg_num, alloc_pool fwt_pool) + unsigned HOST_WIDE_INT arg_num, + pool_allocatorformat_wanted_type fwt_pool) { const char *orig_format_chars = format_chars; tree first_fillin_param = params; @@ -2424,8 +2423,7 @@ check_format_info_main (format_check_results *res, fci = fci-chain; if (fci) { - wanted_type_ptr = (format_wanted_type *) - pool_alloc (fwt_pool); + wanted_type_ptr = fwt_pool.allocate (); arg_num++; wanted_type = *fci-types[length_chars_val].type; wanted_type_name = fci-types[length_chars_val].name; -- 2.1.4
Re: [PATCH 23/35] Change use to type-based pool allocator in tree-ssa-pre.c.
On 05/27/2015 08:18 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * tree-ssa-pre.c (get_or_alloc_expr_for_name): Use new type-based pool allocator. (bitmap_set_new): Likewise. (get_or_alloc_expr_for_constant): Likewise. (get_or_alloc_expr_for): Likewise. (phi_translate_1): Likewise. (compute_avail): Likewise. (init_pre): Likewise. (fini_pre): Likewise. OK. Jeff v2 From 041bfe4c8ae1cc45874631b6656fb38c8e026e05 Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:52 +0200 Subject: [PATCH 22/32] Change use to type-based pool allocator in tree-ssa-pre.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * tree-ssa-pre.c (get_or_alloc_expr_for_name): Use new type-based pool allocator. (bitmap_set_new): Likewise. (get_or_alloc_expr_for_constant): Likewise. (get_or_alloc_expr_for): Likewise. (phi_translate_1): Likewise. (compute_avail): Likewise. (init_pre): Likewise. (fini_pre): Likewise. --- gcc/tree-ssa-pre.c | 32 ++-- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index d857d84..082dbaf 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -380,7 +380,7 @@ clear_expression_ids (void) expressions.release (); } -static alloc_pool pre_expr_pool; +static pool_allocatorpre_expr_d pre_expr_pool (pre_expr nodes, 30); /* Given an SSA_NAME NAME, get or create a pre_expr to represent it. */ @@ -398,7 +398,7 @@ get_or_alloc_expr_for_name (tree name) if (result_id != 0) return expression_for_id (result_id); - result = (pre_expr) pool_alloc (pre_expr_pool); + result = pre_expr_pool.allocate (); result-kind = NAME; PRE_EXPR_NAME (result) = name; alloc_expression_id (result); @@ -519,7 +519,7 @@ static unsigned int get_expr_value_id (pre_expr); /* We can add and remove elements and entries to and from sets and hash tables, so we use alloc pools for them. */ -static alloc_pool bitmap_set_pool; +static pool_allocatorbitmap_set bitmap_set_pool (Bitmap sets, 30); static bitmap_obstack grand_bitmap_obstack; /* Set of blocks with statements that have had their EH properties changed. */ @@ -635,7 +635,7 @@ add_to_value (unsigned int v, pre_expr e) static bitmap_set_t bitmap_set_new (void) { - bitmap_set_t ret = (bitmap_set_t) pool_alloc (bitmap_set_pool); + bitmap_set_t ret = bitmap_set_pool.allocate (); bitmap_initialize (ret-expressions, grand_bitmap_obstack); bitmap_initialize (ret-values, grand_bitmap_obstack); return ret; @@ -1125,7 +1125,7 @@ get_or_alloc_expr_for_constant (tree constant) if (result_id != 0) return expression_for_id (result_id); - newexpr = (pre_expr) pool_alloc (pre_expr_pool); + newexpr = pre_expr_pool.allocate (); newexpr-kind = CONSTANT; PRE_EXPR_CONSTANT (newexpr) = constant; alloc_expression_id (newexpr); @@ -1176,13 +1176,13 @@ get_or_alloc_expr_for (tree t) vn_nary_op_lookup (t, result); if (result != NULL) { - pre_expr e = (pre_expr) pool_alloc (pre_expr_pool); + pre_expr e = pre_expr_pool.allocate (); e-kind = NARY; PRE_EXPR_NARY (e) = result; result_id = lookup_expression_id (e); if (result_id != 0) { - pool_free (pre_expr_pool, e); + pre_expr_pool.remove (e); e = expression_for_id (result_id); return e; } @@ -1526,7 +1526,7 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2, if (result is_gimple_min_invariant (result)) return get_or_alloc_expr_for_constant (result); - expr = (pre_expr) pool_alloc (pre_expr_pool); + expr = pre_expr_pool.allocate (); expr-kind = NARY; expr-id = 0; if (nary) @@ -1688,7 +1688,7 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2, return NULL; } - expr = (pre_expr) pool_alloc (pre_expr_pool); + expr = pre_expr_pool.allocate (); expr-kind = REFERENCE; expr-id = 0; @@ -3795,7 +3795,7 @@ compute_avail (void) || gimple_bb (SSA_NAME_DEF_STMT (gimple_vuse (stmt))) != block) { - result = (pre_expr) pool_alloc (pre_expr_pool); + result = pre_expr_pool.allocate (); result-kind = REFERENCE; result-id = 0; PRE_EXPR_REFERENCE (result) = ref; @@ -3835,7 +3835,7 @@ compute_avail (void) vn_nary_may_trap (nary)) continue; - result = (pre_expr) pool_alloc (pre_expr_pool); + result = pre_expr_pool.allocate (); result-kind = NARY; result-id = 0; PRE_EXPR_NARY (result) = nary; @@ -3876,7 +3876,7 @@ compute_avail (void) continue; } - result = (pre_expr) pool_alloc (pre_expr_pool); + result = pre_expr_pool.allocate (); result-kind = REFERENCE; result-id = 0; PRE_EXPR_REFERENCE (result) = ref; @@ -4779,10 +4779,6 @@
Re: [PATCH 25/35] Change use to type-based pool allocator in tree-ssa-sccvn.c.
On 05/27/2015 08:13 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * tree-ssa-sccvn.c (vn_reference_insert): Use new type-based pool allocator. (vn_reference_insert_pieces): Likewise. (vn_phi_insert): Likewise. (visit_reference_op_call): Likewise. (copy_phi): Likewise. (copy_reference): Likewise. (process_scc): Likewise. (allocate_vn_table): Likewise. (free_vn_table): Likewise. OK. jeff v2 From a82fef12303a5382582e3967ab48c2a077830a90 Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:52 +0200 Subject: [PATCH 24/32] Change use to type-based pool allocator in tree-ssa-sccvn.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * tree-ssa-sccvn.c (vn_reference_insert): Use new type-based pool allocator. (vn_reference_insert_pieces): Likewise. (vn_phi_insert): Likewise. (visit_reference_op_call): Likewise. (copy_phi): Likewise. (copy_reference): Likewise. (process_scc): Likewise. (allocate_vn_table): Likewise. (free_vn_table): Likewise. --- gcc/tree-ssa-sccvn.c | 33 +++-- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 03be480..98b0cc5 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -289,8 +289,8 @@ typedef struct vn_tables_s vn_phi_table_type *phis; vn_reference_table_type *references; struct obstack nary_obstack; - alloc_pool phis_pool; - alloc_pool references_pool; + pool_allocatorvn_phi_s *phis_pool; + pool_allocatorvn_reference_s *references_pool; } *vn_tables_t; @@ -2285,7 +2285,7 @@ vn_reference_insert (tree op, tree result, tree vuse, tree vdef) vn_reference_t vr1; bool tem; - vr1 = (vn_reference_t) pool_alloc (current_info-references_pool); + vr1 = current_info-references_pool-allocate (); if (TREE_CODE (result) == SSA_NAME) vr1-value_id = VN_INFO (result)-value_id; else @@ -2330,7 +2330,7 @@ vn_reference_insert_pieces (tree vuse, alias_set_type set, tree type, vn_reference_s **slot; vn_reference_t vr1; - vr1 = (vn_reference_t) pool_alloc (current_info-references_pool); + vr1 = current_info-references_pool-allocate (); vr1-value_id = value_id; vr1-vuse = vuse ? SSA_VAL (vuse) : NULL_TREE; vr1-operands = valueize_refs (operands); @@ -2756,7 +2756,7 @@ static vn_phi_t vn_phi_insert (gimple phi, tree result) { vn_phi_s **slot; - vn_phi_t vp1 = (vn_phi_t) pool_alloc (current_info-phis_pool); + vn_phi_t vp1 = current_info-phis_pool-allocate (); unsigned i; vectree args = vNULL; @@ -2999,7 +2999,7 @@ visit_reference_op_call (tree lhs, gcall *stmt) changed |= set_ssa_val_to (vdef, vdef); if (lhs) changed |= set_ssa_val_to (lhs, lhs); - vr2 = (vn_reference_t) pool_alloc (current_info-references_pool); + vr2 = current_info-references_pool-allocate (); vr2-vuse = vr1.vuse; /* As we are not walking the virtual operand chain we know the shared_lookup_references are still original so we can re-use @@ -3873,7 +3873,7 @@ copy_nary (vn_nary_op_t onary, vn_tables_t info) static void copy_phi (vn_phi_t ophi, vn_tables_t info) { - vn_phi_t phi = (vn_phi_t) pool_alloc (info-phis_pool); + vn_phi_t phi = info-phis_pool-allocate (); vn_phi_s **slot; memcpy (phi, ophi, sizeof (*phi)); ophi-phiargs.create (0); @@ -3889,7 +3889,7 @@ copy_reference (vn_reference_t oref, vn_tables_t info) { vn_reference_t ref; vn_reference_s **slot; - ref = (vn_reference_t) pool_alloc (info-references_pool); + ref = info-references_pool-allocate (); memcpy (ref, oref, sizeof (*ref)); oref-operands.create (0); slot = info-references-find_slot_with_hash (ref, ref-hashcode, INSERT); @@ -3954,8 +3954,8 @@ process_scc (vectree scc) optimistic_info-references-empty (); obstack_free (optimistic_info-nary_obstack, NULL); gcc_obstack_init (optimistic_info-nary_obstack); - empty_alloc_pool (optimistic_info-phis_pool); - empty_alloc_pool (optimistic_info-references_pool); + optimistic_info-phis_pool-release (); + optimistic_info-references_pool-release (); FOR_EACH_VEC_ELT (scc, i, var) VN_INFO (var)-expr = NULL_TREE; FOR_EACH_VEC_ELT (scc, i, var) @@ -4132,12 +4132,9 @@ allocate_vn_table (vn_tables_t table) table-references = new vn_reference_table_type (23); gcc_obstack_init (table-nary_obstack); - table-phis_pool = create_alloc_pool (VN phis, - sizeof (struct vn_phi_s), - 30); - table-references_pool = create_alloc_pool (VN references, - sizeof (struct vn_reference_s), - 30); + table-phis_pool = new pool_allocatorvn_phi_s (VN phis, 30); + table-references_pool = new pool_allocatorvn_reference_s (VN references, + 30); } /* Free a value number table. */ @@ -4152,8 +4149,8 @@ free_vn_table (vn_tables_t table) delete
Re: [PATCH 24/35] Change use to type-based pool allocator in tree-ssa-reassoc.c.
On 05/27/2015 08:12 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * tree-ssa-reassoc.c (add_to_ops_vec): Use new type-based pool allocator. (add_repeat_to_ops_vec): Likewise. (get_ops): Likewise. (maybe_optimize_range_tests): Likewise. (init_reassoc): Likewise. (fini_reassoc): Likewise. OK. jeff v2 From de04d44798779d4ff12d39144db747936990773e Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:52 +0200 Subject: [PATCH 23/32] Change use to type-based pool allocator in tree-ssa-reassoc.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * tree-ssa-reassoc.c (add_to_ops_vec): Use new type-based pool allocator. (add_repeat_to_ops_vec): Likewise. (get_ops): Likewise. (maybe_optimize_range_tests): Likewise. (init_reassoc): Likewise. (fini_reassoc): Likewise. --- gcc/tree-ssa-reassoc.c | 19 --- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 0c67379..c1a7f4b9 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -235,7 +235,8 @@ typedef struct operand_entry unsigned int count; } *operand_entry_t; -static alloc_pool operand_entry_pool; +static pool_allocatoroperand_entry operand_entry_pool (operand entry pool, + 30); /* This is used to assign a unique ID to each struct operand_entry so that qsort results are identical on different hosts. */ @@ -619,7 +620,7 @@ sort_by_operand_rank (const void *pa, const void *pb) static void add_to_ops_vec (vecoperand_entry_t *ops, tree op) { - operand_entry_t oe = (operand_entry_t) pool_alloc (operand_entry_pool); + operand_entry_t oe = operand_entry_pool.allocate (); oe-op = op; oe-rank = get_rank (op); @@ -635,7 +636,7 @@ static void add_repeat_to_ops_vec (vecoperand_entry_t *ops, tree op, HOST_WIDE_INT repeat) { - operand_entry_t oe = (operand_entry_t) pool_alloc (operand_entry_pool); + operand_entry_t oe = operand_entry_pool.allocate (); oe-op = op; oe-rank = get_rank (op); @@ -2990,7 +2991,7 @@ get_ops (tree var, enum tree_code code, vecoperand_entry_t *ops, !get_ops (rhs[i], code, ops, loop) has_single_use (rhs[i])) { - operand_entry_t oe = (operand_entry_t) pool_alloc (operand_entry_pool); + operand_entry_t oe = operand_entry_pool.allocate (); oe-op = rhs[i]; oe-rank = code; @@ -3223,8 +3224,7 @@ maybe_optimize_range_tests (gimple stmt) has_single_use (rhs)) { /* Otherwise, push the _234 range test itself. */ - operand_entry_t oe - = (operand_entry_t) pool_alloc (operand_entry_pool); + operand_entry_t oe = operand_entry_pool.allocate (); oe-op = rhs; oe-rank = code; @@ -3256,8 +3256,7 @@ maybe_optimize_range_tests (gimple stmt) loop_containing_stmt (stmt { /* Or push the GIMPLE_COND stmt itself. */ - operand_entry_t oe - = (operand_entry_t) pool_alloc (operand_entry_pool); + operand_entry_t oe = operand_entry_pool.allocate (); oe-op = NULL; oe-rank = (e-flags EDGE_TRUE_VALUE) @@ -5035,8 +5034,6 @@ init_reassoc (void) memset (reassociate_stats, 0, sizeof (reassociate_stats)); - operand_entry_pool = create_alloc_pool (operand entry pool, - sizeof (struct operand_entry), 30); next_operand_entry_id = 0; /* Reverse RPO (Reverse Post Order) will give us something where @@ -5085,7 +5082,7 @@ fini_reassoc (void) reassociate_stats.pows_created); delete operand_rank; - free_alloc_pool (operand_entry_pool); + operand_entry_pool.release (); free (bb_rank); plus_negates.release (); free_dominance_info (CDI_POST_DOMINATORS); -- 2.1.4
Re: [PATCH 26/35] Change use to type-based pool allocator in tree-ssa-strlen.c.
On 05/27/2015 03:56 PM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * tree-ssa-strlen.c (new_strinfo): Use new type-based pool allocator. (free_strinfo): Likewise. (pass_strlen::execute): Likewise. --- gcc/tree-ssa-strlen.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index 34776a3..2664189 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -142,7 +142,7 @@ typedef struct strinfo_struct } *strinfo; /* Pool for allocating strinfo_struct entries. */ -static alloc_pool strinfo_pool; +static pool_allocatorstrinfo_struct strinfo_pool (strinfo_struct pool, 64); /* Vector mapping positive string indexes to strinfo, for the current basic block. The first pointer in the vector is special, @@ -431,7 +431,7 @@ new_addr_stridx (tree exp) static strinfo new_strinfo (tree ptr, int idx, tree length) { - strinfo si = (strinfo) pool_alloc (strinfo_pool); + strinfo si = strinfo_pool.allocate (); si-length = length; si-ptr = ptr; si-stmt = NULL; @@ -452,7 +452,7 @@ static inline void free_strinfo (strinfo si) { if (si --si-refcount == 0) -pool_free (strinfo_pool, si); +strinfo_pool.remove (si); } /* Set strinfo in the vector entry IDX to SI. */ @@ -2400,8 +2400,6 @@ pass_strlen::execute (function *fun) { ssa_ver_to_stridx.safe_grow_cleared (num_ssa_names); max_stridx = 1; - strinfo_pool = create_alloc_pool (strinfo_struct pool, - sizeof (struct strinfo_struct), 64); calculate_dominance_info (CDI_DOMINATORS); @@ -2410,7 +2408,7 @@ pass_strlen::execute (function *fun) strlen_dom_walker (CDI_DOMINATORS).walk (fun-cfg-x_entry_block_ptr); ssa_ver_to_stridx.release (); - free_alloc_pool (strinfo_pool); + strinfo_pool.release (); if (decl_to_stridxlist_htab) { obstack_free (stridx_obstack, NULL); v2 From d3b5cce7467dea3cc06489e087ca5d2f15a0eb32 Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:53 +0200 Subject: [PATCH 25/32] Change use to type-based pool allocator in tree-ssa-strlen.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * tree-ssa-strlen.c (new_strinfo): Use new type-based pool allocator. (free_strinfo): Likewise. (pass_strlen::execute): Likewise. --- gcc/tree-ssa-strlen.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index 34776a3..2664189 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -142,7 +142,7 @@ typedef struct strinfo_struct } *strinfo; /* Pool for allocating strinfo_struct entries. */ -static alloc_pool strinfo_pool; +static pool_allocatorstrinfo_struct strinfo_pool (strinfo_struct pool, 64); /* Vector mapping positive string indexes to strinfo, for the current basic block. The first pointer in the vector is special, @@ -431,7 +431,7 @@ new_addr_stridx (tree exp) static strinfo new_strinfo (tree ptr, int idx, tree length) { - strinfo si = (strinfo) pool_alloc (strinfo_pool); + strinfo si = strinfo_pool.allocate (); si-length = length; si-ptr = ptr; si-stmt = NULL; @@ -452,7 +452,7 @@ static inline void free_strinfo (strinfo si) { if (si --si-refcount == 0) -pool_free (strinfo_pool, si); +strinfo_pool.remove (si); } /* Set strinfo in the vector entry IDX to SI. */ @@ -2400,8 +2400,6 @@ pass_strlen::execute (function *fun) { ssa_ver_to_stridx.safe_grow_cleared (num_ssa_names); max_stridx = 1; - strinfo_pool = create_alloc_pool (strinfo_struct pool, -sizeof (struct strinfo_struct), 64); calculate_dominance_info (CDI_DOMINATORS); @@ -2410,7 +2408,7 @@ pass_strlen::execute (function *fun) strlen_dom_walker (CDI_DOMINATORS).walk (fun-cfg-x_entry_block_ptr); ssa_ver_to_stridx.release (); - free_alloc_pool (strinfo_pool); + strinfo_pool.release (); if (decl_to_stridxlist_htab) { obstack_free (stridx_obstack, NULL); -- 2.1.4
[PATCH] TLC to reassoc get_rank
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Richard. 2015-05-29 Richard Biener rguent...@suse.de * tree-ssa-reassoc.c (get_rank): Simplify. Index: gcc/tree-ssa-reassoc.c === --- gcc/tree-ssa-reassoc.c (revision 223818) +++ gcc/tree-ssa-reassoc.c (working copy) @@ -417,10 +417,6 @@ insert_operand_rank (tree e, long rank) static long get_rank (tree e) { - /* Constants have rank 0. */ - if (is_gimple_min_invariant (e)) -return 0; - /* SSA_NAME's have the rank of the expression they are the result of. For globals and uninitialized values, the rank is 0. @@ -460,9 +456,9 @@ get_rank (tree e) if (TREE_CODE (e) == SSA_NAME) { + ssa_op_iter iter; gimple stmt; long rank; - int i, n; tree op; if (SSA_NAME_IS_DEFAULT_DEF (e)) @@ -472,8 +468,7 @@ get_rank (tree e) if (gimple_code (stmt) == GIMPLE_PHI) return phi_rank (stmt); - if (!is_gimple_assign (stmt) - || gimple_vdef (stmt)) + if (!is_gimple_assign (stmt)) return bb_rank[gimple_bb (stmt)-index]; /* If we already have a rank for this expression, use that. */ @@ -484,34 +479,12 @@ get_rank (tree e) /* Otherwise, find the maximum rank for the operands. As an exception, remove the bias from loop-carried phis when propagating the rank so that dependent operations are not also biased. */ + /* Simply walk over all SSA uses - this takes advatage of the + fact that non-SSA operands are is_gimple_min_invariant and +thus have rank 0. */ rank = 0; - if (gimple_assign_single_p (stmt)) - { - tree rhs = gimple_assign_rhs1 (stmt); - n = TREE_OPERAND_LENGTH (rhs); - if (n == 0) - rank = propagate_rank (rank, rhs); - else - { - for (i = 0; i n; i++) - { - op = TREE_OPERAND (rhs, i); - - if (op != NULL_TREE) - rank = propagate_rank (rank, op); - } - } - } - else - { - n = gimple_num_ops (stmt); - for (i = 1; i n; i++) - { - op = gimple_op (stmt, i); - gcc_assert (op); - rank = propagate_rank (rank, op); - } - } + FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE) + rank = propagate_rank (rank, op); if (dump_file (dump_flags TDF_DETAILS)) { @@ -525,7 +498,11 @@ get_rank (tree e) return (rank + 1); } - /* Globals, etc, are rank 0 */ + /* Constants have rank 0. */ + if (is_gimple_min_invariant (e)) +return 0; + + /* Constants, globals, etc., are rank 0 */ return 0; }
Re: [PATCH] TLC to reassoc get_rank
On Fri, 29 May 2015, Jakub Jelinek wrote: On Fri, May 29, 2015 at 02:41:28PM +0200, Richard Biener wrote: @@ -525,7 +498,11 @@ get_rank (tree e) return (rank + 1); } - /* Globals, etc, are rank 0 */ + /* Constants have rank 0. */ + if (is_gimple_min_invariant (e)) +return 0; + + /* Constants, globals, etc., are rank 0 */ return 0; } This looks weird. No reason to test is_gimple_min_invariant if it returns 0 no matter whether it is true or false. Whoops I already adjusted the comment but forgot to remove the stmt! (just moved it down after the cheap == SSA_NAME check initially). Consider that fixed. Richard.
Re: [PATCH 01/35] Introduce new type-based pool allocator.
On 05/28/2015 07:15 PM, Jeff Law wrote: On 05/28/2015 06:49 AM, Martin Liška wrote: . This mechanism has been just adapted. I find it quite useful as we have examples in source code where we allocate same struct/class types from a various pool. For debugging purpose, it helps to identify if release operation is called for a correct pool. I saw that you were following existing practice for the pools in the removal patch. I still don't like it as it makes mixing and matching objects harder when debugging gcc and if the structure is exposed for plugins, then we've got an unnecessary ABI plugin breakage. I certainly understand how it's useful -- I'm not questioning that. I'm questioning changing the size of structures on ENABLE_CHECKING. My first inclination would be to include all that stuff unconditionally. If that's too much overhead, then perhaps include the structure member, but not bother with any of the bookkeeping except for ENABLE_CHECKING. Hi. Updated version of patch removes ENABLE_CHECKING in the struct definition. News in the patchset I'm going to re-send: + Changelog entries are fixed for spaces + Each patch passes ./contrib/check_GNU_style.sh script + pool_allocator::pool_allocator is a trivial constructor and first allocation launches initialization + some patches are squashed as were mentioned multiple time (ira-color.c, ira-build.c) The patch set survives x86_64-linux-pc boostrap, I'm going to re-run regression tests. Thanks, Martin Anyway, I would like to commit all these patches at once (one by one). Thus, I'm going to wait for approval for the whole series before I'll commit the set. Quite reasonable -- I was mostly trying to make sure I understood the testing situation. I think at this point the whole series is approved, so you can move forward. jeff From b551d2349b342776213f518de0835ab54fa9fa03 Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:44 +0200 Subject: [PATCH 01/32] Introduce new type-based pool allocator. Hello. Following patch set attempts to replace old-style pool allocator to a type-based one. Moreover, as we utilize classes and structs that are used just by a pool allocator, these types have overwritten ctors and dtors. Thus, using the allocator is much easier and we shouldn't cast types back and forth. Another beneficat can be achieved in future, as we will be able to call a class constructors to correctly register a location, where a memory is allocated (-fgather-detailed-mem-stats). Patch can boostrap on x86_64-linux-gnu and ppc64-linux-gnu and survives regression tests on x86_64-linux-gnu. Ready for trunk? Thanks, Martin gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * alloc-pool.c (struct alloc_pool_descriptor): Move definition to header file. * alloc-pool.h (pool_allocator::pool_allocator): New function. (pool_allocator::release): Likewise. (inline pool_allocator::release_if_empty): Likewise. (inline pool_allocator::~pool_allocator): Likewise. (pool_allocator::allocate): Likewise. (pool_allocator::remove): Likewise. --- gcc/alloc-pool.c | 33 + gcc/alloc-pool.h | 380 ++- 2 files changed, 383 insertions(+), 30 deletions(-) diff --git a/gcc/alloc-pool.c b/gcc/alloc-pool.c index 81909d8..0bea7a6 100644 --- a/gcc/alloc-pool.c +++ b/gcc/alloc-pool.c @@ -25,6 +25,8 @@ along with GCC; see the file COPYING3. If not see #include hash-table.h #include hash-map.h +ALLOC_POOL_ID_TYPE last_id; + #define align_eight(x) (((x+7) 3) 3) /* The internal allocation object. */ @@ -58,36 +60,10 @@ typedef struct allocation_object_def #define USER_PTR_FROM_ALLOCATION_OBJECT_PTR(X)\ ((void *) (((allocation_object *) (X))-u.data)) -#ifdef ENABLE_CHECKING -/* Last used ID. */ -static ALLOC_POOL_ID_TYPE last_id; -#endif - -/* Store information about each particular alloc_pool. Note that this - will underestimate the amount the amount of storage used by a small amount: - 1) The overhead in a pool is not accounted for. - 2) The unallocated elements in a block are not accounted for. Note - that this can at worst case be one element smaller that the block - size for that pool. */ -struct alloc_pool_descriptor -{ - /* Number of pools allocated. */ - unsigned long created; - /* Gross allocated storage. */ - unsigned long allocated; - /* Amount of currently active storage. */ - unsigned long current; - /* Peak amount of storage used. */ - unsigned long peak; - /* Size of element in the pool. */ - int elt_size; -}; - /* Hashtable mapping alloc_pool names to descriptors. */ -static hash_mapconst char *, alloc_pool_descriptor *alloc_pool_hash; +hash_mapconst char *, alloc_pool_descriptor *alloc_pool_hash; -/* For given name, return descriptor, create new if needed. */ -static struct alloc_pool_descriptor * +struct alloc_pool_descriptor * allocate_pool_descriptor (const char *name) { if
Re: [PATCH 13/35] Change use to type-based pool allocator in df-problems.c.
On 05/27/2015 08:01 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * df-problems.c (df_chain_create):Use new type-based pool allocator. (df_chain_unlink_1) Likewise. (df_chain_unlink) Likewise. (df_chain_remove_problem) Likewise. (df_chain_alloc) Likewise. (df_chain_free) Likewise. * df.h (struct dataflow) Likewise. OK. As Jakub noted, please double-check your ChangeLogs for proper formatting before committing. There's consistently nits to fix in them. Jeff v2 From 66961142fc65ce20b326bb027c590a146736d2d3 Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:48 +0200 Subject: [PATCH 12/32] Change use to type-based pool allocator in df-problems.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * df-problems.c (df_chain_create):Use new type-based pool allocator. (df_chain_unlink_1) Likewise. (df_chain_unlink) Likewise. (df_chain_remove_problem) Likewise. (df_chain_alloc) Likewise. (df_chain_free) Likewise. * df.h (struct dataflow) Likewise. --- gcc/df-problems.c | 14 +++--- gcc/df.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gcc/df-problems.c b/gcc/df-problems.c index ff08abd..7700157 100644 --- a/gcc/df-problems.c +++ b/gcc/df-problems.c @@ -1879,7 +1879,7 @@ struct df_link * df_chain_create (df_ref src, df_ref dst) { struct df_link *head = DF_REF_CHAIN (src); - struct df_link *link = (struct df_link *) pool_alloc (df_chain-block_pool); + struct df_link *link = df_chain-block_pool-allocate (); DF_REF_CHAIN (src) = link; link-next = head; @@ -1904,7 +1904,7 @@ df_chain_unlink_1 (df_ref ref, df_ref target) prev-next = chain-next; else DF_REF_CHAIN (ref) = chain-next; - pool_free (df_chain-block_pool, chain); + df_chain-block_pool-remove (chain); return; } prev = chain; @@ -1924,7 +1924,7 @@ df_chain_unlink (df_ref ref) struct df_link *next = chain-next; /* Delete the other side if it exists. */ df_chain_unlink_1 (chain-ref, ref); - pool_free (df_chain-block_pool, chain); + df_chain-block_pool-remove (chain); chain = next; } DF_REF_CHAIN (ref) = NULL; @@ -1956,7 +1956,7 @@ df_chain_remove_problem (void) /* Wholesale destruction of the old chains. */ if (df_chain-block_pool) -free_alloc_pool (df_chain-block_pool); +delete df_chain-block_pool; EXECUTE_IF_SET_IN_BITMAP (df_chain-out_of_date_transfer_functions, 0, bb_index, bi) { @@ -2010,8 +2010,8 @@ static void df_chain_alloc (bitmap all_blocks ATTRIBUTE_UNUSED) { df_chain_remove_problem (); - df_chain-block_pool = create_alloc_pool (df_chain_block pool, - sizeof (struct df_link), 50); + df_chain-block_pool = new pool_allocatordf_link (df_chain_block pool, + 50); df_chain-optional_p = true; } @@ -2146,7 +2146,7 @@ df_chain_finalize (bitmap all_blocks) static void df_chain_free (void) { - free_alloc_pool (df_chain-block_pool); + delete df_chain-block_pool; BITMAP_FREE (df_chain-out_of_date_transfer_functions); free (df_chain); } diff --git a/gcc/df.h b/gcc/df.h index 7e233667..8a5b21f 100644 --- a/gcc/df.h +++ b/gcc/df.h @@ -305,7 +305,7 @@ struct dataflow unsigned int block_info_size; /* The pool to allocate the block_info from. */ - alloc_pool block_pool; + pool_allocatordf_link *block_pool; /* The lr and live problems have their transfer functions recomputed only if necessary. This is possible for them because, the -- 2.1.4
Re: [PATCH 12/35] Change use to type-based pool allocator in cselib.c.
On 05/27/2015 03:56 PM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * cselib.c (new_elt_list):Use new type-based pool allocator. (new_elt_loc_list) Likewise. (unchain_one_elt_list) Likewise. (unchain_one_elt_loc_list) Likewise. (unchain_one_value) Likewise. (new_cselib_val) Likewise. (cselib_init) Likewise. (cselib_finish) Likewise. --- gcc/alias.c | 1 + gcc/cfgcleanup.c | 1 + gcc/cprop.c | 1 + gcc/cselib.c | 63 gcc/cselib.h | 33 ++- gcc/gcse.c | 1 + gcc/postreload.c | 1 + gcc/print-rtl.c | 1 + gcc/sel-sched-dump.c | 1 + 9 files changed, 78 insertions(+), 25 deletions(-) diff --git a/gcc/alias.c b/gcc/alias.c index aa7dc21..bc8e2b4 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see #include tm_p.h #include regs.h #include diagnostic-core.h +#include alloc-pool.h #include cselib.h #include hash-map.h #include langhooks.h diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index aff64ef..fc2ed31 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see #include flags.h #include recog.h #include diagnostic-core.h +#include alloc-pool.h #include cselib.h #include params.h #include tm_p.h diff --git a/gcc/cprop.c b/gcc/cprop.c index 57c44ef..41ca201 100644 --- a/gcc/cprop.c +++ b/gcc/cprop.c @@ -63,6 +63,7 @@ along with GCC; see the file COPYING3. If not see #include expr.h #include except.h #include params.h +#include alloc-pool.h #include cselib.h #include intl.h #include obstack.h diff --git a/gcc/cselib.c b/gcc/cselib.c index 7a50f50..8de85bc 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -46,6 +46,7 @@ along with GCC; see the file COPYING3. If not see #include ggc.h #include hash-table.h #include dumpfile.h +#include alloc-pool.h #include cselib.h #include predict.h #include basic-block.h @@ -56,9 +57,25 @@ along with GCC; see the file COPYING3. If not see #include bitmap.h /* A list of cselib_val structures. */ -struct elt_list { -struct elt_list *next; -cselib_val *elt; +struct elt_list +{ + struct elt_list *next; + cselib_val *elt; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { +pool.remove((elt_list *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocatorelt_list pool; }; static bool cselib_record_memory; @@ -260,7 +277,13 @@ static unsigned int cfa_base_preserved_regno = INVALID_REGNUM; May or may not contain the useless values - the list is compacted each time memory is invalidated. */ static cselib_val *first_containing_mem = dummy_val; -static alloc_pool elt_loc_list_pool, elt_list_pool, cselib_val_pool, value_pool; + +pool_allocatorelt_list elt_list::pool (elt_list, 10); +pool_allocatorelt_loc_list elt_loc_list::pool (elt_loc_list, 10); +pool_allocatorcselib_val cselib_val::pool (cselib_val_list, 10); + +static pool_allocatorrtx_def value_pool (value, 100, RTX_CODE_SIZE (VALUE), + true); /* If nonnull, cselib will call this function before freeing useless VALUEs. A VALUE is deemed useless if its locs field is null. */ @@ -288,8 +311,7 @@ void (*cselib_record_sets_hook) (rtx_insn *insn, struct cselib_set *sets, static inline struct elt_list * new_elt_list (struct elt_list *next, cselib_val *elt) { - struct elt_list *el; - el = (struct elt_list *) pool_alloc (elt_list_pool); + elt_list *el = new elt_list (); el-next = next; el-elt = elt; return el; @@ -373,14 +395,14 @@ new_elt_loc_list (cselib_val *val, rtx loc) } /* Chain LOC back to VAL. */ - el = (struct elt_loc_list *) pool_alloc (elt_loc_list_pool); + el = new elt_loc_list; el-loc = val-val_rtx; el-setting_insn = cselib_current_insn; el-next = NULL; CSELIB_VAL_PTR (loc)-locs = el; } - el = (struct elt_loc_list *) pool_alloc (elt_loc_list_pool); + el = new elt_loc_list; el-loc = loc; el-setting_insn = cselib_current_insn; el-next = next; @@ -420,7 +442,7 @@ unchain_one_elt_list (struct elt_list **pl) struct elt_list *l = *pl; *pl = l-next; - pool_free (elt_list_pool, l); + delete l; } /* Likewise for elt_loc_lists. */ @@ -431,7 +453,7 @@ unchain_one_elt_loc_list (struct elt_loc_list **pl) struct elt_loc_list *l = *pl; *pl = l-next; - pool_free (elt_loc_list_pool, l); + delete l; } /* Likewise for cselib_vals. This also frees the addr_list associated with @@ -443,7 +465,7 @@ unchain_one_value (cselib_val *v)
Re: [PATCH 11/35] Change use to type-based pool allocator in sh.c.
On 05/27/2015 07:59 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * config/sh/sh.c (add_constant):Use new type-based pool allocator. (sh_reorg) Likewise. OK. jeff v2 From 68f0b72993d882d5dfe4096806f2bb78c87a37c4 Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:47 +0200 Subject: [PATCH 10/32] Change use to type-based pool allocator in sh.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * config/sh/sh.c (add_constant):Use new type-based pool allocator. (sh_reorg) Likewise. --- gcc/config/sh/sh.c | 30 ++ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index bc1ce24..285aa18 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -4648,14 +4648,31 @@ gen_datalabel_ref (rtx sym) } -static alloc_pool label_ref_list_pool; - typedef struct label_ref_list_d { rtx_code_label *label; struct label_ref_list_d *next; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { +pool.remove ((label_ref_list_d *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocatorlabel_ref_list_d pool; + } *label_ref_list_t; +pool_allocatorlabel_ref_list_d label_ref_list_d::pool + (label references list, 30); + /* The SH cannot load a large constant into a register, constants have to come from a pc relative load. The reference of a pc relative load instruction must be less than 1k in front of the instruction. This @@ -4775,7 +4792,7 @@ add_constant (rtx x, machine_mode mode, rtx last_value) } if (lab pool_window_label) { - newref = (label_ref_list_t) pool_alloc (label_ref_list_pool); + newref = new label_ref_list_d; newref-label = pool_window_label; ref = pool_vector[pool_window_last].wend; newref-next = ref; @@ -4804,7 +4821,7 @@ add_constant (rtx x, machine_mode mode, rtx last_value) pool_vector[pool_size].part_of_sequence_p = (lab == 0); if (lab pool_window_label) { - newref = (label_ref_list_t) pool_alloc (label_ref_list_pool); + newref = new label_ref_list_d; newref-label = pool_window_label; ref = pool_vector[pool_window_last].wend; newref-next = ref; @@ -6359,9 +6376,6 @@ sh_reorg (void) /* Scan the function looking for move instructions which have to be changed to pc-relative loads and insert the literal tables. */ - label_ref_list_pool = create_alloc_pool (label references list, - sizeof (struct label_ref_list_d), - 30); mdep_reorg_phase = SH_FIXUP_PCLOAD; for (insn = first, num_mova = 0; insn; insn = NEXT_INSN (insn)) { @@ -6553,7 +6567,7 @@ sh_reorg (void) insn = barrier; } } - free_alloc_pool (label_ref_list_pool); + label_ref_list_d::pool.release (); for (insn = first; insn; insn = NEXT_INSN (insn)) PUT_MODE (insn, VOIDmode); -- 2.1.4
Re: [PATCH 19/35] Change use to type-based pool allocator in sel-sched-ir.c.
On 05/27/2015 08:04 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * sel-sched-ir.c (alloc_sched_pools): Use new type-based pool allocator. (free_sched_pools): Likewise. * sel-sched-ir.h (_list_alloc): Likewise. (_list_remove): Likewise. OK jeff v2 From 9e5b4f84bb12652353c92827371645ca97be2a72 Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:50 +0200 Subject: [PATCH 18/32] Change use to type-based pool allocator in sel-sched-ir.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * sel-sched-ir.c (alloc_sched_pools): Use new type-based pool allocator. (free_sched_pools): Likewise. * sel-sched-ir.h (_list_alloc): Likewise. (_list_remove): Likewise. --- gcc/sel-sched-ir.c | 7 ++- gcc/sel-sched-ir.h | 6 +++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index 94f6c43..ffaba56 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -70,7 +70,7 @@ vecsel_region_bb_info_def sel_region_bb_info = vNULL; /* A pool for allocating all lists. */ -alloc_pool sched_lists_pool; +pool_allocator_list_node sched_lists_pool (sel-sched-lists, 500); /* This contains information about successors for compute_av_set. */ struct succs_info current_succs; @@ -5030,9 +5030,6 @@ alloc_sched_pools (void) succs_info_pool.size = succs_size; succs_info_pool.top = -1; succs_info_pool.max_top = -1; - - sched_lists_pool = create_alloc_pool (sel-sched-lists, -sizeof (struct _list_node), 500); } /* Free the pools. */ @@ -5041,7 +5038,7 @@ free_sched_pools (void) { int i; - free_alloc_pool (sched_lists_pool); + sched_lists_pool.release (); gcc_assert (succs_info_pool.top == -1); for (i = 0; i = succs_info_pool.max_top; i++) { diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h index 91ce92f..3707a87 100644 --- a/gcc/sel-sched-ir.h +++ b/gcc/sel-sched-ir.h @@ -364,12 +364,12 @@ struct _list_node /* _list_t functions. All of _*list_* functions are used through accessor macros, thus we can't move them in sel-sched-ir.c. */ -extern alloc_pool sched_lists_pool; +extern pool_allocator_list_node sched_lists_pool; static inline _list_t _list_alloc (void) { - return (_list_t) pool_alloc (sched_lists_pool); + return sched_lists_pool.allocate (); } static inline void @@ -395,7 +395,7 @@ _list_remove (_list_t *lp) _list_t n = *lp; *lp = _LIST_NEXT (n); - pool_free (sched_lists_pool, n); + sched_lists_pool.remove (n); } static inline void -- 2.1.4
Re: [PATCH 22/35] Change use to type-based pool allocator in sched-deps.c.
On 05/27/2015 08:14 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * sched-deps.c (create_dep_node): Use new type-based pool allocator. (delete_dep_node): Likewise. (create_deps_list): Likewise. (free_deps_list): Likewise. (sched_deps_init): Likewise. (sched_deps_finish): Likewise. OK. First use of the release_if_empty API that I've seen in these patches. jeff v2 From a9216021be50a7b5719fd75c8786ac6831010b05 Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:52 +0200 Subject: [PATCH 21/32] Change use to type-based pool allocator in sched-deps.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * sched-deps.c (create_dep_node): Use new type-based pool allocator. (delete_dep_node): Likewise. (create_deps_list): Likewise. (free_deps_list): Likewise. (sched_deps_init): Likewise. (sched_deps_finish): Likewise. --- gcc/sched-deps.c | 23 --- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c index c1cfc1f..30d4630 100644 --- a/gcc/sched-deps.c +++ b/gcc/sched-deps.c @@ -334,7 +334,7 @@ dep_link_is_detached_p (dep_link_t link) } /* Pool to hold all dependency nodes (dep_node_t). */ -static alloc_pool dn_pool; +static pool_allocator_dep_node *dn_pool; /* Number of dep_nodes out there. */ static int dn_pool_diff = 0; @@ -343,7 +343,7 @@ static int dn_pool_diff = 0; static dep_node_t create_dep_node (void) { - dep_node_t n = (dep_node_t) pool_alloc (dn_pool); + dep_node_t n = dn_pool-allocate (); dep_link_t back = DEP_NODE_BACK (n); dep_link_t forw = DEP_NODE_FORW (n); @@ -371,11 +371,11 @@ delete_dep_node (dep_node_t n) --dn_pool_diff; - pool_free (dn_pool, n); + dn_pool-remove (n); } /* Pool to hold dependencies lists (deps_list_t). */ -static alloc_pool dl_pool; +static pool_allocator_deps_list *dl_pool; /* Number of deps_lists out there. */ static int dl_pool_diff = 0; @@ -393,7 +393,7 @@ deps_list_empty_p (deps_list_t l) static deps_list_t create_deps_list (void) { - deps_list_t l = (deps_list_t) pool_alloc (dl_pool); + deps_list_t l = dl_pool-allocate (); DEPS_LIST_FIRST (l) = NULL; DEPS_LIST_N_LINKS (l) = 0; @@ -410,7 +410,7 @@ free_deps_list (deps_list_t l) --dl_pool_diff; - pool_free (dl_pool, l); + dl_pool-remove (l); } /* Return true if there is no dep_nodes and deps_lists out there. @@ -4075,10 +4075,10 @@ sched_deps_init (bool global_p) if (global_p) { - dl_pool = create_alloc_pool (deps_list, sizeof (struct _deps_list), + dl_pool = new pool_allocator_deps_list (deps_list, /* Allocate lists for one block at a time. */ insns_in_block); - dn_pool = create_alloc_pool (dep_node, sizeof (struct _dep_node), + dn_pool = new pool_allocator_dep_node (dep_node, /* Allocate nodes for one block at a time. We assume that average insn has 5 producers. */ @@ -4128,9 +4128,10 @@ void sched_deps_finish (void) { gcc_assert (deps_pools_are_empty_p ()); - free_alloc_pool_if_empty (dn_pool); - free_alloc_pool_if_empty (dl_pool); - gcc_assert (dn_pool == NULL dl_pool == NULL); + dn_pool-release_if_empty (); + dn_pool = NULL; + dl_pool-release_if_empty (); + dl_pool = NULL; h_d_i_d.release (); cache_size = 0; -- 2.1.4
Re: [PATCH 21/35] Change use to type-based pool allocator in regcprop.c.
On 05/27/2015 08:11 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * regcprop.c (free_debug_insn_changes): Use new type-based pool allocator. (replace_oldest_value_reg): Likewise. (pass_cprop_hardreg::execute): Likewise. OK. jeff v2 From 572893e8d7330b43da2373c7e7ab40a51ce6a40c Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:51 +0200 Subject: [PATCH 20/32] Change use to type-based pool allocator in regcprop.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * regcprop.c (free_debug_insn_changes): Use new type-based pool allocator. (replace_oldest_value_reg): Likewise. (pass_cprop_hardreg::execute): Likewise. --- gcc/regcprop.c | 31 +-- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/gcc/regcprop.c b/gcc/regcprop.c index 7d7a9a09..9bac11a 100644 --- a/gcc/regcprop.c +++ b/gcc/regcprop.c @@ -62,6 +62,21 @@ struct queued_debug_insn_change rtx_insn *insn; rtx *loc; rtx new_rtx; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { +pool.remove ((queued_debug_insn_change *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocatorqueued_debug_insn_change pool; }; /* For each register, we have a list of registers that contain the same @@ -85,7 +100,9 @@ struct value_data unsigned int n_debug_insn_changes; }; -static alloc_pool debug_insn_changes_pool; +pool_allocatorqueued_debug_insn_change queued_debug_insn_change::pool + (debug insn changes pool, 256); + static bool skip_debug_insn_p; static void kill_value_one_regno (unsigned, struct value_data *); @@ -124,7 +141,7 @@ free_debug_insn_changes (struct value_data *vd, unsigned int regno) { next = cur-next; --vd-n_debug_insn_changes; - pool_free (debug_insn_changes_pool, cur); + delete cur; } vd-e[regno].debug_insn_changes = NULL; } @@ -495,8 +512,7 @@ replace_oldest_value_reg (rtx *loc, enum reg_class cl, rtx_insn *insn, fprintf (dump_file, debug_insn %u: queued replacing reg %u with %u\n, INSN_UID (insn), REGNO (*loc), REGNO (new_rtx)); - change = (struct queued_debug_insn_change *) - pool_alloc (debug_insn_changes_pool); + change = new queued_debug_insn_change; change-next = vd-e[REGNO (new_rtx)].debug_insn_changes; change-insn = insn; change-loc = loc; @@ -1244,11 +1260,6 @@ pass_cprop_hardreg::execute (function *fun) visited = sbitmap_alloc (last_basic_block_for_fn (fun)); bitmap_clear (visited); - if (MAY_HAVE_DEBUG_INSNS) -debug_insn_changes_pool - = create_alloc_pool (debug insn changes pool, - sizeof (struct queued_debug_insn_change), 256); - FOR_EACH_BB_FN (bb, fun) { bitmap_set_bit (visited, bb-index); @@ -1308,7 +1319,7 @@ pass_cprop_hardreg::execute (function *fun) } } - free_alloc_pool (debug_insn_changes_pool); + queued_debug_insn_change::pool.release (); } sbitmap_free (visited); -- 2.1.4
Re: [PATCH 29/35] Change use to type-based pool allocator in ipa-prop.c.
On 05/27/2015 08:16 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * ipa-prop.c (ipa_set_jf_constant): Use new type-based pool allocator. (ipa_edge_duplication_hook): Likewise. (ipa_free_all_structures_after_ipa_cp): Likewise. (ipa_free_all_structures_after_iinln): Likewise. OK. Jeff v2 From 5de5c0c01ba9c1c3997b3348c022f4c3013fcefc Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:54 +0200 Subject: [PATCH 28/32] Change use to type-based pool allocator in ipa-prop.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * ipa-prop.c (ipa_set_jf_constant): Use new type-based pool allocator. (ipa_edge_duplication_hook): Likewise. (ipa_free_all_structures_after_ipa_cp): Likewise. (ipa_free_all_structures_after_iinln): Likewise. --- gcc/ipa-prop.c | 23 +++ 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 26be5f2..80ce6b8 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -176,7 +176,8 @@ struct ipa_cst_ref_desc /* Allocation pool for reference descriptions. */ -static alloc_pool ipa_refdesc_pool; +static pool_allocatoripa_cst_ref_desc ipa_refdesc_pool + (IPA-PROP ref descriptions, 32); /* Return true if DECL_FUNCTION_SPECIFIC_OPTIMIZATION of the decl associated with NODE should prevent us from analyzing it for the purposes of IPA-CP. */ @@ -508,11 +509,8 @@ ipa_set_jf_constant (struct ipa_jump_func *jfunc, tree constant, TREE_CODE (TREE_OPERAND (constant, 0)) == FUNCTION_DECL) { struct ipa_cst_ref_desc *rdesc; - if (!ipa_refdesc_pool) - ipa_refdesc_pool = create_alloc_pool (IPA-PROP ref descriptions, - sizeof (struct ipa_cst_ref_desc), 32); - rdesc = (struct ipa_cst_ref_desc *) pool_alloc (ipa_refdesc_pool); + rdesc = ipa_refdesc_pool.allocate (); rdesc-cs = cs; rdesc-next_duplicate = NULL; rdesc-refcount = 1; @@ -3517,9 +3515,7 @@ ipa_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst, gcc_checking_assert (ref); dst-caller-clone_reference (ref, ref-stmt); - gcc_checking_assert (ipa_refdesc_pool); - struct ipa_cst_ref_desc *dst_rdesc - = (struct ipa_cst_ref_desc *) pool_alloc (ipa_refdesc_pool); + struct ipa_cst_ref_desc *dst_rdesc = ipa_refdesc_pool.allocate (); dst_rdesc-cs = dst; dst_rdesc-refcount = src_rdesc-refcount; dst_rdesc-next_duplicate = NULL; @@ -3527,10 +3523,7 @@ ipa_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst, } else if (src_rdesc-cs == src) { - struct ipa_cst_ref_desc *dst_rdesc; - gcc_checking_assert (ipa_refdesc_pool); - dst_rdesc - = (struct ipa_cst_ref_desc *) pool_alloc (ipa_refdesc_pool); + struct ipa_cst_ref_desc *dst_rdesc = ipa_refdesc_pool.allocate (); dst_rdesc-cs = dst; dst_rdesc-refcount = src_rdesc-refcount; dst_rdesc-next_duplicate = src_rdesc-next_duplicate; @@ -3681,8 +3674,7 @@ ipa_free_all_structures_after_ipa_cp (void) free_alloc_pool (ipcp_poly_ctx_values_pool); free_alloc_pool (ipcp_agg_lattice_pool); ipa_unregister_cgraph_hooks (); - if (ipa_refdesc_pool) - free_alloc_pool (ipa_refdesc_pool); + ipa_refdesc_pool.release (); } } @@ -3703,8 +3695,7 @@ ipa_free_all_structures_after_iinln (void) free_alloc_pool (ipcp_poly_ctx_values_pool); if (ipcp_agg_lattice_pool) free_alloc_pool (ipcp_agg_lattice_pool); - if (ipa_refdesc_pool) -free_alloc_pool (ipa_refdesc_pool); + ipa_refdesc_pool.release (); } /* Print ipa_tree_map data structures of all functions in the -- 2.1.4
Re: [PATCH, CFT] Fix bootstrap with in-tree ISL
On 1 April 2015 at 17:55, Bernhard Reutner-Fischer rep.dot@gmail.com wrote: On 1 April 2015 at 17:53, Tobias Grosser tob...@grosser.es wrote: On 04/01/2015 05:09 PM, Bernhard Reutner-Fischer wrote: Hi, Trying to build config-list.mk for current trunk. The box is a stable debian (7.8 it seems) so the OS' ISL is too old thus i was attempting to use in-tree ISL. When using an in-tree ISL gcc attempts to determine if it is recent enough and AFAIU fails to do so since the system's ISL (which we will not use) might be too old and the in-tree ISL is not yet built. This results in HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE being not set and thus compilation of graphite-isl-ast-to-gimple.c fails with template with C linkage. The attached seems to get me past compilation of graphite-isl-ast-to-gimple.c with config-list.mk for e.g. alpha-linux-gnu I'm scheduling a proper regstrap on x86_64-linux-gnu for a native compiler but this will take days to start i fear. So.. if somebody has spare cycles.. :) Hi Bernhard, I can not give an OK for the makefile/configure changes, but in general this seems to be the right direction. It seems that the in-tree ISL is not configured nor built upon make all-gcc, so libbackend linking fails as it stands. Will have a closer look.. The problem above was that isl/configure was not generated (automatically). Is the toplevel Makefile supposed to do that or is the user responsible for running something like autoreconfig -i in the isl/ subdir before a toplevel make in such a combined tree? thanks,
Re: conditional lim
Hi Richard, Here is some explanation. I hope you let me know if I need to clarify something. Also, you asked me about concrete example, to make sure you don’t miss my answer here is the link: https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02417.html. Also, I doubt whether it’s convenient for you to create a build with my patch or not. May be to clarify things you could send me some examples/concrete cases, then I’ll compile them with –fdump-tree-loopinit-details and –fdump-tree-lim-details and send you these dumps. May be these dumps will be useful. (I’ll only disable cleanup_cfg TODO after lim to let you know the exact picture after lim). What do you think? 1. invariantness _dom_walker – 1.1 for each GIMPLE_COND in given bb calls handle_cond_stmt to call for true and false edges handle_branch_edge, which calls SET_TARGET_OF for all bb ‘predicated’ by given GIMPLE_COND. SET_TARGET_OF sets in basic_blocks aux 2 facts: a) this is true or false edge; b) link to cond stmt; Handle_branch_edge works this way: If (cond1) { bb1; if (cond2} { bb2; } Being called for cond1, it sets cond1 as condition for both bb1 and bb2 (the whole branch for cond1, ie also for bb containing cond2), then this method will be called (as there is dominance order) for cond2 to correct things (ie to set cond2 as condition for bb2). 1.2 As 1.1 goes we identify whether some bb is predicated by some condition or not. bb-aux-type will be [TRUE/FALSE]_TARGET_OF and bb-aux-cond_stmt=cond stmt (the nearest condition). If bb is always executed bb-aux-type = ALWAYS_EXECUTED_IN, bb-loop-loop (this info was available in the clean build). 1.3 As this walker is called in dominance order, information about condition is available when invariantness_dom_walker is called for given bb. So we can make some computations based on bb-aux structure. This is done in check_conditionally_executed. The main goal of this method is to check that the root condition is always executed in the loop. I did so to avoid situation like this Loop: Jmp somewhere; If (cond1) If (cond2) Etc By ‘root condition’ I mean cond1 in this case (the first cond in dominance order). If ‘root condition’ is not always executed we disable (free) all the info in bb-aux, ie all the blocks becomes neither conditionally nor always executed according to bb-aux. There is some optimization to don’t go each time trough the conditions chain (cond2-cond1), let me skip such details for now. 1.4 Then we calculate tgt_level (which is used in move_computations later) The patch is the same for phi and regular stmt (calculate_tgt_level) 1) If stmt is conditionally executed we compute max movement (determine_max_movement) starting from get_lim_data(condition)-max_loop. 2) If stmt is not cond executed as start level for determine_max_movement computations we choose ALWAYS_EXECUTED_IN. To clarify why, see the comment /* The reason why we don't set start_level for MOVE_POSSIBLE statements to more outer level is: this statement could depend on conditional statements and even probably is not defined without this condition. So either we should analyze these ones and move under condition somehow or keep more strong start_level . */ As you noted in your review there was some refactoring. Of course, I had no goal to refactor existing code, I intended to remove some duplication which I caused by my changes. I hope we discuss in details later if you don’t like some refactoring. 2. store_motion - for some stmts set flags to ignore predicated execution (I mean to move statements without conditions). 3. move_computations. The patch is doing something in the following 3 calls inside of this method. 3.1 (more details below) walker.walk – move computations(create if() structure) and store information to create phi nodes later (which statements require phi nodes, as they conditionally executed and there are still their uses on other levels, what are the names for such phi nodes, as we replace uses in here, in walker.walk.) 3.2 (more details below) create_phi_nodes – create phi nodes for statements which require that (see 3.1) 3.3 replace_uses_in_conditions After computations movements we can have several copies of the cond stmt. In 3.1 we do replacement of uses based on stmt’s tgt_level. For, cond stmt it doesn’t work. As cond stmt, of course, have something in lim_aux_data-tgt_level, but, in fact, they are moved only if corresponding invariants are moved. So, in fact, the same cond (copies of it, of course) could go to the different levels. So to fix these uses, we call replace_uses_in_conditions. More details on 3.1 and 3.2 3.1 The patch is very similar for phi stmts and regular stmts (there is some difference for regular stmts related to the case when we move sequence instead of single stmt, let’s skip it in this
Re: [RFC / CFT] PR c++/66192 - Remove TARGET_RELAXED_ORDERING and use load acquires.
On 22/05/15 18:36, Jason Merrill wrote: On 05/22/2015 11:23 AM, Ramana Radhakrishnan wrote: On 22/05/15 15:28, Jason Merrill wrote: I do notice that get_guard_bits after build_atomic_load just won't work on non-ARM targets, as it ends up trying to take the address of a value. So on powerpc where targetm.guard_mask_bit is false - this is what I see. (long long int) __atomic_load_8 (_ZGVZ1fvE1p, 2) This is the bit that doesn't make sense to me. __atomic_load_8 returns a value; what does it mean to take its address? If we're going to load more than just the first byte, we should mask off the rest rather than trying to mess with its address. It also seems unnecessary to load 8 bytes on any target; we could add a function to optabs.c that returns the smallest mode for which there's atomic load support? Jason Right, taken all comments on-board - thanks to those who tested the original patch, here's v2 of the patch currently bootstrapped and tested only on aarch64-none-linux-gnu This patch - - Turns build_atomic_load into build_atomic_load_byte in order to do an atomic load of 1 byte instead of a full word atomic load. - Restructures get_guard_cond to decide whether to use an atomic load or a standard load depending on whether code generated will be in a multi-threaded context or not. - Adjusts all callers of get_guard_cond accordingly. One of the bits of fallout that I've observed in my testing and that I'm not sure about what to do is that on *bare-metal* arm-none-eabi targets we still put out calls to __sync_synchronize on architecture versions that do not have a barrier instruction which will result in a link error. While it is tempting to take the easy approach of not putting out the call, I suspect in practice a number of users of the bare-metal tools use these for their own RTOS's and other micro-OS's. Thus generating barriers at higher architecture levels and not generating barriers at lower architecture levels appears to be a bit dangerous especially on architectures where there is backwards compatibility (i.e. -mcpu=arm7tdmi on standard user code is still expected to generate code that works on a core that conforms to a later architecture revision). I am considering leaving this in the ARM backend to force people to think what they want to do about thread safety with statics and C++ on bare-metal systems. If they really do not want thread safety they can well add -fno-threadsafe-statics or provide an appropriate implementation for __sync_synchronize on their platforms. Any thoughts / comments ? regards Ramana gcc/cp/ChangeLog: 2015-05-29 Ramana Radhakrishnan ramana.radhakrish...@arm.com PR c++/66192 * cp-tree.h (get_guard_cond): Adjust declaration * decl.c (expand_static_init): Use atomic load acquire and adjust call to get_guard_cond. * decl2.c (build_atomic_load_byte): New function. (get_guard_cond): Handle thread_safety. (one_static_initialization_or_destruction): Adjust call to get_guard_cond. gcc/ChangeLog: 2015-05-29 Ramana Radhakrishnan ramana.radhakrish...@arm.com PR c++/66192 * config/alpha/alpha.c (TARGET_RELAXED_ORDERING): Likewise. * config/ia64/ia64.c (TARGET_RELAXED_ORDERING): Likewise. * config/rs6000/rs6000.c (TARGET_RELAXED_ORDERING): Likewise. * config/sparc/linux.h (SPARC_RELAXED_ORDERING): Likewise. * config/sparc/linux64.h (SPARC_RELAXED_ORDERING): Likewise. * config/sparc/sparc.c (TARGET_RELAXED_ORDERING): Likewise. * config/sparc/sparc.h (SPARC_RELAXED_ORDERING): Likewise. * doc/tm.texi: Regenerate. * doc/tm.texi.in (TARGET_RELAXED_ORDERING): Delete. * target.def (TARGET_RELAXED_ORDERING): Delete. commit e9c757b843b22609ac161e18fc7cd17e8866562d Author: Ramana Radhakrishnan ramana.radhakrish...@arm.com Date: Fri May 29 10:55:18 2015 +0100 Patch v2 - Remove TARGET_RELAXED_ORDERING. This respun version handles comments from the previous revision. - Simplifies build_atomic_load into build_atomic_load_byte in order to do an atomic load of 1 byte instead of a full word atomic load. - Restructures get_guard_cond to decide whether to use an atomic load or a standard load depending on whether code generated will be in a multi-threaded context or not. - Adjusts all callers of get_guard_cond accordingly. Is this better now ? Bootstrapped and regression tested on aarch64-none-linux-gnu regards Ramana gcc/cp/ChangeLog: 2015-05-29 Ramana Radhakrishnan ramana.radhakrish...@arm.com PR c++/66192 * cp-tree.h (get_guard_cond): Adjust declaration * decl.c (expand_static_init): Use atomic load acquire and adjust call to get_guard_cond. * decl2.c (build_atomic_load_byte): New function. (get_guard_cond): Handle thread_safety. (one_static_initialization_or_destruction): Adjust call to get_guard_cond. gcc/ChangeLog: 2015-05-29 Ramana Radhakrishnan
Re: [PATCH 02/35] Change use to type-based pool allocator in et-forest.c.
On 05/27/2015 07:45 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * et-forest.c (et_new_occ): Use new type-based pool allocator. (et_new_tree): Likewise. (et_free_tree): Likewise. (et_free_tree_force): Likewise. (et_free_pools): Likewise. (et_split): Likewise. OK. jeff v2. From 2d1aa571663a6f503e2722d19e64ba18b2db0403 Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:44 +0200 Subject: [PATCH 02/32] Change use to type-based pool allocator in et-forest.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * et-forest.c (et_new_occ): Use new type-based pool allocator. (et_new_tree): Likewise. (et_free_tree): Likewise. (et_free_tree_force): Likewise. (et_free_pools): Likewise. (et_split): Likewise. --- gcc/dominance.c | 1 + gcc/et-forest.c | 48 +--- gcc/et-forest.h | 15 +++ 3 files changed, 45 insertions(+), 19 deletions(-) diff --git a/gcc/dominance.c b/gcc/dominance.c index 09c8c90..f3c99ba 100644 --- a/gcc/dominance.c +++ b/gcc/dominance.c @@ -51,6 +51,7 @@ #include cfganal.h #include basic-block.h #include diagnostic-core.h +#include alloc-pool.h #include et-forest.h #include timevar.h #include hash-map.h diff --git a/gcc/et-forest.c b/gcc/et-forest.c index da6b7d7..4e55b63 100644 --- a/gcc/et-forest.c +++ b/gcc/et-forest.c @@ -25,8 +25,8 @@ License along with libiberty; see the file COPYING3. If not see #include config.h #include system.h #include coretypes.h -#include et-forest.h #include alloc-pool.h +#include et-forest.h /* We do not enable this with ENABLE_CHECKING, since it is awfully slow. */ #undef DEBUG_ET @@ -59,10 +59,26 @@ struct et_occ on the path to the root. */ struct et_occ *min_occ; /* The occurrence in the subtree with the minimal depth. */ + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { +pool.remove ((et_occ *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocatoret_occ pool; + }; -static alloc_pool et_nodes; -static alloc_pool et_occurrences; +pool_allocatoret_node et_node::pool (et_nodes pool, 300); +pool_allocatoret_occ et_occ::pool (et_occ pool, 300); /* Changes depth of OCC to D. */ @@ -449,11 +465,7 @@ et_splay (struct et_occ *occ) static struct et_occ * et_new_occ (struct et_node *node) { - struct et_occ *nw; - - if (!et_occurrences) -et_occurrences = create_alloc_pool (et_occ pool, sizeof (struct et_occ), 300); - nw = (struct et_occ *) pool_alloc (et_occurrences); + et_occ *nw = new et_occ; nw-of = node; nw-parent = NULL; @@ -474,9 +486,7 @@ et_new_tree (void *data) { struct et_node *nw; - if (!et_nodes) -et_nodes = create_alloc_pool (et_node pool, sizeof (struct et_node), 300); - nw = (struct et_node *) pool_alloc (et_nodes); + nw = new et_node; nw-data = data; nw-father = NULL; @@ -501,8 +511,8 @@ et_free_tree (struct et_node *t) if (t-father) et_split (t); - pool_free (et_occurrences, t-rightmost_occ); - pool_free (et_nodes, t); + delete t-rightmost_occ; + delete t; } /* Releases et tree T without maintaining other nodes. */ @@ -510,10 +520,10 @@ et_free_tree (struct et_node *t) void et_free_tree_force (struct et_node *t) { - pool_free (et_occurrences, t-rightmost_occ); + delete t-rightmost_occ; if (t-parent_occ) -pool_free (et_occurrences, t-parent_occ); - pool_free (et_nodes, t); +delete t-parent_occ; + delete t; } /* Release the alloc pools, if they are empty. */ @@ -521,8 +531,8 @@ et_free_tree_force (struct et_node *t) void et_free_pools (void) { - free_alloc_pool_if_empty (et_occurrences); - free_alloc_pool_if_empty (et_nodes); + et_occ::pool.release_if_empty (); + et_node::pool.release_if_empty (); } /* Sets father of et tree T to FATHER. */ @@ -614,7 +624,7 @@ et_split (struct et_node *t) rmost-depth = 0; rmost-min = 0; - pool_free (et_occurrences, p_occ); + delete p_occ; /* Update the tree. */ if (father-son == t) diff --git a/gcc/et-forest.h b/gcc/et-forest.h index b507c64..15c582d 100644 --- a/gcc/et-forest.h +++ b/gcc/et-forest.h @@ -66,6 +66,21 @@ struct et_node struct et_occ *rightmost_occ; /* The rightmost occurrence. */ struct et_occ *parent_occ; /* The occurrence of the parent node. */ + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { +pool.remove ((et_node *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocatoret_node pool; }; struct et_node *et_new_tree (void *data); -- 2.1.4
Re: [PATCH 03/35] Change use to type-based pool allocator in lra-lives.c.
On 05/27/2015 07:47 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * lra-lives.c (free_live_range): Use new type-based pool allocator. (free_live_range_list) Likewise. (create_live_range) Likewise. (copy_live_range) Likewise. (lra_merge_live_ranges) Likewise. (remove_some_program_points_and_update_live_ranges) Likewise. (lra_live_ranges_init) Likewise. (lra_live_ranges_finish) Likewise. OK. jeff v2. From f44535e764581a661d42b6d8a03bdf0de78d9789 Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:44 +0200 Subject: [PATCH 03/32] Change use to type-based pool allocator in lra-lives.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * lra-lives.c (free_live_range): Use new type-based pool allocator. (free_live_range_list) Likewise. (create_live_range) Likewise. (copy_live_range) Likewise. (lra_merge_live_ranges) Likewise. (remove_some_program_points_and_update_live_ranges) Likewise. (lra_live_ranges_init) Likewise. (lra_live_ranges_finish) Likewise. --- gcc/lra-coalesce.c | 1 + gcc/lra-int.h | 15 +++ gcc/lra-lives.c| 35 ++- gcc/lra-spills.c | 1 + gcc/lra.c | 1 + 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/gcc/lra-coalesce.c b/gcc/lra-coalesce.c index 045691d..b385603 100644 --- a/gcc/lra-coalesce.c +++ b/gcc/lra-coalesce.c @@ -84,6 +84,7 @@ along with GCC; see the file COPYING3. If not see #include except.h #include timevar.h #include ira.h +#include alloc-pool.h #include lra-int.h #include df.h diff --git a/gcc/lra-int.h b/gcc/lra-int.h index 12923ee..42e4a54 100644 --- a/gcc/lra-int.h +++ b/gcc/lra-int.h @@ -54,6 +54,21 @@ struct lra_live_range lra_live_range_t next; /* Pointer to structures with the same start. */ lra_live_range_t start_next; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { +pool.remove ((lra_live_range *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocatorlra_live_range pool; }; typedef struct lra_copy *lra_copy_t; diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c index 085411e..4dfe30f 100644 --- a/gcc/lra-lives.c +++ b/gcc/lra-lives.c @@ -121,14 +121,7 @@ static sparseset unused_set, dead_set; static bitmap_head temp_bitmap; /* Pool for pseudo live ranges. */ -static alloc_pool live_range_pool; - -/* Free live range LR. */ -static void -free_live_range (lra_live_range_t lr) -{ - pool_free (live_range_pool, lr); -} +pool_allocator lra_live_range lra_live_range::pool (live ranges, 100); /* Free live range list LR. */ static void @@ -139,7 +132,7 @@ free_live_range_list (lra_live_range_t lr) while (lr != NULL) { next = lr-next; - free_live_range (lr); + delete lr; lr = next; } } @@ -148,9 +141,7 @@ free_live_range_list (lra_live_range_t lr) static lra_live_range_t create_live_range (int regno, int start, int finish, lra_live_range_t next) { - lra_live_range_t p; - - p = (lra_live_range_t) pool_alloc (live_range_pool); + lra_live_range_t p = new lra_live_range; p-regno = regno; p-start = start; p-finish = finish; @@ -162,11 +153,7 @@ create_live_range (int regno, int start, int finish, lra_live_range_t next) static lra_live_range_t copy_live_range (lra_live_range_t r) { - lra_live_range_t p; - - p = (lra_live_range_t) pool_alloc (live_range_pool); - *p = *r; - return p; + return new lra_live_range (*r); } /* Copy live range list given by its head R and return the result. */ @@ -209,7 +196,7 @@ lra_merge_live_ranges (lra_live_range_t r1, lra_live_range_t r2) r1-start = r2-start; lra_live_range_t temp = r2; r2 = r2-next; - pool_free (live_range_pool, temp); + delete temp; } else { @@ -480,7 +467,7 @@ live_con_fun_n (edge e) basic_block dest = e-dest; bitmap bb_liveout = df_get_live_out (bb); bitmap dest_livein = df_get_live_in (dest); - + return bitmap_ior_and_compl_into (bb_liveout, dest_livein, all_hard_regs_bitmap); } @@ -1024,7 +1011,7 @@ process_bb_lives (basic_block bb, int curr_point, bool dead_insn_p) if (sparseset_bit_p (pseudos_live_through_calls, j)) check_pseudos_live_through_calls (j); } - + if (need_curr_point_incr) next_program_point (curr_point, freq); @@ -1109,7 +1096,7 @@ remove_some_program_points_and_update_live_ranges (void) } prev_r-start = r-start; prev_r-next = next_r; - free_live_range (r); + delete r; } } } @@ -1252,7 +1239,7 @@ lra_create_live_ranges_1 (bool all_p, bool dead_insn_p) } } lra_free_copies (); - + /* Under some circumstances, we can have functions without pseudo registers. For
Re: [PATCH 04/35] Change use to type-based pool allocator in lra.c.
On 05/27/2015 07:50 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * lra.c (init_insn_regs): Use new type-based pool allocator. (new_insn_reg) Likewise. (free_insn_reg) Likewise. (free_insn_regs) Likewise. (finish_insn_regs) Likewise. (init_insn_recog_data) Likewise. (init_reg_info) Likewise. (finish_reg_info) Likewise. (lra_free_copies) Likewise. (lra_create_copy) Likewise. (invalidate_insn_data_regno_info) Likewise. OK. jeff v2 From d4b64952961e379f6d26d609369dc0de4fd0236f Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:45 +0200 Subject: [PATCH 04/32] Change use to type-based pool allocator in lra.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * lra.c (init_insn_regs): Use new type-based pool allocator. (new_insn_reg) Likewise. (free_insn_reg) Likewise. (free_insn_regs) Likewise. (finish_insn_regs) Likewise. (init_insn_recog_data) Likewise. (init_reg_info) Likewise. (finish_reg_info) Likewise. (lra_free_copies) Likewise. (lra_create_copy) Likewise. (invalidate_insn_data_regno_info) Likewise. --- gcc/lra-int.h | 31 +++ gcc/lra.c | 40 ++-- 2 files changed, 41 insertions(+), 30 deletions(-) diff --git a/gcc/lra-int.h b/gcc/lra-int.h index 42e4a54..25bd3ce 100644 --- a/gcc/lra-int.h +++ b/gcc/lra-int.h @@ -84,6 +84,22 @@ struct lra_copy int regno1, regno2; /* Next copy with correspondingly REGNO1 and REGNO2. */ lra_copy_t regno1_next, regno2_next; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { +pool.remove ((lra_copy *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocatorlra_copy pool; + }; /* Common info about a register (pseudo or hard register). */ @@ -191,6 +207,21 @@ struct lra_insn_reg int regno; /* Next reg info of the same insn. */ struct lra_insn_reg *next; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { +pool.remove ((lra_insn_reg *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocatorlra_insn_reg pool; }; /* Static part (common info for insns with the same ICODE) of LRA diff --git a/gcc/lra.c b/gcc/lra.c index 7440668..456f618 100644 --- a/gcc/lra.c +++ b/gcc/lra.c @@ -550,15 +550,7 @@ lra_update_dups (lra_insn_recog_data_t id, signed char *nops) insns. */ /* Pools for insn reg info. */ -static alloc_pool insn_reg_pool; - -/* Initiate pool for insn reg info. */ -static void -init_insn_regs (void) -{ - insn_reg_pool -= create_alloc_pool (insn regs, sizeof (struct lra_insn_reg), 100); -} +pool_allocatorlra_insn_reg lra_insn_reg::pool (insn regs, 100); /* Create LRA insn related info about a reference to REGNO in INSN with TYPE (in/out/inout), biggest reference mode MODE, flag that it is @@ -570,9 +562,7 @@ new_insn_reg (rtx_insn *insn, int regno, enum op_type type, machine_mode mode, bool subreg_p, bool early_clobber, struct lra_insn_reg *next) { - struct lra_insn_reg *ir; - - ir = (struct lra_insn_reg *) pool_alloc (insn_reg_pool); + lra_insn_reg *ir = new lra_insn_reg (); ir-type = type; ir-biggest_mode = mode; if (GET_MODE_SIZE (mode) GET_MODE_SIZE (lra_reg_info[regno].biggest_mode) @@ -585,13 +575,6 @@ new_insn_reg (rtx_insn *insn, int regno, enum op_type type, return ir; } -/* Free insn reg info IR. */ -static void -free_insn_reg (struct lra_insn_reg *ir) -{ - pool_free (insn_reg_pool, ir); -} - /* Free insn reg info list IR. */ static void free_insn_regs (struct lra_insn_reg *ir) @@ -601,7 +584,7 @@ free_insn_regs (struct lra_insn_reg *ir) for (; ir != NULL; ir = next_ir) { next_ir = ir-next; - free_insn_reg (ir); + delete ir; } } @@ -609,7 +592,7 @@ free_insn_regs (struct lra_insn_reg *ir) static void finish_insn_regs (void) { - free_alloc_pool (insn_reg_pool); + lra_insn_reg::pool.release (); } @@ -737,7 +720,6 @@ init_insn_recog_data (void) { lra_insn_recog_data_len = 0; lra_insn_recog_data = NULL; - init_insn_regs (); } /* Expand, if necessary, LRA data about insns. */ @@ -791,6 +773,8 @@ finish_insn_recog_data (void) if ((data = lra_insn_recog_data[i]) != NULL) free_insn_recog_data (data); finish_insn_regs (); + lra_copy::pool.release (); + lra_insn_reg::pool.release (); free (lra_insn_recog_data); } @@ -1310,7 +1294,7 @@ get_new_reg_value (void) } /* Pools for copies. */ -static alloc_pool copy_pool; +pool_allocatorlra_copy lra_copy::pool (lra copies, 100); /* Vec referring
Re: [PATCH 05/35] Change use to type-based pool allocator in ira-color.c.
On 05/27/2015 07:51 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * ira-color.c (init_update_cost_records):Use new type-based pool allocator. (get_update_cost_record) Likewise. (free_update_cost_record_list) Likewise. (finish_update_cost_records) Likewise. (initiate_cost_update) Likewise. OK. jeff v2 From b2142d4d3939a81405f562a0970f7223069f130f Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:46 +0200 Subject: [PATCH 05/32] Change use to type-based pool allocator in ira-color.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * ira-color.c (init_update_cost_records):Use new type-based pool allocator. (get_update_cost_record) Likewise. (free_update_cost_record_list) Likewise. (finish_update_cost_records) Likewise. (initiate_cost_update) Likewise. --- gcc/ira-color.c | 34 -- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/gcc/ira-color.c b/gcc/ira-color.c index 4750714..543440d 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -123,6 +123,21 @@ struct update_cost_record int divisor; /* Next record for given allocno. */ struct update_cost_record *next; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { +pool.remove ((update_cost_record *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocatorupdate_cost_record pool; }; /* To decrease footprint of ira_allocno structure we store all data @@ -1166,16 +1181,8 @@ setup_profitable_hard_regs (void) allocnos. */ /* Pool for update cost records. */ -static alloc_pool update_cost_record_pool; - -/* Initiate update cost records. */ -static void -init_update_cost_records (void) -{ - update_cost_record_pool -= create_alloc_pool (update cost records, - sizeof (struct update_cost_record), 100); -} +static pool_allocatorupdate_cost_record update_cost_record_pool + (update cost records, 100); /* Return new update cost record with given params. */ static struct update_cost_record * @@ -1184,7 +1191,7 @@ get_update_cost_record (int hard_regno, int divisor, { struct update_cost_record *record; - record = (struct update_cost_record *) pool_alloc (update_cost_record_pool); + record = update_cost_record_pool.allocate (); record-hard_regno = hard_regno; record-divisor = divisor; record-next = next; @@ -1200,7 +1207,7 @@ free_update_cost_record_list (struct update_cost_record *list) while (list != NULL) { next = list-next; - pool_free (update_cost_record_pool, list); + update_cost_record_pool.remove (list); list = next; } } @@ -1209,7 +1216,7 @@ free_update_cost_record_list (struct update_cost_record *list) static void finish_update_cost_records (void) { - free_alloc_pool (update_cost_record_pool); + update_cost_record_pool.release (); } /* Array whose element value is TRUE if the corresponding hard @@ -1264,7 +1271,6 @@ initiate_cost_update (void) = (struct update_cost_queue_elem *) ira_allocate (size); memset (update_cost_queue_elems, 0, size); update_cost_check = 0; - init_update_cost_records (); } /* Deallocate data used by function update_costs_from_copies. */ -- 2.1.4
Re: [PATCH 07/35] Change use to type-based pool allocator in var-tracking.c.
On 05/27/2015 03:56 PM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * var-tracking.c (variable_htab_free):Use new type-based pool allocator. (attrs_list_clear) Likewise. (attrs_list_insert) Likewise. (attrs_list_copy) Likewise. (shared_hash_unshare) Likewise. (shared_hash_destroy) Likewise. (unshare_variable) Likewise. (var_reg_delete_and_set) Likewise. (var_reg_delete) Likewise. (var_regno_delete) Likewise. (drop_overlapping_mem_locs) Likewise. (variable_union) Likewise. (insert_into_intersection) Likewise. (canonicalize_values_star) Likewise. (variable_merge_over_cur) Likewise. (dataflow_set_merge) Likewise. (remove_duplicate_values) Likewise. (variable_post_merge_new_vals) Likewise. (dataflow_set_preserve_mem_locs) Likewise. (dataflow_set_remove_mem_locs) Likewise. (variable_from_dropped) Likewise. (variable_was_changed) Likewise. (set_slot_part) Likewise. (clobber_slot_part) Likewise. (delete_slot_part) Likewise. (loc_exp_insert_dep) Likewise. (notify_dependents_of_changed_value) Likewise. (emit_notes_for_differences_1) Likewise. (vt_emit_notes) Likewise. (vt_initialize) Likewise. (vt_finalize) Likewise. --- gcc/var-tracking.c | 201 - 1 file changed, 122 insertions(+), 79 deletions(-) diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 0db4358..f7afed1 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -282,6 +282,21 @@ typedef struct attrs_def /* Offset from start of DECL. */ HOST_WIDE_INT offset; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { +pool.remove((attrs_def *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocatorattrs_def pool; } *attrs; /* Structure for chaining the locations. */ @@ -298,6 +313,21 @@ typedef struct location_chain_def /* Initialized? */ enum var_init_status init; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { +pool.remove((location_chain_def *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocatorlocation_chain_def pool; } *location_chain; /* A vector of loc_exp_dep holds the active dependencies of a one-part @@ -315,6 +345,21 @@ typedef struct loc_exp_dep_s /* A pointer to the pointer to this entry (head or prev's next) in the doubly-linked list. */ struct loc_exp_dep_s **pprev; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { +pool.remove((loc_exp_dep_s *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocatorloc_exp_dep_s pool; } loc_exp_dep; @@ -554,6 +599,21 @@ typedef struct shared_hash_def /* Actual hash table. */ variable_table_type *htab; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { +pool.remove((shared_hash_def *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocatorshared_hash_def pool; } *shared_hash; /* Structure holding the IN or OUT set for a basic block. */ @@ -598,22 +658,28 @@ typedef struct variable_tracking_info_def } *variable_tracking_info; /* Alloc pool for struct attrs_def. */ -static alloc_pool attrs_pool; +pool_allocatorattrs_def attrs_def::pool (attrs_def pool, 1024); /* Alloc pool for struct variable_def with MAX_VAR_PARTS entries. */ -static alloc_pool var_pool; + +static pool_allocatorvariable_def var_pool + (variable_def pool, 64, + (MAX_VAR_PARTS - 1) * sizeof (((variable)NULL)-var_part[0])); /* Alloc pool for struct variable_def with a single var_part entry. */ -static alloc_pool valvar_pool; +static pool_allocatorvariable_def valvar_pool + (small variable_def pool, 256); /* Alloc pool for struct location_chain_def. */ -static alloc_pool loc_chain_pool; +pool_allocatorlocation_chain_def location_chain_def::pool + (location_chain_def pool, 1024); /* Alloc pool for struct shared_hash_def. */ -static alloc_pool shared_hash_pool; +pool_allocatorshared_hash_def shared_hash_def::pool + (shared_hash_def pool, 256); /* Alloc pool for struct loc_exp_dep_s for NOT_ONEPART variables. */ -static alloc_pool loc_exp_dep_pool;
Re: [PATCH 14/35] Change use to type-based pool allocator in df-scan.c.
On 05/27/2015 03:56 PM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * df-scan.c (struct df_scan_problem_data):Use new type-based pool allocator. (df_scan_free_internal) Likewise. (df_scan_alloc) Likewise. (df_grow_reg_info) Likewise. (df_free_ref) Likewise. (df_insn_create_insn_record) Likewise. (df_mw_hardreg_chain_delete) Likewise. (df_insn_info_delete) Likewise. (df_free_collection_rec) Likewise. (df_mw_hardreg_chain_delete_eq_uses) Likewise. (df_sort_and_compress_mws) Likewise. (df_ref_create_structure) Likewise. (df_ref_record) Likewise. --- gcc/df-scan.c | 94 +-- 1 file changed, 46 insertions(+), 48 deletions(-) diff --git a/gcc/df-scan.c b/gcc/df-scan.c index e32eaf5..4646bcf 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -159,15 +159,18 @@ static const unsigned int copy_all = copy_defs | copy_uses | copy_eq_uses it gets run. It also has no need for the iterative solver. */ +#define SCAN_PROBLEM_DATA_BLOCK_SIZE 512 + /* Problem data for the scanning dataflow function. */ struct df_scan_problem_data { - alloc_pool ref_base_pool; - alloc_pool ref_artificial_pool; - alloc_pool ref_regular_pool; - alloc_pool insn_pool; - alloc_pool reg_pool; - alloc_pool mw_reg_pool; + pool_allocatordf_base_ref *ref_base_pool; + pool_allocatordf_artificial_ref *ref_artificial_pool; + pool_allocatordf_regular_ref *ref_regular_pool; + pool_allocatordf_insn_info *insn_pool; + pool_allocatordf_reg_info *reg_pool; + pool_allocatordf_mw_hardreg *mw_reg_pool; + bitmap_obstack reg_bitmaps; bitmap_obstack insn_bitmaps; }; @@ -218,12 +221,12 @@ df_scan_free_internal (void) bitmap_clear (df-insns_to_rescan); bitmap_clear (df-insns_to_notes_rescan); - free_alloc_pool (problem_data-ref_base_pool); - free_alloc_pool (problem_data-ref_artificial_pool); - free_alloc_pool (problem_data-ref_regular_pool); - free_alloc_pool (problem_data-insn_pool); - free_alloc_pool (problem_data-reg_pool); - free_alloc_pool (problem_data-mw_reg_pool); + delete problem_data-ref_base_pool; + delete problem_data-ref_artificial_pool; + delete problem_data-ref_regular_pool; + delete problem_data-insn_pool; + delete problem_data-reg_pool; + delete problem_data-mw_reg_pool; bitmap_obstack_release (problem_data-reg_bitmaps); bitmap_obstack_release (problem_data-insn_bitmaps); free (df_scan-problem_data); @@ -264,7 +267,6 @@ df_scan_alloc (bitmap all_blocks ATTRIBUTE_UNUSED) { struct df_scan_problem_data *problem_data; unsigned int insn_num = get_max_uid () + 1; - unsigned int block_size = 512; basic_block bb; /* Given the number of pools, this is really faster than tearing @@ -276,24 +278,18 @@ df_scan_alloc (bitmap all_blocks ATTRIBUTE_UNUSED) df_scan-problem_data = problem_data; df_scan-computed = true; - problem_data-ref_base_pool -= create_alloc_pool (df_scan ref base, -sizeof (struct df_base_ref), block_size); - problem_data-ref_artificial_pool -= create_alloc_pool (df_scan ref artificial, -sizeof (struct df_artificial_ref), block_size); - problem_data-ref_regular_pool -= create_alloc_pool (df_scan ref regular, -sizeof (struct df_regular_ref), block_size); - problem_data-insn_pool -= create_alloc_pool (df_scan insn, -sizeof (struct df_insn_info), block_size); - problem_data-reg_pool -= create_alloc_pool (df_scan reg, -sizeof (struct df_reg_info), block_size); - problem_data-mw_reg_pool -= create_alloc_pool (df_scan mw_reg, -sizeof (struct df_mw_hardreg), block_size / 16); + problem_data-ref_base_pool = new pool_allocatordf_base_ref +(df_scan ref base, SCAN_PROBLEM_DATA_BLOCK_SIZE); + problem_data-ref_artificial_pool = new pool_allocatordf_artificial_ref +(df_scan ref artificial, SCAN_PROBLEM_DATA_BLOCK_SIZE); + problem_data-ref_regular_pool = new pool_allocatordf_regular_ref +(df_scan ref regular, SCAN_PROBLEM_DATA_BLOCK_SIZE); + problem_data-insn_pool = new pool_allocatordf_insn_info +(df_scan insn, SCAN_PROBLEM_DATA_BLOCK_SIZE); + problem_data-reg_pool = new pool_allocatordf_reg_info +(df_scan reg, SCAN_PROBLEM_DATA_BLOCK_SIZE); + problem_data-mw_reg_pool = new pool_allocatordf_mw_hardreg +(df_scan mw_reg, SCAN_PROBLEM_DATA_BLOCK_SIZE / 16); bitmap_obstack_initialize (problem_data-reg_bitmaps); bitmap_obstack_initialize (problem_data-insn_bitmaps); @@ -519,13 +515,14 @@ df_grow_reg_info (void) { struct df_reg_info *reg_info; - reg_info = (struct df_reg_info *) pool_alloc (problem_data-reg_pool); + // TODO + reg_info =
Re: [PATCH 15/35] Change use to type-based pool allocator in dse.c.
On 05/27/2015 03:56 PM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * dse.c (get_group_info):Use new type-based pool allocator. (dse_step0) Likewise. (free_store_info) Likewise. (delete_dead_store_insn) Likewise. (free_read_records) Likewise. (record_store) Likewise. (replace_read) Likewise. (check_mem_read_rtx) Likewise. (scan_insn) Likewise. (dse_step1) Likewise. (dse_step7) Likewise. --- gcc/dse.c | 201 -- 1 file changed, 129 insertions(+), 72 deletions(-) diff --git a/gcc/dse.c b/gcc/dse.c index b3b38d5..5ade9dd 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -249,7 +249,7 @@ static struct obstack dse_obstack; /* Scratch bitmap for cselib's cselib_expand_value_rtx. */ static bitmap scratch = NULL; -struct insn_info; +struct insn_info_type; /* This structure holds information about a candidate store. */ struct store_info @@ -316,7 +316,7 @@ struct store_info /* Set if this store stores the same constant value as REDUNDANT_REASON insn stored. These aren't eliminated early, because doing that might prevent the earlier larger store to be eliminated. */ - struct insn_info *redundant_reason; + struct insn_info_type *redundant_reason; }; /* Return a bitmask with the first N low bits set. */ @@ -329,12 +329,15 @@ lowpart_bitmask (int n) } typedef struct store_info *store_info_t; -static alloc_pool cse_store_info_pool; -static alloc_pool rtx_store_info_pool; +static pool_allocatorstore_info cse_store_info_pool (cse_store_info_pool, + 100); + +static pool_allocatorstore_info rtx_store_info_pool (rtx_store_info_pool, + 100); /* This structure holds information about a load. These are only built for rtx bases. */ -struct read_info +struct read_info_type { /* The id of the mem group of the base address. */ int group_id; @@ -351,15 +354,30 @@ struct read_info rtx mem; /* The next read_info for this insn. */ - struct read_info *next; + struct read_info_type *next; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { +pool.remove((read_info_type *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocatorread_info_type pool; }; -typedef struct read_info *read_info_t; -static alloc_pool read_info_pool; +typedef struct read_info_type *read_info_t; +pool_allocatorread_info_type read_info_type::pool (read_info_pool, 100); /* One of these records is created for each insn. */ -struct insn_info +struct insn_info_type { /* Set true if the insn contains a store but the insn itself cannot be deleted. This is set if the insn is a parallel and there is @@ -433,27 +451,41 @@ struct insn_info regset fixed_regs_live; /* The prev insn in the basic block. */ - struct insn_info * prev_insn; + struct insn_info_type * prev_insn; /* The linked list of insns that are in consideration for removal in the forwards pass through the basic block. This pointer may be trash as it is not cleared when a wild read occurs. The only time it is guaranteed to be correct is when the traversal starts at active_local_stores. */ - struct insn_info * next_local_store; + struct insn_info_type * next_local_store; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { +pool.remove((insn_info_type *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocatorinsn_info_type pool; }; +typedef struct insn_info_type *insn_info_t; -typedef struct insn_info *insn_info_t; -static alloc_pool insn_info_pool; +pool_allocatorinsn_info_type insn_info_type::pool (insn_info_pool, 100); /* The linked list of stores that are under consideration in this basic block. */ static insn_info_t active_local_stores; static int active_local_stores_len; -struct dse_bb_info +struct dse_bb_info_type { - /* Pointer to the insn info for the last insn in the block. These are linked so this is how all of the insns are reached. During scanning this is the current insn being scanned. */ @@ -507,10 +539,25 @@ struct dse_bb_info to assure that shift and/or add sequences that are inserted do not accidentally clobber live hard regs. */ bitmap regs_live; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator
Re: [PATCH][ARM/AArch64 Testsuite] Cleanup advsimd-intrinsics.exp, removing unnecessary loop
On 29 May 2015 at 12:48, Alan Lawrence alan.lawre...@arm.com wrote: Christophe Lyon wrote: This looks OK, but why can't you also drop the other torture-related lines as you did in your previous patch? I mean: load_lib c-torture.exp load_lib torture-options.exp etc... We need c-torture.exp in order to set-torture-options; we need to set-torture-options to get the right list of variants, as otherwise we lose -Og -g (as I did in my original patch 13/14 for float16). However, I think we can drop the rest - here's v2, which I've cross-tested on aarch64-none-elf, aarch64_be-none-elf and arm-none-eabi: It makes sense, thanks for the clarification. Christophe. diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/advsimd-intrins index 583832a..4679a73 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp @@ -27,8 +27,6 @@ load_lib gcc-dg.exp # Initialize `dg'. load_lib c-torture.exp -load_lib target-supports.exp -load_lib torture-options.exp dg-init @@ -48,29 +46,15 @@ if {[istarget arm*-*-*]} then { } } -torture-init set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS # Make sure Neon flags are provided, if necessary. set additional_flags [add_options_for_arm_neon ] # Main loop. -foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { -# If we're only testing specific files and this isn't one of them, skip it. -if ![runtest_file_p $runtests $src] then { - continue -} - -# runtest_file_p is already run above, and the code below can run -# runtest_file_p again, make sure everything for this test is -# performed if the above runtest_file_p decided this runtest -# instance should execute the test -gcc_parallel_test_enable 0 -gcc-dg-runtest $src $additional_flags -gcc_parallel_test_enable 1 -} +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] \ + ${additional_flags} # All done. set dg-do-what-default ${save-dg-do-what-default}
Re: [PATCH 16/35] Change use to type-based pool allocator in tree-sra.c.
On 05/27/2015 08:02 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * tree-sra.c (sra_initialize): Use new type-based pool allocator. (sra_deinitialize) Likewise. (create_access_1) Likewise. (build_accesses_from_assign) Likewise. (create_artificial_child_access) Likewise. OK. jeff v2 From a9d3c0a7d4c596d6b5b550b14d0754eae748e2b4 Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:49 +0200 Subject: [PATCH 15/32] Change use to type-based pool allocator in tree-sra.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * tree-sra.c (sra_initialize): Use new type-based pool allocator. (sra_deinitialize) Likewise. (create_access_1) Likewise. (build_accesses_from_assign) Likewise. (create_artificial_child_access) Likewise. --- gcc/tree-sra.c | 48 +--- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 4b0d2a8..3c3c320 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -300,13 +300,28 @@ struct access /* Set when we discover that this pointer is not safe to dereference in the caller. */ unsigned grp_not_necessarilly_dereferenced : 1; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { +pool.remove ((access *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocatoraccess pool; }; typedef struct access *access_p; /* Alloc pool for allocating access structures. */ -static alloc_pool access_pool; +pool_allocatorstruct access access::pool (SRA accesses, 16); /* A structure linking lhs and rhs accesses from an aggregate assignment. They are used to propagate subaccesses from rhs to lhs as long as they don't @@ -315,10 +330,25 @@ struct assign_link { struct access *lacc, *racc; struct assign_link *next; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { +return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { +pool.remove ((assign_link *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocatorassign_link pool; }; /* Alloc pool for allocating assign link structures. */ -static alloc_pool link_pool; +pool_allocatorassign_link assign_link::pool (SRA links, 16); /* Base (tree) - Vector (vecaccess_p *) map. */ static hash_maptree, auto_vecaccess_p *base_access_vec; @@ -690,8 +720,6 @@ sra_initialize (void) should_scalarize_away_bitmap = BITMAP_ALLOC (NULL); cannot_scalarize_away_bitmap = BITMAP_ALLOC (NULL); gcc_obstack_init (name_obstack); - access_pool = create_alloc_pool (SRA accesses, sizeof (struct access), 16); - link_pool = create_alloc_pool (SRA links, sizeof (struct assign_link), 16); base_access_vec = new hash_maptree, auto_vecaccess_p ; memset (sra_stats, 0, sizeof (sra_stats)); encountered_apply_args = false; @@ -709,8 +737,8 @@ sra_deinitialize (void) candidates = NULL; BITMAP_FREE (should_scalarize_away_bitmap); BITMAP_FREE (cannot_scalarize_away_bitmap); - free_alloc_pool (access_pool); - free_alloc_pool (link_pool); + access::pool.release (); + assign_link::pool.release (); obstack_free (name_obstack, NULL); delete base_access_vec; @@ -862,9 +890,8 @@ mark_parm_dereference (tree base, HOST_WIDE_INT dist, gimple stmt) static struct access * create_access_1 (tree base, HOST_WIDE_INT offset, HOST_WIDE_INT size) { - struct access *access; + struct access *access = new struct access (); - access = (struct access *) pool_alloc (access_pool); memset (access, 0, sizeof (struct access)); access-base = base; access-offset = offset; @@ -1239,7 +1266,7 @@ build_accesses_from_assign (gimple stmt) { struct assign_link *link; - link = (struct assign_link *) pool_alloc (link_pool); + link = new assign_link; memset (link, 0, sizeof (struct assign_link)); link-lacc = lacc; @@ -2393,13 +2420,12 @@ static struct access * create_artificial_child_access (struct access *parent, struct access *model, HOST_WIDE_INT new_offset) { - struct access *access; struct access **child; tree expr = parent-base; gcc_assert (!model-grp_unscalarizable_region); - access = (struct access *) pool_alloc (access_pool); + struct access *access = new struct access (); memset (access, 0, sizeof (struct access)); if (!build_user_friendly_ref_for_offset (expr, TREE_TYPE (expr), new_offset, model-type)) -- 2.1.4
Re: [PATCH 17/35] Change use to type-based pool allocator in tree-ssa-math-opts.c.
On 05/27/2015 08:03 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * tree-ssa-math-opts.c (occ_new): Use new type-based pool allocator. (free_bb): Likewise. (pass_cse_reciprocals::execute): Likewise. OK. jeff v2 From 3fffec068dfb9ee2b8c23a6b95db33afd8dc6c90 Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:49 +0200 Subject: [PATCH 16/32] Change use to type-based pool allocator in tree-ssa-math-opts.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * tree-ssa-math-opts.c (occ_new): Use new type-based pool allocator. (free_bb): Likewise. (pass_cse_reciprocals::execute): Likewise. --- gcc/tree-ssa-math-opts.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index 98e2c49..0df755b 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -229,7 +229,7 @@ static struct static struct occurrence *occ_head; /* Allocation pool for getting instances of struct occurrence. */ -static alloc_pool occ_pool; +static pool_allocatoroccurrence *occ_pool; @@ -240,7 +240,7 @@ occ_new (basic_block bb, struct occurrence *children) { struct occurrence *occ; - bb-aux = occ = (struct occurrence *) pool_alloc (occ_pool); + bb-aux = occ = occ_pool-allocate (); memset (occ, 0, sizeof (struct occurrence)); occ-bb = bb; @@ -468,7 +468,7 @@ free_bb (struct occurrence *occ) next = occ-next; child = occ-children; occ-bb-aux = NULL; - pool_free (occ_pool, occ); + occ_pool-remove (occ); /* Now ensure that we don't recurse unless it is necessary. */ if (!child) @@ -572,9 +572,8 @@ pass_cse_reciprocals::execute (function *fun) basic_block bb; tree arg; - occ_pool = create_alloc_pool (dominators for recip, -sizeof (struct occurrence), -n_basic_blocks_for_fn (fun) / 3 + 1); + occ_pool = new pool_allocatoroccurrence +(dominators for recip, n_basic_blocks_for_fn (fun) / 3 + 1); memset (reciprocal_stats, 0, sizeof (reciprocal_stats)); calculate_dominance_info (CDI_DOMINATORS); @@ -704,7 +703,7 @@ pass_cse_reciprocals::execute (function *fun) free_dominance_info (CDI_DOMINATORS); free_dominance_info (CDI_POST_DOMINATORS); - free_alloc_pool (occ_pool); + delete occ_pool; return 0; } -- 2.1.4
Re: [PATCH 18/35] Change use to type-based pool allocator in stmt.c.
On 05/27/2015 08:09 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * stmt.c (add_case_node): Use new type-based pool allocator. (expand_case): Likewise. (expand_sjlj_dispatch_table): Likewise. OK. jeff v2 From 7d6b26873043b383aaa0b382f4edbcf43424ea54 Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:50 +0200 Subject: [PATCH 17/32] Change use to type-based pool allocator in stmt.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * stmt.c (add_case_node): Use new type-based pool allocator. (expand_case): Likewise. (expand_sjlj_dispatch_table): Likewise. --- gcc/stmt.c | 16 +--- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/gcc/stmt.c b/gcc/stmt.c index 303df72..a04f69b 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -748,7 +748,7 @@ do_jump_if_equal (machine_mode mode, rtx op0, rtx op1, rtx_code_label *label, static struct case_node * add_case_node (struct case_node *head, tree low, tree high, - tree label, int prob, alloc_pool case_node_pool) + tree label, int prob, pool_allocatorcase_node case_node_pool) { struct case_node *r; @@ -756,7 +756,7 @@ add_case_node (struct case_node *head, tree low, tree high, gcc_checking_assert (high (TREE_TYPE (low) == TREE_TYPE (high))); /* Add this label to the chain. */ - r = (struct case_node *) pool_alloc (case_node_pool); + r = case_node_pool.allocate (); r-low = low; r-high = high; r-code_label = label; @@ -1160,7 +1160,7 @@ expand_case (gswitch *stmt) struct case_node *case_list = 0; /* A pool for case nodes. */ - alloc_pool case_node_pool; + pool_allocatorcase_node case_node_pool (struct case_node pool, 100); /* An ERROR_MARK occurs for various reasons including invalid data type. ??? Can this still happen, with GIMPLE and all? */ @@ -1171,9 +1171,6 @@ expand_case (gswitch *stmt) expressions being INTEGER_CST. */ gcc_assert (TREE_CODE (index_expr) != INTEGER_CST); - case_node_pool = create_alloc_pool (struct case_node pool, - sizeof (struct case_node), - 100); do_pending_stack_adjust (); @@ -1273,7 +1270,6 @@ expand_case (gswitch *stmt) reorder_insns (NEXT_INSN (before_case), get_last_insn (), before_case); free_temp_slots (); - free_alloc_pool (case_node_pool); } /* Expand the dispatch to a short decrement chain if there are few cases @@ -1340,9 +1336,8 @@ expand_sjlj_dispatch_table (rtx dispatch_index, { /* Similar to expand_case, but much simpler. */ struct case_node *case_list = 0; - alloc_pool case_node_pool = create_alloc_pool (struct sjlj_case pool, - sizeof (struct case_node), - ncases); + pool_allocatorcase_node case_node_pool (struct sjlj_case pool, + ncases); tree index_expr = make_tree (index_type, dispatch_index); tree minval = build_int_cst (index_type, 0); tree maxval = CASE_LOW (dispatch_table.last ()); @@ -1362,7 +1357,6 @@ expand_sjlj_dispatch_table (rtx dispatch_index, minval, maxval, range, BLOCK_FOR_INSN (before_case)); emit_label (default_label); - free_alloc_pool (case_node_pool); } /* Dispatching something not handled? Trap! */ -- 2.1.4
Re: [PATCH 20/35] Change use to type-based pool allocator in ira-build.c.
On 05/27/2015 08:12 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * ira-build.c (initiate_cost_vectors): Use new type-based pool allocator. (ira_allocate_cost_vector): Likewise. (ira_free_cost_vector): Likewise. (finish_cost_vectors): Likewise. OK. jeff v2 From 3df359fb77e6e60341ef5f9dec2898708245f5ee Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:51 +0200 Subject: [PATCH 19/32] Change use to type-based pool allocator in ira-build.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * ira-build.c (initiate_cost_vectors): Use new type-based pool allocator. (ira_allocate_cost_vector): Likewise. (ira_free_cost_vector): Likewise. (finish_cost_vectors): Likewise. --- gcc/ira-build.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/gcc/ira-build.c b/gcc/ira-build.c index 8b6b956..2de7d34 100644 --- a/gcc/ira-build.c +++ b/gcc/ira-build.c @@ -1633,7 +1633,7 @@ finish_copies (void) /* Pools for cost vectors. It is defined only for allocno classes. */ -static alloc_pool cost_vector_pool[N_REG_CLASSES]; +static pool_allocatorint * cost_vector_pool[N_REG_CLASSES]; /* The function initiates work with hard register cost vectors. It creates allocation pool for each allocno class. */ @@ -1646,10 +1646,9 @@ initiate_cost_vectors (void) for (i = 0; i ira_allocno_classes_num; i++) { aclass = ira_allocno_classes[i]; - cost_vector_pool[aclass] - = create_alloc_pool (cost vectors, - sizeof (int) * ira_class_hard_regs_num[aclass], - 100); + cost_vector_pool[aclass] = new pool_allocatorint + (cost vectors, 100, + sizeof (int) * (ira_class_hard_regs_num[aclass] - 1)); } } @@ -1657,7 +1656,7 @@ initiate_cost_vectors (void) int * ira_allocate_cost_vector (reg_class_t aclass) { - return (int *) pool_alloc (cost_vector_pool[(int) aclass]); + return cost_vector_pool[(int) aclass]-allocate (); } /* Free a cost vector VEC for ACLASS. */ @@ -1665,7 +1664,7 @@ void ira_free_cost_vector (int *vec, reg_class_t aclass) { ira_assert (vec != NULL); - pool_free (cost_vector_pool[(int) aclass], vec); + cost_vector_pool[(int) aclass]-remove (vec); } /* Finish work with hard register cost vectors. Release allocation @@ -1679,7 +1678,7 @@ finish_cost_vectors (void) for (i = 0; i ira_allocno_classes_num; i++) { aclass = ira_allocno_classes[i]; - free_alloc_pool (cost_vector_pool[aclass]); + delete cost_vector_pool[aclass]; } } -- 2.1.4
Re: [PATCH 30/35] Change use to type-based pool allocator in ipa-inline-analysis.c.
On 05/27/2015 03:56 PM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * ipa-inline-analysis.c (edge_set_predicate): Use new type-based pool allocator. (set_hint_predicate): Likewise. (inline_summary_alloc): Likewise. (reset_inline_edge_summary): Likewise. (reset_inline_summary): Likewise. (set_cond_stmt_execution_predicate): Likewise. (set_switch_stmt_execution_predicate): Likewise. (compute_bb_predicates): Likewise. (estimate_function_body_sizes): Likewise. (inline_free_summary): Likewise. --- gcc/ipa-inline-analysis.c | 39 +-- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 5d99887..7d8edee 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -170,7 +170,7 @@ vecinline_edge_summary_t inline_edge_summary_vec; vecedge_growth_cache_entry edge_growth_cache; /* Edge predicates goes here. */ -static alloc_pool edge_predicate_pool; +static pool_allocatorpredicate edge_predicate_pool (edge predicates, 10); /* Return true predicate (tautology). We represent it by empty list of clauses. */ @@ -804,13 +804,13 @@ edge_set_predicate (struct cgraph_edge *e, struct predicate *predicate) if (predicate !true_predicate_p (predicate)) { if (!es-predicate) - es-predicate = (struct predicate *) pool_alloc (edge_predicate_pool); + es-predicate = edge_predicate_pool.allocate (); *es-predicate = *predicate; } else { if (es-predicate) - pool_free (edge_predicate_pool, es-predicate); + edge_predicate_pool.remove (es-predicate); es-predicate = NULL; } } @@ -823,13 +823,13 @@ set_hint_predicate (struct predicate **p, struct predicate new_predicate) if (false_predicate_p (new_predicate) || true_predicate_p (new_predicate)) { if (*p) - pool_free (edge_predicate_pool, *p); + edge_predicate_pool.remove (*p); *p = NULL; } else { if (!*p) - *p = (struct predicate *) pool_alloc (edge_predicate_pool); + *p = edge_predicate_pool.allocate (); **p = new_predicate; } } @@ -1044,9 +1044,6 @@ inline_summary_alloc (void) if (inline_edge_summary_vec.length () = (unsigned) symtab-edges_max_uid) inline_edge_summary_vec.safe_grow_cleared (symtab-edges_max_uid + 1); - if (!edge_predicate_pool) -edge_predicate_pool = create_alloc_pool (edge predicates, -sizeof (struct predicate), 10); } /* We are called multiple time for given function; clear @@ -1061,7 +1058,7 @@ reset_inline_edge_summary (struct cgraph_edge *e) es-call_stmt_size = es-call_stmt_time = 0; if (es-predicate) - pool_free (edge_predicate_pool, es-predicate); + edge_predicate_pool.remove (es-predicate); es-predicate = NULL; es-param.release (); } @@ -1086,17 +1083,17 @@ reset_inline_summary (struct cgraph_node *node, info-scc_no = 0; if (info-loop_iterations) { - pool_free (edge_predicate_pool, info-loop_iterations); + edge_predicate_pool.remove (info-loop_iterations); info-loop_iterations = NULL; } if (info-loop_stride) { - pool_free (edge_predicate_pool, info-loop_stride); + edge_predicate_pool.remove (info-loop_stride); info-loop_stride = NULL; } if (info-array_index) { - pool_free (edge_predicate_pool, info-array_index); + edge_predicate_pool.remove (info-array_index); info-array_index = NULL; } vec_free (info-conds); @@ -1812,7 +1809,7 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info, struct predicate p = add_condition (summary, index, aggpos, this_code, gimple_cond_rhs (last)); - e-aux = pool_alloc (edge_predicate_pool); + e-aux = edge_predicate_pool.allocate (); *(struct predicate *) e-aux = p; } } @@ -1845,7 +1842,7 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info, { struct predicate p = add_condition (summary, index, aggpos, IS_NOT_CONSTANT, NULL_TREE); - e-aux = pool_alloc (edge_predicate_pool); + e-aux = edge_predicate_pool.allocate (); *(struct predicate *) e-aux = p; } } @@ -1878,7 +1875,7 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info, FOR_EACH_EDGE (e, ei, bb-succs) { - e-aux = pool_alloc (edge_predicate_pool); + e-aux = edge_predicate_pool.allocate (); *(struct predicate *) e-aux = false_predicate (); } n = gimple_switch_num_labels (last); @@ -1932,7 +1929,7 @@
Re: [PATCH 28/35] Change use to type-based pool allocator in ipa-profile.c.
On 05/27/2015 08:15 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * ipa-profile.c (account_time_size): Use new type-based pool allocator. (ipa_profile_generate_summary): Likewise. (ipa_profile_read_summary): Likewise. (ipa_profile): Likewise. OK. jeff v2 From 25e42b4ede0c9d2d6a2ba015166805611957fc53 Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:54 +0200 Subject: [PATCH 27/32] Change use to type-based pool allocator in ipa-profile.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * ipa-profile.c (account_time_size): Use new type-based pool allocator. (ipa_profile_generate_summary): Likewise. (ipa_profile_read_summary): Likewise. (ipa_profile): Likewise. --- gcc/ipa-profile.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c index e0d4266..7c967f9 100644 --- a/gcc/ipa-profile.c +++ b/gcc/ipa-profile.c @@ -107,7 +107,8 @@ struct histogram_entry duplicate entries. */ vechistogram_entry * histogram; -static alloc_pool histogram_pool; +static pool_allocatorhistogram_entry histogram_pool + (IPA histogram, 10); /* Hashtable support for storing SSA names hashed by their SSA_NAME_VAR. */ @@ -144,7 +145,7 @@ account_time_size (hash_tablehistogram_hash *hashtable, if (!*val) { - *val = (histogram_entry *) pool_alloc (histogram_pool); + *val = histogram_pool.allocate (); **val = key; histogram.safe_push (*val); } @@ -205,8 +206,6 @@ ipa_profile_generate_summary (void) basic_block bb; hash_tablehistogram_hash hashtable (10); - histogram_pool = create_alloc_pool (IPA histogram, sizeof (struct histogram_entry), - 10); FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node) FOR_EACH_BB_FN (bb, DECL_STRUCT_FUNCTION (node-decl)) @@ -287,8 +286,6 @@ ipa_profile_read_summary (void) int j = 0; hash_tablehistogram_hash hashtable (10); - histogram_pool = create_alloc_pool (IPA histogram, sizeof (struct histogram_entry), - 10); while ((file_data = file_data_vec[j++])) { @@ -593,7 +590,7 @@ ipa_profile (void) } } histogram.release (); - free_alloc_pool (histogram_pool); + histogram_pool.release (); /* Produce speculative calls: we saved common traget from porfiling into e-common_target_id. Now, at link time, we can look up corresponding -- 2.1.4
Re: [PATCH 32/35] Change use to type-based pool allocator in ira-build.c.
On 05/27/2015 08:21 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * ira-build.c (finish_allocnos): Use new type-based pool allocator. (finish_prefs): Likewise. (finish_copies): Likewise. Is this a partial duplicate of patch #34? Something seems amiss here. jeff v2 From b5e1163dc80daf303431589eb71611afd60c08ef Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:56 +0200 Subject: [PATCH 31/32] Change use to type-based pool allocator in ira-build.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * ira-build.c (initiate_allocnos): Use new type-based pool allocator. (ira_create_object): Likewise. (ira_create_allocno): Likewise. (ira_create_live_range): Likewise. (copy_live_range): Likewise. (ira_finish_live_range): Likewise. (ira_free_allocno_costs): Likewise. (finish_allocno): Likewise. (finish_allocnos): Likewise. (initiate_prefs): Likewise. (ira_create_pref): Likewise. (finish_pref): Likewise. (finish_prefs): Likewise. (initiate_copies): Likewise. (ira_create_copy): Likewise. (finish_copy): Likewise. (finish_copies): Likewise. (finish_prefs): Likewise. --- gcc/ira-build.c | 51 +-- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/gcc/ira-build.c b/gcc/ira-build.c index 2de7d34..534d0bc 100644 --- a/gcc/ira-build.c +++ b/gcc/ira-build.c @@ -428,7 +428,9 @@ rebuild_regno_allocno_maps (void) /* Pools for allocnos, allocno live ranges and objects. */ -static alloc_pool allocno_pool, live_range_pool, object_pool; +static pool_allocatorlive_range live_range_pool (live ranges, 100); +static pool_allocatorira_allocno allocno_pool (allocnos, 100); +static pool_allocatorira_object object_pool (objects, 100); /* Vec containing references to all created allocnos. It is a container of array allocnos. */ @@ -442,13 +444,6 @@ static vecira_object_t ira_object_id_map_vec; static void initiate_allocnos (void) { - live_range_pool -= create_alloc_pool (live ranges, - sizeof (struct live_range), 100); - allocno_pool -= create_alloc_pool (allocnos, sizeof (struct ira_allocno), 100); - object_pool -= create_alloc_pool (objects, sizeof (struct ira_object), 100); allocno_vec.create (max_reg_num () * 2); ira_allocnos = NULL; ira_allocnos_num = 0; @@ -466,7 +461,7 @@ static ira_object_t ira_create_object (ira_allocno_t a, int subword) { enum reg_class aclass = ALLOCNO_CLASS (a); - ira_object_t obj = (ira_object_t) pool_alloc (object_pool); + ira_object_t obj = object_pool.allocate (); OBJECT_ALLOCNO (obj) = a; OBJECT_SUBWORD (obj) = subword; @@ -501,7 +496,7 @@ ira_create_allocno (int regno, bool cap_p, { ira_allocno_t a; - a = (ira_allocno_t) pool_alloc (allocno_pool); + a = allocno_pool.allocate (); ALLOCNO_REGNO (a) = regno; ALLOCNO_LOOP_TREE_NODE (a) = loop_tree_node; if (! cap_p) @@ -943,7 +938,7 @@ ira_create_live_range (ira_object_t obj, int start, int finish, { live_range_t p; - p = (live_range_t) pool_alloc (live_range_pool); + p = live_range_pool.allocate (); p-object = obj; p-start = start; p-finish = finish; @@ -968,7 +963,7 @@ copy_live_range (live_range_t r) { live_range_t p; - p = (live_range_t) pool_alloc (live_range_pool); + p = live_range_pool.allocate (); *p = *r; return p; } @@ -1089,7 +1084,7 @@ ira_live_ranges_intersect_p (live_range_t r1, live_range_t r2) void ira_finish_live_range (live_range_t r) { - pool_free (live_range_pool, r); + live_range_pool.remove (r); } /* Free list of allocno live ranges starting with R. */ @@ -1136,7 +1131,7 @@ ira_free_allocno_costs (ira_allocno_t a) ira_object_id_map[OBJECT_CONFLICT_ID (obj)] = NULL; if (OBJECT_CONFLICT_ARRAY (obj) != NULL) ira_free (OBJECT_CONFLICT_ARRAY (obj)); - pool_free (object_pool, obj); + object_pool.remove (obj); } ira_allocnos[ALLOCNO_NUM (a)] = NULL; @@ -1160,7 +1155,7 @@ static void finish_allocno (ira_allocno_t a) { ira_free_allocno_costs (a); - pool_free (allocno_pool, a); + allocno_pool.remove (a); } /* Free the memory allocated for all allocnos. */ @@ -1175,15 +1170,15 @@ finish_allocnos (void) ira_free (ira_regno_allocno_map); ira_object_id_map_vec.release (); allocno_vec.release (); - free_alloc_pool (allocno_pool); - free_alloc_pool (object_pool); - free_alloc_pool (live_range_pool); + allocno_pool.release (); + object_pool.release (); + live_range_pool.release (); } /* Pools for allocno preferences. */ -static alloc_pool pref_pool; +static pool_allocator ira_allocno_pref pref_pool (prefs, 100); /* Vec containing references to all created preferences. It is a container of array ira_prefs. */ @@ -1193,8 +1188,6 @@ static vecira_pref_t pref_vec; static void initiate_prefs (void) { - pref_pool -= create_alloc_pool (prefs,
Re: [PATCH 31/35] Change use to type-based pool allocator in ipa-prop.c and ipa-cp.c.
On 05/27/2015 03:56 PM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * ipa-cp.c (ipcp_value::add_source): Use new type-based pool allocator. (allocate_and_init_ipcp_value): Likewise. (ipcp_lattice::add_value): Likewise. (merge_agg_lats_step): Likewise. (ipcp_driver): Likewise. * ipa-prop.c (ipa_free_all_structures_after_ipa_cp): Likewise. (ipa_free_all_structures_after_iinln): Likewise. * ipa-prop.h: Likewise. --- gcc/ipa-cp.c | 37 + gcc/ipa-prop.c | 20 gcc/ipa-prop.h | 19 +++ 3 files changed, 40 insertions(+), 36 deletions(-) diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 356f402..0c3f885 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -291,10 +291,17 @@ public: /* Allocation pools for values and their sources in ipa-cp. */ -alloc_pool ipcp_cst_values_pool; -alloc_pool ipcp_poly_ctx_values_pool; -alloc_pool ipcp_sources_pool; -alloc_pool ipcp_agg_lattice_pool; +pool_allocatoripcp_valuetree ipcp_cst_values_pool (IPA-CP constant values, + 32); + +pool_allocatoripcp_valueipa_polymorphic_call_context ipcp_poly_ctx_values_pool + (IPA-CP polymorphic contexts, 32); + +pool_allocatoripcp_value_sourcetree ipcp_sources_pool + (IPA-CP value sources, 64); + +pool_allocatoripcp_agg_lattice ipcp_agg_lattice_pool + (IPA_CP aggregate lattices, 32); /* Maximal count found in program. */ @@ -1147,7 +1154,7 @@ ipcp_valuevaltype::add_source (cgraph_edge *cs, ipcp_value *src_val, { ipcp_value_sourcevaltype *src; - src = new (pool_alloc (ipcp_sources_pool)) ipcp_value_sourcevaltype; + src = new (ipcp_sources_pool.allocate ()) ipcp_value_sourcevaltype; src-offset = offset; src-cs = cs; src-val = src_val; @@ -1165,7 +1172,7 @@ allocate_and_init_ipcp_value (tree source) { ipcp_valuetree *val; - val = new (pool_alloc (ipcp_cst_values_pool)) ipcp_valuetree; + val = ipcp_cst_values_pool.allocate (); memset (val, 0, sizeof (*val)); val-value = source; return val; @@ -1179,8 +1186,8 @@ allocate_and_init_ipcp_value (ipa_polymorphic_call_context source) { ipcp_valueipa_polymorphic_call_context *val; - val = new (pool_alloc (ipcp_poly_ctx_values_pool)) -ipcp_valueipa_polymorphic_call_context; + // TODO + val = ipcp_poly_ctx_values_pool.allocate (); memset (val, 0, sizeof (*val)); val-value = source; return val; @@ -1229,7 +1236,7 @@ ipcp_latticevaltype::add_value (valtype newval, cgraph_edge *cs, { ipcp_value_sourcevaltype *src = val-sources; val-sources = src-next; - pool_free (ipcp_sources_pool, src); + ipcp_sources_pool.remove ((ipcp_value_sourcetree*)src); } } @@ -1599,7 +1606,7 @@ merge_agg_lats_step (struct ipcp_param_lattices *dest_plats, if (dest_plats-aggs_count == PARAM_VALUE (PARAM_IPA_MAX_AGG_ITEMS)) return false; dest_plats-aggs_count++; - new_al = (struct ipcp_agg_lattice *) pool_alloc (ipcp_agg_lattice_pool); + new_al = ipcp_agg_lattice_pool.allocate (); memset (new_al, 0, sizeof (*new_al)); new_al-offset = offset; @@ -4463,16 +4470,6 @@ ipcp_driver (void) edge_removal_hook_holder = symtab-add_edge_removal_hook (ipcp_edge_removal_hook, NULL); - ipcp_cst_values_pool = create_alloc_pool (IPA-CP constant values, - sizeof (ipcp_valuetree), 32); - ipcp_poly_ctx_values_pool = create_alloc_pool -(IPA-CP polymorphic contexts, - sizeof (ipcp_valueipa_polymorphic_call_context), 32); - ipcp_sources_pool = create_alloc_pool (IPA-CP value sources, -sizeof (ipcp_value_sourcetree), 64); - ipcp_agg_lattice_pool = create_alloc_pool (IPA_CP aggregate lattices, -sizeof (struct ipcp_agg_lattice), -32); if (dump_file) { fprintf (dump_file, \nIPA structures before propagation:\n); diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 80ce6b8..e90502b 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -3669,10 +3669,10 @@ ipa_free_all_structures_after_ipa_cp (void) { ipa_free_all_edge_args (); ipa_free_all_node_params (); - free_alloc_pool (ipcp_sources_pool); - free_alloc_pool (ipcp_cst_values_pool); - free_alloc_pool (ipcp_poly_ctx_values_pool); - free_alloc_pool (ipcp_agg_lattice_pool); + ipcp_sources_pool.release (); + ipcp_cst_values_pool.release (); + ipcp_poly_ctx_values_pool.release (); + ipcp_agg_lattice_pool.release (); ipa_unregister_cgraph_hooks (); ipa_refdesc_pool.release (); } @@ -3687,14 +3687,10 @@ ipa_free_all_structures_after_iinln (void) ipa_free_all_edge_args ();
Re: [PATCH 35/35] Remove old pool allocator.
On 05/27/2015 08:24 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * alloc-pool.c (create_alloc_pool): Remove. (empty_alloc_pool): Likewise. (free_alloc_pool): Likewise. (free_alloc_pool_if_empty): Likewise. (pool_alloc): Likewise. (pool_free): Likewise. * alloc-pool.h: Remove old declarations. So, the remaining patches to use the type based pool allocator are OK as long as they have the same overall structure as the patches that have already been OK. You've got something goofy in #32/#34, which I'll assume you'll sort out sensibly. OK. jeff v2 From 92bb6d5c6375ca1dc2f3d09807ff34c45c4e60fc Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:56 +0200 Subject: [PATCH 32/32] Remove old pool allocator. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * alloc-pool.c (create_alloc_pool): Remove. (empty_alloc_pool): Likewise. (free_alloc_pool): Likewise. (free_alloc_pool_if_empty): Likewise. (pool_alloc): Likewise. (pool_free): Likewise. * alloc-pool.h: Remove old declarations. --- gcc/alloc-pool.c | 274 --- gcc/alloc-pool.h | 51 --- 2 files changed, 325 deletions(-) diff --git a/gcc/alloc-pool.c b/gcc/alloc-pool.c index 0bea7a6..78bc305 100644 --- a/gcc/alloc-pool.c +++ b/gcc/alloc-pool.c @@ -27,39 +27,6 @@ along with GCC; see the file COPYING3. If not see ALLOC_POOL_ID_TYPE last_id; -#define align_eight(x) (((x+7) 3) 3) - -/* The internal allocation object. */ -typedef struct allocation_object_def -{ -#ifdef ENABLE_CHECKING - /* The ID of alloc pool which the object was allocated from. */ - ALLOC_POOL_ID_TYPE id; -#endif - - union -{ - /* The data of the object. */ - char data[1]; - - /* Because we want any type of data to be well aligned after the ID, - the following elements are here. They are never accessed so - the allocated object may be even smaller than this structure. - We do not care about alignment for floating-point types. */ - char *align_p; - int64_t align_i; -} u; -} allocation_object; - -/* Convert a pointer to allocation_object from a pointer to user data. */ -#define ALLOCATION_OBJECT_PTR_FROM_USER_PTR(X)\ - ((allocation_object *) (((char *) (X))\ - - offsetof (allocation_object, u.data))) - -/* Convert a pointer to user data from a pointer to allocation_object. */ -#define USER_PTR_FROM_ALLOCATION_OBJECT_PTR(X)\ - ((void *) (((allocation_object *) (X))-u.data)) - /* Hashtable mapping alloc_pool names to descriptors. */ hash_mapconst char *, alloc_pool_descriptor *alloc_pool_hash; @@ -72,247 +39,6 @@ allocate_pool_descriptor (const char *name) return alloc_pool_hash-get_or_insert (name); } - -/* Create a pool of things of size SIZE, with NUM in each block we - allocate. */ - -alloc_pool -create_alloc_pool (const char *name, size_t size, size_t num) -{ - alloc_pool pool; - size_t header_size; - - gcc_checking_assert (name); - - /* Make size large enough to store the list header. */ - if (size sizeof (alloc_pool_list)) -size = sizeof (alloc_pool_list); - - /* Now align the size to a multiple of 4. */ - size = align_eight (size); - -#ifdef ENABLE_CHECKING - /* Add the aligned size of ID. */ - size += offsetof (allocation_object, u.data); -#endif - - /* Um, we can't really allocate 0 elements per block. */ - gcc_checking_assert (num); - - /* Allocate memory for the pool structure. */ - pool = XNEW (struct alloc_pool_def); - - /* Now init the various pieces of our pool structure. */ - pool-name = /*xstrdup (name)*/name; - pool-elt_size = size; - pool-elts_per_block = num; - - if (GATHER_STATISTICS) -{ - struct alloc_pool_descriptor *desc = allocate_pool_descriptor (name); - desc-elt_size = size; - desc-created++; -} - - /* List header size should be a multiple of 8. */ - header_size = align_eight (sizeof (struct alloc_pool_list_def)); - - pool-block_size = (size * num) + header_size; - pool-returned_free_list = NULL; - pool-virgin_free_list = NULL; - pool-virgin_elts_remaining = 0; - pool-elts_allocated = 0; - pool-elts_free = 0; - pool-blocks_allocated = 0; - pool-block_list = NULL; - -#ifdef ENABLE_CHECKING - /* Increase the last used ID and use it for this pool. - ID == 0 is used for free elements of pool so skip it. */ - last_id++; - if (last_id == 0) -last_id++; - - pool-id = last_id; -#endif - - return (pool); -} - -/* Free all memory allocated for the given memory pool. */ -void -empty_alloc_pool (alloc_pool pool) -{ - alloc_pool_list block, next_block; - - gcc_checking_assert (pool); - - /* Free each block allocated to the pool. */ - for (block = pool-block_list; block != NULL; block = next_block) -{ - next_block = block-next; - free (block); -} - - if (GATHER_STATISTICS) -{ -
Re: [PATCH, testsuite]: Cleanup dumps
On 29 May 2015 at 15:21, Kyrill Tkachov kyrylo.tkac...@arm.com wrote: Hi Bernhard, You asked to be CC'ed ;) Applied this as obvious with r223864 to. oops, thanks for fixing! This obviously escaped my grep-foo. As said, i'd vote for -Wcomment -fno-ident to be added per default where testcases should opt-out if they want to test these explicitly. It's stressful to be on a tailcall-fixups branch thinking that you might have broken something when you see scan-assembler-not call fail due to the .ident :P Anyway. Thanks, again!
[patch] Use std::decay in return type of std::async (LWGW 2021)
http://cplusplus.github.io/LWG/lwg-defects.html#2021 corrects the return type of std::async(), which is necessary to ensure that the result_of expression matches the actual result of the callable object passed to async. We already do the right thing for std::bind(), so only std::async() needs changes. Tested powerpc64le-linux, committed to trunk. commit 93ea8027998a76eb93e248c509e6a25a59ba3a79 Author: Jonathan Wakely jwak...@redhat.com Date: Thu May 28 23:22:23 2015 +0100 * include/std/future (__async_result_of): New alias template. (async): Use __async_result_of to pass decayed types to result_of. * testsuite/30_threads/async/lwg2021.cc: New. * doc/xml/manual/intro.xml: Document LWG 2021 status. diff --git a/libstdc++-v3/doc/xml/manual/intro.xml b/libstdc++-v3/doc/xml/manual/intro.xml index b521089..f0c66a2 100644 --- a/libstdc++-v3/doc/xml/manual/intro.xml +++ b/libstdc++-v3/doc/xml/manual/intro.xml @@ -814,6 +814,12 @@ requirements of the license of GCC. listitemparaReturn the end of the filled range. /para/listitem/varlistentry +varlistentrytermlink xmlns:xlink=http://www.w3.org/1999/xlink; xlink:href=../ext/lwg-defects.html#20212021/link: + emphasisFurther incorrect uses of coderesult_of/code/emphasis +/term +listitemparaCorrectly decay types in signature of codestd::async/code. +/para/listitem/varlistentry + /variablelist /section diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future index c4baf90..216a921 100644 --- a/libstdc++-v3/include/std/future +++ b/libstdc++-v3/include/std/future @@ -168,12 +168,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION deferred }; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2021. Further incorrect usages of result_of templatetypename _Fn, typename... _Args -futuretypename result_of_Fn(_Args...)::type +using __async_result_of = typename result_of + typename decay_Fn::type(typename decay_Args::type...)::type; + + templatetypename _Fn, typename... _Args +future__async_result_of_Fn, _Args... async(launch __policy, _Fn __fn, _Args... __args); templatetypename _Fn, typename... _Args -futuretypename result_of_Fn(_Args...)::type +future__async_result_of_Fn, _Args... async(_Fn __fn, _Args... __args); #if defined(_GLIBCXX_HAS_GTHREADS) defined(_GLIBCXX_USE_C99_STDINT_TR1) \ @@ -727,7 +733,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION friend class promise_Res; templatetypename friend class packaged_task; templatetypename _Fn, typename... _Args -friend futuretypename result_of_Fn(_Args...)::type +friend future__async_result_of_Fn, _Args... async(launch, _Fn, _Args...); typedef __basic_future_Res _Base_type; @@ -770,7 +776,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION friend class promise_Res; templatetypename friend class packaged_task; templatetypename _Fn, typename... _Args -friend futuretypename result_of_Fn(_Args...)::type +friend future__async_result_of_Fn, _Args... async(launch, _Fn, _Args...); typedef __basic_future_Res _Base_type; @@ -813,7 +819,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION friend class promisevoid; templatetypename friend class packaged_task; templatetypename _Fn, typename... _Args -friend futuretypename result_of_Fn(_Args...)::type +friend future__async_result_of_Fn, _Args... async(launch, _Fn, _Args...); typedef __basic_futurevoid _Base_type; @@ -1699,10 +1705,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// async templatetypename _Fn, typename... _Args -futuretypename result_of_Fn(_Args...)::type +future__async_result_of_Fn, _Args... async(launch __policy, _Fn __fn, _Args... __args) { - typedef typename result_of_Fn(_Args...)::type result_type; std::shared_ptr__future_base::_State_base __state; if ((__policy launch::async) == launch::async) { @@ -1714,16 +1719,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __state = __future_base::_S_make_deferred_state(std::__bind_simple( std::forward_Fn(__fn), std::forward_Args(__args)...)); } - return futureresult_type(__state); + return future__async_result_of_Fn, _Args...(__state); } /// async, potential overload templatetypename _Fn, typename... _Args -inline futuretypename result_of_Fn(_Args...)::type +inline future__async_result_of_Fn, _Args... async(_Fn __fn, _Args... __args) { - return async(launch::async|launch::deferred, std::forward_Fn(__fn), - std::forward_Args(__args)...); + return std::async(launch::async|launch::deferred, + std::forward_Fn(__fn), + std::forward_Args(__args)...); } #endif // _GLIBCXX_ASYNC_ABI_COMPAT diff --git a/libstdc++-v3/testsuite/30_threads/async/lwg2021.cc b/libstdc++-v3/testsuite/30_threads/async/lwg2021.cc new file mode 100644 index 000..0c0ac3b --- /dev/null +++
Re: [PATCH 27/35] Change use to type-based pool allocator in tree-ssa-structalias.c.
On 05/27/2015 08:15 PM, Jeff Law wrote: On 05/27/2015 07:56 AM, mliska wrote: gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * tree-ssa-structalias.c (new_var_info): Use new type-based pool allocator. (new_constraint): Likewise. (init_alias_vars): Likewise. (delete_points_to_sets): Likewise. --- OK. Jeff v2 From 7fbd298945fdb725099dc3a91f981212c5c1f3c7 Mon Sep 17 00:00:00 2001 From: mliska mli...@suse.cz Date: Wed, 27 May 2015 15:56:54 +0200 Subject: [PATCH 26/32] Change use to type-based pool allocator in tree-ssa-structalias.c. gcc/ChangeLog: 2015-04-30 Martin Liska mli...@suse.cz * tree-ssa-structalias.c (new_var_info): Use new type-based pool allocator. (new_constraint): Likewise. (init_alias_vars): Likewise. (delete_points_to_sets): Likewise. --- gcc/tree-ssa-structalias.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index d6a9f67..e802d78 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -354,7 +354,8 @@ static varinfo_t lookup_vi_for_tree (tree); static inline bool type_can_have_subvars (const_tree); /* Pool of variable info structures. */ -static alloc_pool variable_info_pool; +static pool_allocatorvariable_info variable_info_pool + (Variable info pool, 30); /* Map varinfo to final pt_solution. */ static hash_mapvarinfo_t, pt_solution * *final_solutions; @@ -395,7 +396,7 @@ static varinfo_t new_var_info (tree t, const char *name) { unsigned index = varmap.length (); - varinfo_t ret = (varinfo_t) pool_alloc (variable_info_pool); + varinfo_t ret = variable_info_pool.allocate (); ret-id = index; ret-name = name; @@ -554,7 +555,7 @@ struct constraint /* List of constraints that we use to build the constraint graph from. */ static vecconstraint_t constraints; -static alloc_pool constraint_pool; +static pool_allocatorconstraint constraint_pool (Constraint pool, 30); /* The constraint graph is represented as an array of bitmaps containing successor nodes. */ @@ -676,7 +677,7 @@ static constraint_t new_constraint (const struct constraint_expr lhs, const struct constraint_expr rhs) { - constraint_t ret = (constraint_t) pool_alloc (constraint_pool); + constraint_t ret = constraint_pool.allocate (); ret-lhs = lhs; ret-rhs = rhs; return ret; @@ -6681,10 +6682,6 @@ init_alias_vars (void) bitmap_obstack_initialize (oldpta_obstack); bitmap_obstack_initialize (predbitmap_obstack); - constraint_pool = create_alloc_pool (Constraint pool, - sizeof (struct constraint), 30); - variable_info_pool = create_alloc_pool (Variable info pool, - sizeof (struct variable_info), 30); constraints.create (8); varmap.create (8); vi_for_tree = new hash_maptree, varinfo_t; @@ -6964,8 +6961,8 @@ delete_points_to_sets (void) free (graph); varmap.release (); - free_alloc_pool (variable_info_pool); - free_alloc_pool (constraint_pool); + variable_info_pool.release (); + constraint_pool.release (); obstack_free (fake_var_decl_obstack, NULL); -- 2.1.4
Re: [wwwdocs] Buildstat update for 5.1
On Sun, 3 May 2015, Tom G. Christensen wrote: The first update for 5.x. Thank Tom, and sorry for missing this. Applied, and I'll momentarily check out the other one as well. Did we get more updates for GCC 5.1 in the meantime? Gerald
Re: [PATCH] Simple optimization for MASK_STORE.
Hi Richard, Did you have a chance to look at my updated patch? Any comments will be appreciated. Yuri. 2015-05-20 17:00 GMT+03:00 Yuri Rumyantsev ysrum...@gmail.com: Hi All, Here is updated patch to optimize mask stores. The main goal of it is to avoid execution of mask store if its mask is zero vector since loads that follow it can be blocked. The following changes were done: 1. A test on sink legality was added - it simply prohibits to cross statements with non-null vdef or vuse. 2. New phi node is created in join block for moved MASK_STORE statements. 3. Test was changed to check that 2 MASK_STORE statements are not moved to the same block. 4. New field was added to loop_vec_info structure to mark loops having MASK_STORE's. Any comments will be appreciated. Yuri. 2015-05-20 Yuri Rumyantsev ysrum...@gmail.com * config/i386/i386.c: Include files stringpool.h and tree-ssanames.h. (ix86_vectorize_is_zero_vector): New function. (TARGET_VECTORIZE_IS_ZERO_VECTOR): New target macro * doc/tm.texi.in: Add @hook TARGET_VECTORIZE_IS_ZERO_VECTOR. * doc/tm.texi: Updated. * target.def (is_zero_vector): New DEFHOOK. * tree-vect-stmts.c : Include tree-into-ssa.h. (vectorizable_mask_load_store): Initialize has_mask_store field. (is_valid_sink): New function. (optimize_mask_stores): New function. * tree-vectorizer.c (vectorize_loops): Invoke optimaze_mask_stores for loops having masked stores. * tree-vectorizer.h (loop_vec_info): Add new has_mask_store field and correspondent macros. (optimize_mask_stores): Update prototype. gcc/testsuite/ChangeLog: * gcc.target/i386/avx2-vect-mask-store-move1.c: New test.
Re: [wwwdocs] Buildstat update for 4.9
On Sun, 3 May 2015, Tom G. Christensen wrote: Latest results for 4.9.x This is online now, thank you Tom! Gerald
Re: [Patch]: libbacktrace - add support of PE/COFF
On Fri, May 29, 2015 at 1:43 AM, Tristan Gingold ging...@adacore.com wrote: On 28 May 2015, at 17:14, Ian Lance Taylor i...@google.com wrote: The way you have written the code, I'm fairly sure that it will be compiled for an i386-coff target. And the only coff target supported is djgpp, right ? Really? I didn't know that we had dropped COFF support. That is good to hear. I would be OK with a #include windows.h that is conditional on something that indicates that the host (from the point of view of libbacktrace) really is Windows. Is it ok to test if the _WIN32 macro is defined (like in libiberty) ? Sure. Ian
Re: [PATCH] PR 66215: S390: Fix placement of post-label NOPs with -mhotpatch
No bother, new versions attached. Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany gcc/ChangeLog: -- 2015-05-29 Dominik Vogt v...@linux.vnet.ibm.com PR target/66215 * config/s390/s390.c (s390_reorg): Fix placement of post-label NOPs with -mhotpatch=. gcc/testsuite/ChangeLog: 2015-05-29 Dominik Vogt v...@linux.vnet.ibm.com PR target/66215 * gcc.target/s390/hotpatch-1.c: Remove optimization options from dg-options. * gcc.target/s390/hotpatch-10.c: Likewise. * gcc.target/s390/hotpatch-11.c: Likewise. * gcc.target/s390/hotpatch-12.c: Likewise. * gcc.target/s390/hotpatch-17.c: Likewise. * gcc.target/s390/hotpatch-18.c: Likewise. * gcc.target/s390/hotpatch-20.c: Likewise. * gcc.target/s390/hotpatch-21.c: Likewise. * gcc.target/s390/hotpatch-22.c: Likewise. * gcc.target/s390/hotpatch-23.c: Likewise. * gcc.target/s390/hotpatch-24.c: Likewise. * gcc.target/s390/hotpatch-2.c: Likewise. Adjust scan-assembler to check for the exact nops too. * gcc.target/s390/hotpatch-3.c: Likewise. * gcc.target/s390/hotpatch-4.c: Likewise. * gcc.target/s390/hotpatch-5.c: Likewise. * gcc.target/s390/hotpatch-6.c: Likewise. * gcc.target/s390/hotpatch-7.c: Likewise. * gcc.target/s390/hotpatch-8.c: Likewise. * gcc.target/s390/hotpatch-9.c: Likewise. * gcc.target/s390/hotpatch-14.c: Likewise. * gcc.target/s390/hotpatch-15.c: Likewise. * gcc.target/s390/hotpatch-16.c: Likewise. * gcc.target/s390/hotpatch-19.c: Likewise. * gcc.target/s390/hotpatch-25.c: Likewise. Remove scan-assembler-times counting number of .align directives. * gcc.target/s390/hotpatch-13.c: Remove optimization options from dg-options. Remove scan-assembler-times counting number of .align directives. * gcc.target/s390/hotpatch-26.c: New file. * gcc.target/s390/hotpatch-27.c: New file. * gcc.target/s390/hotpatch-28.c: New file. * gcc.target/s390/s390.exp: Run hotpatch-*.c tests as torture tests using -Os -O0 -O1 -O2 -O3 options. From 4829941179006e5fc1537360e87bcfb09fb9da22 Mon Sep 17 00:00:00 2001 From: Dominik Vogt v...@linux.vnet.ibm.com Date: Fri, 22 May 2015 09:03:26 +0100 Subject: [PATCH] PR 66215: S390: Fix placement of post-label NOPs with -mhotpatch=. --- gcc/config/s390/s390.c | 28 +--- gcc/testsuite/gcc.target/s390/hotpatch-1.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-10.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-11.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-12.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-13.c | 3 +-- gcc/testsuite/gcc.target/s390/hotpatch-14.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-15.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-16.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-17.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-18.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-19.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-2.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-20.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-21.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-22.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-23.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-24.c | 2 +- gcc/testsuite/gcc.target/s390/hotpatch-25.c | 9 - gcc/testsuite/gcc.target/s390/hotpatch-26.c | 17 + gcc/testsuite/gcc.target/s390/hotpatch-27.c | 17 + gcc/testsuite/gcc.target/s390/hotpatch-28.c | 18 ++ gcc/testsuite/gcc.target/s390/hotpatch-3.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-4.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-5.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-6.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-7.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-8.c | 4 ++-- gcc/testsuite/gcc.target/s390/hotpatch-9.c | 4 ++-- gcc/testsuite/gcc.target/s390/s390.exp | 13 +++-- 30 files changed, 120 insertions(+), 55 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-26.c create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-27.c create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-28.c diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 6648597..90d43b1 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -12843,31 +12843,37 @@ s390_reorg (void) /* Insert NOPs for hotpatching. */ for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) - { - if (NOTE_P (insn) NOTE_KIND (insn) == NOTE_INSN_FUNCTION_BEG) - break; - } - gcc_assert (insn); - /* Output a series of NOPs after the NOTE_INSN_FUNCTION_BEG. */ - while (hw_after 0) + /* Emit NOPs + 1. inside
Re: [PATCH 3/4] split-stack for powerpc64
Two fixes for -fsplit-stack on powerpc64. I goofed on the block scanned for uses of r12. ENTRY_BLOCK_PTR_FOR_FN is the fake one. The next block is the first one having insns. The second change emits an error if people use a global register variable r29 with -fsplit-stack. For example: register struct important_stuff *quick_access __asm__ (r29); Such code does exist in the wild, but probably doesn't currently use -fsplit-stack. The problem is that r29 is saved by morestack then used to pass the old stack pointer to the normal function prologue. So on entry to a function, r29 will be modified. It would be possible to restore r29 from the morestack frame in order to let the function body see the original r29, I wrote such a patch, but that trick isn't safe if someone is using r29 in a signal handler. I suppose we could restore r29 and downgrade the error to a warning that using a global register asm r29 isn't safe in signal handlers with -fsplit-stack. What do you think, David? * config/rs6000/rs6000.c (split_stack_arg_pointer_used_p): Scan correct block for use of r12. (rs6000_expand_split_stack_prologue): Error on r29 asm global reg. Index: gcc/config/rs6000/rs6000.c === --- gcc/config/rs6000/rs6000.c (revision 223857) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -23450,7 +23450,7 @@ split_stack_arg_pointer_used_p (void) /* Unfortunately we also need to do some code scanning, since r12 may have been substituted for the pseudo. */ rtx_insn *insn; - basic_block bb = ENTRY_BLOCK_PTR_FOR_FN (cfun); + basic_block bb = ENTRY_BLOCK_PTR_FOR_FN (cfun)-next_bb; FOR_BB_INSNS (bb, insn) if (NONDEBUG_INSN_P (insn)) { @@ -25942,6 +25942,13 @@ rs6000_expand_split_stack_prologue (void) if (!info-push_p) return; + if (global_regs[29]) +{ + error (-fsplit-stack uses register r29); + inform (DECL_SOURCE_LOCATION (global_regs_decl[29]), + conflicts with %qD, global_regs_decl[29]); +} + allocate = info-total_size; if (allocate (unsigned HOST_WIDE_INT) 1 31) { -- Alan Modra Australia Development Lab, IBM
Re: [RFC / CFT] PR c++/66192 - Remove TARGET_RELAXED_ORDERING and use load acquires.
On 05/29/2015 06:18 AM, Ramana Radhakrishnan wrote: PR c++/66192 * config/alpha/alpha.c (TARGET_RELAXED_ORDERING): Likewise. * config/ia64/ia64.c (TARGET_RELAXED_ORDERING): Likewise. * config/rs6000/rs6000.c (TARGET_RELAXED_ORDERING): Likewise. * config/sparc/linux.h (SPARC_RELAXED_ORDERING): Likewise. * config/sparc/linux64.h (SPARC_RELAXED_ORDERING): Likewise. * config/sparc/sparc.c (TARGET_RELAXED_ORDERING): Likewise. * config/sparc/sparc.h (SPARC_RELAXED_ORDERING): Likewise. * doc/tm.texi: Regenerate. * doc/tm.texi.in (TARGET_RELAXED_ORDERING): Delete. * target.def (TARGET_RELAXED_ORDERING): Delete. Looks good to me. You do need to poison the macro in system.h. r~
[gomp4] Avoiding predication for certain blocks
When predicating the code for OpenACC, we should avoid the entry block in an offloaded region, which contains setup code that should be run in every thread. The following patch adds a new marker statement that is used to identify this block. Currently, predication doesn't happen anyway due to an oversight in the algorithm, but I'll be fixing that in a followup patch. Committed on gomp-4_0-branch. Bernd Index: gcc/ChangeLog.gomp === --- gcc/ChangeLog.gomp (revision 223867) +++ gcc/ChangeLog.gomp (working copy) @@ -1,3 +1,18 @@ +2015-05-29 Bernd Schmidt ber...@codesourcery.com + + * gimple.def (GIMPLE_OMP_ENTRY_END): New code. + * gimple.h (gimple_build_omp_entry_end): Declare. + (CASE_GIMPLE_OMP): Add GIMPLE_OMP_ENTRY_END. + * gimple.c (gimple_build_omp_entry_end): New function. + * gimple-low.c (lower_stmt): Handle GIMPLE_OMP_ENTRY_END. + * omp-low.c (expand_omp_target): Remove the entry end statement. + (predicate_bb): Don't predicate a block ending with + GIMPLE_OMP_ENTRY_END. + (lower_omp_target): Append a GIMPLE_OMP_ENTRY_END after the + ganglocal data allocation. + (make_gimple_omp_edges): Handle GIMPLE_OMP_ENTRY_END. + * gimple-pretty-print.c (pp_gimple_stmt_1): Likewise. + 2015-05-28 Tom de Vries t...@codesourcery.com * passes.def: Replace pass_copy_prop with pass_fre. Surround with Index: gcc/gimple-low.c === --- gcc/gimple-low.c (revision 223867) +++ gcc/gimple-low.c (working copy) @@ -337,6 +337,7 @@ lower_stmt (gimple_stmt_iterator *gsi, s case GIMPLE_OMP_ATOMIC_LOAD: case GIMPLE_OMP_ATOMIC_STORE: case GIMPLE_OMP_CONTINUE: +case GIMPLE_OMP_ENTRY_END: break; case GIMPLE_CALL: Index: gcc/gimple-pretty-print.c === --- gcc/gimple-pretty-print.c (revision 223867) +++ gcc/gimple-pretty-print.c (working copy) @@ -2253,6 +2253,10 @@ pp_gimple_stmt_1 (pretty_printer *buffer pp_string (buffer, GIMPLE_SECTIONS_SWITCH); break; +case GIMPLE_OMP_ENTRY_END: + pp_string (buffer, GIMPLE_OMP_ENTRY_END); + break; + case GIMPLE_OMP_MASTER: case GIMPLE_OMP_TASKGROUP: case GIMPLE_OMP_ORDERED: Index: gcc/gimple.c === --- gcc/gimple.c (revision 223867) +++ gcc/gimple.c (working copy) @@ -852,6 +852,15 @@ gimple_build_debug_source_bind_stat (tre } +/* Build a GIMPLE_OMP_ENTRY_END statement. */ + +gimple +gimple_build_omp_entry_end (void) +{ + return gimple_alloc (GIMPLE_OMP_ENTRY_END, 0); +} + + /* Build a GIMPLE_OMP_CRITICAL statement. BODY is the sequence of statements for which only one thread can execute. Index: gcc/gimple.def === --- gcc/gimple.def (revision 223867) +++ gcc/gimple.def (working copy) @@ -227,6 +227,10 @@ DEFGSCODE(GIMPLE_OMP_ATOMIC_STORE, gimp iteration in partially lowered OpenMP code. */ DEFGSCODE(GIMPLE_OMP_CONTINUE, gimple_omp_continue, GSS_OMP_CONTINUE) +/* GIMPLE_OMP_ENTRY_END marks the end of the unpredicated entry block + into an offloaded region. */ +DEFGSCODE(GIMPLE_OMP_ENTRY_END, gimple_omp_entry_end, GSS_BASE) + /* GIMPLE_OMP_CRITICAL NAME, BODY represents #pragma omp critical [name] Index: gcc/gimple.h === --- gcc/gimple.h (revision 223867) +++ gcc/gimple.h (working copy) @@ -1351,6 +1351,7 @@ gimple gimple_build_omp_taskgroup (gimpl gomp_continue *gimple_build_omp_continue (tree, tree); gimple gimple_build_omp_ordered (gimple_seq); gimple gimple_build_omp_return (bool); +gimple gimple_build_omp_entry_end (); gomp_sections *gimple_build_omp_sections (gimple_seq, tree); gimple gimple_build_omp_sections_switch (void); gomp_single *gimple_build_omp_single (gimple_seq, tree); @@ -5597,6 +5598,7 @@ gimple_return_set_retbnd (gimple gs, tre case GIMPLE_OMP_ORDERED: \ case GIMPLE_OMP_CRITICAL: \ case GIMPLE_OMP_RETURN: \ +case GIMPLE_OMP_ENTRY_END: \ case GIMPLE_OMP_ATOMIC_LOAD: \ case GIMPLE_OMP_ATOMIC_STORE: \ case GIMPLE_OMP_CONTINUE Index: gcc/omp-low.c === --- gcc/omp-low.c (revision 223867) +++ gcc/omp-low.c (working copy) @@ -9480,6 +9480,11 @@ expand_omp_target (struct omp_region *re } } + basic_block entry_succ_bb = single_succ (entry_bb); + gsi = gsi_last_bb (entry_succ_bb); + if (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ENTRY_END) +gsi_remove (gsi, true); + if (offloaded do_splitoff) { @@ -9501,7 +9506,6 @@ expand_omp_target (struct omp_region *re tree data_arg = gimple_omp_target_data_arg (entry_stmt); if (data_arg) { - basic_block entry_succ_bb = single_succ (entry_bb); gimple_stmt_iterator gsi; tree arg,
[patch] Fix duplicate xml:id attribute in libstdc++ manual
Self-explanatory. Committed to trunk. commit 1a92bedf73d04fe31eea20d5a7a4fe9407a9e414 Author: Jonathan Wakely jwak...@redhat.com Date: Fri May 29 16:16:17 2015 +0100 * doc/xml/manual/status_cxx2017.xml: Fix duplicate ID attribute. * doc/html/manual/*: Regenerate. diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml index ee32a2b..55f3cd2 100644 --- a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml +++ b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml @@ -167,7 +167,7 @@ not in any particular release. /table -table frame=all xml:id=table.ts_status +table frame=all xml:id=table.cxx1z_ts_status titleC++ Technical Specifications Implementation Status/title tgroup cols=4 align=left colsep=0 rowsep=1
Re: [RFC / CFT] PR c++/66192 - Remove TARGET_RELAXED_ORDERING and use load acquires.
On 05/29/2015 06:18 AM, Ramana Radhakrishnan wrote: One of the bits of fallout that I've observed in my testing and that I'm not sure about what to do is that on *bare-metal* arm-none-eabi targets we still put out calls to __sync_synchronize on architecture versions that do not have a barrier instruction which will result in a link error. While it is tempting to take the easy approach of not putting out the call, I suspect in practice a number of users of the bare-metal tools use these for their own RTOS's and other micro-OS's. Thus generating barriers at higher architecture levels and not generating barriers at lower architecture levels appears to be a bit dangerous especially on architectures where there is backwards compatibility (i.e. -mcpu=arm7tdmi on standard user code is still expected to generate code that works on a core that conforms to a later architecture revision). I am considering leaving this in the ARM backend to force people to think what they want to do about thread safety with statics and C++ on bare-metal systems. If they really do not want thread safety they can well add -fno-threadsafe-statics or provide an appropriate implementation for __sync_synchronize on their platforms. Any thoughts / comments ? That seems reasonable. It probably warrants some documentation somewhere though. r~
[gomp4] A thread barrier builtin
This adds an OpenACC specific thread synchronization builtin and the nvptx pattern it expands to. Committed to gomp-4_0-branch. Bernd Index: gcc/ChangeLog.gomp === --- gcc/ChangeLog.gomp (revision 223869) +++ gcc/ChangeLog.gomp (working copy) @@ -1,5 +1,13 @@ 2015-05-29 Bernd Schmidt ber...@codesourcery.com + * config/nvptx/nvptx.md (UNSPECV_BARSYNC): New constant. + (oacc_threadbarrier): New expander. + (threadbarrier_insn): New pattern. + * config/nvptx/nvptx.c (nvptx_cannot_copy_insn_p): + * omp-builtins.def (BUILT_IN_GOACC_THREADBARRIER): Define. + * builtins.c (expand_oacc_threadbarrier): Expand it. + (expand_builtin): Handle it. + * gimple.def (GIMPLE_OMP_ENTRY_END): New code. * gimple.h (gimple_build_omp_entry_end): Declare. (CASE_GIMPLE_OMP): Add GIMPLE_OMP_ENTRY_END. Index: gcc/builtins.c === --- gcc/builtins.c (revision 223867) +++ gcc/builtins.c (working copy) @@ -5946,6 +5946,19 @@ expand_builtin_acc_on_device (tree exp, #endif } +/* Expand a thread synchronization point for OpenACC threads. */ +static void +expand_oacc_threadbarrier (void) +{ +#ifdef HAVE_oacc_threadbarrier + rtx insn = GEN_FCN (CODE_FOR_oacc_threadbarrier) (); + if (insn != NULL_RTX) +{ + emit_insn (insn); +} +#endif +} + /* Expand a thread-id/thread-count builtin for OpenACC. */ static rtx @@ -7217,6 +7230,10 @@ expand_builtin (tree exp, rtx target, rt case BUILT_IN_GOACC_THREAD_BROADCAST_LL: return expand_builtin_oacc_thread_broadcast (exp, target); +case BUILT_IN_GOACC_THREADBARRIER: + expand_oacc_threadbarrier (); + return const0_rtx; + default: /* just do library call, if unknown builtin */ break; } Index: gcc/config/nvptx/nvptx.c === --- gcc/config/nvptx/nvptx.c (revision 223867) +++ gcc/config/nvptx/nvptx.c (working copy) @@ -2123,14 +2123,20 @@ nvptx_vector_alignment (const_tree type) return MIN (align, BIGGEST_ALIGNMENT); } +/* Indicate that INSN cannot be duplicated. This is true for insns + that generate a unique id. To be on the safe side, we also + exclude instructions that have to be executed simultaneously by + all threads in a warp. */ + static bool nvptx_cannot_copy_insn_p (rtx_insn *insn) { if (recog_memoized (insn) == CODE_FOR_oacc_thread_broadcastsi) return true; + if (recog_memoized (insn) == CODE_FOR_threadbarrier_insn) +return true; return false; } - /* Record a symbol for mkoffload to enter into the mapping table. */ @@ -2255,7 +2261,7 @@ nvptx_file_end (void) #undef TARGET_VECTOR_ALIGNMENT #define TARGET_VECTOR_ALIGNMENT nvptx_vector_alignment -#undef TARGET_CANNOT_COPY_INSN_P +#undef TARGET_CANNOT_COPY_INSN_P #define TARGET_CANNOT_COPY_INSN_P nvptx_cannot_copy_insn_p struct gcc_target targetm = TARGET_INITIALIZER; Index: gcc/config/nvptx/nvptx.md === --- gcc/config/nvptx/nvptx.md (revision 223867) +++ gcc/config/nvptx/nvptx.md (working copy) @@ -62,6 +62,7 @@ (define_c_enum unspecv [ UNSPECV_CAS UNSPECV_XCHG UNSPECV_WARP_BCAST + UNSPECV_BARSYNC ]) (define_attr subregs_ok false,true @@ -1457,3 +1458,16 @@ (define_insn atomic_fetch_logicmode (match_dup 1))] MODEmode == SImode || TARGET_SM35 %.\\tatom%A1.b%T0.logic\\t%0, %1, %2;) + +;; ??? Mark as not predicable later? +(define_insn threadbarrier_insn + [(unspec_volatile [(match_operand:SI 0 const_int_operand )] UNSPECV_BARSYNC)] + + bar.sync\\t%0;) + +(define_expand oacc_threadbarrier + [(unspec_volatile [(match_operand:SI 0 const_int_operand )] UNSPECV_BARSYNC)] + +{ + operands[0] = const0_rtx; +}) Index: gcc/omp-builtins.def === --- gcc/omp-builtins.def (revision 223867) +++ gcc/omp-builtins.def (working copy) @@ -81,6 +81,8 @@ DEF_GOACC_BUILTIN (BUILT_IN_GOACC_THREAD BT_FN_UINT_UINT, ATTR_NOTHROW_LEAF_LIST) DEF_GOACC_BUILTIN (BUILT_IN_GOACC_THREAD_BROADCAST_LL, GOACC_thread_broadcast_ll, BT_FN_ULONGLONG_ULONGLONG, ATTR_NOTHROW_LEAF_LIST) +DEF_GOACC_BUILTIN (BUILT_IN_GOACC_THREADBARRIER, GOACC_threadbarrier, + BT_FN_VOID, ATTR_NOTHROW_LEAF_LIST) DEF_GOACC_BUILTIN_COMPILER (BUILT_IN_ACC_ON_DEVICE, acc_on_device, BT_FN_INT_INT, ATTR_CONST_NOTHROW_LEAF_LIST)
Re: [PATCH] nios2-linux: add missing cpp specs
On 05/27/2015 10:00 AM, Mike Frysinger wrote: Define CPP_SPEC for nios2 linux targets so that -posix -pthread work like on all other linux targets. 2015-05-27 Mike Frysinger vap...@gentoo.org * config/nios2/linux.h (CPP_SPEC): Define. I see that -posix is not documented at all in invoke.texi and -pthread is documented only for RS6000 and Solaris (which is not Linux). What, exactly, are these options supposed to do on all other linux targets? If these options are supposed to be generic to all Linux targets, can't they be handled in some common way instead of duplicating the CPP_SPEC code in all the individual back ends? -Sandra
Re: [PATCH, RFC] New memory usage statistics infrastructure
Martin, The following change: @@ -2655,10 +2655,10 @@ s-iov: build/gcov-iov$(build_exeext) $(BASEVER) $(DEVPHASE) GCOV_OBJS = gcov.o gcov$(exeext): $(GCOV_OBJS) $(LIBDEPS) - +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) $(GCOV_OBJS) $(LIBS) -o $@ + +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) $(GCOV_OBJS) build/hash-table.o ggc-none.o $(LIBS) -o $@ seem to cause canadian cross build failure for arm and aarch64 on x86_64 as build/hash-table.o and ggc-none.o are not built by the same compiler? arm-none-linux-gnueabi-g++ -no-pie -g -O2 -DIN_GCC-fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing +-Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wn build/hash-table.o ggc-none.o libcommon.a ../libcpp/libcpp.a ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a .. +/libdecnumber/libdecnumber.a -o gcov build/hash-table.o: file not recognized: File format not recognized collect2: error: ld returned 1 exit status make[1]: *** [gcov] Error 1 Should it be: - +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) $(GCOV_OBJS) $(LIBS) -o $@ + +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) $(GCOV_OBJS) hash-table.o ggc-none.o $(LIBS) -o $@ instead? VP. On 15/05/15 15:38, Martin Liška wrote: Hello. Following patch attempts to rewrite memory reports for GCC's internal allocations so that it uses a new template type. The type shares parts which are currently duplicated, adds support for special 'counters' and introduces new support for hash-{set,map,table}. Transformation of the current code is a bit tricky as we internally used hash-table as main data structure which takes care of location-related allocations. As I want to add support even for hash tables (and all derived types), header files inclusion and forward declaration is utilized. Feel free to comment the patch, as well as missing features one may want to track by location sensitive memory allocation. Attachment contains sample output taken from tramp3d-v4.cpp. Thanks, Martin
[PATCH, v2] Fix bootstrap with in-tree ISL
Hi, config/ChangeLog: 2015-05-29 Bernhard Reutner-Fischer al...@gcc.gnu.org * isl.m4 (ISL_CHECK_VERSION): AC_SUBST ENABLE_ISL_CHECK and set gcc_cv_isl. Tidy whitespace. Lowercase first line of help-text like for all the other help texts. ChangeLog: 2015-05-29 Bernhard Reutner-Fischer al...@gcc.gnu.org * configure.ac (build_configdirs, configdirs, target_configdirs): Accept autogen.sh along configure. Tidy whitespace around ISL. * Makefile.tpl: Set HOST_ISL_CHECK from substituted ENABLE_ISL_CHECK. (HOST_EXPORTS): Add ENABLE_ISL_CHECK. * Makefile.in: Regenerate. * configure: Regenerate. gcc/ChangeLog: 2015-05-29 Bernhard Reutner-Fischer al...@gcc.gnu.org * configure.ac: Assume a current ISL when using in-tree ISL. * configure: Regenerate. --- This allows for configuring a pristine isl checkout in a combined tree and fixes the version-checks of isl for in-tree builds. Bootstrapped on x86_64-unknown-linux-gnu, ok for trunk? --- Makefile.in | 726 ++ Makefile.tpl |9 + config/isl.m4| 51 ++-- configure| 35 ++- configure.ac | 15 +- gcc/configure| 10 +- gcc/configure.ac |7 +- 7 files changed, 795 insertions(+), 58 deletions(-) diff --git a/Makefile.in b/Makefile.in index 24f51a4..700834e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -222,6 +222,7 @@ HOST_EXPORTS = \ GMPINC=$(HOST_GMPINC); export GMPINC; \ ISLLIBS=$(HOST_ISLLIBS); export ISLLIBS; \ ISLINC=$(HOST_ISLINC); export ISLINC; \ + ENABLE_ISL_CHECK=$(HOST_ISL_CHECK); export ENABLE_ISL_CHECK; \ LIBELFLIBS=$(HOST_LIBELFLIBS); export LIBELFLIBS; \ LIBELFINC=$(HOST_LIBELFINC); export LIBELFINC; \ @if gcc-bootstrap @@ -314,6 +315,8 @@ HOST_GMPINC = @gmpinc@ # Where to find ISL HOST_ISLLIBS = @isllibs@ HOST_ISLINC = @islinc@ +# in-tree ISL has ENABLE_ISL_CHECK set to no +HOST_ISL_CHECK = @ENABLE_ISL_CHECK@ # Where to find libelf HOST_LIBELFLIBS = @libelflibs@ @@ -2767,6 +2770,9 @@ configure-build-libiberty: sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ module_srcdir=libiberty; \ + [ ! -f $$s/$$module_srcdir/configure ] \ + [ -f $$s/$$module_srcdir/autogen.sh ] \ + (cd $$s/$$module_srcdir/ $(SHELL) ./autogen.sh); \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) \ $$s/$$module_srcdir/configure \ @@ -2824,6 +2830,9 @@ configure-build-bison: sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ module_srcdir=bison; \ + [ ! -f $$s/$$module_srcdir/configure ] \ + [ -f $$s/$$module_srcdir/autogen.sh ] \ + (cd $$s/$$module_srcdir/ $(SHELL) ./autogen.sh); \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) \ $$s/$$module_srcdir/configure \ @@ -2881,6 +2890,9 @@ configure-build-flex: sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ module_srcdir=flex; \ + [ ! -f $$s/$$module_srcdir/configure ] \ + [ -f $$s/$$module_srcdir/autogen.sh ] \ + (cd $$s/$$module_srcdir/ $(SHELL) ./autogen.sh); \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) \ $$s/$$module_srcdir/configure \ @@ -2938,6 +2950,9 @@ configure-build-m4: sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ module_srcdir=m4; \ + [ ! -f $$s/$$module_srcdir/configure ] \ + [ -f $$s/$$module_srcdir/autogen.sh ] \ + (cd $$s/$$module_srcdir/ $(SHELL) ./autogen.sh); \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) \ $$s/$$module_srcdir/configure \ @@ -2995,6 +3010,9 @@ configure-build-texinfo: sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ module_srcdir=texinfo; \ + [ ! -f $$s/$$module_srcdir/configure ] \ + [ -f $$s/$$module_srcdir/autogen.sh ] \ + (cd $$s/$$module_srcdir/ $(SHELL) ./autogen.sh); \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) \ $$s/$$module_srcdir/configure \ @@ -3052,6 +3070,9 @@ configure-build-fixincludes: sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ module_srcdir=fixincludes; \ + [ ! -f $$s/$$module_srcdir/configure ] \ + [ -f $$s/$$module_srcdir/autogen.sh ] \ + (cd $$s/$$module_srcdir/ $(SHELL) ./autogen.sh); \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) \ $$s/$$module_srcdir/configure \ @@ -3109,6 +3130,9 @@ configure-build-libcpp: sed -e
[gomp4] Initialize some extra variables at the entry to an OpenACC offloaded region
This initializes worker count and worker id variables; these will be used in a followup patch to allocate arrays in gang-local memory to be used for synchronizing threads. Committed to gomp-4_0-branch. Bernd Index: gcc/ChangeLog.gomp === --- gcc/ChangeLog.gomp (revision 223870) +++ gcc/ChangeLog.gomp (working copy) @@ -1,5 +1,10 @@ 2015-05-29 Bernd Schmidt ber...@codesourcery.com + * omp-low.c (struct omp_context): Add worker_var and worker_count + fields. + (oacc_init_count_vars): New function. + (lower_omp_target): Call it. + * config/nvptx/nvptx.md (UNSPECV_BARSYNC): New constant. (oacc_threadbarrier): New expander. (threadbarrier_insn): New pattern. Index: gcc/omp-low.c === --- gcc/omp-low.c (revision 223869) +++ gcc/omp-low.c (working copy) @@ -243,6 +243,11 @@ typedef struct omp_context tree ganglocal_ptr; tree ganglocal_size; tree ganglocal_size_host; + + /* For OpenACC offloaded regions, variables holding the worker id and count + of workers. */ + tree worker_var; + tree worker_count; } omp_context; /* A structure holding the elements of: @@ -12300,6 +12305,35 @@ lower_omp_taskreg (gimple_stmt_iterator } } +/* A subroutine of lower_omp_target. Build variables holding the + worker count and index for use inside in ganglocal memory allocations. */ + +static void +oacc_init_count_vars (omp_context *ctx, tree clauses ATTRIBUTE_UNUSED) +{ + tree gettid = builtin_decl_explicit (BUILT_IN_GOACC_TID); + tree getntid = builtin_decl_explicit (BUILT_IN_GOACC_NTID); + tree worker_var, worker_count; + tree u1 = fold_convert (unsigned_type_node, integer_one_node); + tree u0 = fold_convert (unsigned_type_node, integer_zero_node); + if (ctx-gwv_this MASK_WORKER) +{ + worker_var = create_tmp_var (unsigned_type_node, .worker); + worker_count = create_tmp_var (unsigned_type_node, .workercount); + gimple call1 = gimple_build_call (gettid, 1, u1); + gimple_call_set_lhs (call1, worker_var); + gimple_seq_add_stmt (ctx-ganglocal_init, call1); + gimple call2 = gimple_build_call (getntid, 1, u1); + gimple_call_set_lhs (call2, worker_count); + gimple_seq_add_stmt (ctx-ganglocal_init, call2); +} + else +worker_var = u0, worker_count = u1; + + ctx-worker_var = worker_var; + ctx-worker_count = worker_count; +} + /* Lower the GIMPLE_OMP_TARGET in the current statement in GSI_P. CTX holds context information for the directive. */ @@ -12465,6 +12499,9 @@ lower_omp_target (gimple_stmt_iterator * irlist = NULL; orlist = NULL; + if (is_gimple_omp_oacc (stmt)) +oacc_init_count_vars (ctx, clauses); + if (has_reduction) { lower_rec_input_clauses (clauses, irlist, orlist, ctx, NULL);
Re: [RFC][PATCH][X86_64] Eliminate PLT stubs for specified external functions via -fno-plt=
+Uros On Fri, May 29, 2015 at 10:25 AM, H.J. Lu hjl.to...@gmail.com wrote: On Fri, May 29, 2015 at 10:20 AM, Sriraman Tallam tmsri...@google.com wrote: Hi HJ, Is this ok to commit? Looks good to me. But I can't approve it. -- H.J.
RFC: Add C++ warnings for unnecessarily general return types
One of the main early aims of the rtl refactoring is to finally separate instructions (rtx_insns) from other rtxes. I thought it would help if the compiler could warn about cases where a function returns rtx when it could return rtx_insn*, or where a variable has type rtx but could have type rtx_insn*. This patch tries to implement something along those lines. There are two warning options, one for function returns and one for variables. There are obviously many good reasons why a functon or variable might have a more general type than it might appear to need, so the options certainly aren't -Wall or -Wextra material. But it might be worth having them as stage 2 and 3 warnings. I have a local patch that fixes all instances of the warnings in an x86_64-linux-gnu bootstrap. This is very much an RFC. Maybe the options are too special-purpose to be worth including. Or, if they are worth including, there are probably interesting corner cases that I've not thought about. The option did find a couple of useful things besides rtx-rtx_insn* though. For example, in ipa-comdats.c:enqueue_references we have: symtab_node *node = edge-callee-ultimate_alias_target (); /* Always keep thunks in same sections as target function. */ if (is_a cgraph_node *(node)) node = dyn_cast cgraph_node * (node)-function_symbol (); if (!node-aux node-definition) { node-aux = *first; *first = node; } ultimate_alias_target always returns a cgraph_node*, so the is_a is always true. There are also two cases where we have unnecessary safe_as_a rtx_insn *s. Thanks, Richard gcc/ * doc/invoke.texi (-Wupcast-result, -Wupcast-var): Document. * doc/extend.texi (no_upcast_warning): Document. gcc/c-family/ * c.opt (Wupcast-result, Wupcast-var): New options. * c-common.c (c_common_attribute_table): Add no_upcast_warning. (handle_no_upcast_warning_attribute): New function. gcc/cp/ * cp-tree.h (cp_decl_target_types): New structure. (cp_decl_target_types_hasher): Likewise. (language_function): Add x_result_target_types and x_decl_target_types. (current_function_return_target_types): New macro. (current_function_decl_target_types): Likewise. (upcast_var_record_type): Declare. * decl.c (get_common_target, get_upcast_warning_type): New functions. (poplevel): Handle warn_upcast_var. (finish_function): Handle warn_upcast_result. Clear out new language_function fields. * typeck.c (cp_decl_target_types_hasher::hash): New function. (cp_decl_target_types_hasher::equal): Likewise. (joust_upcast_types, upcast_var_record_type): Likewise. (cp_build_modify_expr): Record upcasts for warn_upcast_var. (check_return_expr): Likewise warn_upcast_result. * typeck2.c (store_init_value): Record upcasts for warn_upcast_var. gcc/testsuite/ * g++.dg/warn/Wupcast-result-1.C, g++.dg/warn/Wupcast-result-2.C, g++.dg/warn/Wupcast-result-3.C, g++.dg/warn/Wupcast-result-4.C, g++.dg/warn/Wupcast-var-1.C: New tests. Index: gcc/doc/invoke.texi === --- gcc/doc/invoke.texi 2015-05-27 14:37:58.553464723 +0100 +++ gcc/doc/invoke.texi 2015-05-27 15:44:05.624385485 +0100 @@ -288,6 +288,7 @@ Objective-C and Objective-C++ Dialects}. -Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol -Wno-unused-result -Wunused-value @gol -Wunused-variable @gol -Wunused-but-set-parameter -Wunused-but-set-variable @gol +-Wupcast-result -Wupcast-var @gol -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol -Wvla -Wvolatile-register-var -Wwrite-strings @gol -Wzero-as-null-pointer-constant} @@ -4879,6 +4880,43 @@ compilations. Warn when deleting a pointer to incomplete type, which may cause undefined behavior at runtime. This warning is enabled by default. +@item -Wupcast-result @r{(C++ and Objective-C++ only)} +@opindex Wupcast-result +@opindex Wno-upcast-result +Warn about functions whose return type is more general than it needs +to be. Specifically, if a function returns a pointer or reference +to some base class @var{B} and all nonnull returns have an implicit +upcast from a derived class, warn if there is a derived class @var{D} +that would satisfy all such returns. + +The warning does not consider @var{D} to be a candidate if it is in an +anonymous namespace or if it has the @code{no_upcast_warning} attribute. +It also ignores returns from virtual functions, where general types are +likely to be deliberate. + +For example, the warning would trigger on the following function, +which could return @code{D1*} rather than @code{B*}: +@cindex @code{no_upcast_warning} type attribute +@smallexample +struct B @{@}; +struct D1 : public B @{@}; +struct D2 : public D1 @{@}; +B *f(int
Re: RFA: Fix mode checks for possibly-constant predicates
On 05/29/2015 10:23 AM, Richard Sandiford wrote: + /* Check whether the predicate accepts const scalar ints (which always + have a stored mode of VOIDmode, but logically have a real mode) + and whether it matches anything besides const scalar ints. */ + bool matches_const_scalar_int_p = false; + bool matches_other_p = false; + for (int i = 0; i NUM_RTX_CODE; ++i) +if (p-codes[i]) + switch (i) + { + CASE_CONST_SCALAR_INT: + matches_const_scalar_int_p = true; + break; + + default: + matches_other_p = true; + break; + } + + /* There's no need for a mode check if the predicate only accepts + constant integers. The code checks in the predicate are enough + to establish that the mode is VOIDmode. + + Note that the predicate itself should check whether a scalar + integer is in range of the given mode. */ + if (!matches_other_p !p-codes[CONST_DOUBLE]) +return; I think perhaps it would be cleaner to not use CASE_CONST_SCALAR_INT, and then do switch (i) { case CONST_INT: case CONST_WIDE_INT: matches_const_scalar_int_p = true; break; case CONST_DOUBLE: if (!TARGET_SUPPORTS_WIDE_INT) matches_const_scalar_int_p = true; matches_other_p = true; break; default: matches_other_p = true; break; } if (!matches_other_p) return; Otherwise ok. r~
Re: [patch 10/10] debug-early merge: compiler proper
On 05/28/2015 04:35 PM, Jason Merrill wrote: On 05/28/2015 02:53 PM, Aldy Hernandez wrote: On 05/27/2015 08:39 AM, Jason Merrill wrote: On 05/20/2015 11:50 AM, Aldy Hernandez wrote: + /* Fill in the size of variable-length fields in late dwarf. */ + if (TREE_ASM_WRITTEN (type) + !early_dwarf_dumping) +{ + tree member; + for (member = TYPE_FIELDS (type); member; member = DECL_CHAIN (member)) +fill_variable_array_bounds (TREE_TYPE (member)); + return; +} Why is this happening in late dwarf? I'm concerned that front-end information that is necessary to do this might be lost by that point. I thought only after the optimizations had run their course would we be guaranteed to have accurate bound information. At least, that's what my experience showed. Hmm, I'm don't know why optimizations would change the representation of the array type. + /* Variable-length types may be incomplete even if + TREE_ASM_WRITTEN. For such types, fall through to + gen_array_type_die() and possibly fill in + DW_AT_{upper,lower}_bound attributes. */ + if ((TREE_CODE (type) != ARRAY_TYPE +TREE_CODE (type) != RECORD_TYPE +TREE_CODE (type) != UNION_TYPE +TREE_CODE (type) != QUAL_UNION_TYPE) + || (TYPE_SIZE (type) + TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)) Similarly, why check for INTEGER_CST here? The INTEGER_CST check was supposed to mean we have bound information already, no need to look further. I guess we could have a variable length bound that does not decay to a constant. Right. I would expect that to usually be the case with VLAs. Perhaps I could check the presence of a cached DIE with a type DIE containing a DW_TAG_subrange_type *and* DW_AT_{lower,upper}_bound ??. Basically I just want to add bound information, if available and not already present. Suggestions? I'm still not sure why we can't just emit bound info in early dwarf. Can you be more specific about the optimization thing? Ok, I see what I was trying to do, albeit incorrectly. Imagine this: unsigned int i=555; int main() { unsigned int array[i]; ... } For the VLA, I'd like to check if we have an array type with a missing DW_AT_{upper,lower}_bound late in the game, and fill it in. During early dwarf we only have an uninitialized gimple register representing the bound, and loc_list_from_tree() cannot find the RTL with the final bound location. Thus, we end up with a missing bound, which I propose to fill in late dwarf. Obviously I was doing some nonsense with TYPE_SIZE != INTEGER_CST, when in reality I should probably check that TREE_CODE (type) == ARRAY_TYPE and that we are missing the bound late (by looking for DW_AT_*_bound in the cached DIE). Is this acceptable, or where you thinking of some other scheme? Thanks. Aldy
Re: [PATCH] nios2-linux: add missing cpp specs
On 29 May 2015 08:44, Sandra Loosemore wrote: On 05/27/2015 10:00 AM, Mike Frysinger wrote: Define CPP_SPEC for nios2 linux targets so that -posix -pthread work like on all other linux targets. 2015-05-27 Mike Frysinger vap...@gentoo.org * config/nios2/linux.h (CPP_SPEC): Define. I see that -posix is not documented at all in invoke.texi and -pthread is documented only for RS6000 and Solaris (which is not Linux). What, exactly, are these options supposed to do on all other linux targets? If these options are supposed to be generic to all Linux targets, can't they be handled in some common way instead of duplicating the CPP_SPEC code in all the individual back ends? please see my other threads/patches -mike signature.asc Description: Digital signature
Re: [PATCH 3/4] split-stack for powerpc64
On Fri, May 29, 2015 at 10:47 AM, Alan Modra amo...@gmail.com wrote: Two fixes for -fsplit-stack on powerpc64. I goofed on the block scanned for uses of r12. ENTRY_BLOCK_PTR_FOR_FN is the fake one. The next block is the first one having insns. The second change emits an error if people use a global register variable r29 with -fsplit-stack. For example: register struct important_stuff *quick_access __asm__ (r29); Such code does exist in the wild, but probably doesn't currently use -fsplit-stack. The problem is that r29 is saved by morestack then used to pass the old stack pointer to the normal function prologue. So on entry to a function, r29 will be modified. It would be possible to restore r29 from the morestack frame in order to let the function body see the original r29, I wrote such a patch, but that trick isn't safe if someone is using r29 in a signal handler. I suppose we could restore r29 and downgrade the error to a warning that using a global register asm r29 isn't safe in signal handlers with -fsplit-stack. What do you think, David? * config/rs6000/rs6000.c (split_stack_arg_pointer_used_p): Scan correct block for use of r12. (rs6000_expand_split_stack_prologue): Error on r29 asm global reg. Okay. I doubt that many developers explicitly use r29 as a global register. I agree with you that it probably is better to error out completely instead of likely generating buggy code for this particular combination of r29 asm and split stack. Thanks, David
RFA: Fix mode checks for possibly-constant predicates
genrecog relies on a predicate foo_operand (op, mode) checking that OP really does have mode MODE, with VOIDmode acting as a wildcard. This was true even with the old genrecog, but as Andreas found on s390x, new genrecog is being a bit more aggressive about it. The problem is that at the moment, genpreds drops the mode check for anything that can accept a CONST_INT or CONST_DOUBLE, on the basis that constant integers have a recorded mode of VOIDmode whatever their real logical mode is. But that means that a predicate that accepts constant integers and other rtxes like REG won't check the modes of those other rtxes either. Even dropping the check for CONST_DOUBLE is wrong, since it can be a floating-point constant with a real mode. This patch therefore adjusts the automatic mode test to allow GET_MODE (op) == VOIDmode in cases where that's necessary. It also includes CONST_WIDE_INT in the list of constant integer codes. Bootstrapped regression-tested on x86_64-linux-gnu. OK to install? Thanks, Richard gcc/ * genpreds.c (mark_mode_tests): Mark all MATCH_CODEs as NO_MODE_TEST. (add_mode_tests): Don't add mode tests if the predicate only accepts scalar constant integers. Otherwise, allow the mode of op to be VOIDmode if the predicate does accept such integers. Index: gcc/genpreds.c === --- gcc/genpreds.c 2015-05-22 16:49:55.454319576 +0100 +++ gcc/genpreds.c 2015-05-23 10:46:58.187370110 +0100 @@ -218,11 +218,11 @@ needs_variable (rtx exp, const char *var /* Given an RTL expression EXP, find all subexpressions which we may assume to perform mode tests. Normal MATCH_OPERAND does; - MATCH_CODE does if it applies to the whole expression and accepts - CONST_INT or CONST_DOUBLE; and we have to assume that MATCH_TEST - does not. These combine in almost-boolean fashion - the only - exception is that (not X) must be assumed not to perform a mode - test, whether or not X does. + MATCH_CODE doesn't as such (although certain codes always have + VOIDmode); and we have to assume that MATCH_TEST does not. + These combine in almost-boolean fashion - the only exception is + that (not X) must be assumed not to perform a mode test, whether + or not X does. The mark is the RTL /v flag, which is true for subexpressions which do *not* perform mode tests. @@ -244,10 +244,7 @@ mark_mode_tests (rtx exp) break; case MATCH_CODE: - if (XSTR (exp, 1)[0] != '\0' - || (!strstr (XSTR (exp, 0), const_int) - !strstr (XSTR (exp, 0), const_double))) - NO_MODE_TEST (exp) = 1; + NO_MODE_TEST (exp) = 1; break; case MATCH_TEST: @@ -313,6 +310,33 @@ add_mode_tests (struct pred_data *p) if (p-special) return; + /* Check whether the predicate accepts const scalar ints (which always + have a stored mode of VOIDmode, but logically have a real mode) + and whether it matches anything besides const scalar ints. */ + bool matches_const_scalar_int_p = false; + bool matches_other_p = false; + for (int i = 0; i NUM_RTX_CODE; ++i) +if (p-codes[i]) + switch (i) + { + CASE_CONST_SCALAR_INT: + matches_const_scalar_int_p = true; + break; + + default: + matches_other_p = true; + break; + } + + /* There's no need for a mode check if the predicate only accepts + constant integers. The code checks in the predicate are enough + to establish that the mode is VOIDmode. + + Note that the predicate itself should check whether a scalar + integer is in range of the given mode. */ + if (!matches_other_p !p-codes[CONST_DOUBLE]) +return; + mark_mode_tests (p-exp); /* If the whole expression already tests the mode, we're done. */ @@ -320,7 +344,11 @@ add_mode_tests (struct pred_data *p) return; match_test_exp = rtx_alloc (MATCH_TEST); - XSTR (match_test_exp, 0) = mode == VOIDmode || GET_MODE (op) == mode; + if (matches_const_scalar_int_p) +XSTR (match_test_exp, 0) = (mode == VOIDmode || GET_MODE (op) == mode +|| GET_MODE (op) == VOIDmode); + else +XSTR (match_test_exp, 0) = mode == VOIDmode || GET_MODE (op) == mode; and_exp = rtx_alloc (AND); XEXP (and_exp, 1) = match_test_exp;
Re: [RFC][PATCH][X86_64] Eliminate PLT stubs for specified external functions via -fno-plt=
On Fri, May 29, 2015 at 10:20 AM, Sriraman Tallam tmsri...@google.com wrote: Hi HJ, Is this ok to commit? Looks good to me. But I can't approve it. -- H.J.
Re: [PATCH] nios2-linux: add missing cpp specs
On 05/29/2015 11:36 AM, Mike Frysinger wrote: On 29 May 2015 08:44, Sandra Loosemore wrote: On 05/27/2015 10:00 AM, Mike Frysinger wrote: Define CPP_SPEC for nios2 linux targets so that -posix -pthread work like on all other linux targets. 2015-05-27 Mike Frysinger vap...@gentoo.org * config/nios2/linux.h (CPP_SPEC): Define. I see that -posix is not documented at all in invoke.texi and -pthread is documented only for RS6000 and Solaris (which is not Linux). What, exactly, are these options supposed to do on all other linux targets? If these options are supposed to be generic to all Linux targets, can't they be handled in some common way instead of duplicating the CPP_SPEC code in all the individual back ends? please see my other threads/patches (Sorry, I am a few days behind in mailing list traffic, was just trying to respond to the review request that was CC'ed to me directly.) Do you mean this one? https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02708.html That addresses my concern about not duplicating this in every back end, but I still don't see any documentation and don't really understand what these flags are supposed to do or why I might need to add them to my command line. Taking off my nios2 maintainer hat and putting on the docs maintainer one instead, I think proper documentation for these options is a requirement here -Sandra
Re: [PATCH] Fix PR66314
On Fri, May 29, 2015 at 3:39 AM, Richard Biener rguent...@suse.de wrote: This fixes jump threading which fails to update the loop ownership of duplicated blocks (and was probably just lucky that loops were fixed up usually). The blocks of the jump thread path always belong to the loop of the final threading destination. Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Richard. 2015-05-29 Richard Biener rguent...@suse.de PR tree-optimization/66314 * tree-ssa-threadupdate.c (create_block_for_threading): Add parameter that says which loop the new block belongs to. (ssa_create_duplicates): Blocks duplicated for the threaded path belong to the loop of the thread destination. This caused: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66340 -- H.J.
[patch] Implement Ada support for DragonFly, improve it for FreeBSD
This patch set is a subset of the GNAT patches I've maintained separately for a few years. I have limited it adding support for x86-64-*-dragonfly* and improving support for i[34567]86-*-freebsd and x86_64-*-freebsd*. In some cases of pre-processor macros, they may contain additions for NetBSD and OpenBSD. GNAT does not officially support these platforms, so technically they are no-ops. However, GNAT is buildable in OpenBSD ports, and in NetBSD's pkgsrc. Since I'm modifying the lines anyway and I already know they are required for NetBSD and OpenBSD, I'm adding them at the same time to reduce diffs elsewhere. I am only doing this when I touch the line for other reasons involving FreeBSD and DragonFly BSD. I've added the attached patch to the gcc trunk as it was on May 29, built GNAT and ran the testsuite. The results are linked here: 1. http://leaf.dragonflybsd.org/~marino/freebsd/dfly64.concise.log.txt 2. http://leaf.dragonflybsd.org/~marino/freebsd/fbsd64.concise.log.txt 3. http://leaf.dragonflybsd.org/~marino/freebsd/fbsd32.concise.log.txt There is one regression in the gnat.dg tests on all platforms, but I believe this is caused by recent commits to GNAT and not by these patches. Note 1) All TOOL_TARGET_PAIRS in gcc/ada/gcc-interface/Makefile.in should be removed for most (if not all) platforms as they were moved to gnattools/configure and are now no-ops. However, for this patch set I only removed them for FreeBSD. Note 2) I removed reference to FreeBSD 6 and earlier. These platforms have been EOL for years (FreeBSD 8 is EOL in 4 weeks) Note 3) FreeBSD should have switched to use errno years ago, this patch does that now. Note 4) For all BSD except DragonFly (which doesn't support i386 anymore), the GCC_UNWINDER is specified for i386 platforms. It wasn't specified before. Note 5) All the ce/cxa/cxg tests that failed on i386-FreeBSD are related to the 53-bit float mantissa issue on FreeBSD. This is resolved by my GNAT-AUX repository changes so the tests pass without compromising other compilers, but those patches are out of scope of this set. copy of patch: http://leaf.dragonflybsd.org/~marino/freebsd/gnat-dragonfly-support.diff copy of suggested commit message: http://leaf.dragonflybsd.org/~marino/freebsd/gnat-dragonfly-support.msg.txt (both attached to this email) Also, my FSF copyright assignment is in order and on file at FSF. Thank you for reviewing this! John gnattools/ChangeLog: 2015-06-XX John Marino gnu...@marino.st * configure.ac (*-*-dragonfly*): Add * configure: Regenerate gcc/ada/ChangeLog: 2015-06-XX John Marino gnu...@marino.st * a-intnam-dragonfly.ads: New * s-osinte-dragonfly.adb: New * s-osinte-dragonfly.ads: New * system-dragonfly-x86_64.ads: New * adaint.c: Add BSD macros * cstreams.c: ditto * gsocket.h: ditto * link.c: ditto * socket.c: ditto * env.c: Add __DragonFly__, remove __FreeBSD__ * init.c: Add __DragonFly__, change __gnat_install_handler prototype from empty to void * initialize.c: Add __DragonFly__ * sysdep.c: ditto. * s-osinte-freebsd.adb: Use __get_errno instead of __error * tracebak.c: Set unwinder for i386 BSD * gcc-interface/Makefile.in: Add x86_64 DragonFly, tweak x86_64 FreeBSD and x86 FreeBSD --- gnattools/configure.orig +++ gnattools/configure @@ -2039,6 +2039,11 @@ mlib-tgt-specific.adbmlib-tgt-specific-darwin.adb \ indepsw.adbindepsw-darwin.adb ;; + *-*-dragonfly*) +TOOLS_TARGET_PAIRS=\ +mlib-tgt-specific.adbmlib-tgt-specific-linux.adb \ +indepsw.adbindepsw-gnu.adb +;; *-*-freebsd*) TOOLS_TARGET_PAIRS=\ mlib-tgt-specific.adbmlib-tgt-specific-linux.adb \ --- gnattools/configure.ac.orig +++ gnattools/configure.ac @@ -79,6 +79,11 @@ mlib-tgt-specific.adbmlib-tgt-specific-darwin.adb \ indepsw.adbindepsw-darwin.adb ;; + *-*-dragonfly*) +TOOLS_TARGET_PAIRS=\ +mlib-tgt-specific.adbmlib-tgt-specific-linux.adb \ +indepsw.adbindepsw-gnu.adb +;; *-*-freebsd*) TOOLS_TARGET_PAIRS=\ mlib-tgt-specific.adbmlib-tgt-specific-linux.adb \ --- /dev/null +++ gcc/ada/a-intnam-dragonfly.ads @@ -0,0 +1,136 @@ +-- +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- A D A . I N T E R R U P T S . N A M E S-- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 1991-2015, Free Software Foundation, Inc.
Re: [Patch, fortran, PR44672, v6] [F08] ALLOCATE with SOURCE and no array-spec
Hi Andre, just a couple of remarks. You are adding significant new code to an existing test case, allocate_with_source_3.f90. As discussed previously, it would be better to put the new code into an extra test case. The following test case segfaults with your patch with an invalid free: module foo contains integer function f() f = 2 end function f end module foo program main use foo integer :: n n = 42 block real, dimension(0:n) :: a real, dimension(:), allocatable :: c call random_number(a) allocate(c,source=a(:f())) end block end program main You could also add n = n - 1 allocate(c,source=a) if (size(a,1) /= size(c,1)) call abort to the test case above to make sure that changing a variable that was used to declare an array bound does not lead to wrong code. Regards Thomas
Re: Teach gimple_canonical_types_compatible_p about incomplete types
Joseph, Richard, this is patch implementing the ENUM/INGEGER globbing and also POINTER/REFERENCE (though I don't know if that one follows by some standard rules). Joseph, does the attached testcase make sense for you? Is it defined? It is my first attempt to really interpret C standard to detail. Ideally I would like to have testcases for all the globbing we do and reasoning why it is needed. Bootstraped/regtested ppc64le-linux. OK? Honza * lto.c (hash_canonical_type): Use tree_code_for_canonical_type_merging. * tree.h (tree_code_for_canonical_type_merging): New function. * tree.c (gimple_canonical_types_compatible_p): Use tree_code_for_canonical_type_merging.. * gcc.dg/lto/c-compatible-types_0.c: New testcase. * gcc.dg/lto/c-compatible-types_1.c: New testcase. Index: lto/lto.c === --- lto/lto.c (revision 223877) +++ lto/lto.c (working copy) @@ -319,7 +319,7 @@ smaller sets; when searching for existing matching types to merge, only existing types having the same features as the new type will be checked. */ - hstate.add_int (TREE_CODE (type)); + hstate.add_int (tree_code_for_canonical_type_merging (TREE_CODE (type))); hstate.add_int (TYPE_MODE (type)); /* Incorporate common features of numerical types. */ Index: testsuite/gcc.dg/lto/c-compatible-types_0.c === --- testsuite/gcc.dg/lto/c-compatible-types_0.c (revision 0) +++ testsuite/gcc.dg/lto/c-compatible-types_0.c (working copy) @@ -0,0 +1,21 @@ +/* { dg-do run } */ +/* { dg-options -O3 } */ +/* By C standard Each enumerated type shall be compatible with char, a signed + integer, type, or an unsigned integer type. The choice of type is + implementation-defined. Check that enum and unsigned int match. */ +unsigned int a; +unsigned int *b; +void t(); + +void reset () +{ + asm(:=r(a):0(0)); +} +int +main() +{ + asm(:=r(a):0(1)); + asm(:=r(b):0(a)); + t(); + return 0; +} Index: testsuite/gcc.dg/lto/c-compatible-types_1.c === --- testsuite/gcc.dg/lto/c-compatible-types_1.c (revision 0) +++ testsuite/gcc.dg/lto/c-compatible-types_1.c (working copy) @@ -0,0 +1,19 @@ +enum a {test1, test2}; +enum a a; +enum a *b; + +void reset (void); + +void +t() +{ + if (a != test2) +__builtin_abort (); + if (*b != test2) +__builtin_abort (); + reset (); + if (a != test1) +__builtin_abort (); + if (*b != test1) +__builtin_abort (); +} Index: tree.c === --- tree.c (revision 223877) +++ tree.c (working copy) @@ -12877,7 +12877,8 @@ return TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2); /* Can't be the same type if the types don't have the same code. */ - if (TREE_CODE (t1) != TREE_CODE (t2)) + if (tree_code_for_canonical_type_merging (TREE_CODE (t1)) + != tree_code_for_canonical_type_merging (TREE_CODE (t2))) return false; /* Qualifiers do not matter for canonical type comparison purposes. */ Index: tree.h === --- tree.h (revision 223877) +++ tree.h (working copy) @@ -4598,7 +4598,28 @@ extern void DEBUG_FUNCTION verify_type (const_tree t); extern bool gimple_canonical_types_compatible_p (const_tree, const_tree, bool trust_type_canonical = true); +/* Return simplified tree code of type that is used for canonical type merging. */ +inline enum tree_code +tree_code_for_canonical_type_merging (enum tree_code code) +{ + /* By C standard, each enumerated type shall be compatible with char, + a signed integer, or an unsigned integer. The choice of type is + implementation defined (in our case it depends on -fshort-enum). + For this reason we make no distinction between ENUMERAL_TYPE and INTEGER + type and compare only by their signedness and precision. */ + if (code == ENUMERAL_TYPE) +return INTEGER_TYPE; + /* To allow inter-operability between languages having references and + C, we consider reference types and pointers alike. Note that this is + not strictly necessary for C-Fortran 2008 interoperability because + Fortran define C_PTR type that needs to be compatible with C pointers + and we handle this one as ptr_type_node. */ + if (code == REFERENCE_TYPE) +return POINTER_TYPE; + return code; +} + #define tree_map_eq tree_map_base_eq extern unsigned int tree_map_hash (const void *); #define tree_map_marked_p tree_map_base_marked_p
Re: [RFC][PATCH][X86_64] Eliminate PLT stubs for specified external functions via -fno-plt=
On Fri, May 29, 2015 at 3:24 PM, Ramana Radhakrishnan ramana@googlemail.com wrote: On Friday, 29 May 2015, Sriraman Tallam tmsri...@google.com wrote: On Fri, May 29, 2015 at 12:35 PM, Jan Hubicka hubi...@ucw.cz wrote: * config/i386/i386.c (avoid_plt_to_call): New function. (ix86_output_call_insn): Generate indirect call for functions marked with noplt attribute. (attribute_spec ix86_attribute_): Define new attribute noplt. * doc/extend.texi: Document new attribute noplt. * gcc.target/i386/noplt-1.c: New testcase. * gcc.target/i386/noplt-2.c: New testcase. Index: config/i386/i386.c === --- config/i386/i386.c(revision 223720) +++ config/i386/i386.c(working copy) @@ -25599,6 +25599,24 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx call return call; } +/* Return true if the function being called was marked with attribute + noplt. If this function is defined, this should return false. */ +static bool +avoid_plt_to_call (rtx call_op) +{ + if (SYMBOL_REF_LOCAL_P (call_op)) +return false; + + tree symbol_decl = SYMBOL_REF_DECL (call_op); + + if (symbol_decl != NULL_TREE + TREE_CODE (symbol_decl) == FUNCTION_DECL + lookup_attribute (noplt, DECL_ATTRIBUTES (symbol_decl))) +return true; + + return false; +} OK, now we have __attribute__ (optimize(noplt)) which binds to the caller and makes all calls in the function to skip PLT and __attribute__ (noplt) which binds to callee and makes all calls to function to not use PLT. That sort of makes sense to me, but why noplt attribute is not implemented at generic level just like -fplt? Is it only because every target supporting PLT would need update in its call expansion patterns? Yes, that is what I had in mind. Why isn't it just an indirect call in the cases that would require a GOT slot and a direct call otherwise ? I'm trying to work out what's so different on each target that mandates this to be in the target backend. Also it would be better to push the tests into gcc.dg if you can and check for the absence of a relocation so that folks at least see these as being UNSUPPORTED on their target. I am not familiar with PLT calls for other targets. I can move the tests to gcc.dg but what relocation are you suggesting I check for? Thanks Sri Ramana Also I think the PLT calls have EBX in call fusage wich is added by ix86_expand_call. else { /* Static functions and indirect calls don't need the pic register. */ if (flag_pic (!TARGET_64BIT || (ix86_cmodel == CM_LARGE_PIC DEFAULT_ABI != MS_ABI)) GET_CODE (XEXP (fnaddr, 0)) == SYMBOL_REF ! SYMBOL_REF_LOCAL_P (XEXP (fnaddr, 0))) { use_reg (use, gen_rtx_REG (Pmode, REAL_PIC_OFFSET_TABLE_REGNUM)); if (ix86_use_pseudo_pic_reg ()) emit_move_insn (gen_rtx_REG (Pmode, REAL_PIC_OFFSET_TABLE_REGNUM), pic_offset_table_rtx); } I think you want to take that away from FUSAGE there just like we do for local calls (and in fact the code should already check flag_pic flag_plt I suppose. Done that now and patch attached. Thanks Sri Honza
Re: [PATCH] nios2-linux: add missing cpp specs
On 29 May 2015 12:32, Sandra Loosemore wrote: On 05/29/2015 11:36 AM, Mike Frysinger wrote: On 29 May 2015 08:44, Sandra Loosemore wrote: On 05/27/2015 10:00 AM, Mike Frysinger wrote: Define CPP_SPEC for nios2 linux targets so that -posix -pthread work like on all other linux targets. 2015-05-27 Mike Frysinger vap...@gentoo.org * config/nios2/linux.h (CPP_SPEC): Define. I see that -posix is not documented at all in invoke.texi and -pthread is documented only for RS6000 and Solaris (which is not Linux). What, exactly, are these options supposed to do on all other linux targets? If these options are supposed to be generic to all Linux targets, can't they be handled in some common way instead of duplicating the CPP_SPEC code in all the individual back ends? please see my other threads/patches (Sorry, I am a few days behind in mailing list traffic, was just trying to respond to the review request that was CC'ed to me directly.) Do you mean this one? https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02708.html yes That addresses my concern about not duplicating this in every back end, but I still don't see any documentation and don't really understand what these flags are supposed to do or why I might need to add them to my command line. Taking off my nios2 maintainer hat and putting on the docs maintainer one instead, I think proper documentation for these options is a requirement here i'm not familiar with the history. i'm merely cleaning up some of the mess. both defines are respected by glibc and make a difference to compilation. -mike signature.asc Description: Digital signature