aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/GVN/rle-nonlocal.ll
blob: 7975462313c039e97410538632d98997b96cc0d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
; RUN: opt < %s -basicaa -gvn -S | FileCheck %s

define i32 @main(i32** %p, i32 %x, i32 %y) {
block1:
    %cmp = icmp eq i32 %x, %y
	br i1 %cmp , label %block2, label %block3

block2:
 %a = load i32*, i32** %p
 br label %block4

block3:
  %b = load i32*, i32** %p
  br label %block4

block4:
; CHECK-NOT: %existingPHI = phi
; CHECK: %DEAD = phi
  %existingPHI = phi i32* [ %a, %block2 ], [ %b, %block3 ] 
  %DEAD = load i32*, i32** %p
  %c = load i32, i32* %DEAD
  %d = load i32, i32* %existingPHI
  %e = add i32 %c, %d
  ret i32 %e
}