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 %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0 22 catch i8* null 23 call void @llvm.stackrestore(i8* %tmp4) 24 resume { i8*, i32 } %exn 25 26invcont23: ; 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 30 31bb30: ; 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 35 36cond_true: ; preds = %bb30 37 invoke void @Bar(i64 %range.0.0, %struct.Range* %effectiveRange) 38 to label %invcont23 unwind label %unwind 39 40cleanup: ; preds = %bb30 41 ret void 42} 43 44declare i8* @llvm.stacksave() nounwind 45 46declare void @Foo(i8**) 47 48declare void @Bar(i64, %struct.Range*) 49 50declare void @llvm.stackrestore(i8*) nounwind 51 52declare i32 @__gxx_personality_v0(...) 53