Home | History | Annotate | Download | only in LoopIdiom
      1 ; RUN: opt -S -basicaa -loop-idiom < %s | FileCheck %s
      2 
      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"
      5 
      6 define void @f_0(i8 addrspace(3)** %ptr) {
      7 ; CHECK-LABEL: @f_0(
      8 ; CHECK: call{{.*}}memset
      9 
     10 ; LIR'ing stores of pointers with address space 3 is fine, since
     11 ; they're integral pointers.
     12 
     13 entry:
     14   br label %for.body
     15 
     16 for.body:
     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
     23 
     24 for.end:
     25   ret void
     26 }
     27 
     28 define void @f_1(i8 addrspace(4)** %ptr) {
     29 ; CHECK-LABEL: @f_1(
     30 ; CHECK-NOT: call{{.*}}memset
     31 
     32 ; LIR'ing stores of pointers with address space 4 is not ok, since
     33 ; they're non-integral pointers.
     34 
     35 entry:
     36   br label %for.body
     37 
     38 for.body:
     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
     45 
     46 for.end:
     47   ret void
     48 }
     49