On 22 October 2007 17:16, Michael Matz wrote:
>> I'd rather wish the optimization would be done differently. Currently we >> have: >> >> mem -> reg; >> loop loop >> if (condition) => optimize => if (condition) >> val -> mem; val -> reg; >> reg -> mem; >> >> >> But it could use additional register and be: >> >> 0 -> flag_reg; >> loop >> if (condition) >> val -> reg; >> 1 -> flag_reg; >> if (flag_reg == 1) >> reg -> mem; > > That could be done but would be besides the point. You traded one > conditional store with another one, so you've gained nothing in that > transformation. Not quite: he's hoisted it (lowered it? sunk it?) out of the bottom of the loop, so the test/branch/store only occurs once, and inside the loop there's no memory access at all (which should be faster even than a load-cmove-store with hot caches and no branches...) cheers, DaveK -- Can't think of a witty .sigline today....