Home | History | Annotate | Download | only in BasicAA
      1 ; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
      2 
      3 ; The input *.ll is obtained by manually annotating "invariant.load" to the 
      4 ; two loads. With "invariant.load" metadata, the second load is redundant.
      5 ;
      6 ; int foo(int *p, char *q) {
      7 ;     *q = (char)*p;
      8 ;     return *p + 1;
      9 ; }
     10 
     11 define i32 @foo(i32* nocapture %p, i8* nocapture %q) {
     12 entry:
     13   %0 = load i32, i32* %p, align 4, !invariant.load !3
     14   %conv = trunc i32 %0 to i8
     15   store i8 %conv, i8* %q, align 1
     16   %1 = load i32, i32* %p, align 4, !invariant.load !3
     17   %add = add nsw i32 %1, 1
     18   ret i32 %add
     19 
     20 ; CHECK: foo
     21 ; CHECK: %0 = load i32, i32* %p
     22 ; CHECK: store i8 %conv, i8* %q,
     23 ; CHECK: %add = add nsw i32 %0, 1
     24 }
     25 
     26 !3 = !{}
     27