<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 16, 2016 at 2:21 PM, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Thanks!<br>
<br>
FYI, we essentially have the same FIXME in Scalar/LoopUnswitch.cpp and Utils/InlineFunction.cpp, in case you'd like to take a look.<br></blockquote><div><br></div><div>Should be fixed in r278860.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
 -Hal<br>
<div class=""><div class="h5"><br>
----- Original Message -----<br>
> From: "David Majnemer via llvm-commits" <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>><br>
> To: <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> Sent: Tuesday, August 16, 2016 4:09:46 PM<br>
> Subject: [llvm] r278854 - [LoopUnroll] Don't clear out the AssumptionCache on each loop<br>
><br>
> Author: majnemer<br>
> Date: Tue Aug 16 16:09:46 2016<br>
> New Revision: 278854<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=278854&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=278854&view=rev</a><br>
> Log:<br>
> [LoopUnroll] Don't clear out the AssumptionCache on each loop<br>
><br>
> Clearing out the AssumptionCache can cause us to rescan the entire<br>
> function for assumes.  If there are many loops, then we are scanning<br>
> over the entire function many times.<br>
><br>
> Instead of clearing out the AssumptionCache, register all cloned<br>
> assumes.<br>
><br>
> Modified:<br>
>     llvm/trunk/lib/Transforms/<wbr>Utils/LoopUnroll.cpp<br>
><br>
> Modified: llvm/trunk/lib/Transforms/<wbr>Utils/LoopUnroll.cpp<br>
> URL:<br>
> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp?rev=278854&r1=278853&r2=278854&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/Utils/LoopUnroll.<wbr>cpp?rev=278854&r1=278853&r2=<wbr>278854&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- llvm/trunk/lib/Transforms/<wbr>Utils/LoopUnroll.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/<wbr>Utils/LoopUnroll.cpp Tue Aug 16<br>
> 16:09:46 2016<br>
> @@ -28,6 +28,7 @@<br>
>  #include "llvm/IR/BasicBlock.h"<br>
>  #include "llvm/IR/DataLayout.h"<br>
>  #include "llvm/IR/Dominators.h"<br>
> +#include "llvm/IR/IntrinsicInst.h"<br>
>  #include "llvm/IR/LLVMContext.h"<br>
>  #include "llvm/Support/Debug.h"<br>
>  #include "llvm/Support/raw_ostream.h"<br>
> @@ -486,9 +487,14 @@ bool llvm::UnrollLoop(Loop *L, unsigned<br>
>      }<br>
><br>
>      // Remap all instructions in the most recent iteration<br>
> -    for (BasicBlock *NewBlock : NewBlocks)<br>
> -      for (Instruction &I : *NewBlock)<br>
> +    for (BasicBlock *NewBlock : NewBlocks) {<br>
> +      for (Instruction &I : *NewBlock) {<br>
>          ::remapInstruction(&I, LastValueMap);<br>
> +        if (auto *II = dyn_cast<IntrinsicInst>(&I))<br>
> +          if (II->getIntrinsicID() == Intrinsic::assume)<br>
> +            AC->registerAssumption(II);<br>
> +      }<br>
> +    }<br>
>    }<br>
><br>
>    // Loop over the PHI nodes in the original block, setting incoming<br>
>    values.<br>
> @@ -601,10 +607,6 @@ bool llvm::UnrollLoop(Loop *L, unsigned<br>
>      }<br>
>    }<br>
><br>
> -  // FIXME: We could register any cloned assumptions instead of<br>
> clearing the<br>
> -  // whole function's cache.<br>
> -  AC->clear();<br>
> -<br>
>    // FIXME: We only preserve DT info for complete unrolling now.<br>
>    Incrementally<br>
>    // updating domtree after partial loop unrolling should also be<br>
>    easy.<br>
>    if (DT && !CompletelyUnroll)<br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
><br>
<br>
</div></div><span class=""><font color="#888888">--<br>
Hal Finkel<br>
Assistant Computational Scientist<br>
Leadership Computing Facility<br>
Argonne National Laboratory<br>
</font></span></blockquote></div><br></div></div>