Duncan Sands | dabc280 | 2011-09-05 06:52:48 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -instsimplify -S | FileCheck %s |
| 2 | |
Duncan Sands | dabc280 | 2011-09-05 06:52:48 +0000 | [diff] [blame] | 3 | declare void @bar() |
| 4 | |
Benjamin Kramer | ae707bd | 2011-09-05 18:16:19 +0000 | [diff] [blame^] | 5 | define void @test1() { |
Duncan Sands | dabc280 | 2011-09-05 06:52:48 +0000 | [diff] [blame] | 6 | entry: |
| 7 | invoke void @bar() to label %cont unwind label %lpad |
| 8 | cont: |
| 9 | ret void |
| 10 | lpad: |
| 11 | %ex = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 cleanup |
| 12 | %exc_ptr = extractvalue { i8*, i32 } %ex, 0 |
| 13 | %filter = extractvalue { i8*, i32 } %ex, 1 |
| 14 | %exc_ptr2 = insertvalue { i8*, i32 } undef, i8* %exc_ptr, 0 |
| 15 | %filter2 = insertvalue { i8*, i32 } %exc_ptr2, i32 %filter, 1 |
| 16 | resume { i8*, i32 } %filter2 |
Benjamin Kramer | ae707bd | 2011-09-05 18:16:19 +0000 | [diff] [blame^] | 17 | ; CHECK: @test1 |
| 18 | ; CHECK-NOT: extractvalue |
| 19 | ; CHECK-NOT: insertvalue |
Duncan Sands | dabc280 | 2011-09-05 06:52:48 +0000 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | declare i32 @__gxx_personality_v0(i32, i64, i8*, i8*) |
Benjamin Kramer | ae707bd | 2011-09-05 18:16:19 +0000 | [diff] [blame^] | 23 | |
| 24 | define { i8, i32 } @test2({ i8*, i32 } %x) { |
| 25 | %ex = extractvalue { i8*, i32 } %x, 1 |
| 26 | %ins = insertvalue { i8, i32 } undef, i32 %ex, 1 |
| 27 | ret { i8, i32 } %ins |
| 28 | ; CHECK: @test2 |
| 29 | } |