1 ; RUN: opt -S -basicaa -loop-idiom < %s | FileCheck %s
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:4"
4 target triple = "x86_64-unknown-linux-gnu"
6 define void @f_0(i8 addrspace(3)** %ptr) {
8 ; CHECK: call{{.*}}memset
10 ; LIR'ing stores of pointers with address space 3 is fine, since
11 ; they're integral pointers.
17 %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %for.body ]
18 %arrayidx = getelementptr i8 addrspace(3)*, i8 addrspace(3)** %ptr, i64 %indvar
19 store i8 addrspace(3)* null, i8 addrspace(3)** %arrayidx, align 4
20 %indvar.next = add i64 %indvar, 1
21 %exitcond = icmp eq i64 %indvar.next, 10000
22 br i1 %exitcond, label %for.end, label %for.body
28 define void @f_1(i8 addrspace(4)** %ptr) {
30 ; CHECK-NOT: call{{.*}}memset
32 ; LIR'ing stores of pointers with address space 4 is not ok, since
33 ; they're non-integral pointers.
39 %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %for.body ]
40 %arrayidx = getelementptr i8 addrspace(4)*, i8 addrspace(4)** %ptr, i64 %indvar
41 store i8 addrspace(4)* null, i8 addrspace(4)** %arrayidx, align 4
42 %indvar.next = add i64 %indvar, 1
43 %exitcond = icmp eq i64 %indvar.next, 10000
44 br i1 %exitcond, label %for.end, label %for.body