diff options
author | Florian Hahn <flo@fhahn.com> | 2020-12-06 19:58:33 +0000 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2020-12-06 20:19:15 +0000 |
commit | f19876c5366136da942b733d6e4b435fb19863a3 (patch) | |
tree | af4b5c4e516fed198427076b91a971aa874c7b30 /llvm/lib/Analysis/ConstraintSystem.cpp | |
parent | d1c14dd0fc95e8d3400dd447b516e073ba1efc07 (diff) | |
download | llvm-f19876c5366136da942b733d6e4b435fb19863a3.zip llvm-f19876c5366136da942b733d6e4b435fb19863a3.tar.gz llvm-f19876c5366136da942b733d6e4b435fb19863a3.tar.bz2 |
[ConstraintElimination] Bail out if system gets too big.
For some inputs, the constraint system can grow quite large during
solving, because it replaces complex constraints with one or more
simpler constraints. This adds a cut-off to avoid compile-time explosion
on problematic inputs.
Diffstat (limited to 'llvm/lib/Analysis/ConstraintSystem.cpp')
-rw-r--r-- | llvm/lib/Analysis/ConstraintSystem.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ConstraintSystem.cpp b/llvm/lib/Analysis/ConstraintSystem.cpp index f3a2834..1d58280 100644 --- a/llvm/lib/Analysis/ConstraintSystem.cpp +++ b/llvm/lib/Analysis/ConstraintSystem.cpp @@ -84,6 +84,9 @@ bool ConstraintSystem::eliminateUsingFM() { .getZExtValue(); } NewSystem.push_back(std::move(NR)); + // Give up if the new system gets too big. + if (NewSystem.size() > 500) + return false; } } Constraints = std::move(NewSystem); |