blob: 885cb70007e673ff7552e1bcae7bd619b5cecb42 [file] [log] [blame]
Duncan Sandsfd26a952011-09-05 06:52:48 +00001; RUN: opt < %s -instsimplify -S | FileCheck %s
2
Duncan Sandsfd26a952011-09-05 06:52:48 +00003declare void @bar()
4
David Majnemer7fddecc2015-06-17 20:52:32 +00005define void @test1() personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 {
Duncan Sandsfd26a952011-09-05 06:52:48 +00006entry:
7 invoke void @bar() to label %cont unwind label %lpad
8cont:
9 ret void
10lpad:
David Majnemer7fddecc2015-06-17 20:52:32 +000011 %ex = landingpad { i8*, i32 } cleanup
Duncan Sandsfd26a952011-09-05 06:52:48 +000012 %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
Stephen Linc1c7a132013-07-14 01:42:54 +000017; CHECK-LABEL: @test1(
Benjamin Kramer4b79c212011-09-05 18:16:19 +000018; CHECK-NOT: extractvalue
19; CHECK-NOT: insertvalue
Duncan Sandsfd26a952011-09-05 06:52:48 +000020}
21
22declare i32 @__gxx_personality_v0(i32, i64, i8*, i8*)
Benjamin Kramer4b79c212011-09-05 18:16:19 +000023
24define { 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
Stephen Linc1c7a132013-07-14 01:42:54 +000028; CHECK-LABEL: @test2(
Benjamin Kramer4b79c212011-09-05 18:16:19 +000029}