1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=instcombine -S < %s | FileCheck %s
4 ; Check that InstCombine can sink instructions to the landingpad of the invoke.
6 define void @t0_noop(i32 %arg) personality ptr @__gxx_personality_v0 {
7 ; CHECK-LABEL: @t0_noop(
9 ; CHECK-NEXT: [[C:%.*]] = call i1 @cond()
10 ; CHECK-NEXT: br i1 [[C]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
12 ; CHECK-NEXT: invoke void @simple_throw()
13 ; CHECK-NEXT: to label [[INVOKE_CONT:%.*]] unwind label [[LPAD:%.*]]
15 ; CHECK-NEXT: unreachable
17 ; CHECK-NEXT: [[EH:%.*]] = landingpad { ptr, i32 }
19 ; CHECK-NEXT: [[V0:%.*]] = add i32 [[ARG:%.*]], 42
20 ; CHECK-NEXT: call void @consume(i32 [[V0]])
21 ; CHECK-NEXT: call void @destructor()
22 ; CHECK-NEXT: resume { ptr, i32 } [[EH]]
24 ; CHECK-NEXT: [[V1:%.*]] = add i32 [[ARG]], 24
25 ; CHECK-NEXT: call void @consume(i32 [[V1]])
26 ; CHECK-NEXT: call void @sideeffect()
27 ; CHECK-NEXT: ret void
31 %v0 = add i32 %arg, 42
32 %v1 = add i32 %arg, 24
33 br i1 %c, label %if.then, label %if.end
36 invoke void @simple_throw() to label %invoke.cont unwind label %lpad
42 %eh = landingpad { ptr, i32 } cleanup
43 call void @consume(i32 %v0)
44 call void @destructor()
45 resume { ptr, i32 } %eh
48 call void @consume(i32 %v1)
49 call void @sideeffect()
55 declare void @sideeffect()
57 declare void @simple_throw() noreturn
59 declare void @destructor()
61 declare void @consume(i32)
63 declare dso_local i32 @__gxx_personality_v0(...)