[PATCH] D12066: Introduce the ScopExpander as a SCEVExpander replacement

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 01:28:11 PDT 2015


> <sanjoy at playingwithpointers.com> wrote:
> > sanjoy added inline comments.
> >
> > ================
> > Comment at: lib/Support/ScopHelper.cpp:292
> > @@ +291,3 @@
> > +
> > +    Value *LHS = Expander.expandCodeFor(LHSScev, E->getType(), StartIP);
> > +    Value *RHS = Expander.expandCodeFor(RHSScev, E->getType(), StartIP);
> > ----------------
> > I don't grok how Polly uses SCEVs, but won't `LHS` be identical to `Inst->getOperand(0)` here?  Likewise for `RHS` and `Inst->getOperand(1)`?  Why can't this function just `return E->getValue()` (after which `ScopExpander::expandCodeFor` should become equivalent to `SCEVExpander::expandCodeFor`)?
> 
> Sorry, I meant "Why can't this function just `return E;`"
Because it the SCEVExpander will __not__ generate any code for an
existing SDiv/SRem instruction but just use it. We want however to
generate new code if the instruction is in the analyzed region but we
generate code outside/infront of that region. Hence, we generate the
code for the SDiv/SRem operands in front of the analyzed region and then
create a new SDiv/SRem operation there too.

-- 

Johannes Doerfert
Researcher / PhD Student

Compiler Design Lab (Prof. Hack)
Saarland University, Computer Science
Building E1.3, Room 4.31

Tel. +49 (0)681 302-57521 : doerfert at cs.uni-saarland.de
Fax. +49 (0)681 302-3065  : http://www.cdl.uni-saarland.de/people/doerfert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150817/f26d174f/attachment.sig>


More information about the llvm-commits mailing list