[PATCH] D18710: code hoisting using GVN

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 4 11:23:45 PDT 2016


>
>
>
>
> The pattern we are matching does not match this example: please correct me
> if I'm wrong here.
> The only case we are handling is without the intermediate blocks 2 and 3
> on your example:
>
>   BasicBlock *BB = Dom->getBlock();
>   // Only handle two branches for now: it is possible to extend the
> hoisting
>   // to switch statements.
>   BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator());
>   if (!BI || BI->getNumSuccessors() != 2)
>     return false;
>

BB1 and BB2 are the direct successors of BB: there is no other block in
> between.

We only hoist expressions from BB1 and BB2 into BB.
>
>
Yes, i misread this part.


> > 3. This seems like a really expensive way of doing this :)
>
> >
>
> >   This is pretty badly N^2.
>
> >
>
> >   Can i suggest a different method, closely based on what we do in GCC
> for speed reasons
>
>
> We will implement your suggestion: Aditya has also remarked that we could
> be more efficient on compile time by using the internal structures of the
> VN table, though I agree with you that we will need some more changes.
>

(FWIW: New GVN already has such a mapping/structure. For each value, it can
tell you all the member expressions of that value)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160404/63f3a93a/attachment.html>


More information about the llvm-commits mailing list