[PATCH] D25810: [SCEV] Memoize visitMulExpr results in SCEVRewriteVisitor. Fix PR18606
Li Huang via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 19 17:56:26 PDT 2016
lihuang created this revision.
lihuang added reviewers: sanjoy, mehdi_amini, mzolotukhin.
lihuang added a subscriber: llvm-commits.
lihuang added a dependency: D25794: [SCEV] Add a threshold to restrict number of mul operands to be inlined into SCEV.
[SCEV] Memoize visitMulExpr results in SCEVRewriteVisitor. Fix PR18606
When SCEVRewriteVisitor traverses the SCEV DAG, it may visit the same SCEV multiple times if this SCEV is referenced by multiple other SCEVs. This has exponential time complexity in the worst case. Memoizing the results will avoid re-visiting the same SCEV.
It's legal to memoize the rewrite results because SCEVRewriteVisitor is state-less, i.e., it should return the same rewrite result each time for the same input SCEV. Currently only memoize results of visitMulExpr because other functions are much cheaper in the worst case.
This patch depends on https://reviews.llvm.org/D25794, and they together fix PR18606.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4911 bytes
Desc: not available
More information about the llvm-commits