[PATCH] D54239: [JumpThreading] Fix exponential time algorithm computing known values.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 7 16:24:23 PST 2018
efriedma created this revision.
efriedma added reviewers: mkazantsev, mzolotukhin, wmi.
Herald added a subscriber: jfb.
ComputeValueKnownInPredecessors has a "visited" set to prevent infinite loops, since a value can be visited more than once. However, the implementation didn't prevent the algorithm from taking exponential time. Instead of removing elements from the RecursionSet one at a time, we should keep around the whole set until ComputeValueKnownInPredecessors finishes, then discard it.
The testcase is synthetic because I was having trouble effectively reducing the original. But it's basically the same idea.
Instead of failing, we could theoretically cache the result instead. But I don't think it would help substantially in practice.
Repository:
rL LLVM
https://reviews.llvm.org/D54239
Files:
include/llvm/Transforms/Scalar/JumpThreading.h
lib/Transforms/Scalar/JumpThreading.cpp
test/Transforms/JumpThreading/crash.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54239.173077.patch
Type: text/x-patch
Size: 8321 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181108/264eec13/attachment.bin>
More information about the llvm-commits
mailing list