aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/Transforms/SCCP/dont-zap-return.ll
blob: 3dca821e25b94414aaf0b6f42f2eb48ff127794f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
; RUN: opt -passes=ipsccp < %s -S | FileCheck %s

define internal {i32, i32} @identity(i32 %patatino) {
  %foo = insertvalue {i32, i32} {i32 1, i32 undef}, i32 %patatino, 1
  ret {i32, i32} %foo
}

; Check that the return value is not transformed to undef
; CHECK: define internal { i32, i32 } @identity(i32 %patatino) {
; CHECK-NEXT:  %foo = insertvalue { i32, i32 } { i32 1, i32 undef }, i32 %patatino, 1
; CHECK-NEXT:  ret { i32, i32 } %foo
; CHECK-NEXT: }


define {i32, i32} @caller(i32 %pat) {
  %S1 = call {i32, i32} @identity(i32 %pat)
  ret {i32, i32} %S1
}

; Check that we don't invent values and propagate them.
; CHECK: define { i32, i32 } @caller(i32 %pat) {
; CHECK-NEXT:  %S1 = call { i32, i32 } @identity(i32 %pat)
; CHECK-NEXT:  ret { i32, i32 } %S1
; CHECK-NEXT: }