Home | History | Annotate | Download | only in BasicAA
      1 target datalayout =
      2 "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
      3 
      4 ; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
      5 
      6 ; ptr_phi and ptr2_phi do not alias.
      7 ; CHECK: NoAlias: i32* %ptr2_phi, i32* %ptr_phi
      8 
      9 define i32 @test_noalias(i32* %ptr2, i32 %count, i32* %coeff) {
     10 entry:
     11   %ptr = getelementptr inbounds i32* %ptr2, i64 1
     12   br label %while.body
     13 
     14 while.body:
     15   %num = phi i32 [ %count, %entry ], [ %dec, %while.body ]
     16   %ptr_phi = phi i32* [ %ptr, %entry ], [ %ptr_inc, %while.body ]
     17   %ptr2_phi = phi i32* [ %ptr2, %entry ], [ %ptr2_inc, %while.body ]
     18   %result.09 = phi i32 [ 0 , %entry ], [ %add, %while.body ]
     19   %dec = add nsw i32 %num, -1
     20   %0 = load i32* %ptr_phi, align 4
     21   store i32 %0, i32* %ptr2_phi, align 4
     22   %1 = load i32* %coeff, align 4
     23   %2 = load i32* %ptr_phi, align 4
     24   %mul = mul nsw i32 %1, %2
     25   %add = add nsw i32 %mul, %result.09
     26   %tobool = icmp eq i32 %dec, 0
     27   %ptr_inc = getelementptr inbounds i32* %ptr_phi, i64 1
     28   %ptr2_inc = getelementptr inbounds i32* %ptr2_phi, i64 1
     29   br i1 %tobool, label %the_exit, label %while.body
     30 
     31 the_exit:
     32   ret i32 %add
     33 }
     34