1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -basicaa -newgvn -S | FileCheck %s
4 define i32 @main(i32** %p, i32 %x, i32 %y) {
7 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[X:%.*]], [[Y:%.*]]
8 ; CHECK-NEXT: br i1 [[CMP]], label [[BLOCK2:%.*]], label [[BLOCK3:%.*]]
10 ; CHECK-NEXT: [[A:%.*]] = load i32*, i32** [[P:%.*]]
11 ; CHECK-NEXT: br label [[BLOCK4:%.*]]
13 ; CHECK-NEXT: [[B:%.*]] = load i32*, i32** [[P]]
14 ; CHECK-NEXT: br label [[BLOCK4]]
16 ; CHECK-NEXT: [[EXISTINGPHI:%.*]] = phi i32* [ [[A]], [[BLOCK2]] ], [ [[B]], [[BLOCK3]] ]
17 ; CHECK-NEXT: [[C:%.*]] = load i32, i32* [[EXISTINGPHI]]
18 ; CHECK-NEXT: [[E:%.*]] = add i32 [[C]], [[C]]
19 ; CHECK-NEXT: ret i32 [[E]]
22 %cmp = icmp eq i32 %x, %y
23 br i1 %cmp , label %block2, label %block3
26 %a = load i32*, i32** %p
30 %b = load i32*, i32** %p
34 %existingPHI = phi i32* [ %a, %block2 ], [ %b, %block3 ]
35 %DEAD = load i32*, i32** %p
36 %c = load i32, i32* %DEAD
37 %d = load i32, i32* %existingPHI