diff options
| -rw-r--r-- | llvm/test/Transforms/InstSimplify/insertvalue.ll | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/llvm/test/Transforms/InstSimplify/insertvalue.ll b/llvm/test/Transforms/InstSimplify/insertvalue.ll index d9cf8dc4e..b236073 100644 --- a/llvm/test/Transforms/InstSimplify/insertvalue.ll +++ b/llvm/test/Transforms/InstSimplify/insertvalue.ll @@ -9,6 +9,23 @@ define {i32, i32} @insert_poison({i32, i32} %x) { ret {i32, i32} %v } +define {i32, i32} @insert_undef({i32, i32} %x) { +; CHECK-LABEL: @insert_undef( +; CHECK-NEXT: [[V:%.*]] = insertvalue { i32, i32 } [[X:%.*]], i32 undef, 0 +; CHECK-NEXT: ret { i32, i32 } [[V]] +; + %v = insertvalue {i32, i32} %x, i32 undef, 0 + ret {i32, i32} %v +} + +define {i32, i32} @insert_undef_into_non_poison({i32, i32} noundef %x) { +; CHECK-LABEL: @insert_undef_into_non_poison( +; CHECK-NEXT: ret { i32, i32 } [[X:%.*]] +; + %v = insertvalue {i32, i32} %x, i32 undef, 0 + ret {i32, i32} %v +} + define {i32, i32} @insert_into_poison({i32, i32} %x) { ; CHECK-LABEL: @insert_into_poison( ; CHECK-NEXT: ret { i32, i32 } [[X:%.*]] @@ -18,19 +35,20 @@ define {i32, i32} @insert_into_poison({i32, i32} %x) { ret {i32, i32} %v } -define {i32, i32} @insert_undef({i32, i32} %x) { -; CHECK-LABEL: @insert_undef( -; CHECK-NEXT: [[V:%.*]] = insertvalue { i32, i32 } [[X:%.*]], i32 undef, 0 -; CHECK-NEXT: ret { i32, i32 } [[V]] +define {i32, i32} @insert_into_undef({i32, i32} %x) { +; CHECK-LABEL: @insert_into_undef( +; CHECK-NEXT: ret { i32, i32 } [[X:%.*]] ; - %v = insertvalue {i32, i32} %x, i32 undef, 0 + %elem = extractvalue {i32, i32} %x, 0 + %v = insertvalue {i32, i32} undef, i32 %elem, 0 ret {i32, i32} %v } -define {i32, i32} @insert_undef_into_non_poison({i32, i32} noundef %x) { -; CHECK-LABEL: @insert_undef_into_non_poison( +define {i32, i32} @insert_non_poison_into_undef({i32, i32} noundef %x) { +; CHECK-LABEL: @insert_non_poison_into_undef( ; CHECK-NEXT: ret { i32, i32 } [[X:%.*]] ; - %v = insertvalue {i32, i32} %x, i32 undef, 0 + %elem = extractvalue {i32, i32} %x, 0 + %v = insertvalue {i32, i32} undef, i32 %elem, 0 ret {i32, i32} %v } |
