[PATCH] D30350: [LSR] Add a cap for reassociation of AllFixupsOutsideLoop type LSRUse to protect compile time

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 14:17:22 PDT 2017


sanjoy added inline comments.


================
Comment at: lib/Analysis/ScalarEvolution.cpp:1790
 
+      // If we have special knowledge that this addrec won't self-overflow,
+      // we don't need to do any further analysis.
----------------
wmi wrote:
> sanjoy wrote:
> > I'm not sure if this is correct.  You're saying that, e.g., `sext({A,+,B}<nw>` is `{sext A,+,zext B}`, but what if `A` is `INT_MAX`, `B` is `1`, and the backedge taken count count is 1?
> Is adding one more constraint isKnownNegative(Step) enough?
I don't think so (btw, the same issue applies to the getSignExtendExpr case as well):  `{-1,0,-1}` is `<nw>` for a loop that runs (say) 10 times, but it unsigned overflows the first time the loop's backedge is taken.



Repository:
  rL LLVM

https://reviews.llvm.org/D30350





More information about the llvm-commits mailing list