summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2014-04-16 16:54:24 +0000
committerDiego Novillo <dnovillo@google.com>2014-04-16 16:54:24 +0000
commit829b1700484d145ca93750384e7f49ef61a8d9b4 (patch)
treef744f1021f79a0a2822c60da1ece6a62cc7851cd /clang/test
parentdf655013a997cc07dde62316bd4ba0b17fb3c25a (diff)
downloadbcm5719-llvm-829b1700484d145ca93750384e7f49ef61a8d9b4.tar.gz
bcm5719-llvm-829b1700484d145ca93750384e7f49ef61a8d9b4.zip
Add support for optimization reports.
Summary: This patch adds a new flag -Rpass=. The flag indicates the name of the optimization pass that should emit remarks stating when it made a transformation to the code. This implements the design I proposed in: https://docs.google.com/document/d/1FYUatSjZZO-zmFBxjOiuOzAy9mhHA8hqdvklZv68WuQ/edit?usp=sharing Other changes: - Add DiagnosticIDs::isRemark(). Use it in printDiagnosticOptions to print "-R" instead of "-W" in the diagnostic message. - In BackendConsumer::OptimizationRemarkHandler, get a SourceLocation object out of the file name, line and column number. Use that location in the call to Diags.Report(). - When -Rpass is used without debug info a note is emitted alerting the user that they need to use -gline-tables-only -gcolumn-info to get this information. CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3226 llvm-svn: 206401
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Frontend/optimization-remark.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/test/Frontend/optimization-remark.c b/clang/test/Frontend/optimization-remark.c
new file mode 100644
index 00000000000..d5345b546a5
--- /dev/null
+++ b/clang/test/Frontend/optimization-remark.c
@@ -0,0 +1,19 @@
+// This file tests the -Rpass= flag with the inliner. The test is
+// designed to always trigger the inliner, so it should be independent
+// of the optimization level.
+
+// RUN: %clang -c %s -Rpass=inline -O0 -gline-tables-only -o /dev/null 2> %t.err
+// RUN: FileCheck < %t.err %s --check-prefix=INLINE
+
+// RUN: %clang -c %s -Rpass=inline -O0 -o /dev/null 2> %t.err
+// RUN: FileCheck < %t.err %s --check-prefix=INLINE-NO-LOC
+
+int foo(int x, int y) __attribute__((always_inline));
+
+int foo(int x, int y) { return x + y; }
+int bar(int j) { return foo(j, j - 2); }
+
+// INLINE: remark: foo inlined into bar [-Rpass]
+
+// INLINE-NO-LOC: {{^remark: foo inlined into bar}}
+// INLINE-NO-LOC: note: use -gline-tables-only -gcolumn-info to track
OpenPOWER on IntegriCloud