summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/hangs.c
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2018-05-31 17:22:38 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2018-05-31 17:22:38 +0000
commit16a1f64ccf0f85b501e41dc54a583f56e4826e12 (patch)
treeed5b3edc4aee767f87de8b9f360e1015f39a95cf /clang/test/Analysis/hangs.c
parent745918ff87f17fae86edcdfac8daa16f44c8b1e0 (diff)
downloadbcm5719-llvm-16a1f64ccf0f85b501e41dc54a583f56e4826e12.tar.gz
bcm5719-llvm-16a1f64ccf0f85b501e41dc54a583f56e4826e12.zip
[analyzer] Improve performance of the SVal simplification mechanism.
When neither LHS nor RHS of a binary operator expression can be simplified, return the original expression instead of re-evaluating the binary operator. Such re-evaluation was causing recusrive re-simplification which caused the algorithmic complexity to explode. Differential Revision: https://reviews.llvm.org/D47155 llvm-svn: 333670
Diffstat (limited to 'clang/test/Analysis/hangs.c')
-rw-r--r--clang/test/Analysis/hangs.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/test/Analysis/hangs.c b/clang/test/Analysis/hangs.c
new file mode 100644
index 00000000000..b109bcb52fd
--- /dev/null
+++ b/clang/test/Analysis/hangs.c
@@ -0,0 +1,30 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker core -verify %s
+
+// expected-no-diagnostics
+
+// Stuff that used to hang.
+
+int g();
+
+int f(int y) {
+ return y + g();
+}
+
+int produce_a_very_large_symbol(int x) {
+ return f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(
+ f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(x))))))))))))))))))))))))))))))));
+}
+
+void produce_an_exponentially_exploding_symbol(int x, int y) {
+ x += y; y += x + g();
+ x += y; y += x + g();
+ x += y; y += x + g();
+ x += y; y += x + g();
+ x += y; y += x + g();
+ x += y; y += x + g();
+ x += y; y += x + g();
+ x += y; y += x + g();
+ x += y; y += x + g();
+ x += y; y += x + g();
+ x += y; y += x + g();
+}
OpenPOWER on IntegriCloud