On Aug 18, 2010, at 11:22 AM, Chris Lattner wrote:> > On Aug 18, 2010, at 11:13 AM, Jakob Stoklund Olesen wrote: > >> >> On Aug 18, 2010, at 9:56 AM, Chris Lattner wrote: >> >>> Some things to consider: When the input to the zext is spilled, the reload can be folded into the zext on almost all targets, making the zext free. When the zext *isn't* folded into a load, what you're really looking for is a code placement pass which tries to put the zexts in non-redundant (and non-partially redundant) places. >> >> That makes sense to me, but note that this is not currently implemented. All our RISC-like targets only support folding of COPY to load/store through the target-independent mechanisms. >> >> It should be fairly simple to add a foldMemoryOperandImpl override to ARM that folds load+zext into a zextload. > > Really? I'm pretty sure that ppc folded load into [sz]ext (with custom code). If ARM isn't doing this, it should - it is a clear win.It is entirely possible I broke it when I added the COPY instruction. I deleted the RISC target hooks for foldMemoryOperandImpl, thinking that COPY folding was all they needed. /jakob
On Aug 18, 2010, at 11:31 AM, Jakob Stoklund Olesen wrote:> > On Aug 18, 2010, at 11:22 AM, Chris Lattner wrote: > >> >> On Aug 18, 2010, at 11:13 AM, Jakob Stoklund Olesen wrote: >> >>> >>> On Aug 18, 2010, at 9:56 AM, Chris Lattner wrote: >>> >>>> Some things to consider: When the input to the zext is spilled, the reload can be folded into the zext on almost all targets, making the zext free. When the zext *isn't* folded into a load, what you're really looking for is a code placement pass which tries to put the zexts in non-redundant (and non-partially redundant) places. >>> >>> That makes sense to me, but note that this is not currently implemented. All our RISC-like targets only support folding of COPY to load/store through the target-independent mechanisms. >>> >>> It should be fairly simple to add a foldMemoryOperandImpl override to ARM that folds load+zext into a zextload. >> >> Really? I'm pretty sure that ppc folded load into [sz]ext (with custom code). If ARM isn't doing this, it should - it is a clear win. > > It is entirely possible I broke it when I added the COPY instruction. > > I deleted the RISC target hooks for foldMemoryOperandImpl, thinking that COPY folding was all they needed.The issue I'm looking at predates your COPY changes: <rdar://problem/7999181> values spilled to the stack should not need to be sign- or zero-extended
On Aug 18, 2010, at 11:40 AM, Bob Wilson wrote:>> >> It is entirely possible I broke it when I added the COPY instruction. >> >> I deleted the RISC target hooks for foldMemoryOperandImpl, thinking that COPY folding was all they needed. > > The issue I'm looking at predates your COPY changes: > <rdar://problem/7999181> values spilled to the stack should not need to be sign- or zero-extendedI just checked. I removed the RISC implementations of foldMemoryOperand in r108099. I didn't accidentally remove any zext folding. It was never there, at least not in the spill folding code. /jakob