summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test')
-rwxr-xr-xllvm/test/Reduce/Inputs/remove-args.py16
-rw-r--r--llvm/test/Reduce/remove-args.ll22
2 files changed, 38 insertions, 0 deletions
diff --git a/llvm/test/Reduce/Inputs/remove-args.py b/llvm/test/Reduce/Inputs/remove-args.py
new file mode 100755
index 00000000000..fea62c3174e
--- /dev/null
+++ b/llvm/test/Reduce/Inputs/remove-args.py
@@ -0,0 +1,16 @@
+import sys
+
+InterestingArgumentPresent = False
+FunctionCallPresent = False
+
+input = open(sys.argv[1], "r")
+for line in input:
+ if "%interesting" in line:
+ InterestingArgumentPresent = True
+ if "call void @interesting" in line:
+ FunctionCallPresent = True
+
+if InterestingArgumentPresent and FunctionCallPresent:
+ sys.exit(0) # Interesting!
+
+sys.exit(1)
diff --git a/llvm/test/Reduce/remove-args.ll b/llvm/test/Reduce/remove-args.ll
new file mode 100644
index 00000000000..6aadeb57d83
--- /dev/null
+++ b/llvm/test/Reduce/remove-args.ll
@@ -0,0 +1,22 @@
+; Test that llvm-reduce can remove uninteresting function arguments from function definitions as well as their calls.
+;
+; RUN: rm -rf %t
+; RUN: mkdir %t
+; copy the test file to preserve executable bit
+; RUN: cp %p/Inputs/remove-args.py %t/test.py
+; get the python path from lit
+; RUN: echo "#!" %python > %t/test.py
+; then include the rest of the test script
+; RUN: cat %p/Inputs/remove-args.py >> %t/test.py
+
+; RUN: llvm-reduce --test %t/test.py %s -o %t/out.ll
+; RUN: cat %t/out.ll | FileCheck -implicit-check-not=uninteresting %s
+; REQUIRES: plugins
+
+; CHECK: @interesting(i32 %interesting)
+define void @interesting(i32 %uninteresting1, i32 %interesting, i32 %uninteresting2) {
+entry:
+ ; CHECK: call void @interesting(i32 0)
+ call void @interesting(i32 -1, i32 0, i32 -1)
+ ret void
+}
OpenPOWER on IntegriCloud