blob: ecf45efee2e648878ac78979c5100346f5bc9fc3 [file] [log] [blame]
Duncan Sands57b6e9e2010-05-02 15:36:26 +00001; RUN: llc < %s
Dale Johannesend81ae562007-11-16 23:16:35 +00002;; Formerly crashed, see PR 1508
Dale Johannesend81ae562007-11-16 23:16:35 +00003target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128"
4target triple = "powerpc64-apple-darwin8"
Chris Lattnera5457782009-01-09 05:32:00 +00005 %struct.Range = type { i64, i64 }
Dale Johannesend81ae562007-11-16 23:16:35 +00006
7define void @Bork(i64 %range.0.0, i64 %range.0.1, i64 %size) {
8entry:
Chris Lattnera5457782009-01-09 05:32:00 +00009 %effectiveRange = alloca %struct.Range, align 8 ; <%struct.Range*> [#uses=2]
10 %tmp4 = call i8* @llvm.stacksave() ; <i8*> [#uses=1]
11 %size1 = trunc i64 %size to i32 ; <i32> [#uses=1]
12 %tmp17 = alloca i8*, i32 %size1 ; <i8**> [#uses=1]
13 invoke void @Foo(i8** %tmp17)
14 to label %bb30.preheader unwind label %unwind
Dale Johannesend81ae562007-11-16 23:16:35 +000015
Chris Lattnera5457782009-01-09 05:32:00 +000016bb30.preheader: ; preds = %entry
17 %tmp26 = getelementptr %struct.Range* %effectiveRange, i64 0, i32 1 ; <i64*> [#uses=1]
18 br label %bb30
Dale Johannesend81ae562007-11-16 23:16:35 +000019
Chris Lattnera5457782009-01-09 05:32:00 +000020unwind: ; preds = %cond_true, %entry
Bill Wendlingab98f9d2011-08-31 21:04:11 +000021 %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
22 catch i8* null
Chris Lattnera5457782009-01-09 05:32:00 +000023 call void @llvm.stackrestore(i8* %tmp4)
Bill Wendlingab98f9d2011-08-31 21:04:11 +000024 resume { i8*, i32 } %exn
Dale Johannesend81ae562007-11-16 23:16:35 +000025
Chris Lattnera5457782009-01-09 05:32:00 +000026invcont23: ; preds = %cond_true
27 %tmp27 = load i64* %tmp26, align 8 ; <i64> [#uses=1]
28 %tmp28 = sub i64 %range_addr.1.0, %tmp27 ; <i64> [#uses=1]
29 br label %bb30
Dale Johannesend81ae562007-11-16 23:16:35 +000030
Chris Lattnera5457782009-01-09 05:32:00 +000031bb30: ; preds = %invcont23, %bb30.preheader
32 %range_addr.1.0 = phi i64 [ %tmp28, %invcont23 ], [ %range.0.1, %bb30.preheader ] ; <i64> [#uses=2]
33 %tmp33 = icmp eq i64 %range_addr.1.0, 0 ; <i1> [#uses=1]
34 br i1 %tmp33, label %cleanup, label %cond_true
Dale Johannesend81ae562007-11-16 23:16:35 +000035
Chris Lattnera5457782009-01-09 05:32:00 +000036cond_true: ; preds = %bb30
37 invoke void @Bar(i64 %range.0.0, %struct.Range* %effectiveRange)
38 to label %invcont23 unwind label %unwind
Dale Johannesend81ae562007-11-16 23:16:35 +000039
Chris Lattnera5457782009-01-09 05:32:00 +000040cleanup: ; preds = %bb30
41 ret void
Dale Johannesend81ae562007-11-16 23:16:35 +000042}
43
Chris Lattnera5457782009-01-09 05:32:00 +000044declare i8* @llvm.stacksave() nounwind
Dale Johannesend81ae562007-11-16 23:16:35 +000045
46declare void @Foo(i8**)
47
Dale Johannesend81ae562007-11-16 23:16:35 +000048declare void @Bar(i64, %struct.Range*)
49
Chris Lattnera5457782009-01-09 05:32:00 +000050declare void @llvm.stackrestore(i8*) nounwind
Bill Wendlingab98f9d2011-08-31 21:04:11 +000051
52declare i32 @__gxx_personality_v0(...)