2017-03-14 06:43:30 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
[GVN] Initial check-in of a new global value numbering algorithm.
The code have been developed by Daniel Berlin over the years, and
the new implementation goal is that of addressing shortcomings of
the current GVN infrastructure, i.e. long compile time for large
testcases, lack of phi predication, no load/store value numbering
etc...
The current code just implements the "core" GVN algorithm, although
other pieces (load coercion, phi handling, predicate system) are
already implemented in a branch out of tree. Once the core is stable,
we'll start adding pieces on top of the base framework.
The test currently living in test/Transform/NewGVN are a copy
of the ones in GVN, with proper `XFAIL` (missing features in NewGVN).
A flag will be added in a future commit to enable NewGVN, so that
interested parties can exercise this code easily.
Differential Revision: https://reviews.llvm.org/D26224
llvm-svn: 290346
2016-12-23 00:03:48 +08:00
|
|
|
; RUN: opt < %s -basicaa -newgvn -S | FileCheck %s
|
|
|
|
|
|
|
|
define i32 @main(i32** %p, i32 %x, i32 %y) {
|
2017-03-14 06:43:30 +08:00
|
|
|
; CHECK-LABEL: @main(
|
|
|
|
; CHECK-NEXT: block1:
|
|
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[X:%.*]], [[Y:%.*]]
|
|
|
|
; CHECK-NEXT: br i1 [[CMP]], label [[BLOCK2:%.*]], label [[BLOCK3:%.*]]
|
|
|
|
; CHECK: block2:
|
|
|
|
; CHECK-NEXT: [[A:%.*]] = load i32*, i32** [[P:%.*]]
|
|
|
|
; CHECK-NEXT: br label [[BLOCK4:%.*]]
|
|
|
|
; CHECK: block3:
|
|
|
|
; CHECK-NEXT: [[B:%.*]] = load i32*, i32** [[P]]
|
|
|
|
; CHECK-NEXT: br label [[BLOCK4]]
|
|
|
|
; CHECK: block4:
|
|
|
|
; CHECK-NEXT: [[EXISTINGPHI:%.*]] = phi i32* [ [[A]], [[BLOCK2]] ], [ [[B]], [[BLOCK3]] ]
|
|
|
|
; CHECK-NEXT: [[C:%.*]] = load i32, i32* [[EXISTINGPHI]]
|
|
|
|
; CHECK-NEXT: [[E:%.*]] = add i32 [[C]], [[C]]
|
|
|
|
; CHECK-NEXT: ret i32 [[E]]
|
|
|
|
;
|
[GVN] Initial check-in of a new global value numbering algorithm.
The code have been developed by Daniel Berlin over the years, and
the new implementation goal is that of addressing shortcomings of
the current GVN infrastructure, i.e. long compile time for large
testcases, lack of phi predication, no load/store value numbering
etc...
The current code just implements the "core" GVN algorithm, although
other pieces (load coercion, phi handling, predicate system) are
already implemented in a branch out of tree. Once the core is stable,
we'll start adding pieces on top of the base framework.
The test currently living in test/Transform/NewGVN are a copy
of the ones in GVN, with proper `XFAIL` (missing features in NewGVN).
A flag will be added in a future commit to enable NewGVN, so that
interested parties can exercise this code easily.
Differential Revision: https://reviews.llvm.org/D26224
llvm-svn: 290346
2016-12-23 00:03:48 +08:00
|
|
|
block1:
|
2017-03-14 06:43:30 +08:00
|
|
|
%cmp = icmp eq i32 %x, %y
|
|
|
|
br i1 %cmp , label %block2, label %block3
|
[GVN] Initial check-in of a new global value numbering algorithm.
The code have been developed by Daniel Berlin over the years, and
the new implementation goal is that of addressing shortcomings of
the current GVN infrastructure, i.e. long compile time for large
testcases, lack of phi predication, no load/store value numbering
etc...
The current code just implements the "core" GVN algorithm, although
other pieces (load coercion, phi handling, predicate system) are
already implemented in a branch out of tree. Once the core is stable,
we'll start adding pieces on top of the base framework.
The test currently living in test/Transform/NewGVN are a copy
of the ones in GVN, with proper `XFAIL` (missing features in NewGVN).
A flag will be added in a future commit to enable NewGVN, so that
interested parties can exercise this code easily.
Differential Revision: https://reviews.llvm.org/D26224
llvm-svn: 290346
2016-12-23 00:03:48 +08:00
|
|
|
|
|
|
|
block2:
|
2017-03-14 06:43:30 +08:00
|
|
|
%a = load i32*, i32** %p
|
|
|
|
br label %block4
|
[GVN] Initial check-in of a new global value numbering algorithm.
The code have been developed by Daniel Berlin over the years, and
the new implementation goal is that of addressing shortcomings of
the current GVN infrastructure, i.e. long compile time for large
testcases, lack of phi predication, no load/store value numbering
etc...
The current code just implements the "core" GVN algorithm, although
other pieces (load coercion, phi handling, predicate system) are
already implemented in a branch out of tree. Once the core is stable,
we'll start adding pieces on top of the base framework.
The test currently living in test/Transform/NewGVN are a copy
of the ones in GVN, with proper `XFAIL` (missing features in NewGVN).
A flag will be added in a future commit to enable NewGVN, so that
interested parties can exercise this code easily.
Differential Revision: https://reviews.llvm.org/D26224
llvm-svn: 290346
2016-12-23 00:03:48 +08:00
|
|
|
|
|
|
|
block3:
|
|
|
|
%b = load i32*, i32** %p
|
|
|
|
br label %block4
|
|
|
|
|
|
|
|
block4:
|
2017-03-14 06:43:30 +08:00
|
|
|
%existingPHI = phi i32* [ %a, %block2 ], [ %b, %block3 ]
|
[GVN] Initial check-in of a new global value numbering algorithm.
The code have been developed by Daniel Berlin over the years, and
the new implementation goal is that of addressing shortcomings of
the current GVN infrastructure, i.e. long compile time for large
testcases, lack of phi predication, no load/store value numbering
etc...
The current code just implements the "core" GVN algorithm, although
other pieces (load coercion, phi handling, predicate system) are
already implemented in a branch out of tree. Once the core is stable,
we'll start adding pieces on top of the base framework.
The test currently living in test/Transform/NewGVN are a copy
of the ones in GVN, with proper `XFAIL` (missing features in NewGVN).
A flag will be added in a future commit to enable NewGVN, so that
interested parties can exercise this code easily.
Differential Revision: https://reviews.llvm.org/D26224
llvm-svn: 290346
2016-12-23 00:03:48 +08:00
|
|
|
%DEAD = load i32*, i32** %p
|
|
|
|
%c = load i32, i32* %DEAD
|
|
|
|
%d = load i32, i32* %existingPHI
|
|
|
|
%e = add i32 %c, %d
|
|
|
|
ret i32 %e
|
|
|
|
}
|