summaryrefslogtreecommitdiffstats
path: root/llvm/test/Bitcode
diff options
context:
space:
mode:
authorSerge Guelton <sguelton@quarkslab.com>2018-01-05 19:41:19 +0000
committerSerge Guelton <sguelton@quarkslab.com>2018-01-05 19:41:19 +0000
commit4c975578b42a3adcfa5f7d08d67feff589f03398 (patch)
tree1f801ff57ceaee8fe68853241b414a6a9c9f94de /llvm/test/Bitcode
parent9e52e50ac0afc182a899706f436934b570eaf09b (diff)
downloadbcm5719-llvm-4c975578b42a3adcfa5f7d08d67feff589f03398.tar.gz
bcm5719-llvm-4c975578b42a3adcfa5f7d08d67feff589f03398.zip
Limit size of non-GlobalValue name
Otherwise, in some extreme test case, very long names are created and the compiler consumes large amount of memory. Size limit is set to a relatively high value not to disturb debugging. Compiler flag -non-global-value-max-name-size=<value> can be used to customize the size. Differential Revision: https://reviews.llvm.org/D41296 llvm-svn: 321886
Diffstat (limited to 'llvm/test/Bitcode')
-rw-r--r--llvm/test/Bitcode/value-with-long-name.ll18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/test/Bitcode/value-with-long-name.ll b/llvm/test/Bitcode/value-with-long-name.ll
new file mode 100644
index 00000000000..1ca5d133e09
--- /dev/null
+++ b/llvm/test/Bitcode/value-with-long-name.ll
@@ -0,0 +1,18 @@
+; Check the size of generated variable when no option is set
+; RUN: opt -S %s -O2 -o - | FileCheck -check-prefix=CHECK-LONG %s
+; CHECK-LONG: %{{[a-z]{4}[a-z]+}}
+
+; Then check we correctly cap the size of newly generated non-global values name
+; Force the size to be small so that the check works on release and debug build
+; RUN: opt -S %s -O2 -o - -non-global-value-max-name-size=0 | FileCheck -check-prefix=CHECK-SHORT %s
+; RUN: opt -S %s -O2 -o - -non-global-value-max-name-size=1 | FileCheck -check-prefix=CHECK-SHORT %s
+; CHECK-SHORT-NOT: %{{[a-z][a-z]+}}
+
+define i32 @f(i32 %a, i32 %b) {
+ %c = add i32 %a, %b
+ %d = add i32 %c, %a
+ %e = add i32 %d, %b
+ ret i32 %e
+}
+
+
OpenPOWER on IntegriCloud