; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s ;; Formerly crashed, see PR 1508 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" target triple = "powerpc64-unknown-linux-gnu" %struct.Range = type { i64, i64 } define void @Bork(i64 %range.0.0, i64 %range.0.1, i64 %size) personality i32 (...)* @__gxx_personality_v0 { ; CHECK-LABEL: Bork: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: mflr 0 ; CHECK-NEXT: std 31, -8(1) ; CHECK-NEXT: std 0, 16(1) ; CHECK-NEXT: stdu 1, -176(1) ; CHECK-NEXT: .cfi_def_cfa_offset 176 ; CHECK-NEXT: .cfi_offset r31, -8 ; CHECK-NEXT: .cfi_offset lr, 16 ; CHECK-NEXT: mr 31, 1 ; CHECK-NEXT: .cfi_def_cfa_register r31 ; CHECK-NEXT: .cfi_offset r27, -40 ; CHECK-NEXT: .cfi_offset r28, -32 ; CHECK-NEXT: .cfi_offset r29, -24 ; CHECK-NEXT: .cfi_offset r30, -16 ; CHECK-NEXT: std 29, 152(31) # 8-byte Folded Spill ; CHECK-NEXT: mr 29, 3 ; CHECK-NEXT: rldic 3, 5, 3, 29 ; CHECK-NEXT: std 27, 136(31) # 8-byte Folded Spill ; CHECK-NEXT: std 30, 160(31) # 8-byte Folded Spill ; CHECK-NEXT: mr 30, 4 ; CHECK-NEXT: addi 3, 3, 15 ; CHECK-NEXT: rldicl 3, 3, 60, 4 ; CHECK-NEXT: mr 27, 1 ; CHECK-NEXT: rldicl 3, 3, 4, 28 ; CHECK-NEXT: addi 4, 31, 176 ; CHECK-NEXT: neg 3, 3 ; CHECK-NEXT: std 28, 144(31) # 8-byte Folded Spill ; CHECK-NEXT: stdux 4, 1, 3 ; CHECK-NEXT: addi 3, 1, 112 ; CHECK-NEXT: .Ltmp0: ; CHECK-NEXT: bl Foo ; CHECK-NEXT: nop ; CHECK-NEXT: .Ltmp1: ; CHECK-NEXT: # %bb.1: # %bb30.preheader ; CHECK-NEXT: addi 28, 31, 120 ; CHECK-NEXT: cmpldi 30, 0 ; CHECK-NEXT: beq 0, .LBB0_4 ; CHECK-NEXT: .LBB0_2: # %cond_true ; CHECK-NEXT: # ; CHECK-NEXT: .Ltmp3: ; CHECK-NEXT: mr 3, 29 ; CHECK-NEXT: mr 4, 28 ; CHECK-NEXT: bl Bar ; CHECK-NEXT: nop ; CHECK-NEXT: .Ltmp4: ; CHECK-NEXT: # %bb.3: # %invcont23 ; CHECK-NEXT: # ; CHECK-NEXT: ld 3, 128(31) ; CHECK-NEXT: sub 30, 30, 3 ; CHECK-NEXT: cmpldi 30, 0 ; CHECK-NEXT: bne 0, .LBB0_2 ; CHECK-NEXT: .LBB0_4: # %cleanup ; CHECK-NEXT: ld 30, 160(31) # 8-byte Folded Reload ; CHECK-NEXT: ld 29, 152(31) # 8-byte Folded Reload ; CHECK-NEXT: ld 28, 144(31) # 8-byte Folded Reload ; CHECK-NEXT: ld 27, 136(31) # 8-byte Folded Reload ; CHECK-NEXT: ld 1, 0(1) ; CHECK-NEXT: ld 0, 16(1) ; CHECK-NEXT: ld 31, -8(1) ; CHECK-NEXT: mtlr 0 ; CHECK-NEXT: blr ; CHECK-NEXT: .LBB0_5: # %unwind.loopexit.split-lp ; CHECK-NEXT: .Ltmp2: ; CHECK-NEXT: b .LBB0_7 ; CHECK-NEXT: .LBB0_6: # %unwind.loopexit ; CHECK-NEXT: .Ltmp5: ; CHECK-NEXT: .LBB0_7: # %unwind ; CHECK-NEXT: ld 4, 0(1) ; CHECK-NEXT: mr 1, 27 ; CHECK-NEXT: std 4, 0(1) ; CHECK-NEXT: bl _Unwind_Resume ; CHECK-NEXT: nop entry: %effectiveRange = alloca %struct.Range, align 8 ; <%struct.Range*> [#uses=2] %tmp4 = call i8* @llvm.stacksave() ; <i8*> [#uses=1] %size1 = trunc i64 %size to i32 ; <i32> [#uses=1] %tmp17 = alloca i8*, i32 %size1 ; <i8**> [#uses=1] invoke void @Foo(i8** %tmp17) to label %bb30.preheader unwind label %unwind bb30.preheader: ; preds = %entry %tmp26 = getelementptr %struct.Range, %struct.Range* %effectiveRange, i64 0, i32 1 ; <i64*> [#uses=1] br label %bb30 unwind: ; preds = %cond_true, %entry %exn = landingpad {i8*, i32} cleanup call void @llvm.stackrestore(i8* %tmp4) resume { i8*, i32 } %exn invcont23: ; preds = %cond_true %tmp27 = load i64, i64* %tmp26, align 8 ; <i64> [#uses=1] %tmp28 = sub i64 %range_addr.1.0, %tmp27 ; <i64> [#uses=1] br label %bb30 bb30: ; preds = %invcont23, %bb30.preheader %range_addr.1.0 = phi i64 [ %tmp28, %invcont23 ], [ %range.0.1, %bb30.preheader ] ; <i64> [#uses=2] %tmp33 = icmp eq i64 %range_addr.1.0, 0 ; <i1> [#uses=1] br i1 %tmp33, label %cleanup, label %cond_true cond_true: ; preds = %bb30 invoke void @Bar(i64 %range.0.0, %struct.Range* %effectiveRange) to label %invcont23 unwind label %unwind cleanup: ; preds = %bb30 ret void } declare i8* @llvm.stacksave() nounwind declare void @Foo(i8**) declare void @Bar(i64, %struct.Range*) declare void @llvm.stackrestore(i8*) nounwind declare i32 @__gxx_personality_v0(...)