1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s
3 ;; Formerly crashed, see PR 1508
4 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"
5 target triple = "powerpc64-unknown-linux-gnu"
6 %struct.Range = type { i64, i64 }
8 define void @Bork(i64 %range.0.0, i64 %range.0.1, i64 %size) personality ptr @__gxx_personality_v0 {
10 ; CHECK: # %bb.0: # %entry
12 ; CHECK-NEXT: std 31, -8(1)
13 ; CHECK-NEXT: stdu 1, -176(1)
14 ; CHECK-NEXT: std 0, 192(1)
15 ; CHECK-NEXT: .cfi_def_cfa_offset 176
16 ; CHECK-NEXT: .cfi_offset r31, -8
17 ; CHECK-NEXT: .cfi_offset lr, 16
18 ; CHECK-NEXT: mr 31, 1
19 ; CHECK-NEXT: .cfi_def_cfa_register r31
20 ; CHECK-NEXT: .cfi_offset r27, -40
21 ; CHECK-NEXT: .cfi_offset r28, -32
22 ; CHECK-NEXT: .cfi_offset r29, -24
23 ; CHECK-NEXT: .cfi_offset r30, -16
24 ; CHECK-NEXT: std 29, 152(31) # 8-byte Folded Spill
25 ; CHECK-NEXT: mr 29, 3
26 ; CHECK-NEXT: rldic 3, 5, 3, 29
27 ; CHECK-NEXT: std 27, 136(31) # 8-byte Folded Spill
28 ; CHECK-NEXT: std 30, 160(31) # 8-byte Folded Spill
29 ; CHECK-NEXT: mr 30, 4
30 ; CHECK-NEXT: addi 3, 3, 15
31 ; CHECK-NEXT: rldicl 3, 3, 60, 4
32 ; CHECK-NEXT: mr 27, 1
33 ; CHECK-NEXT: rldicl 3, 3, 4, 28
34 ; CHECK-NEXT: addi 4, 31, 176
35 ; CHECK-NEXT: neg 3, 3
36 ; CHECK-NEXT: std 28, 144(31) # 8-byte Folded Spill
37 ; CHECK-NEXT: stdux 4, 1, 3
38 ; CHECK-NEXT: addi 3, 1, 112
43 ; CHECK-NEXT: # %bb.1: # %bb30.preheader
44 ; CHECK-NEXT: addi 28, 31, 120
45 ; CHECK-NEXT: cmpldi 30, 0
46 ; CHECK-NEXT: beq 0, .LBB0_4
47 ; CHECK-NEXT: .LBB0_2: # %cond_true
50 ; CHECK-NEXT: mr 3, 29
51 ; CHECK-NEXT: mr 4, 28
55 ; CHECK-NEXT: # %bb.3: # %invcont23
57 ; CHECK-NEXT: ld 3, 128(31)
58 ; CHECK-NEXT: sub 30, 30, 3
59 ; CHECK-NEXT: cmpldi 30, 0
60 ; CHECK-NEXT: bne 0, .LBB0_2
61 ; CHECK-NEXT: .LBB0_4: # %cleanup
62 ; CHECK-NEXT: ld 30, 160(31) # 8-byte Folded Reload
63 ; CHECK-NEXT: ld 29, 152(31) # 8-byte Folded Reload
64 ; CHECK-NEXT: ld 28, 144(31) # 8-byte Folded Reload
65 ; CHECK-NEXT: ld 27, 136(31) # 8-byte Folded Reload
66 ; CHECK-NEXT: ld 1, 0(1)
67 ; CHECK-NEXT: ld 0, 16(1)
68 ; CHECK-NEXT: ld 31, -8(1)
71 ; CHECK-NEXT: .LBB0_5: # %unwind.loopexit.split-lp
73 ; CHECK-NEXT: b .LBB0_7
74 ; CHECK-NEXT: .LBB0_6: # %unwind.loopexit
76 ; CHECK-NEXT: .LBB0_7: # %unwind
77 ; CHECK-NEXT: ld 4, 0(1)
78 ; CHECK-NEXT: mr 1, 27
79 ; CHECK-NEXT: std 4, 0(1)
80 ; CHECK-NEXT: bl _Unwind_Resume
83 %effectiveRange = alloca %struct.Range, align 8 ; <ptr> [#uses=2]
84 %tmp4 = call ptr @llvm.stacksave() ; <ptr> [#uses=1]
85 %size1 = trunc i64 %size to i32 ; <i32> [#uses=1]
86 %tmp17 = alloca ptr, i32 %size1 ; <ptr> [#uses=1]
87 invoke void @Foo(ptr %tmp17)
88 to label %bb30.preheader unwind label %unwind
90 bb30.preheader: ; preds = %entry
91 %tmp26 = getelementptr %struct.Range, ptr %effectiveRange, i64 0, i32 1 ; <ptr> [#uses=1]
94 unwind: ; preds = %cond_true, %entry
95 %exn = landingpad {ptr, i32}
97 call void @llvm.stackrestore(ptr %tmp4)
98 resume { ptr, i32 } %exn
100 invcont23: ; preds = %cond_true
101 %tmp27 = load i64, ptr %tmp26, align 8 ; <i64> [#uses=1]
102 %tmp28 = sub i64 %range_addr.1.0, %tmp27 ; <i64> [#uses=1]
105 bb30: ; preds = %invcont23, %bb30.preheader
106 %range_addr.1.0 = phi i64 [ %tmp28, %invcont23 ], [ %range.0.1, %bb30.preheader ] ; <i64> [#uses=2]
107 %tmp33 = icmp eq i64 %range_addr.1.0, 0 ; <i1> [#uses=1]
108 br i1 %tmp33, label %cleanup, label %cond_true
110 cond_true: ; preds = %bb30
111 invoke void @Bar(i64 %range.0.0, ptr %effectiveRange)
112 to label %invcont23 unwind label %unwind
114 cleanup: ; preds = %bb30
118 declare ptr @llvm.stacksave() nounwind
120 declare void @Foo(ptr)
122 declare void @Bar(i64, ptr)
124 declare void @llvm.stackrestore(ptr) nounwind
126 declare i32 @__gxx_personality_v0(...)