|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 |
| 2 | +; RUN: llc -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s |
| 3 | + |
| 4 | +; Make sure codegen doesn't try to inspect the use list of constants |
| 5 | + |
| 6 | +; Make sure we do not try to make use of the uselist of a constant |
| 7 | +; null when looking for the alignment of the pointer. |
| 8 | +define <2 x i32> @no_uselist_null_isDereferenceableAndAlignedPointer(i1 %arg0, ptr align(4) %arg) { |
| 9 | +; CHECK-LABEL: no_uselist_null_isDereferenceableAndAlignedPointer: |
| 10 | +; CHECK: # %bb.0: |
| 11 | +; CHECK-NEXT: xorl %eax, %eax |
| 12 | +; CHECK-NEXT: testb $1, %dil |
| 13 | +; CHECK-NEXT: cmoveq %rsi, %rax |
| 14 | +; CHECK-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero |
| 15 | +; CHECK-NEXT: retq |
| 16 | + %select.ptr = select i1 %arg0, ptr null, ptr %arg |
| 17 | + %load = load i32, ptr %select.ptr |
| 18 | + %insert = insertelement <2 x i32> zeroinitializer, i32 %load, i64 0 |
| 19 | + ret <2 x i32> %insert |
| 20 | +} |
| 21 | + |
| 22 | +; Make sure we do not try to inspect the uselist of a constant null |
| 23 | +; when processing a memcpy |
| 24 | +define void @gep_nullptr_no_inspect_uselist(ptr %arg) { |
| 25 | +; CHECK-LABEL: gep_nullptr_no_inspect_uselist: |
| 26 | +; CHECK: # %bb.0: |
| 27 | +; CHECK-NEXT: movzbl 16, %eax |
| 28 | +; CHECK-NEXT: movb %al, (%rdi) |
| 29 | +; CHECK-NEXT: retq |
| 30 | + %null_gep = getelementptr i8, ptr null, i64 16 |
| 31 | + call void @llvm.memcpy.p0.p0.i64(ptr %arg, ptr %null_gep, i64 1, i1 false) |
| 32 | + ret void |
| 33 | +} |
| 34 | + |
| 35 | +define <16 x i8> @load_null_offset() { |
| 36 | +; CHECK-LABEL: load_null_offset: |
| 37 | +; CHECK: # %bb.0: |
| 38 | +; CHECK-NEXT: movzbl 11, %eax |
| 39 | +; CHECK-NEXT: movd %eax, %xmm1 |
| 40 | +; CHECK-NEXT: pslld $8, %xmm1 |
| 41 | +; CHECK-NEXT: xorps %xmm0, %xmm0 |
| 42 | +; CHECK-NEXT: movss {{.*#+}} xmm0 = xmm1[0],xmm0[1,2,3] |
| 43 | +; CHECK-NEXT: retq |
| 44 | + %gep.null = getelementptr i8, ptr null, i64 11 |
| 45 | + %load = load i8, ptr %gep.null, align 1 |
| 46 | + %insert = insertelement <16 x i8> zeroinitializer, i8 %load, i64 1 |
| 47 | + ret <16 x i8> %insert |
| 48 | +} |
| 49 | + |
| 50 | +declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 |
| 51 | + |
| 52 | +attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } |
0 commit comments