Home | History | Annotate | Download | only in GVN
      1 ; RUN: opt -basicaa -gvn -S < %s | FileCheck %s
      2 
      3 target datalayout = "e-p:64:64:64"
      4 
      5 ; CHECK: @foo
      6 ; CHECK: entry.end_crit_edge:
      7 ; CHECK:   %n.pre = load i32* %q.phi.trans.insert
      8 ; CHECK: then:
      9 ; CHECK:   store i32 %z
     10 ; CHECK: end:
     11 ; CHECK:   %n = phi i32 [ %n.pre, %entry.end_crit_edge ], [ %z, %then ]
     12 ; CHECK:   ret i32 %n
     13 
     14 @G = external global [100 x i32]
     15 define i32 @foo(i32 %x, i32 %z) {
     16 entry:
     17   %tobool = icmp eq i32 %z, 0
     18   br i1 %tobool, label %end, label %then
     19 
     20 then:
     21   %i = sext i32 %x to i64
     22   %p = getelementptr [100 x i32]* @G, i64 0, i64 %i
     23   store i32 %z, i32* %p
     24   br label %end
     25 
     26 end:
     27   %j = sext i32 %x to i64
     28   %q = getelementptr [100 x i32]* @G, i64 0, i64 %j
     29   %n = load i32* %q
     30   ret i32 %n
     31 }
     32