1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
6 define void @test1() personality ptr @__gxx_personality_v0 {
9 ; CHECK-NEXT: invoke void @bar()
10 ; CHECK-NEXT: to label [[CONT:%.*]] unwind label [[LPAD:%.*]]
12 ; CHECK-NEXT: ret void
14 ; CHECK-NEXT: [[EX:%.*]] = landingpad { ptr, i32 }
16 ; CHECK-NEXT: resume { ptr, i32 } [[EX]]
19 invoke void @bar() to label %cont unwind label %lpad
23 %ex = landingpad { ptr, i32 } cleanup
24 %exc_ptr = extractvalue { ptr, i32 } %ex, 0
25 %filter = extractvalue { ptr, i32 } %ex, 1
26 %exc_ptr2 = insertvalue { ptr, i32 } poison, ptr %exc_ptr, 0
27 %filter2 = insertvalue { ptr, i32 } %exc_ptr2, i32 %filter, 1
28 resume { ptr, i32 } %filter2
31 declare i32 @__gxx_personality_v0(i32, i64, ptr, ptr)
33 define { i8, i32 } @test2({ ptr, i32 } %x) {
34 ; CHECK-LABEL: @test2(
35 ; CHECK-NEXT: [[EX:%.*]] = extractvalue { ptr, i32 } [[X:%.*]], 1
36 ; CHECK-NEXT: [[INS:%.*]] = insertvalue { i8, i32 } undef, i32 [[EX]], 1
37 ; CHECK-NEXT: ret { i8, i32 } [[INS]]
39 %ex = extractvalue { ptr, i32 } %x, 1
40 %ins = insertvalue { i8, i32 } undef, i32 %ex, 1
44 define i32 @test3(i32 %a, float %b) {
45 ; CHECK-LABEL: @test3(
46 ; CHECK-NEXT: ret i32 [[A:%.*]]
48 %agg1 = insertvalue {i32, float} undef, i32 %a, 0
49 %agg2 = insertvalue {i32, float} %agg1, float %b, 1
50 %ev = extractvalue {i32, float} %agg2, 0
54 define i8 @test4(<8 x i8> %V) {
55 ; CHECK-LABEL: @test4(
56 ; CHECK-NEXT: [[ADD:%.*]] = add <8 x i8> [[V:%.*]], bitcast (<1 x double> <double 0x319BEB8FD172E36> to <8 x i8>)
57 ; CHECK-NEXT: [[EXTRACT:%.*]] = extractelement <8 x i8> [[ADD]], i32 6
58 ; CHECK-NEXT: ret i8 [[EXTRACT]]
60 %add = add <8 x i8> %V, bitcast (double 0x319BEB8FD172E36 to <8 x i8>)
61 %extract = extractelement <8 x i8> %add, i32 6
65 define i32 @test5(<4 x i32> %V) {
66 ; CHECK-LABEL: @test5(
67 ; CHECK-NEXT: ret i32 poison
69 %extract = extractelement <4 x i32> %V, i32 undef