blob: 0c11674094478af26fb6b899485596bcfe0d8c51 [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
21 %eh_ptr = call i8* @llvm.eh.exception() ; <i8*> [#uses=2]
22 %eh_select = call i64 (i8*, i8*, ...)* @llvm.eh.selector.i64(i8* %eh_ptr, i8* bitcast (void ()* @__gxx_personality_v0 to i8*), i8* null) ; <i64> [#uses=0]
23 call void @llvm.stackrestore(i8* %tmp4)
24 call void @_Unwind_Resume(i8* %eh_ptr)
25 unreachable
Dale Johannesend81ae562007-11-16 23:16:35 +000026
Chris Lattnera5457782009-01-09 05:32:00 +000027invcont23: ; preds = %cond_true
28 %tmp27 = load i64* %tmp26, align 8 ; <i64> [#uses=1]
29 %tmp28 = sub i64 %range_addr.1.0, %tmp27 ; <i64> [#uses=1]
30 br label %bb30
Dale Johannesend81ae562007-11-16 23:16:35 +000031
Chris Lattnera5457782009-01-09 05:32:00 +000032bb30: ; preds = %invcont23, %bb30.preheader
33 %range_addr.1.0 = phi i64 [ %tmp28, %invcont23 ], [ %range.0.1, %bb30.preheader ] ; <i64> [#uses=2]
34 %tmp33 = icmp eq i64 %range_addr.1.0, 0 ; <i1> [#uses=1]
35 br i1 %tmp33, label %cleanup, label %cond_true
Dale Johannesend81ae562007-11-16 23:16:35 +000036
Chris Lattnera5457782009-01-09 05:32:00 +000037cond_true: ; preds = %bb30
38 invoke void @Bar(i64 %range.0.0, %struct.Range* %effectiveRange)
39 to label %invcont23 unwind label %unwind
Dale Johannesend81ae562007-11-16 23:16:35 +000040
Chris Lattnera5457782009-01-09 05:32:00 +000041cleanup: ; preds = %bb30
42 ret void
Dale Johannesend81ae562007-11-16 23:16:35 +000043}
44
Chris Lattnera5457782009-01-09 05:32:00 +000045declare i8* @llvm.stacksave() nounwind
Dale Johannesend81ae562007-11-16 23:16:35 +000046
47declare void @Foo(i8**)
48
Chris Lattnera5457782009-01-09 05:32:00 +000049declare i8* @llvm.eh.exception() nounwind
Dale Johannesend81ae562007-11-16 23:16:35 +000050
Chris Lattnera5457782009-01-09 05:32:00 +000051declare i64 @llvm.eh.selector.i64(i8*, i8*, ...) nounwind
Dale Johannesend81ae562007-11-16 23:16:35 +000052
53declare void @__gxx_personality_v0()
54
55declare void @_Unwind_Resume(i8*)
56
57declare void @Bar(i64, %struct.Range*)
58
Chris Lattnera5457782009-01-09 05:32:00 +000059declare void @llvm.stackrestore(i8*) nounwind