2010-10-19 02:04:47 +08:00
|
|
|
; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
|
2007-07-26 03:57:03 +08:00
|
|
|
|
2013-11-12 06:00:23 +08:00
|
|
|
define i32 @main(i32** %p, i32 %x, i32 %y) {
|
2007-07-26 03:57:03 +08:00
|
|
|
block1:
|
2013-11-12 06:00:23 +08:00
|
|
|
%cmp = icmp eq i32 %x, %y
|
|
|
|
br i1 %cmp , label %block2, label %block3
|
2007-07-26 03:57:03 +08:00
|
|
|
|
|
|
|
block2:
|
|
|
|
%a = load i32** %p
|
|
|
|
br label %block4
|
|
|
|
|
|
|
|
block3:
|
|
|
|
%b = load i32** %p
|
|
|
|
br label %block4
|
|
|
|
|
|
|
|
block4:
|
2010-01-28 06:01:02 +08:00
|
|
|
; CHECK-NOT: %existingPHI = phi
|
|
|
|
; CHECK: %DEAD = phi
|
|
|
|
%existingPHI = phi i32* [ %a, %block2 ], [ %b, %block3 ]
|
2007-07-26 03:57:03 +08:00
|
|
|
%DEAD = load i32** %p
|
|
|
|
%c = load i32* %DEAD
|
2010-01-28 06:01:02 +08:00
|
|
|
%d = load i32* %existingPHI
|
|
|
|
%e = add i32 %c, %d
|
|
|
|
ret i32 %e
|
2007-08-15 21:36:28 +08:00
|
|
|
}
|