[PATCH] D40718: [LSR] Complexity tradeoff in GenerateReassociationsImpl

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 26 13:16:48 PST 2017


sanjoy requested changes to this revision.
sanjoy added inline comments.
This revision now requires changes to proceed.


================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:3497
+    unsigned Depth = InnerAddOps.size() / 4;
+    const SCEV *InnerSum = SE.getAddExpr(InnerAddOps, SCEV::FlagAnyWrap, Depth);
     if (InnerSum->isZero())
----------------
This worries me from a design perspective -- the `Depth` parameter definitely should not be part of the public API of SCEV (I had not noticed that we've added these parameters to the public API).  We can't guarantee its meaning or even its presence to passes that use SCEV.

Can we instead make SCEV smarter to avoid spending a lot of cycles in pathological cases like this?


https://reviews.llvm.org/D40718





More information about the llvm-commits mailing list