1; RUN: llc < %s 2;; Formerly crashed, see PR 1508 3target 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" 5 %struct.Range = type { i64, i64 } 6 7define void @Bork(i64 %range.0.0, i64 %range.0.1, i64 %size) { 8entry: 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 15 16bb30.preheader: ; preds = %entry 17 %tmp26 = getelementptr %struct.Range* %effectiveRange, i64 0, i32 1 ; <i64*> [#uses=1] 18 br label %bb30 19 20unwind: ; 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 26 27invcont23: ; 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 31 32bb30: ; 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 36 37cond_true: ; preds = %bb30 38 invoke void @Bar(i64 %range.0.0, %struct.Range* %effectiveRange) 39 to label %invcont23 unwind label %unwind 40 41cleanup: ; preds = %bb30 42 ret void 43} 44 45declare i8* @llvm.stacksave() nounwind 46 47declare void @Foo(i8**) 48 49declare i8* @llvm.eh.exception() nounwind 50 51declare i64 @llvm.eh.selector.i64(i8*, i8*, ...) nounwind 52 53declare void @__gxx_personality_v0() 54 55declare void @_Unwind_Resume(i8*) 56 57declare void @Bar(i64, %struct.Range*) 58 59declare void @llvm.stackrestore(i8*) nounwind 60