1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
4 define {i32, i32} @insert_poison({i32, i32} %x) {
5 ; CHECK-LABEL: @insert_poison(
6 ; CHECK-NEXT: ret { i32, i32 } [[X:%.*]]
8 %v = insertvalue {i32, i32} %x, i32 poison, 0
12 define {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]]
17 %v = insertvalue {i32, i32} %x, i32 undef, 0
21 define {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:%.*]]
25 %v = insertvalue {i32, i32} %x, i32 undef, 0
29 define {i32, i32} @insert_into_poison({i32, i32} %x) {
30 ; CHECK-LABEL: @insert_into_poison(
31 ; CHECK-NEXT: ret { i32, i32 } [[X:%.*]]
33 %elem = extractvalue {i32, i32} %x, 0
34 %v = insertvalue {i32, i32} poison, i32 %elem, 0
38 define {i32, i32} @insert_into_undef({i32, i32} %x) {
39 ; CHECK-LABEL: @insert_into_undef(
40 ; CHECK-NEXT: [[ELEM:%.*]] = extractvalue { i32, i32 } [[X:%.*]], 0
41 ; CHECK-NEXT: [[V:%.*]] = insertvalue { i32, i32 } undef, i32 [[ELEM]], 0
42 ; CHECK-NEXT: ret { i32, i32 } [[V]]
44 %elem = extractvalue {i32, i32} %x, 0
45 %v = insertvalue {i32, i32} undef, i32 %elem, 0
49 define {i32, i32} @insert_non_poison_into_undef({i32, i32} noundef %x) {
50 ; CHECK-LABEL: @insert_non_poison_into_undef(
51 ; CHECK-NEXT: ret { i32, i32 } [[X:%.*]]
53 %elem = extractvalue {i32, i32} %x, 0
54 %v = insertvalue {i32, i32} undef, i32 %elem, 0