summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorSam Elliott <ashe2@cs.washington.edu>2017-08-20 06:43:34 +0000
committerSam Elliott <ashe2@cs.washington.edu>2017-08-20 06:43:34 +0000
commit785dd7536915fcb481ccfa205f1e0458bcd1125b (patch)
tree699a177c252eff921781cc5f1c3492b1b3d49ba9 /llvm/test/Transforms
parentd88dfd32f8556ea455e811061c47d0dd6a6c402e (diff)
downloadbcm5719-llvm-785dd7536915fcb481ccfa205f1e0458bcd1125b.tar.gz
bcm5719-llvm-785dd7536915fcb481ccfa205f1e0458bcd1125b.zip
Emit only A Single Opt Remark When Inlining
Summary: This updates the Inliner to only add a single Optimization Remark when Inlining, rather than an Analysis Remark and an Optimization Remark. Fixes https://bugs.llvm.org/show_bug.cgi?id=33786 Reviewers: anemet, davidxl, chandlerc Reviewed By: anemet Subscribers: haicheng, fhahn, mehdi_amini, dblaikie, llvm-commits, eraman Differential Revision: https://reviews.llvm.org/D36054 llvm-svn: 311273
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/Inline/optimization-remarks-passed-yaml.ll27
-rw-r--r--llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll6
-rw-r--r--llvm/test/Transforms/Inline/optimization-remarks-yaml.ll23
-rw-r--r--llvm/test/Transforms/Inline/optimization-remarks.ll12
4 files changed, 46 insertions, 22 deletions
diff --git a/llvm/test/Transforms/Inline/optimization-remarks-passed-yaml.ll b/llvm/test/Transforms/Inline/optimization-remarks-passed-yaml.ll
index f532a164857..11325b3c623 100644
--- a/llvm/test/Transforms/Inline/optimization-remarks-passed-yaml.ll
+++ b/llvm/test/Transforms/Inline/optimization-remarks-passed-yaml.ll
@@ -3,6 +3,11 @@
; RUN: -pass-remarks-with-hotness 2>&1 | FileCheck %s
; RUN: cat %t | FileCheck -check-prefix=YAML %s
+; RUN: opt < %s -S -passes=inline -pass-remarks-output=%t -pass-remarks=inline \
+; RUN: -pass-remarks-missed=inline -pass-remarks-analysis=inline \
+; RUN: -pass-remarks-with-hotness 2>&1 | FileCheck %s
+; RUN: cat %t | FileCheck -check-prefix=YAML %s
+
; Check the YAML file for inliner-generated passed and analysis remarks. This
; is the input:
@@ -12,19 +17,18 @@
; 4 return foo();
; 5 }
-; CHECK: remark: /tmp/s.c:4:10: foo can be inlined into bar with cost={{[0-9\-]+}} (threshold={{[0-9]+}}) (hotness: 30)
-; CHECK-NEXT: remark: /tmp/s.c:4:10: foo inlined into bar (hotness: 30)
+; CHECK: remark: /tmp/s.c:4:10: foo inlined into bar with cost={{[0-9\-]+}} (threshold={{[0-9]+}}) (hotness: 30)
-; YAML: --- !Analysis
+; YAML: --- !Passed
; YAML-NEXT: Pass: inline
-; YAML-NEXT: Name: CanBeInlined
+; YAML-NEXT: Name: Inlined
; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 4, Column: 10 }
; YAML-NEXT: Function: bar
; YAML-NEXT: Hotness: 30
; YAML-NEXT: Args:
; YAML-NEXT: - Callee: foo
; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 1, Column: 0 }
-; YAML-NEXT: - String: ' can be inlined into '
+; YAML-NEXT: - String: ' inlined into '
; YAML-NEXT: - Caller: bar
; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 3, Column: 0 }
; YAML-NEXT: - String: ' with cost='
@@ -33,19 +37,6 @@
; YAML-NEXT: - Threshold: '{{[0-9]+}}'
; YAML-NEXT: - String: ')'
; YAML-NEXT: ...
-; YAML-NEXT: --- !Passed
-; YAML-NEXT: Pass: inline
-; YAML-NEXT: Name: Inlined
-; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 4, Column: 10 }
-; YAML-NEXT: Function: bar
-; YAML-NEXT: Hotness: 30
-; YAML-NEXT: Args:
-; YAML-NEXT: - Callee: foo
-; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 1, Column: 0 }
-; YAML-NEXT: - String: ' inlined into '
-; YAML-NEXT: - Caller: bar
-; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 3, Column: 0 }
-; YAML-NEXT: ...
; ModuleID = '/tmp/s.c'
source_filename = "/tmp/s.c"
diff --git a/llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll b/llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll
index 1d6d135bdda..3614c3b5230 100644
--- a/llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll
+++ b/llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll
@@ -1,9 +1,11 @@
; RUN: opt < %s -inline -pass-remarks=inline -pass-remarks-missed=inline \
; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 \
; RUN: | FileCheck %s
+; RUN: opt < %s -passes=inline -pass-remarks=inline -pass-remarks-missed=inline \
+; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 \
+; RUN: | FileCheck %s
-; CHECK: foo should always be inlined (cost=always) (hotness: 30)
-; CHECK: foo inlined into bar (hotness: 30)
+; CHECK: foo inlined into bar with cost=always (hotness: 30)
; CHECK: foz not inlined into bar because it should never be inlined (cost=never) (hotness: 30)
; Function Attrs: alwaysinline nounwind uwtable
diff --git a/llvm/test/Transforms/Inline/optimization-remarks-yaml.ll b/llvm/test/Transforms/Inline/optimization-remarks-yaml.ll
index 16783634484..df7fecbc195 100644
--- a/llvm/test/Transforms/Inline/optimization-remarks-yaml.ll
+++ b/llvm/test/Transforms/Inline/optimization-remarks-yaml.ll
@@ -17,6 +17,26 @@
; The remarks output file should be empty.
; RUN: test ! -s %t.threshold
+; NewPM:
+; RUN: opt < %s -S -passes=inline -pass-remarks-missed=inline \
+; RUN: -pass-remarks-with-hotness -pass-remarks-hotness-threshold 15 \
+; RUN: -pass-remarks-output=%t 2>&1 | FileCheck %s -check-prefix=CHECK_NEW
+; RUN: test ! -s %t
+; RUN: opt < %s -S -passes=inline -pass-remarks-with-hotness -pass-remarks-output=%t
+; RUN: test ! -s %t
+;
+; Verify that remarks that don't meet the hotness threshold are not output.
+; RUN: opt < %s -S -passes=inline -pass-remarks-missed=inline \
+; RUN: -pass-remarks-with-hotness -pass-remarks-hotness-threshold 100 \
+; RUN: -pass-remarks-output=%t.threshold 2>&1 | \
+; RUN: FileCheck -check-prefix=THRESHOLD %s
+; RUN: test ! -s %t.threshold
+; RUN: opt < %s -S -passes=inline \
+; RUN: -pass-remarks-with-hotness -pass-remarks-hotness-threshold 100 \
+; RUN: -pass-remarks-output=%t.threshold
+; The remarks output file should be empty.
+; RUN: test ! -s %t.threshold
+
; Check the YAML file generated for inliner remarks for this program:
;
; 1 int foo();
@@ -59,6 +79,9 @@
; No remarks should be output, since none meet the threshold.
; THRESHOLD-NOT: remark
+; NewPM does not output this kind of "missed" remark.
+; CHECK_NEW-NOT: remark
+
; ModuleID = '/tmp/s.c'
source_filename = "/tmp/s.c"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
diff --git a/llvm/test/Transforms/Inline/optimization-remarks.ll b/llvm/test/Transforms/Inline/optimization-remarks.ll
index 61e270cff76..3f8332134e0 100644
--- a/llvm/test/Transforms/Inline/optimization-remarks.ll
+++ b/llvm/test/Transforms/Inline/optimization-remarks.ll
@@ -5,10 +5,18 @@
; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 | \
; RUN: FileCheck -check-prefix=CHECK -check-prefix=HOTNESS %s
+; RUN: opt < %s -passes=inline -pass-remarks=inline -pass-remarks-missed=inline \
+; RUN: -pass-remarks-analysis=inline -S 2>&1 | \
+; RUN: FileCheck -check-prefix=CHECK -check-prefix=NO_HOTNESS %s
+; RUN: opt < %s -passes=inline -pass-remarks=inline -pass-remarks-missed=inline \
+; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 | \
+; RUN: FileCheck -check-prefix=CHECK -check-prefix=HOTNESS_NEW %s
+
; HOTNESS: fox will not be inlined into bar because its definition is unavailable
; NO_HOTNESS-NOT: fox will not be inlined into bar because its definition is unavailable
-; CHECK: foo should always be inlined (cost=always)
-; CHECK: foo inlined into bar
+; NewPM's inliner does not emit the following remark:
+; HOTNESS_NEW-NOT: fox will not be inlined into bar because its definition is unavailable
+; CHECK: foo inlined into bar with cost=always
; CHECK: foz not inlined into bar because it should never be inlined (cost=never)
; Function Attrs: alwaysinline nounwind uwtable
OpenPOWER on IntegriCloud