1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
2 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -verify-coalescing < %s | FileCheck %s
4 %"class.llvm::APInt." = type <{ %union.anon., i32, [4 x i8] }>
5 %union.anon. = type { i64 }
7 define void @_ZNK4llvm5APInt21multiplicativeInverseERKS0_(ptr %r) {
8 ; CHECK-LABEL: _ZNK4llvm5APInt21multiplicativeInverseERKS0_:
9 ; CHECK: # %bb.0: # %entry
10 ; CHECK-NEXT: xorl %eax, %eax
11 ; CHECK-NEXT: xorl %edx, %edx
12 ; CHECK-NEXT: xorl %ecx, %ecx
13 ; CHECK-NEXT: jmp .LBB0_1
14 ; CHECK-NEXT: .p2align 4
15 ; CHECK-NEXT: .LBB0_4: # %_ZNK4llvm5APInt13getActiveBitsEv.exit.i.i
16 ; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1
17 ; CHECK-NEXT: movl %edx, %edx
18 ; CHECK-NEXT: shlq $4, %rdx
19 ; CHECK-NEXT: movl $0, (%rdi,%rdx)
20 ; CHECK-NEXT: movl %ecx, %edx
21 ; CHECK-NEXT: .LBB0_1: # %bb
22 ; CHECK-NEXT: # =>This Loop Header: Depth=1
23 ; CHECK-NEXT: # Child Loop BB0_3 Depth 2
24 ; CHECK-NEXT: xorl $1, %ecx
25 ; CHECK-NEXT: xorl %esi, %esi
26 ; CHECK-NEXT: movq %rcx, %r8
27 ; CHECK-NEXT: testb %al, %al
28 ; CHECK-NEXT: jne .LBB0_4
29 ; CHECK-NEXT: .p2align 4
30 ; CHECK-NEXT: .LBB0_3: # %for.body.i.i.i.i.i.3
31 ; CHECK-NEXT: # Parent Loop BB0_1 Depth=1
32 ; CHECK-NEXT: # => This Inner Loop Header: Depth=2
33 ; CHECK-NEXT: orq $1, %r8
34 ; CHECK-NEXT: orq $1, %rsi
35 ; CHECK-NEXT: testb %al, %al
36 ; CHECK-NEXT: je .LBB0_3
37 ; CHECK-NEXT: jmp .LBB0_4
41 bb: ; preds = %_ZNK4llvm5APInt13getActiveBitsEv.exit.i.i, %entry
42 %i.0 = phi i32 [ 0, %entry ], [ %xor, %_ZNK4llvm5APInt13getActiveBitsEv.exit.i.i ]
43 %xor = xor i32 %i.0, 1
44 %idxprom = zext nneg i32 %xor to i64
45 br label %for.body.i.i.i.i.i
47 for.body.i.i.i.i.i: ; preds = %for.body.i.i.i.i.i.3, %bb
48 %lsr.iv37 = phi i64 [ %lsr.iv.next38, %for.body.i.i.i.i.i.3 ], [ 0, %bb ]
49 %lsr.iv = phi i64 [ %lsr.iv.next, %for.body.i.i.i.i.i.3 ], [ %idxprom, %bb ]
50 %exitcond.not.i.i.i.i.i.2 = icmp eq i64 0, 1
51 br i1 %exitcond.not.i.i.i.i.i.2, label %_ZNK4llvm5APInt13getActiveBitsEv.exit.i.i, label %for.body.i.i.i.i.i.3
53 for.body.i.i.i.i.i.3: ; preds = %for.body.i.i.i.i.i
54 %sunkaddr55 = mul i64 %lsr.iv37, 0
55 %i = xor i64 %lsr.iv, 0
56 %lsr.iv.next = or i64 %lsr.iv, 1
57 %lsr.iv.next38 = or i64 %lsr.iv37, 1
58 br label %for.body.i.i.i.i.i
60 _ZNK4llvm5APInt13getActiveBitsEv.exit.i.i: ; preds = %for.body.i.i.i.i.i
61 %idxprom12 = zext nneg i32 %i.0 to i64
62 %arrayidx13 = getelementptr [2 x %"class.llvm::APInt."], ptr %r, i64 0, i64 %idxprom12
63 store i32 0, ptr %arrayidx13, align 4
67 ; This variant hit an assert and never reached the verifier error
68 define void @_ZNK4llvm5APInt21multiplicativeInverseERKS0__assert(ptr %r) {
69 ; CHECK-LABEL: _ZNK4llvm5APInt21multiplicativeInverseERKS0__assert:
70 ; CHECK: # %bb.0: # %entry
71 ; CHECK-NEXT: xorl %eax, %eax
72 ; CHECK-NEXT: xorl %edx, %edx
73 ; CHECK-NEXT: xorl %ecx, %ecx
74 ; CHECK-NEXT: jmp .LBB1_1
75 ; CHECK-NEXT: .p2align 4
76 ; CHECK-NEXT: .LBB1_4: # %_ZNK4llvm5APInt13getActiveBitsEv.exit.i.i
77 ; CHECK-NEXT: # in Loop: Header=BB1_1 Depth=1
78 ; CHECK-NEXT: movl %edx, %edx
79 ; CHECK-NEXT: shlq $4, %rdx
80 ; CHECK-NEXT: movl $0, (%rdi,%rdx)
81 ; CHECK-NEXT: movl %ecx, %edx
82 ; CHECK-NEXT: .LBB1_1: # %bb
83 ; CHECK-NEXT: # =>This Loop Header: Depth=1
84 ; CHECK-NEXT: # Child Loop BB1_3 Depth 2
85 ; CHECK-NEXT: xorl $1, %ecx
86 ; CHECK-NEXT: movq %rcx, %rsi
87 ; CHECK-NEXT: shlq $4, %rsi
88 ; CHECK-NEXT: movq (%rsi), %rsi
89 ; CHECK-NEXT: xorl %r8d, %r8d
90 ; CHECK-NEXT: testb %al, %al
91 ; CHECK-NEXT: jne .LBB1_4
92 ; CHECK-NEXT: .p2align 4
93 ; CHECK-NEXT: .LBB1_3: # %for.body.i.i.i.i.i.3
94 ; CHECK-NEXT: # Parent Loop BB1_1 Depth=1
95 ; CHECK-NEXT: # => This Inner Loop Header: Depth=2
96 ; CHECK-NEXT: orq $1, %rsi
97 ; CHECK-NEXT: orq $1, %r8
98 ; CHECK-NEXT: testb %al, %al
99 ; CHECK-NEXT: je .LBB1_3
100 ; CHECK-NEXT: jmp .LBB1_4
104 bb: ; preds = %_ZNK4llvm5APInt13getActiveBitsEv.exit.i.i, %entry
105 %i.0 = phi i32 [ 0, %entry ], [ %xor, %_ZNK4llvm5APInt13getActiveBitsEv.exit.i.i ]
106 %xor = xor i32 %i.0, 1
107 %idxprom = zext nneg i32 %xor to i64
108 %arrayidx = getelementptr [2 x %"class.llvm::APInt."], ptr null, i64 0, i64 %idxprom
109 %i.i.i.i.i.i = load ptr, ptr %arrayidx, align 16
110 %i.i.i.i.i.i36 = ptrtoint ptr %i.i.i.i.i.i to i64
111 br label %for.body.i.i.i.i.i
113 for.body.i.i.i.i.i: ; preds = %for.body.i.i.i.i.i.3, %bb
114 %lsr.iv37 = phi i64 [ %lsr.iv.next38, %for.body.i.i.i.i.i.3 ], [ 0, %bb ]
115 %lsr.iv = phi i64 [ %lsr.iv.next, %for.body.i.i.i.i.i.3 ], [ %i.i.i.i.i.i36, %bb ]
116 %exitcond.not.i.i.i.i.i.2 = icmp eq i64 0, 1
117 br i1 %exitcond.not.i.i.i.i.i.2, label %_ZNK4llvm5APInt13getActiveBitsEv.exit.i.i, label %for.body.i.i.i.i.i.3
119 for.body.i.i.i.i.i.3: ; preds = %for.body.i.i.i.i.i
120 %sunkaddr55 = mul i64 %lsr.iv37, 0
121 %i = xor i64 %lsr.iv, 0
122 %lsr.iv.next = or i64 %lsr.iv, 1
123 %lsr.iv.next38 = or i64 %lsr.iv37, 1
124 br label %for.body.i.i.i.i.i
126 _ZNK4llvm5APInt13getActiveBitsEv.exit.i.i: ; preds = %for.body.i.i.i.i.i
127 %idxprom12 = zext nneg i32 %i.0 to i64
128 %arrayidx13 = getelementptr [2 x %"class.llvm::APInt."], ptr %r, i64 0, i64 %idxprom12
129 store i32 0, ptr %arrayidx13, align 4