blob: a301993973511ce08e6cefdf761875bcb49ee005 [file] [log] [blame]
Dan Gohmaneab06fa2012-03-13 18:01:37 +00001; RUN: opt -S -globalopt < %s | FileCheck %s
2; rdar://11022897
3
4; Globalopt should be able to evaluate an invoke.
Peter Collingbourne96efdd62016-06-14 21:01:22 +00005; CHECK: @tmp = local_unnamed_addr global i32 1
Dan Gohmaneab06fa2012-03-13 18:01:37 +00006
7@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }]
8@tmp = global i32 0
9
10define i32 @one() {
11 ret i32 1
12}
13
David Majnemer7fddecc2015-06-17 20:52:32 +000014define void @_GLOBAL__I_a() personality i8* undef {
Dan Gohmaneab06fa2012-03-13 18:01:37 +000015bb:
16 %tmp1 = invoke i32 @one()
17 to label %bb2 unwind label %bb4
18
19bb2: ; preds = %bb
20 store i32 %tmp1, i32* @tmp
21 ret void
22
23bb4: ; preds = %bb
David Majnemer7fddecc2015-06-17 20:52:32 +000024 %tmp5 = landingpad { i8*, i32 }
Dan Gohmaneab06fa2012-03-13 18:01:37 +000025 filter [0 x i8*] zeroinitializer
26 unreachable
27}