on 2019/5/6 上午9:50, Bin.Cheng wrote: > On Sun, May 5, 2019 at 2:02 PM Kewen.Lin <li...@linux.ibm.com> wrote: >> >> To decrease the cost isn't workable for this case, it make the original >> iv cand is preferred more and over the other iv cand for memory iv use, >> then the desirable memory based iv cand won't be chosen. >> If increase the cost, one basic iv cand is chosen for cmp use, memory >> based iv cand is chosen for memory use, instead of original iv for both. > Sorry for the mistake, I meant to decrease use cost of whatever "correct" > iv_cand for cmp iv_use that could enable doloop optimization, it doesn't > has to the original iv_cand. >
Thanks for your clarification. As mentioned, we are trying to make the predict doloop hook work as conservative as possible, so under the hypothesis that predicted cmp iv use is going to be eliminated later, I'd prefer the way to bind iv_cand artificially. Because whichever iv_cand is selected as "correct" one and then increase/decrease the cost, we are considering one upcoming eliminated cmp iv use (it doesn't require the iv cand eventually), it will *probably* affect the optimal candidate set decision. >> Could you help to explain the "binding" more? Does it mean cost modeling >> decision making can simply bypass the cmp iv_use (we have artificially >> assigned one "correct" cand iv to it) and also doesn't count the "correct" >> iv cand cost into total iv cost? Is my understanding correct? > For example, if the heuristic finds out the "correct" doloop iv_cand, we can > force choosing that iv_cand for cmp iv_use and bypass the candidate choosing > algorithm: > struct iv_group { > //... > struct iv_cand *bind_cand; > }; > then set this bind_cand directly in struct iv_ca::cand_for_group. As a > result, > iv_use rewriting code takes care of everything, no special handling (such as > preserve_ivs_for_use) is needed. > > Whether letting cost model decide the "correct" iv_cand or bind it by yourself > depends on how good your heuristic check is. It's your call. :) > Thanks a lot for your detailed explanation! As mentioned above, I prefer to use "bind" for it. I'll modify the patch with the "bind cand" way, initially set the relevant iv cand originally used in that cmp iv use, then update it if it can be updated with IV_ELIM. >> Yes, I agree we should be conservative. But it's hard to determine which is >> better in practice, even for capturing all cases, we are still trying our >> best >> to be more conservative, excluding any suspicious factor which is possible to >> make it fail in later RTL checking, one example is that the patch won't >> predict >> it can be doloop once finding switch statement. It depends on how much "bad" >> cases we don't catch and how serious its impact is and whether easy to >> improve. > Sure, I don't know ppc so have all the trust in your decision here. > > Thanks for your patience. > Thank you too!!! Kewen > Thanks, > bin >