forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GVN] Basic optimization remark support
[recommitting after the fix in r288307] Follow-on patches will add more interesting cases. The goal of this patch-set is to get the GVN messages printed in opt-viewer from Dhrystone as was presented in my Dev Meeting talk. This is the optimization view for the function (the last remark in the function has a bug which is fixed in this series): http://lab.llvm.org:8080/artifacts/opt-view_test-suite/build/SingleSource/Benchmarks/Dhrystone/CMakeFiles/dry.dir/html/_org_test-suite_SingleSource_Benchmarks_Dhrystone_dry.c.html#L430 Differential Revision: https://reviews.llvm.org/D26488 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288370 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
5 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
; RUN: opt < %s -gvn -o /dev/null -pass-remarks-output=%t -S -pass-remarks=gvn \ | ||
; RUN: 2>&1 | FileCheck %s | ||
; RUN: cat %t | FileCheck -check-prefix=YAML %s | ||
|
||
; CHECK: remark: <unknown>:0:0: load of type i32 eliminated{{$}} | ||
; CHECK-NEXT: remark: <unknown>:0:0: load of type i32 eliminated{{$}} | ||
; CHECK-NEXT: remark: <unknown>:0:0: load of type i32 eliminated{{$}} | ||
; CHECK-NOT: remark: | ||
|
||
; YAML: --- !Passed | ||
; YAML-NEXT: Pass: gvn | ||
; YAML-NEXT: Name: LoadElim | ||
; YAML-NEXT: Function: arg | ||
; YAML-NEXT: Args: | ||
; YAML-NEXT: - String: 'load of type ' | ||
; YAML-NEXT: - Type: i32 | ||
; YAML-NEXT: - String: ' eliminated' | ||
; YAML-NEXT: ... | ||
; YAML-NEXT: --- !Passed | ||
; YAML-NEXT: Pass: gvn | ||
; YAML-NEXT: Name: LoadElim | ||
; YAML-NEXT: Function: const | ||
; YAML-NEXT: Args: | ||
; YAML-NEXT: - String: 'load of type ' | ||
; YAML-NEXT: - Type: i32 | ||
; YAML-NEXT: - String: ' eliminated' | ||
; YAML-NEXT: ... | ||
; YAML-NEXT: --- !Passed | ||
; YAML-NEXT: Pass: gvn | ||
; YAML-NEXT: Name: LoadElim | ||
; YAML-NEXT: Function: inst | ||
; YAML-NEXT: Args: | ||
; YAML-NEXT: - String: 'load of type ' | ||
; YAML-NEXT: - Type: i32 | ||
; YAML-NEXT: - String: ' eliminated' | ||
; YAML-NEXT: ... | ||
|
||
|
||
define i32 @arg(i32* %p, i32 %i) { | ||
entry: | ||
store i32 %i, i32* %p | ||
%load = load i32, i32* %p | ||
ret i32 %load | ||
} | ||
|
||
define i32 @const(i32* %p) { | ||
entry: | ||
store i32 4, i32* %p | ||
%load = load i32, i32* %p | ||
ret i32 %load | ||
} | ||
|
||
define i32 @inst(i32* %p) { | ||
entry: | ||
%load1 = load i32, i32* %p | ||
%load = load i32, i32* %p | ||
%add = add i32 %load1, %load | ||
ret i32 %add | ||
} |