xref: /llvm-project/llvm/test/Transforms/SCCP/dont-zap-return.ll (revision 8ebb3eac02a926ffa4298c12834c57aefb2e8579)
1; RUN: opt -passes=ipsccp < %s -S | FileCheck %s
2
3define internal {i32, i32} @identity(i32 %patatino) {
4  %foo = insertvalue {i32, i32} {i32 1, i32 undef}, i32 %patatino, 1
5  ret {i32, i32} %foo
6}
7
8; Check that the return value is not transformed to undef
9; CHECK: define internal { i32, i32 } @identity(i32 %patatino) {
10; CHECK-NEXT:  %foo = insertvalue { i32, i32 } { i32 1, i32 undef }, i32 %patatino, 1
11; CHECK-NEXT:  ret { i32, i32 } %foo
12; CHECK-NEXT: }
13
14
15define {i32, i32} @caller(i32 %pat) {
16  %S1 = call {i32, i32} @identity(i32 %pat)
17  ret {i32, i32} %S1
18}
19
20; Check that we don't invent values and propagate them.
21; CHECK: define { i32, i32 } @caller(i32 %pat) {
22; CHECK-NEXT:  %S1 = call { i32, i32 } @identity(i32 %pat)
23; CHECK-NEXT:  ret { i32, i32 } %S1
24; CHECK-NEXT: }
25