[llvm] r278854 - [LoopUnroll] Don't clear out the AssumptionCache on each loop

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 16 15:15:55 PDT 2016


On Tue, Aug 16, 2016 at 2:21 PM, Hal Finkel <hfinkel at anl.gov> wrote:

> Thanks!
>
> FYI, we essentially have the same FIXME in Scalar/LoopUnswitch.cpp and
> Utils/InlineFunction.cpp, in case you'd like to take a look.
>

Should be fixed in r278860.


>
>  -Hal
>
> ----- Original Message -----
> > From: "David Majnemer via llvm-commits" <llvm-commits at lists.llvm.org>
> > To: llvm-commits at lists.llvm.org
> > Sent: Tuesday, August 16, 2016 4:09:46 PM
> > Subject: [llvm] r278854 - [LoopUnroll] Don't clear out the
> AssumptionCache on each loop
> >
> > Author: majnemer
> > Date: Tue Aug 16 16:09:46 2016
> > New Revision: 278854
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=278854&view=rev
> > Log:
> > [LoopUnroll] Don't clear out the AssumptionCache on each loop
> >
> > Clearing out the AssumptionCache can cause us to rescan the entire
> > function for assumes.  If there are many loops, then we are scanning
> > over the entire function many times.
> >
> > Instead of clearing out the AssumptionCache, register all cloned
> > assumes.
> >
> > Modified:
> >     llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp
> >
> > Modified: llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
> Transforms/Utils/LoopUnroll.cpp?rev=278854&r1=278853&r2=278854&view=diff
> > ============================================================
> ==================
> > --- llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp (original)
> > +++ llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp Tue Aug 16
> > 16:09:46 2016
> > @@ -28,6 +28,7 @@
> >  #include "llvm/IR/BasicBlock.h"
> >  #include "llvm/IR/DataLayout.h"
> >  #include "llvm/IR/Dominators.h"
> > +#include "llvm/IR/IntrinsicInst.h"
> >  #include "llvm/IR/LLVMContext.h"
> >  #include "llvm/Support/Debug.h"
> >  #include "llvm/Support/raw_ostream.h"
> > @@ -486,9 +487,14 @@ bool llvm::UnrollLoop(Loop *L, unsigned
> >      }
> >
> >      // Remap all instructions in the most recent iteration
> > -    for (BasicBlock *NewBlock : NewBlocks)
> > -      for (Instruction &I : *NewBlock)
> > +    for (BasicBlock *NewBlock : NewBlocks) {
> > +      for (Instruction &I : *NewBlock) {
> >          ::remapInstruction(&I, LastValueMap);
> > +        if (auto *II = dyn_cast<IntrinsicInst>(&I))
> > +          if (II->getIntrinsicID() == Intrinsic::assume)
> > +            AC->registerAssumption(II);
> > +      }
> > +    }
> >    }
> >
> >    // Loop over the PHI nodes in the original block, setting incoming
> >    values.
> > @@ -601,10 +607,6 @@ bool llvm::UnrollLoop(Loop *L, unsigned
> >      }
> >    }
> >
> > -  // FIXME: We could register any cloned assumptions instead of
> > clearing the
> > -  // whole function's cache.
> > -  AC->clear();
> > -
> >    // FIXME: We only preserve DT info for complete unrolling now.
> >    Incrementally
> >    // updating domtree after partial loop unrolling should also be
> >    easy.
> >    if (DT && !CompletelyUnroll)
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> >
>
> --
> Hal Finkel
> Assistant Computational Scientist
> Leadership Computing Facility
> Argonne National Laboratory
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160816/6d0ad4fe/attachment.html>


More information about the llvm-commits mailing list