[PATCH] fix to compile-time blowup in LoopStrengthReduce
Andrew Trick
atrick at apple.com
Sat Oct 25 12:53:47 PDT 2014
LGTM
And committed: r220622.
Thanks Daniel.
-Andy
> On Oct 24, 2014, at 3:04 PM, Daniel Reynaud <dreynaud at apple.com> wrote:
>
> This is a simple fix that brings the compilation time from 5min to 5s on a specific example I've encountered.
>
> It's tricky to come up with a test case, and it would just take a long time to build anyway (before the fix).
>
> Thanks,
> -- daniel
>
>
>
> diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
> index fbc8e0e..e1d18e8 100644
> --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
> +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
> @@ -3117,10 +3117,15 @@ void
> LSRInstance::CollectLoopInvariantFixupsAndFormulae() {
> SmallVector<const SCEV *, 8> Worklist(RegUses.begin(), RegUses.end());
> SmallPtrSet<const SCEV *, 8> Inserted;
> + SmallPtrSet<const SCEV *, 32> Done;
>
> while (!Worklist.empty()) {
> const SCEV *S = Worklist.pop_back_val();
>
> + // Don't process the same SCEV twice
> + if (!Done.insert(S))
> + continue;
> +
> if (const SCEVNAryExpr *N = dyn_cast<SCEVNAryExpr>(S))
> Worklist.append(N->op_begin(), N->op_end());
> else if (const SCEVCastExpr *C = dyn_cast<SCEVCastExpr>(S))
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list