1 ; RUN: opt < %s -instcombine -S | FileCheck %s
2 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4 ; Check that we can find and remove redundant insertvalues
5 ; CHECK-LABEL: foo_simple
7 define { i8*, i64, i32 } @foo_simple(i8* %x, i8* %y) nounwind {
9 %0 = insertvalue { i8*, i64, i32 } undef, i8* %x, 0
10 %1 = insertvalue { i8*, i64, i32 } %0, i8* %y, 0
11 ret { i8*, i64, i32 } %1
13 ; Check that we can find and remove redundant nodes in insertvalues chain
14 ; CHECK-LABEL: foo_ovwrt_chain
15 ; CHECK-NOT: i64 %y, 1
16 ; CHECK-NOT: i32 555, 2
17 define { i8*, i64, i32 } @foo_ovwrt_chain(i8* %x, i64 %y, i64 %z) nounwind {
19 %0 = insertvalue { i8*, i64, i32 } undef, i8* %x, 0
20 %1 = insertvalue { i8*, i64, i32 } %0, i64 %y, 1
21 %2 = insertvalue { i8*, i64, i32 } %1, i32 555, 2
22 %3 = insertvalue { i8*, i64, i32 } %2, i64 %z, 1
23 %4 = insertvalue { i8*, i64, i32 } %3, i32 777, 2
24 ret { i8*, i64, i32 } %4