294 lines · plain
1# RUN: llc -run-pass implicit-null-checks -mtriple=x86_64-apple-macosx -o - %s | FileCheck %s2 3# CHECK-NOT: FAULTING_OP4 5--- |6 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"7 target triple = "x86_64-unknown-linux-gnu"8 9 @global = external global i8*10 @global.1 = external global i8*11 12 declare i8* @ham(i8*, i8**)13 14 define void @eggs(i8* %arg) gc "statepoint-example" {15 bb:16 %tmp = call i8* undef(i8* undef, i8** undef)17 %tmp1 = icmp eq i8* %tmp, null18 br i1 %tmp1, label %bb2, label %bb3, !make.implicit !019 20 bb2: ; preds = %bb21 br i1 undef, label %bb51, label %bb5922 23 bb3: ; preds = %bb24 %tmp4 = getelementptr inbounds i8, i8* %tmp, i64 1625 %tmp5 = bitcast i8* %tmp4 to i64*26 br label %bb727 28 bb7: ; preds = %bb37, %bb329 %tmp8 = phi i64* [ %tmp5, %bb3 ], [ %tmp18, %bb37 ]30 %tmp10 = phi i32 [ undef, %bb3 ], [ %tmp48, %bb37 ]31 %tmp12 = phi i32 [ 0, %bb3 ], [ 6, %bb37 ]32 %tmp13 = phi double [ 0.000000e+00, %bb3 ], [ 2.000000e+00, %bb37 ]33 %tmp14 = zext i32 %tmp10 to i6434 br i1 undef, label %bb26, label %bb1535 36 bb15: ; preds = %bb737 %tmp16 = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* nonnull elementtype(void ()) @wibble, i32 0, i32 0, i32 0, i32 0) ["deopt" (i32 1, i32 0, i32 99, i32 0, i32 12, i32 0, i32 10, i32 %tmp10, i32 10, i32 0, i32 10, i32 %tmp12, i32 10, i32 undef, i32 6, float undef, i32 7, double %tmp13, i32 99, i8* null, i32 7, double undef, i32 99, i8* null, i32 13, i8* %tmp, i32 7, double undef, i32 99, i8* null, i8* undef)]38 br label %bb2639 40 bb26: ; preds = %bb15, %bb741 %tmp18 = phi i64* [ %tmp8, %bb7 ], [ undef, %bb15 ]42 %tmp20 = sub i32 0, 043 %tmp21 = select i1 undef, i32 0, i32 %tmp2044 %tmp22 = sext i32 %tmp21 to i6445 %tmp23 = load i8*, i8** @global.1, align 846 %tmp24 = icmp eq i8* %tmp23, null47 %tmp25 = select i1 %tmp24, i8* null, i8* undef48 %tmp27 = load i32, i32* undef, align 449 %sunkaddr = mul i64 %tmp14, 850 %tmp2 = bitcast i64* %tmp18 to i8*51 %sunkaddr1 = getelementptr i8, i8* %tmp2, i64 %sunkaddr52 %tmp3 = bitcast i8* %sunkaddr1 to i64*53 %tmp28 = load i64, i64* %tmp3, align 854 %tmp29 = add i64 %tmp28, 155 store i64 %tmp29, i64* %tmp3, align 856 %tmp30 = trunc i64 %tmp28 to i3257 %tmp31 = sub i32 %tmp27, %tmp3058 store i32 %tmp31, i32* undef, align 459 %tmp32 = getelementptr inbounds i8, i8* %tmp25, i64 76860 %tmp33 = bitcast i8* %tmp32 to i64*61 %tmp34 = load i64, i64* %tmp33, align 862 br i1 undef, label %bb37, label %bb3563 64 bb35: ; preds = %bb2665 %tmp36 = call i8* @ham(i8* undef, i8** nonnull @global)66 br label %bb3767 68 bb37: ; preds = %bb35, %bb2669 %tmp38 = phi i8* [ %tmp36, %bb35 ], [ undef, %bb26 ]70 %tmp39 = getelementptr inbounds i8, i8* %tmp38, i64 76071 %tmp40 = bitcast i8* %tmp39 to i64*72 %tmp41 = load i64, i64* %tmp40, align 873 %tmp42 = icmp slt i64 %tmp34, %tmp4174 %tmp43 = select i1 %tmp42, i64 %tmp41, i64 %tmp3475 %tmp44 = and i64 %tmp43, 6376 %tmp45 = ashr i64 %tmp29, %tmp4477 %sunkaddr2 = mul i64 %tmp14, 878 %tmp6 = bitcast i64* %tmp18 to i8*79 %sunkaddr3 = getelementptr i8, i8* %tmp6, i64 %sunkaddr280 %tmp7 = bitcast i8* %sunkaddr3 to i64*81 store i64 %tmp45, i64* %tmp7, align 882 %tmp46 = sub i64 0, %tmp2283 store i64 %tmp46, i64* undef, align 884 %tmp47 = add nsw i32 %tmp12, 185 %tmp48 = add i32 %tmp10, 186 %tmp49 = icmp sgt i32 %tmp48, 1514087 br i1 %tmp49, label %bb51.loopexit, label %bb788 89 bb51.loopexit: ; preds = %bb3790 %tmp9 = add i32 %tmp10, 191 br label %bb5192 93 bb51: ; preds = %bb51.loopexit, %bb294 %tmp52 = phi i32 [ %tmp47, %bb51.loopexit ], [ 0, %bb2 ]95 %tmp53 = phi double [ 2.000000e+00, %bb51.loopexit ], [ 0.000000e+00, %bb2 ]96 %tmp54 = phi i32 [ %tmp9, %bb51.loopexit ], [ undef, %bb2 ]97 %tmp56 = add i32 %tmp54, 098 %tmp57 = call token (i64, i32, void (i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidi32f(i64 2882400000, i32 0, void (i32)* nonnull elementtype(void (i32)) @wobble, i32 1, i32 0, i32 -121, i32 0, i32 0) ["deopt" (i32 1, i32 0, i32 270, i32 4, i32 12, i32 0, i32 11, i64 undef, i32 99, i8* null, i32 10, i32 %tmp56, i32 6, float undef, i32 99, i8* null, i32 99, i8* null, i32 10, i32 %tmp52, i32 10, i32 undef, i32 99, i8* null, i32 7, double %tmp53, i32 99, i8* null, i32 7, double undef, i32 99, i8* null, i32 13, i8* undef, i32 99, i8* null, i32 99, i8* null, i8* undef)]99 unreachable100 101 bb59: ; preds = %bb2102 %tmp61 = call token (i64, i32, void (i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidi32f(i64 2882400000, i32 0, void (i32)* nonnull elementtype(void (i32)) @wobble, i32 1, i32 0, i32 8, i32 0, i32 0) ["deopt" (i32 1, i32 0, i32 123, i32 4, i32 12, i32 0, i32 13, i8* null, i32 99, i32 undef, i32 13, i8* null, i32 10, i32 undef, i32 99, i32 undef, i32 99, i32 undef, i32 99, i32 undef, i32 99, i8* null, i32 99, float undef, i32 99, double undef, i32 99, i8* null, i32 99, double undef, i32 99, i8* null, i32 13, i8* null, i32 99, double undef, i32 99, i8* null)]103 unreachable104 }105 106 declare void @wibble()107 108 declare void @wobble(i32)109 110 declare token @llvm.experimental.gc.statepoint.p0f_isVoidi32f(i64, i32, void (i32)*, i32, i32, ...)111 112 declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)113 114 ; Function Attrs: nounwind115 declare void @llvm.stackprotector(i8*, i8**) #0116 117 attributes #0 = { nounwind }118 119 !0 = !{}120...121---122name: eggs123alignment: 16124tracksRegLiveness: true125fixedStack:126 - { id: 0, type: spill-slot, offset: -56, size: 8, alignment: 8, callee-saved-register: '$rbx' }127 - { id: 1, type: spill-slot, offset: -48, size: 8, alignment: 16, callee-saved-register: '$r12' }128 - { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, callee-saved-register: '$r13' }129 - { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 16, callee-saved-register: '$r14' }130 - { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '$r15' }131 - { id: 5, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$rbp' }132stack:133 - { id: 0, offset: -88, size: 8, alignment: 8 }134 - { id: 1, offset: -96, size: 8, alignment: 8 }135 - { id: 2, offset: -104, size: 8, alignment: 8 }136 - { id: 3, offset: -64, size: 8, alignment: 8 }137 - { id: 4, type: spill-slot, offset: -72, size: 8, alignment: 8 }138 - { id: 5, type: spill-slot, offset: -80, size: 8, alignment: 8 }139constants:140 - id: 0141 value: 'double 2.000000e+00'142 alignment: 8143body: |144 bb.0.bb:145 successors: %bb.1.bb2(0x00000800), %bb.3.bb3(0x7ffff800)146 liveins: $rbp, $r15, $r14, $r13, $r12, $rbx147 148 frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp149 frame-setup PUSH64r killed $r15, implicit-def $rsp, implicit $rsp150 frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp151 frame-setup PUSH64r killed $r13, implicit-def $rsp, implicit $rsp152 frame-setup PUSH64r killed $r12, implicit-def $rsp, implicit $rsp153 frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp154 $rsp = frame-setup SUB64ri8 $rsp, 56, implicit-def dead $eflags155 CALL64r undef $rax, csr_64, implicit $rsp, implicit undef $rdi, implicit undef $rsi, implicit-def $rsp, implicit-def $rax156 TEST64rr $rax, $rax, implicit-def $eflags157 JCC_1 %bb.3.bb3, 5, implicit killed $eflags158 159 bb.1.bb2:160 successors: %bb.2(0x40000000), %bb.13.bb59(0x40000000)161 162 $ebp = XOR32rr undef $ebp, undef $ebp, implicit-def dead $eflags163 TEST8rr $bpl, $bpl, implicit-def $eflags164 JCC_1 %bb.13.bb59, 4, implicit killed $eflags165 166 bb.2:167 successors: %bb.12.bb51(0x80000000)168 liveins: $ebp169 170 $xmm0 = XORPSrr undef $xmm0, undef $xmm0171 $ebx = IMPLICIT_DEF implicit-def $rbx172 JMP_1 %bb.12.bb51173 174 bb.3.bb3:175 successors: %bb.4.bb7(0x80000000)176 liveins: $rax177 178 MOV64mr $rsp, 1, $noreg, 32, $noreg, $rax :: (store (s64) into %stack.5)179 $r12 = MOV64rr killed $rax180 $r12 = ADD64ri8 killed $r12, 16, implicit-def dead $eflags181 $xmm0 = XORPSrr undef $xmm0, undef $xmm0182 $esi = XOR32rr undef $esi, undef $esi, implicit-def dead $eflags183 $rax = MOV64ri %const.0184 $xmm1 = MOVSDrm_alt killed $rax, 1, $noreg, 0, $noreg :: (load (s64) from constant-pool)185 MOVSDmr $rsp, 1, $noreg, 40, $noreg, killed $xmm1 :: (store (s64) into %stack.4)186 $eax = IMPLICIT_DEF187 $ecx = XOR32rr undef $ecx, undef $ecx, implicit-def dead $eflags188 189 bb.4.bb7:190 successors: %bb.6.bb26(0x40000000), %bb.5.bb15(0x40000000)191 liveins: $eax, $ecx, $esi, $r12, $xmm0192 193 $ebp = MOV32rr killed $ecx194 $ebx = MOV32rr killed $eax, implicit-def $rbx195 $r14d = MOV32rr $ebx, implicit-def $r14196 TEST8rr $sil, $sil, implicit-def $eflags197 JCC_1 %bb.6.bb26, 5, implicit $eflags198 199 bb.5.bb15:200 successors: %bb.6.bb26(0x80000000)201 liveins: $ebp, $rbx, $r14, $xmm0202 203 MOV32mr $rsp, 1, $noreg, 24, $noreg, $ebx :: (store (s32) into %stack.0, align 8)204 MOV32mr $rsp, 1, $noreg, 16, $noreg, $ebp :: (store (s32) into %stack.1, align 8)205 MOVSDmr $rsp, 1, $noreg, 8, $noreg, killed $xmm0 :: (store (s64) into %stack.2)206 $rax = MOV64rm $rsp, 1, $noreg, 32, $noreg :: (load (s64) from %stack.5)207 MOV64mr $rsp, 1, $noreg, 48, $noreg, killed $rax :: (store (s64) into %stack.3)208 $rax = MOV64ri @wibble209 STATEPOINT 2882400000, 0, 0, killed $rax, 2, 0, 2, 0, 2, 30, 2, 1, 2, 0, 2, 99, 2, 0, 2, 12, 2, 0, 2, 10, 1, 8, $rsp, 24, 2, 10, 2, 0, 2, 10, 1, 8, $rsp, 16, 2, 10, 2, 4278124286, 2, 6, 2, 4278124286, 2, 7, 1, 8, $rsp, 8, 2, 99, 2, 0, 2, 7, 2, 4278124286, 2, 99, 2, 0, 2, 13, 1, 8, $rsp, 48, 2, 7, 2, 4278124286, 2, 99, 2, 0, 2, 0, 2, 0, 2, 0, csr_64, implicit-def $rsp :: (volatile load (s64) from %stack.0), (volatile load (s64) from %stack.1), (volatile load (s64) from %stack.2), (volatile load (s64) from %stack.3)210 $esi = XOR32rr undef $esi, undef $esi, implicit-def dead $eflags211 $r12 = IMPLICIT_DEF212 213 bb.6.bb26:214 successors: %bb.8.bb37(0x40000000), %bb.7.bb35(0x40000000)215 liveins: $ebp, $esi, $rbx, $r12, $r14216 217 $rax = MOV64ri @global.1218 $rax = MOV64rm killed $rax, 1, $noreg, 0, $noreg :: (dereferenceable load (s64) from @global.1)219 TEST64rr $rax, $rax, implicit-def $eflags220 $rax = CMOV64rr undef $rax, killed $rax, 4, implicit killed $eflags221 $ecx = MOV32rm undef $rax, 1, $noreg, 0, $noreg :: (load (s32) from `i32* undef`)222 $rdx = MOV64rm $r12, 8, $r14, 0, $noreg :: (load (s64) from %ir.tmp3)223 $r15 = LEA64r $rdx, 1, $noreg, 1, _224 MOV64mr $r12, 8, $r14, 0, $noreg, $r15 :: (store (s64) into %ir.tmp3)225 $ecx = SUB32rr killed $ecx, $edx, implicit-def dead $eflags, implicit killed $rdx226 MOV32mr undef $rax, 1, $noreg, 0, $noreg, killed $ecx :: (store (s32) into `i32* undef`)227 $r13 = MOV64rm killed $rax, 1, $noreg, 768, $noreg :: (load (s64) from %ir.tmp33)228 TEST8rr $sil, $sil, implicit-def $eflags229 $rax = IMPLICIT_DEF230 JCC_1 %bb.8.bb37, 5, implicit $eflags231 232 bb.7.bb35:233 successors: %bb.8.bb37(0x80000000)234 liveins: $ebp, $rbx, $r12, $r13, $r14, $r15235 236 $rsi = MOV64ri @global237 $rax = MOV64ri @ham238 CALL64r killed $rax, csr_64, implicit $rsp, implicit undef $rdi, implicit $rsi, implicit-def $rsp, implicit-def $rax239 $esi = XOR32rr undef $esi, undef $esi, implicit-def dead $eflags240 241 bb.8.bb37:242 successors: %bb.9.bb37(0x40000000), %bb.10.bb37(0x40000000)243 liveins: $ebp, $esi, $rax, $rbx, $r12, $r13, $r14, $r15244 245 $rcx = MOV64rm killed $rax, 1, $noreg, 760, $noreg :: (load (s64) from %ir.tmp40)246 CMP64rr $r13, $rcx, implicit-def $eflags247 JCC_1 %bb.10.bb37, 12, implicit $eflags248 249 bb.9.bb37:250 successors: %bb.10.bb37(0x80000000)251 liveins: $ebp, $esi, $rbx, $r12, $r13, $r14, $r15252 253 $cl = MOV8rr $r13b, implicit killed $r13, implicit-def $rcx254 255 bb.10.bb37:256 successors: %bb.11.bb51.loopexit(0x00000800), %bb.4.bb7(0x7ffff800)257 liveins: $ebp, $esi, $rbx, $rcx, $r12, $r14, $r15258 259 $cl = KILL $cl, implicit killed $rcx260 $r15 = SAR64rCL killed $r15, implicit-def dead $eflags, implicit $cl261 MOV64mr $r12, 8, killed $r14, 0, $noreg, killed $r15 :: (store (s64) into %ir.tmp7)262 MOV64mi32 undef $rax, 1, $noreg, 0, $noreg, 0 :: (store (s64) into `i64* undef`)263 $eax = LEA64_32r $rbx, 1, $noreg, 1, _264 $ecx = MOV32ri 6265 CMP32ri $eax, 15141, implicit-def $eflags266 $xmm0 = MOVSDrm_alt $rsp, 1, $noreg, 40, $noreg :: (load (s64) from %stack.4)267 JCC_1 %bb.4.bb7, 12, implicit $eflags268 269 bb.11.bb51.loopexit:270 successors: %bb.12.bb51(0x80000000)271 liveins: $ebp, $rbx272 273 $ebp = INC32r killed $ebp, implicit-def dead $eflags274 $ebx = INC32r $ebx, implicit-def dead $eflags, implicit killed $rbx, implicit-def $rbx275 $rax = MOV64ri %const.0276 $xmm0 = MOVSDrm_alt killed $rax, 1, $noreg, 0, $noreg :: (load (s64) from constant-pool)277 278 bb.12.bb51:279 liveins: $ebp, $rbx, $xmm0280 281 MOV32mr $rsp, 1, $noreg, 24, $noreg, $ebx, implicit killed $rbx :: (store (s32) into %stack.0, align 8)282 MOV32mr $rsp, 1, $noreg, 16, $noreg, killed $ebp :: (store (s32) into %stack.1, align 8)283 MOVSDmr $rsp, 1, $noreg, 8, $noreg, killed $xmm0 :: (store (s64) into %stack.2)284 $rax = MOV64ri @wobble285 $edi = MOV32ri -121286 STATEPOINT 2882400000, 0, 1, killed $rax, $edi, 2, 0, 2, 0, 2, 38, 2, 1, 2, 0, 2, 270, 2, 4, 2, 12, 2, 0, 2, 11, 2, 4278124286, 2, 99, 2, 0, 2, 10, 1, 8, $rsp, 24, 2, 6, 2, 4278124286, 2, 99, 2, 0, 2, 99, 2, 0, 2, 10, 1, 8, $rsp, 16, 2, 10, 2, 4278124286, 2, 99, 2, 0, 2, 7, 1, 8, $rsp, 8, 2, 99, 2, 0, 2, 7, 2, 4278124286, 2, 99, 2, 0, 2, 13, 2, 4278124286, 2, 99, 2, 0, 2, 99, 2, 0, 2, 0, 2, 0, 2, 0, csr_64, implicit-def $rsp :: (volatile load (s64) from %stack.0), (volatile load (s64) from %stack.1), (volatile load (s64) from %stack.2)287 288 bb.13.bb59:289 $rax = MOV64ri @wobble290 $edi = MOV32ri 8291 STATEPOINT 2882400000, 0, 1, killed $rax, $edi, 2, 0, 2, 0, 2, 38, 2, 1, 2, 0, 2, 123, 2, 4, 2, 12, 2, 0, 2, 13, 2, 0, 2, 99, 2, 4278124286, 2, 13, 2, 0, 2, 10, 2, 4278124286, 2, 99, 2, 4278124286, 2, 99, 2, 4278124286, 2, 99, 2, 4278124286, 2, 99, 2, 0, 2, 99, 2, 4278124286, 2, 99, 2, 4278124286, 2, 99, 2, 0, 2, 99, 2, 4278124286, 2, 99, 2, 0, 2, 13, 2, 0, 2, 99, 2, 4278124286, 2, 99, 2, 0, 2, 0, 2, 0, 2, 0, csr_64, implicit-def $rsp292 293...294