Re: Help understand the may_be_zero field in loop niter information

2014-06-12 Thread Zdenek Dvorak
Hi, I noticed there is below code/comments about may_be_zero field in loop niter desc: tree may_be_zero;/* The boolean expression. If it evaluates to true, the loop will exit in the first iteration (i.e. its latch will not be executed), even if the

Re: [PATCH] Builtins handling in IVOPT

2013-11-22 Thread Zdenek Dvorak
Hi, If a pointer typed use is plainly value passed to a func call, it is not an address use, right? But as you said, x86 lea may help here. But that's what you are matching ... (well, for builtins you know will expand that to a memory reference). What I dislike in the patch is the

Re: [PATCH] Builtins handling in IVOPT

2013-11-22 Thread Zdenek Dvorak
Hi, If a pointer typed use is plainly value passed to a func call, it is not an address use, right? But as you said, x86 lea may help here. But that's what you are matching ... (well, for builtins you know will expand that to a memory reference). What I dislike in the patch is the

Re: [PATCH] Builtins handling in IVOPT

2013-11-21 Thread Zdenek Dvorak
Hi, This patch works on the intrinsic calls handling issue in IVOPT mentioned here: http://gcc.gnu.org/ml/gcc-patches/2010-10/msg01295.html In find_interesting_uses_stmt, it changes arg = expr __builtin_xxx (arg) to arg = expr; tmp = addr_expr (mem_ref(arg)); __builtin_xxx

Re: [PATCH] Fix PR57343

2013-05-27 Thread Zdenek Dvorak
Hi, Bootstrapped and tested on x86_64-unknown-linux-gnu, ok for trunk? PR tree-optimization/57343 * tree-ssa-loop-niter.c (number_of_iterations_ne_max): Do not use multiple_of_p if not TYPE_OVERFLOW_UNDEFINED. (number_of_iterations_cond): Do not build the folded

Re: [PATCH] Fix PR57396

2013-05-24 Thread Zdenek Dvorak
Hi, Bootstrap and regtest running on x86_64-unknown-linux-gnu. Zdenek, does this look ok? double_int_constant_multiple_p seems to be only used from aff_combination_constant_multiple_p. yes, Zdenek

Re: [PATCH] New switch optimization pass (PR tree-optimization/54742)

2013-05-15 Thread Zdenek Dvorak
Hi, I realize you're trying to do the same, but by using the SESE copier, you're implicitly trying to do an incremental update. I think you're going to really need to look at the assumptions of that code and verify that the switch FSA optimization doesn't violate those assumptions.

Re: How do I modify SSA and copy basic blocks?

2013-04-25 Thread Zdenek Dvorak
Hi, On Tue, 2013-04-23 at 15:24 -0600, Jeff Law wrote: Well, you have to copy the blocks, adjust the edges and rewrite the SSA graph. I'd use duplicate_block to help. You really want to look at tree-ssa-threadupdate.c. There's a nice big block comment which gives the high level

Re: [PATCH] Fix PR56035

2013-01-22 Thread Zdenek Dvorak
Hi, We ICEd on attached testcase because we didn't properly detected the latch edge. Furthermore, I think the code for re-computing latches is somehow broken at the moment. In fix_loop_structure we have /* If there was no latch, schedule the loop for removal. */ if

Re: [PATCH] Fix PR56035

2013-01-22 Thread Zdenek Dvorak
Hi, We ICEd on attached testcase because we didn't properly detected the latch edge. Furthermore, I think the code for re-computing latches is somehow broken at the moment. In fix_loop_structure we have /* If there was no latch, schedule the loop for removal. */ if

Re: [PATCH] Fix PR55833 + cheaper checking

