summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDylan McKay <me@dylanmckay.io>2018-03-20 11:23:03 +0000
committerDylan McKay <me@dylanmckay.io>2018-03-20 11:23:03 +0000
commit212841b7ad0b61b1386def50013d251a5fb0a9f9 (patch)
tree6bf0a73d465d0a5ad03c74d213428609dcb977c6 /llvm
parentceecf3bbda59776198d8f650bb97cca453efc885 (diff)
downloadbcm5719-llvm-212841b7ad0b61b1386def50013d251a5fb0a9f9.tar.gz
bcm5719-llvm-212841b7ad0b61b1386def50013d251a5fb0a9f9.zip
[AVR] Add a regression test for struct return lowering
The test is taken from https://github.com/avr-rust/rust/issues/57 The originally implementation of struct return lowering was made in r325474. Patch by Peter Nimmervoll llvm-svn: 327967
Diffstat (limited to 'llvm')
-rw-r--r--llvm/test/CodeGen/AVR/lower-formal-args-struct-return.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AVR/lower-formal-args-struct-return.ll b/llvm/test/CodeGen/AVR/lower-formal-args-struct-return.ll
new file mode 100644
index 00000000000..f7a45632ba8
--- /dev/null
+++ b/llvm/test/CodeGen/AVR/lower-formal-args-struct-return.ll
@@ -0,0 +1,21 @@
+; RUN: llc < %s -march=avr | FileCheck %s
+
+; This test ensures that the backend can lower returns of struct values.
+; It does not check how these are lowered.
+;
+; In the past, this code used to return an error
+;
+; Assertion `InVals.size() == Ins.size() && "LowerFormalArguments didn't emit the correct number of values!"' failed.
+;
+; This feature was first implemented in r325474.
+
+declare i8 @do_something(i8 %val)
+
+; CHECK-LABEL: main
+define { i1, i8 } @main(i8) #2 {
+entry:
+ %1 = call zeroext i8 @do_something(i8 zeroext %0)
+ %2 = insertvalue { i1, i8 } { i1 true, i8 undef }, i8 %1, 1
+ ret { i1, i8 } %2
+}
+
OpenPOWER on IntegriCloud