1 ; RUN: llvm-as < %s | llc -enable-eh
2 ;; Formerly crashed, see PR 1508
3 target 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"
4 target triple = "powerpc64-apple-darwin8"
5 %struct.Range = type { i64, i64 }
7 define void @Bork(i64 %range.0.0, i64 %range.0.1, i64 %size) {
9 %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
16 bb30.preheader: ; preds = %entry
17 %tmp26 = getelementptr %struct.Range* %effectiveRange, i64 0, i32 1 ; <i64*> [#uses=1]
20 unwind: ; 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)
27 invcont23: ; 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]
32 bb30: ; 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
37 cond_true: ; preds = %bb30
38 invoke void @Bar(i64 %range.0.0, %struct.Range* %effectiveRange)
39 to label %invcont23 unwind label %unwind
41 cleanup: ; preds = %bb30
45 declare i8* @llvm.stacksave() nounwind
47 declare void @Foo(i8**)
49 declare i8* @llvm.eh.exception() nounwind
51 declare i64 @llvm.eh.selector.i64(i8*, i8*, ...) nounwind
53 declare void @__gxx_personality_v0()
55 declare void @_Unwind_Resume(i8*)
57 declare void @Bar(i64, %struct.Range*)
59 declare void @llvm.stackrestore(i8*) nounwind