2013-01-15 Thread Zdenek Dvorak
Hi, Yes, you should check whether you are in an irreducible loop. This is done by testing EDGE_IRREDUCIBLE_LOOP flag, Alright, I was wondering whether there's any other way. Unfortunately, here I couldn't do something like if (loop_preheader_edge (loop)-flags

Re: [PATCH] Fix PR55833 + cheaper checking

2013-01-14 Thread Zdenek Dvorak
Hi, On Thu, Jan 10, 2013 at 11:19:43PM +0100, Zdenek Dvorak wrote: I agree -- at the very least, unswitch_single_loop should check whether there is any possiblity it could have affected irreducible loops information (this should only be the case when some already existing irreducible

Re: [PATCH] Fix PR55833 + cheaper checking

2013-01-10 Thread Zdenek Dvorak
Hi, On Thu, Jan 10, 2013 at 6:31 PM, Marek Polacek wrote: + /* We changed the CFG. Recompute irreducible BBs and edges. */ + mark_irreducible_loops (); This is a very expensive fix for a really unusual situation. I don't think this is the right thing to do... I agree -- at the

Re: [PATCH] Fix iv_number_of_iterations (PR rtl-optimization/55838)

2013-01-03 Thread Zdenek Dvorak
Hi, When one (or both) IVs have extend_mode wider than mode, but step doesn't fit into mode (the IV is (subreg:MODE (plus:EXTEND_MODE base (mult:EXTEND_MODE i step)) lowpart) ), such as for EXTEND_MODE SImode, MODE QImode and step e.g. 129, 128, 256 or 517, iv_number_of_iterations can create

Re: [patch, mips] Fix for PR 54619, GCC aborting with -O -mips16

2012-11-15 Thread Zdenek Dvorak
Hi, I think tree-ssa-loop-ivopts is simply asking for the wrong thing, and needs to be changed. As I say, Sandra had some fixes in this area. This patch: http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00319.html Sadly, that patch has fallen off the bottom of my priority list

Re: Ping: RFA: Improve doloop_begin support

2012-10-16 Thread Zdenek Dvorak
Hi, 2012-09-26 Jorn Rennecke joern.renne...@arc.com * loop-doloop.c (doloop_modify): Pass doloop_end pattern to gen_doloop_begin. * loop-doloop.c (doloop_optimize): Pass flag to indicate if loop is entered at top to gen_doloop_end. *

Re: Ping: RFA: Improve doloop_begin support

2012-10-16 Thread Zdenek Dvorak
Hi, The loop appears to be entered at the top, yet both my original and your test fail. Looking what happens with your test in more detail, I find that loop-latch == desc-in_edge-dest is true, but forwarder_block_p (loop-latch) fails: 562 if (dest-loop_father-header ==

Re: Ping: RFA: Improve doloop_begin support

2012-10-16 Thread Zdenek Dvorak
Quoting Zdenek Dvorak rakd...@iuuk.mff.cuni.cz: no -- you should also test that latch contains no active insns. I.e., factorize out whatever forwarder_block_p does except for the test (dest-loop_father-header == dest) test, Like this? * basic-block.h (forwarder_block_p_1

Re: [RFC, ivopts] fix bugs in ivopts address cost computation

2012-06-06 Thread Zdenek Dvorak
Hi, (7) If the computed address cost turns out to be 0, the current code (for some unknown reason) is turning that into 1, which can screw up the relative costs of address computations vs other operations like addition. I've come up with the attached patch to try to fix these things.  

Re: A question about loop ivopt

2012-05-15 Thread Zdenek Dvorak
Hi, Why can't we replace function force_expr_to_var_cost directly with function computation_cost in tree-ssa-loop-ivopt.c? Actually I think it is inaccurate for the current recursive algorithm in force_expr_to_var_cost to estimate expr cost. Instead computation_cost can count some

Re: A question about loop ivopt

2012-05-15 Thread Zdenek Dvorak
Hi, Why can't we replace function force_expr_to_var_cost directly with function computation_cost in tree-ssa-loop-ivopt.c? Actually I think it is inaccurate for the current recursive algorithm in force_expr_to_var_cost to estimate expr cost. Instead computation_cost can

Re: Preserve pointer types in ivopts

2012-03-16 Thread Zdenek Dvorak
Yes, that could work. ?Though it might end up being incredibly ugly ;) In the code? Should really only change a few lines in the patch I would have thought. I'll get back to you when I have a new version - thanks for the tip. No, in the GIMPLE IL. Richard. And I can just imagine

Re: Preserve pointer types in ivopts

2012-03-16 Thread Zdenek Dvorak
Hello, On 03/16/2012 02:46 PM, Richard Guenther wrote: In the end what we want is a POINTER_PLUS_EXPR variant that does not make alias-analysis assume the result still points to within the objects the pointer pointed to before the increment/decrement. Hold on, is alias analysis really

Re: Preserve pointer types in ivopts

2012-03-15 Thread Zdenek Dvorak
Hi, Currently, tree-ssa-loop-ivopts assumes that pointers and integers can be used interchangeably. It prefers to compute everything in unsigned integer types rather than pointer types. On a new target that I'm working on, this assumption is problematic; casting a pointer to an integer and

Re: Preserve pointer types in ivopts

2012-03-15 Thread Zdenek Dvorak
Hi, Well, what are our rules for whether overflow on POINTER_PLUS_EXPR is defined or not? A quick search through the headers and docs doesn't turn up anything. Would there be a downside to defining it as wrapping? Can you show an example where a POINTER_PLUS_EXPR produced by ivopts

Re: [PATCH] Fix RTL sharing bug in loop unswitching (PR rtl-optimization/52092)

2012-02-03 Thread Zdenek Dvorak
Hi, It seems loop-iv.c happily creates shared RTL in lots of places, loop-unroll.c solves that by unsharing everything it adds, this is an attempt to do the same in unswitching to unshare everything iv_analyze came up with. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for

Re: reverse conditionnal jump

2012-01-06 Thread Zdenek Dvorak
Hi, I'm still developping a new private target backend (gcc4.5.2) and I noticed something strange in the assembler generated for conditionnal jump. The compiled C code source is : void funct (int c) { int a; a = 7; if (c 0) a = 4; return a; } The

Re: PR rtl-optimization/49710 (segfault in loop peeling)

2012-01-04 Thread Zdenek Dvorak
Hi, --- 316,333 normally. We may assume that e-dest is not a header of any loop, as it now has exactly one predecessor. */ while (loop_outer (e-src-loop_father) ! dominated_by_p (CDI_DOMINATORS, !e-src-loop_father-latch,

Re: PR rtl-optimization/51069 (verify_loop_info failed)

2011-12-28 Thread Zdenek Dvorak
Hi, Just a nit, can't you break out of the loop when irred_invalidated is set to true as well? There is no need to look through any further edges. I.e. perhaps: if (!irred_invalidated) FOR_EACH_EDGE (ae, ei, e-src-succs) if (ae != e ae-dest != EXIT_BLOCK_PTR

Re: Simplification of relational operations (was [patch for PR18942])

2011-12-02 Thread Zdenek Dvorak
Hi, I'm looking at a missed optimizations in combine and it is similar to the one you've fixed in PR18942 (http://thread.gmane.org/gmane.comp.gcc.patches/81504). I'm trying to make GCC optimize (leu:SI (plus:SI (reg:SI) (const_int -1)) (const_int 1)) into (leu:SI (reg:SI)

Re: [PATCH, PR50322] Fix test-case ivopts-lt.c to use int of same size as pointer.

2011-09-14 Thread Zdenek Dvorak
Hi, The attached patch fixes PR50322. The test-case is supposed to succeed if the loop counter data-type has the same size as a pointer. The patch defines TYPE to be an int datatype of the same size as a pointer, and uses it. After this fix, there's no need for the avr xfails anymore.

Re: ivopts improvement

2011-08-25 Thread Zdenek Dvorak
Hi, here's the updated version of the patch. The goal is to remove the 'i' iterator from the following example, by replacing 'i n' with 'p base + n'. void f (char *base, unsigned long int i, unsigned long int n) { char *p = base + i; do { *p = '\0'; p++;

Re: [PATCH 2/2] Fix PR47594: Build signed niter expressions

2011-08-02 Thread Zdenek Dvorak
Hi, * tree-ssa-loop-niter.c (number_of_iterations_ne): Use the signed types for the trivial case, then convert to unsigned. (number_of_iterations_lt): Use the original signed types. (number_of_iterations_cond): Same. (find_loop_niter): Build signed integer

Re: [patch] Fix PR tree-optimization/49471

2011-07-31 Thread Zdenek Dvorak
Hi, It'll collide with Sebastians patch in that area.  I suggested a INTEGRAL_TYPE_P check instead of the simple_iv one, it should be cheaper.  Zdenek, do you think it will be incorrect in some cases? well, it does not make much sense -- reductions of integral type would be taken

Re: [patch] Fix PR tree-optimization/49471

2011-07-30 Thread Zdenek Dvorak
Hi, This patch fixes the build failure of cactusADM and dealII spec2006 benchmarks when autopar is enabled. (for powerpc they fail only when -m32 is additionally enabled) The problem originated in canonicalize_loop_ivs, where we iterate the header's phis in order to base all the

Re: PATCH] PR 49580

2011-07-05 Thread Zdenek Dvorak
Hi, I moved the adjustment of the loop's iterations from gimple_duplicate_sese_tail to tree-parloops.c, right before the call to gimple_duplicate_sese_tail. I repeated the bootstrap, regression and spec runs - no new regressions. OK to commit? OK, Zdenek Index: gcc/tree-parloops.c

Re: PATCH] PR 49580

2011-06-30 Thread Zdenek Dvorak
Hi, This patch fixes the build failure of gcc spec2006 benchmark. The change is in gimple_duplicate_sese_tail(), where we need to subtract 1 from the loop's number of iterations. The stmt created to change the rhs of the loop's condition, used to be inserted right after the defining stmt

Re: [PATCH PR45098] Disallow NULL pointer in pointer arithmetic

2011-06-20 Thread Zdenek Dvorak
I don't think we should move this kind of undefinedness from C to the GIMPLE semantics. What do other languages allow that we have to support (what did KR C specify?). I don't think there is a formal specification of KR C, just the (somewhat informal) book. On topic of pointer arithmetics,

Re: [PATCH PR45098] Disallow NULL pointer in pointer arithmetic

2011-06-20 Thread Zdenek Dvorak
I don't think we should move this kind of undefinedness from C to the GIMPLE semantics. What do other languages allow that we have to support (what did KR C specify?). I don't think there is a formal specification of KR C, just the (somewhat informal) book. On topic of pointer

Re: [PATCH PR45098] Disallow NULL pointer in pointer arithmetic

2011-06-17 Thread Zdenek Dvorak
Interesting.  I'd never thought about the generation/use angle to prove a pointer was non-null.  ISTM we could use that same logic to infer that more pointers are non-null in extract_range_from_binary_expr. Interested in tackling that improvement, obviously as an independent patch?

Re: [PATCH PR45098] Disallow NULL pointer in pointer arithmetic

2011-06-17 Thread Zdenek Dvorak
Hi, Index: tree-vrp.c === --- tree-vrp.c  (revision 173703) +++ tree-vrp.c  (working copy) @@ -2273,7 +2273,12 @@ extract_range_from_binary_expr (value_ra        {          /* For pointer types, we are really

Re: [PATCH PR45098] Disallow NULL pointer in pointer arithmetic

2011-06-16 Thread Zdenek Dvorak
diff -u gcc/tree-ssa-loop-niter.c (working copy) gcc/tree-ssa-loop-niter.c (working copy) --- gcc/tree-ssa-loop-niter.c (working copy) +++ gcc/tree-ssa-loop-niter.c (working copy) @@ -2875,6 +2875,16 @@    low = lower_bound_in_type (type, type);    high = upper_bound_in_type (type,

Re: [PATCH PR45098, 7/10] Nowrap limits iterations

2011-05-31 Thread Zdenek Dvorak
Hi, As far as I can tell, what is current calculated in i_bound (and assigned to nb_iterations_upper_bound), is the maximum amount of times any statement in the loop is executed, where any includes exit tests. Differently put, the maximum amount of times the loop header is executed. hmm...

Re: [PATCH PR45098, 7/10] Nowrap limits iterations

2011-05-30 Thread Zdenek Dvorak
Hi, The header block of the loop is bb 4, the latch block is bb 3: ... (gdb) p loop.header.index $4 = 4 (gdb) p loop.latch.index $5 = 3 ... The number of times the latch edge is executed, is 10. But loop-nb_iterations_upper_bound, or max_niter is 11: this is a bit

Re: [PATCH, PR49121] [4.7 Regression] FAIL: gcc.dg/tree-ssa/ivopt_infer_2.c scan-tree-dump-times ivopts Replacing 0

2011-05-24 Thread Zdenek Dvorak
Hi, The analysis is correct, and the test case needs to be adapted. I adapted the testcase such that it still replaces the exit test if 'a' is declared as 'char a[400]', but not if it is declared as 'extern char a[]'. ok for trunk? OK, Zdenek

Re: [PATCH PR45098, 7/10] Nowrap limits iterations

2011-05-21 Thread Zdenek Dvorak
Hi, Would it be possible to add the handling of these cases to estimate_numbers_of_iterations, rather than doing it just for ivopts? Yes, I did that now. Thanks, - Tom 2011-05-05 Tom de Vries t...@codesourcery.com PR target/45098 * tree-ssa-loop-niter.c

Re: [PATCH, PR45098, 2/10]

2011-05-18 Thread Zdenek Dvorak
Hi, 2011-05-05 Tom de Vries t...@codesourcery.com PR target/45098 * tree-ssa-loop-ivopts.c (seq_cost): Fix call to rtx_cost. OK, Zdenek

Re: [PATCH PR45098, 4/10] Iv init cost.

2011-05-18 Thread Zdenek Dvorak
Hi, Resubmitting with comment. The init cost of an iv will in general not be zero. It will be exceptional that the iv register happens to be initialized with the proper value at no cost. In general, there will at the very least be a regcopy or a const set. OK. Please add a comment

Re: [PATCH PR45098, 9/10] Cheap shift-add.

2011-05-18 Thread Zdenek Dvorak
Hi, + sa_cost = (TREE_CODE (expr) != MINUS_EXPR + ? shiftadd_cost[speed][mode][m] + : (mult == op1 +? shiftsub1_cost[speed][mode][m] +: shiftsub0_cost[speed][mode][m])); + res = new_cost (sa_cost, 0); + res = add_costs (res, mult

Re: [PATCH, SMS 3/3] Skip DEBUG_INSN in loop-doloop.c

2011-05-08 Thread Zdenek Dvorak
Hi, This small fix was inserted to skip DEBUG_INSNs while recognizing doloop pattern in loop-doloop.c file. It's a fix for the already approved do-loop patch (not in mainline yet, http://gcc.gnu.org/ml/gcc-patches/2011-01/msg01718.html) in loop-doloop.c The patch was tested together with

[patch] PR 48837

2011-05-06 Thread Zdenek Dvorak
Hi, when accumulator transformation is performed on a function like foo(a) { if (a 0) return 1 + foo (a - 1) return bla(); } this becomes foo(a) { int tmp = 0; while (a 0) tm = 1 + tmp; return tmp + bla(); } Before, bla was a tail-call, but after the optimization, it is

Re: ivopts improvement

2011-03-14 Thread Zdenek Dvorak
Hi, + /* Determine if the exit test is formulated in terms of the phi or the + increment of the use iv. */ + use_uses_inced_iv += gimple_code (SSA_NAME_DEF_STMT (use-iv-ssa_name)) != GIMPLE_PHI; + + /* Determine if the exit test is before or after the increment of the +

Re: ivopts improvement

2011-03-14 Thread Zdenek Dvorak
Hi, it is trying to allow for do { *p = '\0'; i++; /* use_uses_inced_iv == true */ p++; /* use_after_cand_inc == true */ if (!(i n)) break; } while (1); and for do { *p = '\0'; if (!(i n)) break; i++; /*

Re: ivopts improvement

2011-03-04 Thread Zdenek Dvorak
Hi, /* Whether the loop body includes any function calls. */ bool body_includes_call; + + /* Whether the loop body includes any function calls that possibly have side + effects. */ + bool body_includes_side_effect_call; }; /* An assignment of iv candidates to uses.

Re: Loop-iv.c ICEs on subregs

2010-11-25 Thread Zdenek Dvorak
Hi, I'm investigating an ICE in loop-iv.c:get_biv_step(). I hope you can shed some light on what the correct fix would be. The ICE happens when processing: == (insn 111 (set (reg:SI 304) (plus (subreg:SI (reg:DI 251) 4) (const_int 1 (insn 177

Re: non-algorithmic maintainers

2010-11-15 Thread Zdenek Dvorak
On Mon, Nov 15, 2010 at 10:00 PM, Paolo Bonzini bonz...@gnu.org wrote: We currently have 3 non-algorithmic maintainers: loop optimizer          Zdenek Dvorak           o...@ucw.cz loop optimizer          Daniel Berlin           dber...@dberlin.org libcpp                  Tom Tromey

Re: Question about Doloop

2010-09-06 Thread Zdenek Dvorak
Hi, Doloop optimization fails to be applied on the following inner loop when compiling for PowerPC (GCC -r162294) due to: Doloop: number of iterations too costly to compute. strength reduction is performed in ivopts, introducing new variable: for (p = inptr; p something; p += 3) ...

Re: Irreducible loops in generated code

2010-08-19 Thread Zdenek Dvorak
Hi, I'm working on decompiling x86-64 binary programs, using branches to rebuild a control-flow graph and looking for loops. I've found a significant number of irreducible loops in gcc-produced code (irreducible loops are loops with more than one entry point), especially in -O3 optimized

Re: Turning off unrolling to certain loops

2009-10-15 Thread Zdenek Dvorak
Hi, I faced a similar issue a while ago. I filed a bug report (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36712) In the end, I implemented a simple tree-level unrolling pass in our port which uses all the existing infrastructure. It works quite well for our purpose, but I hesitated to

Re: Turning off unrolling to certain loops

2009-10-14 Thread Zdenek Dvorak
Hi, Ok, I've actually gone a different route. Instead of waiting for the middle end to perform this, I've directly modified the parser stage to unroll the loop directly there. I think this is a very bad idea. First of all, getting the information needed to decide at this stage whether

Re: Scev analysing number of loop iterations returns (2^32-1) instead of -1

2009-10-08 Thread Zdenek Dvorak
Hi, Ah, indeed. Sorry for being confused. Is tree-niter-desc-assumptions or -may_be_zero non-NULL? Yes both. I attached the gdb content for both. you need to check may_be_zero, which in your case should contain something like N = 49. If this condition is true, the number of iterations

Re: Scev analysing number of loop iterations returns (2^32-1) instead of -1

2009-10-08 Thread Zdenek Dvorak
On Wed, Oct 7, 2009 at 7:21 PM, Tobias Grosser gros...@fim.uni-passau.de wrote: On Wed, 2009-10-07 at 18:30 +0200, Tobias Grosser wrote: On Wed, 2009-10-07 at 17:44 +0200, Richard Guenther wrote: On Wed, Oct 7, 2009 at 5:35 PM, Tobias Grosser gros...@fim.uni-passau.de wrote: On

Re: Turning off unrolling to certain loops

2009-10-08 Thread Zdenek Dvorak
Hi, 2) I was using a simple example: #pragma unroll 2 for (i=0;i6;i++) { printf (Hello world\n); } If I do this, instead of transforming the code into : for (i=0;i3;i++) { printf (Hello world\n); printf

Re: Turning off unrolling to certain loops

2009-10-06 Thread Zdenek Dvorak
Hi, I was wondering if it was possible to turn off the unrolling to certain loops. Basically, I'd like the compiler not to consider certain loops for unrolling but fail to see how exactly I can achieve that. I've traced the unrolling code to multiple places in the code (I'm working with

Re: RFC: missed loop optimizations from loop induction variable copies

2009-09-23 Thread Zdenek Dvorak
Hi, snip IVOpts cannot identify start_26, start_4 and ivtmp_32_7 to be copies. The root cause is that expression 'i + start' is identified as a common expression between the test in the header and the index operation in the latch. This is unified by copy propagation or FRE prior to loop

Re: M32C vs PR tree-optimization/39233

2009-04-15 Thread Zdenek Dvorak
Hi, Can we somehow make this fix contingent on ports that have suitable integral modes? yes; however, maybe it would be easier to wait till Richard finishes the work on not representing the overflow semantics in types (assuming that's going to happen say in a few weeks?), which should make the

Re: New no-undefined-overflow branch

2009-02-27 Thread Zdenek Dvorak
Hi, introducing new codes seems like a bad idea to me. There are many places that do not care about the distinction between PLUS_EXPR and PLUSV_EXPR, and handling both cases will complicate the code (see eg. the problems caused by introducing POINTER_PLUS_EXPR vs PLUS_EXPR

Re: New no-undefined-overflow branch

2009-02-27 Thread Zdenek Dvorak
Hi, I obviously thought about this. The issue with using a flag is that there is no convenient place to stick it and that it makes the distinction between the two variants less visible. Consider the folding routines that take split trees for a start. IMHO using new tree-codes is

Re: New no-undefined-overflow branch

2009-02-26 Thread Zdenek Dvorak
Hi, in general, I like this proposal a lot. However, As a start there will be no-overflow variants of NEGATE_EXPR, PLUS_EXPR, MINUS_EXPR, MULT_EXPR and POINTER_PLUS_EXPR. The sizetypes will simply be operated on in no-overflow variants by default (by size_binop and friends). Naming

Re: Warning when compiling dwarf2out.c with -ftree-parallelize-loops=4

2008-11-25 Thread Zdenek Dvorak
Hi, As far as I get it, there is no real failure here. Parloop, unaware of the array's upper bound, inserts the 'enough iterations' condition (i400-1), and thereby makes the last iteration range from 400 upwards. VRP now has a constant it can compare to the array's upper bound. Correct

Re: query regarding adding a pass to undo final value replacement.

2008-10-15 Thread Zdenek Dvorak
Hi, but you only take the hash of the argument of the phi node (i.e., the ssa name), not the computations on that it is based Is this something like what you had in mind ? gen_hash (stmt) { if (stmt == NULL) return 0; use_operand_p use_p; ssa_op_iter iter;

Re: query regarding adding a pass to undo final value replacement.

2008-10-14 Thread Zdenek Dvorak
Hi, [Sorry about dropping the ball on this. I've had some trouble with internet connectivity and was on vacation for a few days. ] On Thu, Oct 2, 2008 at 2:56 AM, Zdenek Dvorak [EMAIL PROTECTED] wrote: Hi, b) If any PHI node has count zero it can be inserted back and its

Re: query regarding adding a pass to undo final value replacement.

2008-10-14 Thread Zdenek Dvorak
Hi, So if the ssa_names are infact reused they won't be the same computations. do you also check this for ssa names inside the loop (in your example, D.10_1? If we have to reinsert for a = phi (B) . We do the following checks. 1. If the edge information in the phi node has

Re: query regarding adding a pass to undo final value replacement.

2008-10-01 Thread Zdenek Dvorak
Hi, Based on the conversation in the thread at http://gcc.gnu.org/ml/gcc/2008-03/msg00513.html , we've tried to get a pass trying to undo final value replacement going. The initial implementation was done by Pranav Bhandarkar when he was employed at Azingo as part of work sponsored by

Re: query regarding adding a pass to undo final value replacement.

2008-10-01 Thread Zdenek Dvorak
Hi, On Wed, Oct 1, 2008 at 3:59 PM, Richard Guenther [EMAIL PROTECTED] wrote: On Wed, Oct 1, 2008 at 3:22 PM, Ramana Radhakrishnan [EMAIL PROTECTED] wrote: Hi , Based on the conversation in the thread at http://gcc.gnu.org/ml/gcc/2008-03/msg00513.html , we've tried to get a pass

Re: query regarding adding a pass to undo final value replacement.

2008-10-01 Thread Zdenek Dvorak
Hi, b) If any PHI node has count zero it can be inserted back and its corresponding computations removed, iff the argument of the PHI node still exists as an SSA variable. This means that we can insert a_1 = PHI D.10_1 if D.10_1 still exists and hasnt been

Re: query regarding adding a pass to undo final value replacement.

2008-10-01 Thread Zdenek Dvorak
Hi, I would disagree on that. Whether a final value replacement is profitable or not largely depends on whether it makes further optimization of the loop possible or not; this makes it difficult to find a good cost model. I think undoing FVR is a good approach to solve this problem

Re: Using cfglayout mode in the selective scheduler

2008-08-11 Thread Zdenek Dvorak
Hi, I am probably missing something: The basic idea is enabling cfglayout mode and then ensuring that insn stream and control flow are in sync with each other at all times. This is required because e.g. on Itanium the final bundling happens right after scheduling, and any extra jumps emitted

Re: Out of ssa form only for some basic block

2008-04-16 Thread Zdenek Dvorak
Hi, I'm trying to add a simple function to the callgraph using cgraph_add_new_function() ( new function body is obtained by function actually processed) . I put my pass in pass_tree_loop.sub as first pass just after pass_tree_loop_init pass, but I have some problems because the code that I

Re: Moving statements from one BB to other BB.

2008-04-15 Thread Zdenek Dvorak
Hi, To clarify what Richard means, your assertion that you have updated SSA information is false. If you had updated the SSA information, the error would not occur :). How exactly are you updating the ssa information? The general way to update SSA for this case would be: For each

Re: Moving statements from one BB to other BB.

2008-04-15 Thread Zdenek Dvorak
Hi, To clarify what Richard means, your assertion that you have updated SSA information is false. If you had updated the SSA information, the error would not occur :). How exactly are you updating the ssa information? The general way to update SSA for this case would

Re: Fusing two loops

2008-04-10 Thread Zdenek Dvorak
Hi, The error is rectified. The bug is in the function that calls fuse_loops(). Now I am trying to transfer all the statements, using code - /* The following function fuses two loops. */ void fuse_loops (struct loop *loop_a, struct loop *loop_b) { debug_loop (loop_a, 10);

Re: Fusing two loops

2008-04-04 Thread Zdenek Dvorak
Hi, I am trying to fuse two loops in tree level. For that, I am trying to transfer statements in the header of one loop to the header of the other one. The codehttp://rafb.net/p/fha0IG57.html contains the 2 loops. After moving a statement from one BB to another BB, do I need to

Re: [PATCH][RFC] Statistics infrastructure

2008-03-15 Thread Zdenek Dvorak
Hi, This is an attempt to provide (pass) statistics collection. The goal is to provide infrastructure to handle the current (pass specific) statistics dumping that is done per function and per pass along the regular tree/rtl dumps as well as to allow CU wide fancy analysis. The most

Re: [PATCH][RFC] Statistics infrastructure

2008-03-15 Thread Zdenek Dvorak
Hi, A statistics event consists of a function (optional), a statement (optional) and the counter ID. I converted the counters from tree-ssa-propagate.c as an example, instead of prop_stats.num_copy_prop++; you now write statistics_add (copy

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-09 Thread Zdenek Dvorak
Hi, On Sun, Mar 9, 2008 at 2:17 PM, Diego Novillo [EMAIL PROTECTED] wrote: On Sun, Mar 9, 2008 at 08:15, Richard Guenther [EMAIL PROTECTED] wrote: What is GIMPLE_SINGLE_RHS after all? Represents a copy operation, an operand with no operator (e.g., a = 3, b = c) '3' and

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-09 Thread Zdenek Dvorak
Hi, So, what about adding a GIMPLE_COPY code? The code would have 0 operands and used only for its numeric value. another possibility would be to make GIMPLE_COPY an unary operator, and get rid of the SINGLE_RHS case altogether (of course, unlike any other unary operator, it would not require

Re: [tuples] gimple_assign_subcode for GIMPLE_SINGLE_RHS

2008-03-09 Thread Zdenek Dvorak
Hi, On 3/9/08 3:24 PM, Zdenek Dvorak wrote: however, it would make things simpler. Now, we need to distiguish three cases -- SINGLE, UNARY and BINARY; if we pretended that GIMPLE_COPY is an unary operator, this would be reduced just to UNARY and BINARY. Of course, GIMPLE_COPY would never

Re: Assigning a value to a temp var in GIMPLE SSA

2008-02-22 Thread Zdenek Dvorak
Hi, I'm trying to add a simple statement to GIMPLE code adding a new pass, that I put in pass_tree_loop.sub as last pass just before pass_tree_loop_done pass. Just as test I'd like to add a call like: .palp = shmalloc (16); This is the code I'm using: t =

Re: [tuples] tree-tailcall.c

2008-02-21 Thread Zdenek Dvorak
Hi, Zdenek, you committed changes to tree-tailcall.c but you didn't fully convert the file. Was that a mis-commit? The file does not compile and uses PHI_RESULT instead of gimple_phi_result. the file compiles for me; it indeed uses PHI_RESULT, but since that is equivalent to DEF_FROM_PTR

Re: [tuples] Call for help converting passes

2008-02-11 Thread Zdenek Dvorak
Hi, Everything else should work well enough for passes to be converted. If anyone has some free cycles and are willing to put up with various broken bits, would you be willing to help converting passes? There is a list of the passes that need conversion in the tuples wiki

Re: Tree-SSA and POST_INC address mode inompatible in GCC4?

2007-11-03 Thread Zdenek Dvorak
Hi, I believe that this is something new and is most likely fallout from diego's reworking of the tree to rtl converter. To fix this will require a round of copy propagation, most likely in concert with some induction variable detection, since the most profitable place for this will be in

Re: Tree-SSA and POST_INC address mode inompatible in GCC4?

2007-11-03 Thread Zdenek Dvorak
Hi, I believe that this is something new and is most likely fallout from diego's reworking of the tree to rtl converter. To fix this will require a round of copy propagation, most likely in concert with some induction variable detection, since the most profitable place for this will

Re: optimising recursive functions

2007-10-27 Thread Zdenek Dvorak
Hi, So I am guessing the Felix version is lucky there are no gratuitous temporaries to be saved when this happens, and the C code is unlucky and there are. Maybe someone who knows how the optimiser works can comment? One problem with departing from the ABI even on a local level

Re: problem with iv folding

2007-10-26 Thread Zdenek Dvorak
Hi, traceback, tt, and ops follow. Why is this going wrong? [ gdb ] call debug_tree(arg0) nop_expr 0xb7f5f6e0 type pointer_type 0xb7f5d2f4 [ gdb ] call debug_tree(arg1) ssa_name 0xb7f61c30 type pointer_type 0xb7f5d2f4 you cannot add two pointers. Please create a PR for this

Re: From SSA back to GIMPLE.

2007-10-22 Thread Zdenek Dvorak
I was mildly annoyed by your previous contributions to the discussion in the gcc mailing list, I could tolerate those. But answering a seriously ment question of a beginner by this confusing and completely irrelevant drivel is another thing. Sincerely, Zdenek Dvorak

Re: Question on GGC

2007-09-27 Thread Zdenek Dvorak
Hello, I have several global variables which are of type rtx. They are used in flow.c ia64.c and final.c. As stated in the internal doc with types. I add GTY(()) marker after the keyword 'extern'. for example: extern GTY(()) rtx a; these 'extern's are added in regs.h which is

Re: Re[2]: [GSoC: DDG export][RFC] Current status

2007-09-04 Thread Zdenek Dvorak
Hello, An important missing piece is correction of exported information for loop unrolling. As far as I can tell, for loop unrolled by factor N we need to clone MEM_ORIG_EXPRs and datarefs for newly-created MEMs, create no-dependence DDRs for those pairs, for which original DDR was

Re: question about rtl loop-iv analysis

2007-08-28 Thread Zdenek Dvorak
Hello, And finally at the stage of rtl unrolling it looks like this: [6] r186 = r2 + C; r318 = r186 + 160; loop: r186 = r186 + 16 if (r186 != r318) then goto loop else exit Then, in loop-unroll.c we call iv_number_of_iterations, which eventually calls

Re: question about rtl loop-iv analysis

2007-08-28 Thread Zdenek Dvorak
Hello, And finally at the stage of rtl unrolling it looks like this: [6] r186 = r2 + C; r318 = r186 + 160; loop: r186 = r186 + 16 if (r186 != r318) then goto loop else exit Then, in loop-unroll.c we call iv_number_of_iterations, which eventually calls

  1   2   3   >