xref: /llvm-project/llvm/test/Transforms/InstSimplify/insertvalue.ll (revision 22882c39df71397cc6f9774d18e87d06e016c55f)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
3
4define {i32, i32} @insert_poison({i32, i32} %x) {
5; CHECK-LABEL: @insert_poison(
6; CHECK-NEXT:    ret { i32, i32 } [[X:%.*]]
7;
8  %v = insertvalue {i32, i32} %x, i32 poison, 0
9  ret {i32, i32} %v
10}
11
12define {i32, i32} @insert_undef({i32, i32} %x) {
13; CHECK-LABEL: @insert_undef(
14; CHECK-NEXT:    [[V:%.*]] = insertvalue { i32, i32 } [[X:%.*]], i32 undef, 0
15; CHECK-NEXT:    ret { i32, i32 } [[V]]
16;
17  %v = insertvalue {i32, i32} %x, i32 undef, 0
18  ret {i32, i32} %v
19}
20
21define {i32, i32} @insert_undef_into_non_poison({i32, i32} noundef %x) {
22; CHECK-LABEL: @insert_undef_into_non_poison(
23; CHECK-NEXT:    ret { i32, i32 } [[X:%.*]]
24;
25  %v = insertvalue {i32, i32} %x, i32 undef, 0
26  ret {i32, i32} %v
27}
28
29define {i32, i32} @insert_into_poison({i32, i32} %x) {
30; CHECK-LABEL: @insert_into_poison(
31; CHECK-NEXT:    ret { i32, i32 } [[X:%.*]]
32;
33  %elem = extractvalue {i32, i32} %x, 0
34  %v = insertvalue {i32, i32} poison, i32 %elem, 0
35  ret {i32, i32} %v
36}
37
38define {i32, i32} @insert_into_undef({i32, i32} %x) {
39; CHECK-LABEL: @insert_into_undef(
40; CHECK-NEXT:    ret { i32, i32 } [[X:%.*]]
41;
42  %elem = extractvalue {i32, i32} %x, 0
43  %v = insertvalue {i32, i32} undef, i32 %elem, 0
44  ret {i32, i32} %v
45}
46
47define {i32, i32} @insert_non_poison_into_undef({i32, i32} noundef %x) {
48; CHECK-LABEL: @insert_non_poison_into_undef(
49; CHECK-NEXT:    ret { i32, i32 } [[X:%.*]]
50;
51  %elem = extractvalue {i32, i32} %x, 0
52  %v = insertvalue {i32, i32} undef, i32 %elem, 0
53  ret {i32, i32} %v
54}
55