Michael Zolotukhin | 7d6293a | 2014-05-07 14:30:18 +0000 | [diff] [blame^] | 1 | ; RUN: opt < %s -instcombine -S | FileCheck %s |
| 2 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 3 | |
| 4 | ; Check that we can find and remove redundant insertvalues |
| 5 | ; CHECK-LABEL: foo_simple |
| 6 | ; CHECK-NOT: i8* %x, 0 |
| 7 | define { i8*, i64, i32 } @foo_simple(i8* %x, i8* %y) nounwind { |
| 8 | entry: |
| 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 |
| 12 | } |
| 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 { |
| 18 | entry: |
| 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 |
| 25 | } |