r349117 - Revert "Make -Wstring-plus-int warns even if when the result is not out of bounds"

2018-12-13 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Thu Dec 13 16:43:34 2018
New Revision: 349117

URL: http://llvm.org/viewvc/llvm-project?rev=349117=rev
Log:
Revert "Make -Wstring-plus-int warns even if when the result is not out of 
bounds"

This reverts commit r349054.

It's causing:

FAILED: tools/clang/bindings/python/tests/CMakeFiles/check-clang-python
FAIL: test_diagnostic_range (tests.cindex.test_diagnostics.TestDiagnostics)
--
Traceback (most recent call last):
  File
  
"/Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/bindings/python/tests/cindex/test_diagnostics.py",
  line 55, in test_diagnostic_range
  self.assertEqual(len(tu.diagnostics), 1)
  AssertionError: 2 != 1

==
FAIL: test_diagnostic_warning (tests.cindex.test_diagnostics.TestDiagnostics)
--
Traceback (most recent call last):
  File
  
"/Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/bindings/python/tests/cindex/test_diagnostics.py",
  line 18, in test_diagnostic_warning
  self.assertEqual(len(tu.diagnostics), 2)
  AssertionError: 1 != 2

Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaCXX/string-plus-int.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=349117=349116=349117=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Dec 13 16:43:34 2018
@@ -9135,6 +9135,16 @@ static void diagnoseStringPlusInt(Sema &
   if (!IsStringPlusInt || IndexExpr->isValueDependent())
 return;
 
+  Expr::EvalResult Result;
+  if (IndexExpr->EvaluateAsInt(Result, Self.getASTContext())) {
+llvm::APSInt index = Result.Val.getInt();
+unsigned StrLenWithNull = StrExpr->getLength() + 1;
+if (index.isNonNegative() &&
+index <= llvm::APSInt(llvm::APInt(index.getBitWidth(), StrLenWithNull),
+  index.isUnsigned()))
+  return;
+  }
+
   SourceRange DiagRange(LHSExpr->getBeginLoc(), RHSExpr->getEndLoc());
   Self.Diag(OpLoc, diag::warn_string_plus_int)
   << DiagRange << IndexExpr->IgnoreImpCasts()->getType();

Modified: cfe/trunk/test/SemaCXX/string-plus-int.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/string-plus-int.cpp?rev=349117=349116=349117=diff
==
--- cfe/trunk/test/SemaCXX/string-plus-int.cpp (original)
+++ cfe/trunk/test/SemaCXX/string-plus-int.cpp Thu Dec 13 16:43:34 2018
@@ -31,36 +31,37 @@ void f(int index) {
   consume("foo" + 5);  // expected-warning {{adding 'int' to a string does not 
append to the string}} expected-note {{use array indexing to silence this 
warning}}
   consume("foo" + index);  // expected-warning {{adding 'int' to a string does 
not append to the string}} expected-note {{use array indexing to silence this 
warning}}
   consume("foo" + kMyEnum);  // expected-warning {{adding 'MyEnum' to a string 
does not append to the string}} expected-note {{use array indexing to silence 
this warning}}
-  consume("foo" + kMySmallEnum); // expected-warning {{adding 'MyEnum' to a 
string does not append to the string}} expected-note {{use array indexing to 
silence this warning}}
 
   consume(5 + "foo");  // expected-warning {{adding 'int' to a string does not 
append to the string}} expected-note {{use array indexing to silence this 
warning}}
   consume(index + "foo");  // expected-warning {{adding 'int' to a string does 
not append to the string}} expected-note {{use array indexing to silence this 
warning}}
   consume(kMyEnum + "foo");  // expected-warning {{adding 'MyEnum' to a string 
does not append to the string}} expected-note {{use array indexing to silence 
this warning}}
-  consume(kMySmallEnum + "foo"); // expected-warning {{adding 'MyEnum' to a 
string does not append to the string}} expected-note {{use array indexing to 
silence this warning}}
 
   // FIXME: suggest replacing with "foo"[5]
   consumeChar(*("foo" + 5));  // expected-warning {{adding 'int' to a string 
does not append to the string}} expected-note {{use array indexing to silence 
this warning}}
   consumeChar(*(5 + "foo"));  // expected-warning {{adding 'int' to a string 
does not append to the string}} expected-note {{use array indexing to silence 
this warning}}
 
   consume(L"foo" + 5);  // expected-warning {{adding 'int' to a string does 
not append to the string}} expected-note {{use array indexing to silence this 
warning}}
-  consume(L"foo" + 2); // expected-warning {{adding 'int' to a string does not 
append to the string}} expected-note {{use array indexing to silence this 
warning}}
-
-  consume("foo" + 3);  // expected-warning {{adding 

r349118 - Revert "Try to update the test to fix the breakage With the new warning, we are showing one more output in the test."

2018-12-13 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Thu Dec 13 16:43:36 2018
New Revision: 349118

URL: http://llvm.org/viewvc/llvm-project?rev=349118=rev
Log:
Revert "Try to update the test to fix the breakage With the new warning, we are 
showing one more output in the test."

This reverts commit r349064.

This wasn't updating the right test.  Causing (not the different line number
from the previous revert):

==
FAIL: test_diagnostic_warning (tests.cindex.test_diagnostics.TestDiagnostics)
--
Traceback (most recent call last):
  File 
"/Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/bindings/python/tests/cindex/test_diagnostics.py",
 line 18, in test_diagnostic_warning
self.assertEqual(len(tu.diagnostics), 2)
AssertionError: 1 != 2

Modified:
cfe/trunk/bindings/python/tests/cindex/test_diagnostics.py

Modified: cfe/trunk/bindings/python/tests/cindex/test_diagnostics.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/cindex/test_diagnostics.py?rev=349118=349117=349118=diff
==
--- cfe/trunk/bindings/python/tests/cindex/test_diagnostics.py (original)
+++ cfe/trunk/bindings/python/tests/cindex/test_diagnostics.py Thu Dec 13 
16:43:36 2018
@@ -15,7 +15,7 @@ import unittest
 class TestDiagnostics(unittest.TestCase):
 def test_diagnostic_warning(self):
 tu = get_tu('int f0() {}\n')
-self.assertEqual(len(tu.diagnostics), 2)
+self.assertEqual(len(tu.diagnostics), 1)
 self.assertEqual(tu.diagnostics[0].severity, Diagnostic.Warning)
 self.assertEqual(tu.diagnostics[0].location.line, 1)
 self.assertEqual(tu.diagnostics[0].location.column, 11)


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r326168 - Attempt to fix greendragon bot after r326141

2018-02-26 Thread Adam Nemet via cfe-commits
: note: Use '--' to treat subsequent arguments as filenames
> clang-7.0: warning: argument unused during compilation: '/Z7' 
> [-Wunused-command-line-argument]
> clang-7.0: warning: argument unused during compilation: ‘-U 
> sers/buildslave/jenkins/workspace/apple-clang-master-RA-stage1-cmake-incremental/clang/src/tools/clang/test/Driver/codeview-column-info.c'
>  [-Wunused-command-line-argument]
>  
> Anyhow as I said to Reid, feel free to improve the patch, I am just bringing 
> back a bot that has been red for hours.
>  
> Adam
> 
> 
> 
> 
> On Feb 26, 2018, at 9:22 PM, Shoaib Meenai <smee...@fb.com 
> <mailto:smee...@fb.com>> wrote:
>  
> This seems bogus to me. CodeView can be generated on any build platform; it 
> just needs the correct triple, which Reid added in r326144.
>  
> From: cfe-commits <cfe-commits-boun...@lists.llvm.org 
> <mailto:cfe-commits-boun...@lists.llvm.org>> on behalf of Adam Nemet via 
> cfe-commits <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>>
> Reply-To: Adam Nemet <ane...@apple.com <mailto:ane...@apple.com>>
> Date: Monday, February 26, 2018 at 8:51 PM
> To: "cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>" 
> <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>>
> Subject: r326168 - Attempt to fix greendragon bot after r326141
>  
> Author: anemet <>
> Date: Mon Feb 26 20:49:26 2018
> New Revision: 326168
>  
> URL: 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D326168-26view-3Drev=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=oqoKnyrAT6kNwxIasdWb7eopGd0q41TFJ5Hxp_eoiZs=
>  
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D326168-26view-3Drev=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=oqoKnyrAT6kNwxIasdWb7eopGd0q41TFJ5Hxp_eoiZs=>
> Log:
> Attempt to fix greendragon bot after r326141
>  
> Modified:
> cfe/trunk/test/Driver/codeview-column-info.c
>  
> Modified: cfe/trunk/test/Driver/codeview-column-info.c
> URL: 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_Driver_codeview-2Dcolumn-2Dinfo.c-3Frev-3D326168-26r1-3D326167-26r2-3D326168-26view-3Ddiff=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=Hs37wkn2y2OFh6b_DWdNuK_AD--vySi-ptv_d_HDqxg=
>  
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_Driver_codeview-2Dcolumn-2Dinfo.c-3Frev-3D326168-26r1-3D326167-26r2-3D326168-26view-3Ddiff=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=Hs37wkn2y2OFh6b_DWdNuK_AD--vySi-ptv_d_HDqxg=>
> ==
> --- cfe/trunk/test/Driver/codeview-column-info.c (original)
> +++ cfe/trunk/test/Driver/codeview-column-info.c Mon Feb 26 20:49:26 2018
> @@ -1,3 +1,4 @@
> +// REQUIRES: system-windows
> // Check that -dwarf-column-info does not get added to the cc1 line:
> // 1) When -gcodeview is present via the clang or clang++ driver
> // 2) When /Z7 is present via the cl driver.
>  
>  
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommits=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=JTIVfh7ogIVoFYMFdjOK-30TFLWLX39y8q9KItC_xnY=
>  
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommits=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=JTIVfh7ogIVoFYMFdjOK-30TFLWLX39y8q9KItC_xnY=>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r326168 - Attempt to fix greendragon bot after r326141

2018-02-26 Thread Adam Nemet via cfe-commits
nkins/workspace/apple-clang-master-RA-stage1-cmake-incremental/clang/src/tools/clang/test/Driver/codeview-column-info.c'
>  treated as the '/U' option [-Wslash-u-filename]
> clang-7.0: note: Use '--' to treat subsequent arguments as filenames
> clang-7.0: warning: argument unused during compilation: '/Z7' 
> [-Wunused-command-line-argument]
> clang-7.0: warning: argument unused during compilation: ‘-U 
> sers/buildslave/jenkins/workspace/apple-clang-master-RA-stage1-cmake-incremental/clang/src/tools/clang/test/Driver/codeview-column-info.c'
>  [-Wunused-command-line-argument]
>  
> Anyhow as I said to Reid, feel free to improve the patch, I am just bringing 
> back a bot that has been red for hours.
>  
> Adam
> 
> 
> 
> 
> On Feb 26, 2018, at 9:22 PM, Shoaib Meenai <smee...@fb.com 
> <mailto:smee...@fb.com>> wrote:
>  
> This seems bogus to me. CodeView can be generated on any build platform; it 
> just needs the correct triple, which Reid added in r326144.
>  
> From: cfe-commits <cfe-commits-boun...@lists.llvm.org 
> <mailto:cfe-commits-boun...@lists.llvm.org>> on behalf of Adam Nemet via 
> cfe-commits <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>>
> Reply-To: Adam Nemet <ane...@apple.com <mailto:ane...@apple.com>>
> Date: Monday, February 26, 2018 at 8:51 PM
> To: "cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>" 
> <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>>
> Subject: r326168 - Attempt to fix greendragon bot after r326141
>  
> Author: anemet <>
> Date: Mon Feb 26 20:49:26 2018
> New Revision: 326168
>  
> URL: 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D326168-26view-3Drev=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=oqoKnyrAT6kNwxIasdWb7eopGd0q41TFJ5Hxp_eoiZs=
>  
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D326168-26view-3Drev=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=oqoKnyrAT6kNwxIasdWb7eopGd0q41TFJ5Hxp_eoiZs=>
> Log:
> Attempt to fix greendragon bot after r326141
>  
> Modified:
> cfe/trunk/test/Driver/codeview-column-info.c
>  
> Modified: cfe/trunk/test/Driver/codeview-column-info.c
> URL: 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_Driver_codeview-2Dcolumn-2Dinfo.c-3Frev-3D326168-26r1-3D326167-26r2-3D326168-26view-3Ddiff=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=Hs37wkn2y2OFh6b_DWdNuK_AD--vySi-ptv_d_HDqxg=
>  
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_Driver_codeview-2Dcolumn-2Dinfo.c-3Frev-3D326168-26r1-3D326167-26r2-3D326168-26view-3Ddiff=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=Hs37wkn2y2OFh6b_DWdNuK_AD--vySi-ptv_d_HDqxg=>
> ==
> --- cfe/trunk/test/Driver/codeview-column-info.c (original)
> +++ cfe/trunk/test/Driver/codeview-column-info.c Mon Feb 26 20:49:26 2018
> @@ -1,3 +1,4 @@
> +// REQUIRES: system-windows
> // Check that -dwarf-column-info does not get added to the cc1 line:
> // 1) When -gcodeview is present via the clang or clang++ driver
> // 2) When /Z7 is present via the cl driver.
>  
>  
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommits=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=JTIVfh7ogIVoFYMFdjOK-30TFLWLX39y8q9KItC_xnY=
>  
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommits=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=JTIVfh7ogIVoFYMFdjOK-30TFLWLX39y8q9KItC_xnY=>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r326168 - Attempt to fix greendragon bot after r326141

2018-02-26 Thread Adam Nemet via cfe-commits
Yep.

> On Feb 26, 2018, at 9:50 PM, Shoaib Meenai <smee...@fb.com> wrote:
> 
> Reid re-committed r326141 this morning (and followed up with r326144), and I 
> don't think either of those have been reverted?
>  
> From: Zachary Turner <ztur...@google.com>
> Date: Monday, February 26, 2018 at 9:47 PM
> To: Adam Nemet <ane...@apple.com>
> Cc: Shoaib Meenai <smee...@fb.com>, "cfe-commits@lists.llvm.org" 
> <cfe-commits@lists.llvm.org>, Reid Kleckner <r...@google.com>
> Subject: Re: r326168 - Attempt to fix greendragon bot after r326141
>  
> I already reverted this a long time ago, but if Shoaib has a proper fix that 
> would be great <>
> On Mon, Feb 26, 2018 at 9:45 PM Adam Nemet <ane...@apple.com 
> <mailto:ane...@apple.com>> wrote:
> Ah, that should be sufficient.
>  
> 
> 
> On Feb 26, 2018, at 9:44 PM, Shoaib Meenai <smee...@fb.com 
> <mailto:smee...@fb.com>> wrote:
>  
> Thanks. I'm building on macOS locally to confirm the original problem and my 
> fix.
>  
> From: <ane...@apple.com <mailto:ane...@apple.com>> on behalf of Adam Nemet 
> <ane...@apple.com <mailto:ane...@apple.com>>
> Date: Monday, February 26, 2018 at 9:42 PM
> To: Shoaib Meenai <smee...@fb.com <mailto:smee...@fb.com>>
> Cc: "cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>" 
> <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>>, Reid 
> Kleckner <r...@google.com <mailto:r...@google.com>>, Zachary Turner 
> <ztur...@google.com <mailto:ztur...@google.com>>
> Subject: Re: r326168 - Attempt to fix greendragon bot after r326141
>  
> This is the bot with the failure: 
>  
> http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental/46794/#showFailuresLink
>  
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__lab.llvm.org-3A8080_green_job_clang-2Dstage1-2Dcmake-2DRA-2Dincremental_46794_-23showFailuresLink=DwMFaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=OIgCAeO_dFHAJFlsBo7l_qhVKV7niFfyQ0fpICifvN4=OEMtPu3dUHXK8327qnfWOSUP62v1F-s_a13X0lqbdJ0=>
>  
> But to make matters worse, greendragon is experience some difficulty fetching 
> from SVN so you might want to wait until things recover.  I am not sure if I 
> will be able to get in touch with Mike Edwards until the morning PST.
>  
> There may also be llvm bots that exhibit the same problem.  You may have 
> better luck with those in the short term.
>  
> Adam
>  
> 
> On Feb 26, 2018, at 9:35 PM, Shoaib Meenai <smee...@fb.com 
> <mailto:smee...@fb.com>> wrote:
>  
> Could you point me to the specific bot that was failing? I've dealt with that 
> problem before, and it shouldn't be hard to fix, but I wanna monitor the bot 
> after the fix to make sure it stays green.
>  
> From: <ane...@apple.com <mailto:ane...@apple.com>> on behalf of Adam Nemet 
> <ane...@apple.com <mailto:ane...@apple.com>>
> Date: Monday, February 26, 2018 at 9:30 PM
> To: Shoaib Meenai <smee...@fb.com <mailto:smee...@fb.com>>
> Cc: "cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>" 
> <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>>, Reid 
> Kleckner <r...@google.com <mailto:r...@google.com>>, Zachary Turner 
> <ztur...@google.com <mailto:ztur...@google.com>>
> Subject: Re: r326168 - Attempt to fix greendragon bot after r326141
>  
> I don’t think we can deal with the slash options:
>  
> clang-7.0: warning: 
> '/Users/buildslave/jenkins/workspace/apple-clang-master-RA-stage1-cmake-incremental/clang/src/tools/clang/test/Driver/codeview-column-info.c'
>  treated as the '/U' option [-Wslash-u-filename]
> clang-7.0: note: Use '--' to treat subsequent arguments as filenames
> clang-7.0: warning: argument unused during compilation: '/Z7' 
> [-Wunused-command-line-argument]
> clang-7.0: warning: argument unused during compilation: ‘-U 
> sers/buildslave/jenkins/workspace/apple-clang-master-RA-stage1-cmake-incremental/clang/src/tools/clang/test/Driver/codeview-column-info.c'
>  [-Wunused-command-line-argument]
>  
> Anyhow as I said to Reid, feel free to improve the patch, I am just bringing 
> back a bot that has been red for hours.
>  
> Adam
> 
> 
> 
> On Feb 26, 2018, at 9:22 PM, Shoaib Meenai <smee...@fb.com 
> <mailto:smee...@fb.com>> wrote:
>  
> This seems bogus to me. CodeView can be generated on any build platform; it 
> just needs the correct triple, which Reid added in r326144.
>  
> From: cfe-commits <cfe-commits-boun...@lists.llvm.org 
> <mailto:cfe-commits-boun...@lists.ll

Re: r326168 - Attempt to fix greendragon bot after r326141

2018-02-26 Thread Adam Nemet via cfe-commits
What did you revert?

> On Feb 26, 2018, at 9:46 PM, Zachary Turner <ztur...@google.com> wrote:
> 
> I already reverted this a long time ago, but if Shoaib has a proper fix that 
> would be great 
> On Mon, Feb 26, 2018 at 9:45 PM Adam Nemet <ane...@apple.com 
> <mailto:ane...@apple.com>> wrote:
> Ah, that should be sufficient.
> 
> 
>> On Feb 26, 2018, at 9:44 PM, Shoaib Meenai <smee...@fb.com 
>> <mailto:smee...@fb.com>> wrote:
>> 
>> Thanks. I'm building on macOS locally to confirm the original problem and my 
>> fix.
>>  
>> From: <ane...@apple.com <mailto:ane...@apple.com>> on behalf of Adam Nemet 
>> <ane...@apple.com <mailto:ane...@apple.com>>
>> Date: Monday, February 26, 2018 at 9:42 PM
>> To: Shoaib Meenai <smee...@fb.com <mailto:smee...@fb.com>>
>> Cc: "cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>" 
>> <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>>, Reid 
>> Kleckner <r...@google.com <mailto:r...@google.com>>, Zachary Turner 
>> <ztur...@google.com <mailto:ztur...@google.com>>
>> Subject: Re: r326168 - Attempt to fix greendragon bot after r326141
>>  
>> This is the bot with the failure: 
>>  
>> http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental/46794/#showFailuresLink
>>  
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__lab.llvm.org-3A8080_green_job_clang-2Dstage1-2Dcmake-2DRA-2Dincremental_46794_-23showFailuresLink=DwMFaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=OIgCAeO_dFHAJFlsBo7l_qhVKV7niFfyQ0fpICifvN4=OEMtPu3dUHXK8327qnfWOSUP62v1F-s_a13X0lqbdJ0=>
>>  
>> But to make matters worse, greendragon is experience some difficulty 
>> fetching from SVN so you might want to wait until things recover.  I am not 
>> sure if I will be able to get in touch with Mike Edwards until the morning 
>> PST.
>>  
>> There may also be llvm bots that exhibit the same problem.  You may have 
>> better luck with those in the short term.
>>  
>> Adam
>> 
>> 
>> On Feb 26, 2018, at 9:35 PM, Shoaib Meenai <smee...@fb.com 
>> <mailto:smee...@fb.com>> wrote:
>>  
>> Could you point me to the specific bot that was failing? I've dealt with 
>> that problem before, and it shouldn't be hard to fix, but I wanna monitor 
>> the bot after the fix to make sure it stays green.
>>  
>> From: <ane...@apple.com <mailto:ane...@apple.com>> on behalf of Adam Nemet 
>> <ane...@apple.com <mailto:ane...@apple.com>>
>> Date: Monday, February 26, 2018 at 9:30 PM
>> To: Shoaib Meenai <smee...@fb.com <mailto:smee...@fb.com>>
>> Cc: "cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>" 
>> <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>>, Reid 
>> Kleckner <r...@google.com <mailto:r...@google.com>>, Zachary Turner 
>> <ztur...@google.com <mailto:ztur...@google.com>>
>> Subject: Re: r326168 - Attempt to fix greendragon bot after r326141
>>  
>> I don’t think we can deal with the slash options:
>>  
>> clang-7.0: warning: 
>> '/Users/buildslave/jenkins/workspace/apple-clang-master-RA-stage1-cmake-incremental/clang/src/tools/clang/test/Driver/codeview-column-info.c'
>>  treated as the '/U' option [-Wslash-u-filename]
>> clang-7.0: note: Use '--' to treat subsequent arguments as filenames
>> clang-7.0: warning: argument unused during compilation: '/Z7' 
>> [-Wunused-command-line-argument]
>> clang-7.0: warning: argument unused during compilation: ‘-U 
>> sers/buildslave/jenkins/workspace/apple-clang-master-RA-stage1-cmake-incremental/clang/src/tools/clang/test/Driver/codeview-column-info.c'
>>  [-Wunused-command-line-argument]
>>  
>> Anyhow as I said to Reid, feel free to improve the patch, I am just bringing 
>> back a bot that has been red for hours.
>>  
>> Adam
>> 
>> 
>> 
>> On Feb 26, 2018, at 9:22 PM, Shoaib Meenai <smee...@fb.com 
>> <mailto:smee...@fb.com>> wrote:
>>  
>> This seems bogus to me. CodeView can be generated on any build platform; it 
>> just needs the correct triple, which Reid added in r326144.
>>  
>> From: cfe-commits <cfe-commits-boun...@lists.llvm.org 
>> <mailto:cfe-commits-boun...@lists.llvm.org>> on behalf of Adam Nemet via 
>> cfe-commits <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>>
>> Reply-To: Adam Nemet <ane...@apple.com <mailto:ane...@ap

Re: r326168 - Attempt to fix greendragon bot after r326141

2018-02-26 Thread Adam Nemet via cfe-commits
Ah, that should be sufficient.

> On Feb 26, 2018, at 9:44 PM, Shoaib Meenai <smee...@fb.com> wrote:
> 
> Thanks. I'm building on macOS locally to confirm the original problem and my 
> fix.
>  
> From: <ane...@apple.com> on behalf of Adam Nemet <ane...@apple.com>
> Date: Monday, February 26, 2018 at 9:42 PM
> To: Shoaib Meenai <smee...@fb.com>
> Cc: "cfe-commits@lists.llvm.org" <cfe-commits@lists.llvm.org>, Reid Kleckner 
> <r...@google.com>, Zachary Turner <ztur...@google.com>
> Subject: Re: r326168 - Attempt to fix greendragon bot after r326141
>  
> This is the bot with the failure: 
>  
> http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental/46794/#showFailuresLink
>  
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__lab.llvm.org-3A8080_green_job_clang-2Dstage1-2Dcmake-2DRA-2Dincremental_46794_-23showFailuresLink=DwMFaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=OIgCAeO_dFHAJFlsBo7l_qhVKV7niFfyQ0fpICifvN4=OEMtPu3dUHXK8327qnfWOSUP62v1F-s_a13X0lqbdJ0=>
>  
> But to make matters worse, greendragon is experience some difficulty fetching 
> from SVN so you might want to wait until things recover.  I am not sure if I 
> will be able to get in touch with Mike Edwards until the morning PST.
>  
> There may also be llvm bots that exhibit the same problem.  You may have 
> better luck with those in the short term.
>  
> Adam
> 
> 
> On Feb 26, 2018, at 9:35 PM, Shoaib Meenai <smee...@fb.com 
> <mailto:smee...@fb.com>> wrote:
>  
> Could you point me to the specific bot that was failing? I've dealt with that 
> problem before, and it shouldn't be hard to fix, but I wanna monitor the bot 
> after the fix to make sure it stays green.
>  
> From: <ane...@apple.com <mailto:ane...@apple.com>> on behalf of Adam Nemet 
> <ane...@apple.com <mailto:ane...@apple.com>>
> Date: Monday, February 26, 2018 at 9:30 PM
> To: Shoaib Meenai <smee...@fb.com <mailto:smee...@fb.com>>
> Cc: "cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>" 
> <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>>, Reid 
> Kleckner <r...@google.com <mailto:r...@google.com>>, Zachary Turner 
> <ztur...@google.com <mailto:ztur...@google.com>>
> Subject: Re: r326168 - Attempt to fix greendragon bot after r326141
>  
> I don’t think we can deal with the slash options:
>  
> clang-7.0: warning: 
> '/Users/buildslave/jenkins/workspace/apple-clang-master-RA-stage1-cmake-incremental/clang/src/tools/clang/test/Driver/codeview-column-info.c'
>  treated as the '/U' option [-Wslash-u-filename]
> clang-7.0: note: Use '--' to treat subsequent arguments as filenames
> clang-7.0: warning: argument unused during compilation: '/Z7' 
> [-Wunused-command-line-argument]
> clang-7.0: warning: argument unused during compilation: ‘-U 
> sers/buildslave/jenkins/workspace/apple-clang-master-RA-stage1-cmake-incremental/clang/src/tools/clang/test/Driver/codeview-column-info.c'
>  [-Wunused-command-line-argument]
>  
> Anyhow as I said to Reid, feel free to improve the patch, I am just bringing 
> back a bot that has been red for hours.
>  
> Adam
> 
> 
> 
> On Feb 26, 2018, at 9:22 PM, Shoaib Meenai <smee...@fb.com 
> <mailto:smee...@fb.com>> wrote:
>  
> This seems bogus to me. CodeView can be generated on any build platform; it 
> just needs the correct triple, which Reid added in r326144.
>  
> From: cfe-commits <cfe-commits-boun...@lists.llvm.org 
> <mailto:cfe-commits-boun...@lists.llvm.org>> on behalf of Adam Nemet via 
> cfe-commits <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>>
> Reply-To: Adam Nemet <ane...@apple.com <mailto:ane...@apple.com>>
> Date: Monday, February 26, 2018 at 8:51 PM
> To: "cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>" 
> <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>>
> Subject: r326168 - Attempt to fix greendragon bot after r326141
>  
> Author: anemet <>
> Date: Mon Feb 26 20:49:26 2018
> New Revision: 326168
>  
> URL: 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D326168-26view-3Drev=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=oqoKnyrAT6kNwxIasdWb7eopGd0q41TFJ5Hxp_eoiZs=
>  
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D326168-26view-3Drev=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=oqoKnyrAT6kNwxIasdWb7eopGd0q41TFJ5Hxp_eoiZs=>
> Log:
>

Re: r326168 - Attempt to fix greendragon bot after r326141

2018-02-26 Thread Adam Nemet via cfe-commits
This is the bot with the failure:

http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental/46794/#showFailuresLink
 
<http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental/46794/#showFailuresLink>

But to make matters worse, greendragon is experience some difficulty fetching 
from SVN so you might want to wait until things recover.  I am not sure if I 
will be able to get in touch with Mike Edwards until the morning PST.

There may also be llvm bots that exhibit the same problem.  You may have better 
luck with those in the short term.

Adam

> On Feb 26, 2018, at 9:35 PM, Shoaib Meenai <smee...@fb.com> wrote:
> 
> Could you point me to the specific bot that was failing? I've dealt with that 
> problem before, and it shouldn't be hard to fix, but I wanna monitor the bot 
> after the fix to make sure it stays green.
>  
> From: <ane...@apple.com> on behalf of Adam Nemet <ane...@apple.com>
> Date: Monday, February 26, 2018 at 9:30 PM
> To: Shoaib Meenai <smee...@fb.com>
> Cc: "cfe-commits@lists.llvm.org" <cfe-commits@lists.llvm.org>, Reid Kleckner 
> <r...@google.com>, Zachary Turner <ztur...@google.com>
> Subject: Re: r326168 - Attempt to fix greendragon bot after r326141
>  
> I don’t think we can deal with the slash options:
>  
> clang-7.0: warning: 
> '/Users/buildslave/jenkins/workspace/apple-clang-master-RA-stage1-cmake-incremental/clang/src/tools/clang/test/Driver/codeview-column-info.c'
>  treated as the '/U' option [-Wslash-u-filename]
> clang-7.0: note: Use '--' to treat subsequent arguments as filenames
> clang-7.0: warning: argument unused during compilation: '/Z7' 
> [-Wunused-command-line-argument]
> clang-7.0: warning: argument unused during compilation: ‘-U 
> sers/buildslave/jenkins/workspace/apple-clang-master-RA-stage1-cmake-incremental/clang/src/tools/clang/test/Driver/codeview-column-info.c'
>  [-Wunused-command-line-argument]
>  
> Anyhow as I said to Reid, feel free to improve the patch, I am just bringing 
> back a bot that has been red for hours.
>  
> Adam
> 
> 
> On Feb 26, 2018, at 9:22 PM, Shoaib Meenai <smee...@fb.com 
> <mailto:smee...@fb.com>> wrote:
>  
> This seems bogus to me. CodeView can be generated on any build platform; it 
> just needs the correct triple, which Reid added in r326144.
>  
> From: cfe-commits <cfe-commits-boun...@lists.llvm.org 
> <mailto:cfe-commits-boun...@lists.llvm.org>> on behalf of Adam Nemet via 
> cfe-commits <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>>
> Reply-To: Adam Nemet <ane...@apple.com <mailto:ane...@apple.com>>
> Date: Monday, February 26, 2018 at 8:51 PM
> To: "cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>" 
> <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>>
> Subject: r326168 - Attempt to fix greendragon bot after r326141
>  
> Author: anemet <>
> Date: Mon Feb 26 20:49:26 2018
> New Revision: 326168
>  
> URL: 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D326168-26view-3Drev=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=oqoKnyrAT6kNwxIasdWb7eopGd0q41TFJ5Hxp_eoiZs=
>  
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D326168-26view-3Drev=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=oqoKnyrAT6kNwxIasdWb7eopGd0q41TFJ5Hxp_eoiZs=>
> Log:
> Attempt to fix greendragon bot after r326141
>  
> Modified:
> cfe/trunk/test/Driver/codeview-column-info.c
>  
> Modified: cfe/trunk/test/Driver/codeview-column-info.c
> URL: 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_Driver_codeview-2Dcolumn-2Dinfo.c-3Frev-3D326168-26r1-3D326167-26r2-3D326168-26view-3Ddiff=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=Hs37wkn2y2OFh6b_DWdNuK_AD--vySi-ptv_d_HDqxg=
>  
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_Driver_codeview-2Dcolumn-2Dinfo.c-3Frev-3D326168-26r1-3D326167-26r2-3D326168-26view-3Ddiff=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=Hs37wkn2y2OFh6b_DWdNuK_AD--vySi-ptv_d_HDqxg=>
> ==
> --- cfe/trunk/test/Driver/codeview-column-info.c (original)
> +++ cfe/trunk/test/Driver/codeview-column-info.c Mon Feb 26 20:49:26 2018
> @@ -1,3 +1,4 @@
> +// REQUIRES: system-windows
> // Check that -dwarf-column-info does not get added to the cc1 line

Re: r326168 - Attempt to fix greendragon bot after r326141

2018-02-26 Thread Adam Nemet via cfe-commits
I don’t think we can deal with the slash options:

clang-7.0: warning: 
'/Users/buildslave/jenkins/workspace/apple-clang-master-RA-stage1-cmake-incremental/clang/src/tools/clang/test/Driver/codeview-column-info.c'
 treated as the '/U' option [-Wslash-u-filename]
clang-7.0: note: Use '--' to treat subsequent arguments as filenames
clang-7.0: warning: argument unused during compilation: '/Z7' 
[-Wunused-command-line-argument]
clang-7.0: warning: argument unused during compilation: ‘-U 
sers/buildslave/jenkins/workspace/apple-clang-master-RA-stage1-cmake-incremental/clang/src/tools/clang/test/Driver/codeview-column-info.c'
 [-Wunused-command-line-argument]

Anyhow as I said to Reid, feel free to improve the patch, I am just bringing 
back a bot that has been red for hours.

Adam

> On Feb 26, 2018, at 9:22 PM, Shoaib Meenai <smee...@fb.com> wrote:
> 
> This seems bogus to me. CodeView can be generated on any build platform; it 
> just needs the correct triple, which Reid added in r326144.
>  
> From: cfe-commits <cfe-commits-boun...@lists.llvm.org 
> <mailto:cfe-commits-boun...@lists.llvm.org>> on behalf of Adam Nemet via 
> cfe-commits <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>>
> Reply-To: Adam Nemet <ane...@apple.com <mailto:ane...@apple.com>>
> Date: Monday, February 26, 2018 at 8:51 PM
> To: "cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>" 
> <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>>
> Subject: r326168 - Attempt to fix greendragon bot after r326141
>  
> Author: anemet <>
> Date: Mon Feb 26 20:49:26 2018
> New Revision: 326168
>  
> URL: 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D326168-26view-3Drev=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=oqoKnyrAT6kNwxIasdWb7eopGd0q41TFJ5Hxp_eoiZs=
>  
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D326168-26view-3Drev=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=oqoKnyrAT6kNwxIasdWb7eopGd0q41TFJ5Hxp_eoiZs=>
> Log:
> Attempt to fix greendragon bot after r326141
>  
> Modified:
> cfe/trunk/test/Driver/codeview-column-info.c
>  
> Modified: cfe/trunk/test/Driver/codeview-column-info.c
> URL: 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_Driver_codeview-2Dcolumn-2Dinfo.c-3Frev-3D326168-26r1-3D326167-26r2-3D326168-26view-3Ddiff=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=Hs37wkn2y2OFh6b_DWdNuK_AD--vySi-ptv_d_HDqxg=
>  
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_Driver_codeview-2Dcolumn-2Dinfo.c-3Frev-3D326168-26r1-3D326167-26r2-3D326168-26view-3Ddiff=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=Hs37wkn2y2OFh6b_DWdNuK_AD--vySi-ptv_d_HDqxg=>
> ==
> --- cfe/trunk/test/Driver/codeview-column-info.c (original)
> +++ cfe/trunk/test/Driver/codeview-column-info.c Mon Feb 26 20:49:26 2018
> @@ -1,3 +1,4 @@
> +// REQUIRES: system-windows
> // Check that -dwarf-column-info does not get added to the cc1 line:
> // 1) When -gcodeview is present via the clang or clang++ driver
> // 2) When /Z7 is present via the cl driver.
>  
>  
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommits=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=JTIVfh7ogIVoFYMFdjOK-30TFLWLX39y8q9KItC_xnY=
>  
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommits=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=B6WfLLVLbYMU_571sI0XgBTcOm561QyDCKF2UOJyc-k=JTIVfh7ogIVoFYMFdjOK-30TFLWLX39y8q9KItC_xnY=>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r326168 - Attempt to fix greendragon bot after r326141

2018-02-26 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Mon Feb 26 20:49:26 2018
New Revision: 326168

URL: http://llvm.org/viewvc/llvm-project?rev=326168=rev
Log:
Attempt to fix greendragon bot after r326141

Modified:
cfe/trunk/test/Driver/codeview-column-info.c

Modified: cfe/trunk/test/Driver/codeview-column-info.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/codeview-column-info.c?rev=326168=326167=326168=diff
==
--- cfe/trunk/test/Driver/codeview-column-info.c (original)
+++ cfe/trunk/test/Driver/codeview-column-info.c Mon Feb 26 20:49:26 2018
@@ -1,3 +1,4 @@
+// REQUIRES: system-windows
 // Check that -dwarf-column-info does not get added to the cc1 line:
 // 1) When -gcodeview is present via the clang or clang++ driver
 // 2) When /Z7 is present via the cl driver.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r326108 - [Driver] Forward opt-remark hotness threshold to LTO

2018-02-26 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Mon Feb 26 10:38:11 2018
New Revision: 326108

URL: http://llvm.org/viewvc/llvm-project?rev=326108=rev
Log:
[Driver] Forward opt-remark hotness threshold to LTO

Modified:
cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
cfe/trunk/test/Driver/darwin-ld.c

Modified: cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Darwin.cpp?rev=326108=326107=326108=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Darwin.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Darwin.cpp Mon Feb 26 10:38:11 2018
@@ -452,7 +452,8 @@ void darwin::Linker::ConstructJob(Compil
   // we follow suite for ease of comparison.
   AddLinkArgs(C, Args, CmdArgs, Inputs);
 
-  // For LTO, pass the name of the optimization record file.
+  // For LTO, pass the name of the optimization record file and other
+  // opt-remarks flags.
   if (Args.hasFlag(options::OPT_fsave_optimization_record,
options::OPT_fno_save_optimization_record, false)) {
 CmdArgs.push_back("-mllvm");
@@ -467,6 +468,14 @@ void darwin::Linker::ConstructJob(Compil
 if (getLastProfileUseArg(Args)) {
   CmdArgs.push_back("-mllvm");
   CmdArgs.push_back("-lto-pass-remarks-with-hotness");
+
+  if (const Arg *A =
+  Args.getLastArg(options::OPT_fdiagnostics_hotness_threshold_EQ)) 
{
+CmdArgs.push_back("-mllvm");
+std::string Opt =
+std::string("-lto-pass-remarks-hotness-threshold=") + 
A->getValue();
+CmdArgs.push_back(Args.MakeArgString(Opt));
+  }
 }
   }
 

Modified: cfe/trunk/test/Driver/darwin-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-ld.c?rev=326108=326107=326108=diff
==
--- cfe/trunk/test/Driver/darwin-ld.c (original)
+++ cfe/trunk/test/Driver/darwin-ld.c Mon Feb 26 10:38:11 2018
@@ -342,6 +342,10 @@
 // RUN: FileCheck -check-prefix=PASS_REMARKS_WITH_HOTNESS %s < %t.log
 // PASS_REMARKS_WITH_HOTNESS: "-mllvm" "-lto-pass-remarks-output" "-mllvm" 
"foo/bar.out.opt.yaml" "-mllvm" "-lto-pass-remarks-with-hotness"
 
+// RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record 
-fprofile-instr-use=blah -fdiagnostics-hotness-threshold=100 -### -o 
foo/bar.out 2> %t.log
+// RUN: FileCheck -check-prefix=PASS_REMARKS_WITH_HOTNESS_THRESHOLD %s < %t.log
+// PASS_REMARKS_WITH_HOTNESS_THRESHOLD: "-mllvm" "-lto-pass-remarks-output" 
"-mllvm" "foo/bar.out.opt.yaml" "-mllvm" "-lto-pass-remarks-with-hotness" 
"-mllvm" "-lto-pass-remarks-hotness-threshold=100"
+
 // RUN: %clang -target x86_64-apple-ios6.0 -miphoneos-version-min=6.0 
-fprofile-instr-generate -### %t.o 2> %t.log
 // RUN: FileCheck -check-prefix=LINK_PROFILE_FIRST %s < %t.log
 // RUN: %clang -target x86_64-apple-darwin12 -fprofile-instr-generate -### 
%t.o 2> %t.log


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r319578 - Fix the second part of the broken comment from r306079

2017-12-01 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Fri Dec  1 11:59:45 2017
New Revision: 319578

URL: http://llvm.org/viewvc/llvm-project?rev=319578=rev
Log:
Fix the second part of the broken comment from r306079

The driver-based test is still not identical to the front-end line, remove the
hotness threshold from there and add a new front-end based test with
threshold.

Modified:
cfe/trunk/test/Frontend/optimization-remark-with-hotness.c

Modified: cfe/trunk/test/Frontend/optimization-remark-with-hotness.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/optimization-remark-with-hotness.c?rev=319578=319577=319578=diff
==
--- cfe/trunk/test/Frontend/optimization-remark-with-hotness.c (original)
+++ cfe/trunk/test/Frontend/optimization-remark-with-hotness.c Fri Dec  1 
11:59:45 2017
@@ -15,8 +15,7 @@
 // RUN: %clang -target x86_64-apple-macosx10.9 %s -c -emit-llvm -o /dev/null \
 // RUN: -fprofile-instr-use=%t.profdata -Rpass=inline \
 // RUN: -Rpass-analysis=inline -Rpass-missed=inline \
-// RUN: -fdiagnostics-show-hotness -fdiagnostics-hotness-threshold=10 \
-// RUN: -Xclang -verify
+// RUN: -fdiagnostics-show-hotness -Xclang -verify
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
 // RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
 // RUN: -fprofile-sample-use=%t-sample.profdata -Rpass=inline \
@@ -26,6 +25,11 @@
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
 // RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
 // RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline -Rpass-missed=inline \
+// RUN: -fdiagnostics-show-hotness -fdiagnostics-hotness-threshold=10 
-verify
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
 // RUN: -Rpass-analysis=inline 2>&1 | FileCheck -check-prefix=HOTNESS_OFF 
%s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
 // RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r319577 - Fix opt-remark with hotness testcase for sample-based PGO

2017-12-01 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Fri Dec  1 11:59:42 2017
New Revision: 319577

URL: http://llvm.org/viewvc/llvm-project?rev=319577=rev
Log:
Fix opt-remark with hotness testcase for sample-based PGO

1. Require hotness on all remark lines with -verify.

3. Fix the samplePGO file to actually produce hotness on each line.

The second remark has hotness 60 rather 30 which I don't quite understand but
testing this is strictly better than before.  It also unblocks the commit of
D40678.

Modified:

cfe/trunk/test/Frontend/Inputs/optimization-remark-with-hotness-sample.proftext
cfe/trunk/test/Frontend/optimization-remark-with-hotness.c

Modified: 
cfe/trunk/test/Frontend/Inputs/optimization-remark-with-hotness-sample.proftext
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/Inputs/optimization-remark-with-hotness-sample.proftext?rev=319577=319576=319577=diff
==
--- 
cfe/trunk/test/Frontend/Inputs/optimization-remark-with-hotness-sample.proftext 
(original)
+++ 
cfe/trunk/test/Frontend/Inputs/optimization-remark-with-hotness-sample.proftext 
Fri Dec  1 11:59:42 2017
@@ -1,7 +1,7 @@
-foo:0:0
- 0: 0
+foo:29:29
+ 0: 29
 bar:29:29
- 9: foo:0
-main:0:0
- 0: 0 bar:0
+ 8: 29 foo:29
+main:29:1
+ 3: 29 bar:29
 

Modified: cfe/trunk/test/Frontend/optimization-remark-with-hotness.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/optimization-remark-with-hotness.c?rev=319577=319576=319577=diff
==
--- cfe/trunk/test/Frontend/optimization-remark-with-hotness.c (original)
+++ cfe/trunk/test/Frontend/optimization-remark-with-hotness.c Fri Dec  1 
11:59:42 2017
@@ -56,13 +56,13 @@ void bar(int x) {
   // THRESHOLD-NOT: hotness
   // NO_PGO: '-fdiagnostics-show-hotness' requires profile-guided optimization 
information
   // NO_PGO: '-fdiagnostics-hotness-threshold=' requires profile-guided 
optimization information
-  // expected-remark@+1 {{foo inlined into bar with cost=always}}
+  // expected-remark@+1 {{foo inlined into bar with cost=always (hotness:}}
   sum += foo(x, x - 2);
 }
 
 int main(int argc, const char *argv[]) {
   for (int i = 0; i < 30; i++)
-// expected-remark@+1 {{bar not inlined into main because it should never 
be inlined}}
+// expected-remark@+1 {{bar not inlined into main because it should never 
be inlined (cost=never) (hotness:}}
 bar(argc);
   return sum;
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r319576 - Partially fix comment in test broken in r306079 and r306948

2017-12-01 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Fri Dec  1 11:59:37 2017
New Revision: 319576

URL: http://llvm.org/viewvc/llvm-project?rev=319576=rev
Log:
Partially fix comment in test broken in r306079 and r306948

A RUN line was referring to the previous RUN line but a new test was added in
between them.  Just reorder the lines.

Note this still does not completely fix this the brokenness of the comment as
the driver-based test gained a new hotness-threshold argument in r306948 but
I'll fix that is a separate commit.

Modified:
cfe/trunk/test/Frontend/optimization-remark-with-hotness.c

Modified: cfe/trunk/test/Frontend/optimization-remark-with-hotness.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/optimization-remark-with-hotness.c?rev=319576=319575=319576=diff
==
--- cfe/trunk/test/Frontend/optimization-remark-with-hotness.c (original)
+++ cfe/trunk/test/Frontend/optimization-remark-with-hotness.c Fri Dec  1 
11:59:37 2017
@@ -11,12 +11,6 @@
 // RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
 // RUN: -Rpass-analysis=inline -Rpass-missed=inline \
 // RUN: -fdiagnostics-show-hotness -verify
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
-// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
-// RUN: -fprofile-sample-use=%t-sample.profdata -Rpass=inline \
-// RUN: -Rpass-analysis=inline -Rpass-missed=inline \
-// RUN: -fdiagnostics-show-hotness -fdiagnostics-hotness-threshold=10 \
-// RUN: -verify
 // The clang version of the previous test.
 // RUN: %clang -target x86_64-apple-macosx10.9 %s -c -emit-llvm -o /dev/null \
 // RUN: -fprofile-instr-use=%t.profdata -Rpass=inline \
@@ -25,6 +19,12 @@
 // RUN: -Xclang -verify
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
 // RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -fprofile-sample-use=%t-sample.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline -Rpass-missed=inline \
+// RUN: -fdiagnostics-show-hotness -fdiagnostics-hotness-threshold=10 \
+// RUN: -verify
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
 // RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
 // RUN: -Rpass-analysis=inline 2>&1 | FileCheck -check-prefix=HOTNESS_OFF 
%s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r315643 - Handle/assert on DK_Remark

2017-10-12 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Thu Oct 12 16:56:54 2017
New Revision: 315643

URL: http://llvm.org/viewvc/llvm-project?rev=315643=rev
Log:
Handle/assert on DK_Remark

We don't generate remarks during inline assembly parsing so no need to handle
these for now.

Modified:
cfe/trunk/lib/CodeGen/CodeGenAction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=315643=315642=315643=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Thu Oct 12 16:56:54 2017
@@ -433,6 +433,8 @@ void BackendConsumer::InlineAsmDiagHandl
   case llvm::SourceMgr::DK_Note:
 DiagID = diag::note_fe_inline_asm;
 break;
+  case llvm::SourceMgr::DK_Remark:
+llvm_unreachable("remarks unexpected");
   }
   // If this problem has clang-level source location information, report the
   // issue in the source with a note showing the instantiated
@@ -919,6 +921,8 @@ static void BitcodeInlineAsmDiagHandler(
   case llvm::SourceMgr::DK_Note:
 DiagID = diag::note_fe_inline_asm;
 break;
+  case llvm::SourceMgr::DK_Remark:
+llvm_unreachable("remarks unexpected");
   }
 
   Diags->Report(DiagID).AddString("cannot compile inline asm");


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r314873 - Move verbosity check for opt remarks to the diag handler.

2017-10-03 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Oct  3 21:25:31 2017
New Revision: 314873

URL: http://llvm.org/viewvc/llvm-project?rev=314873=rev
Log:
Move verbosity check for opt remarks to the diag handler.

Modified:
cfe/trunk/lib/CodeGen/CodeGenAction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=314873=314872=314873=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Tue Oct  3 21:25:31 2017
@@ -631,6 +631,10 @@ void BackendConsumer::EmitOptimizationMe
 
 void BackendConsumer::OptimizationRemarkHandler(
 const llvm::DiagnosticInfoOptimizationBase ) {
+  // Without hotness information, don't show noisy remarks.
+  if (D.isVerbose() && !D.getHotness())
+return;
+
   if (D.isPassed()) {
 // Optimization remarks are active only if the -Rpass flag has a regular
 // expression that matches the name of the pass name in \p D.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r313693 - Add override for ClangDiagnosticHandler::isAnyRemarkEnabled()

2017-09-19 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Sep 19 16:00:59 2017
New Revision: 313693

URL: http://llvm.org/viewvc/llvm-project?rev=313693=rev
Log:
Add override for ClangDiagnosticHandler::isAnyRemarkEnabled()

This is used by the new closure-based variant of
OptimizationRemarkEmitter::emit().

Modified:
cfe/trunk/lib/CodeGen/CodeGenAction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=313693=313692=313693=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Tue Sep 19 16:00:59 2017
@@ -67,6 +67,12 @@ namespace clang {
   CodeGenOpts.OptimizationRemarkPattern->match(PassName));
 }
 
+bool isAnyRemarkEnabled() const override {
+  return (CodeGenOpts.OptimizationRemarkAnalysisPattern ||
+  CodeGenOpts.OptimizationRemarkMissedPattern ||
+  CodeGenOpts.OptimizationRemarkPattern);
+}
+
   private:
 const CodeGenOptions 
 BackendConsumer *BackendCon;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r313653 - Fix ClangDiagnosticHandler::is*RemarkEnabled members

2017-09-19 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Sep 19 10:59:40 2017
New Revision: 313653

URL: http://llvm.org/viewvc/llvm-project?rev=313653=rev
Log:
Fix ClangDiagnosticHandler::is*RemarkEnabled members

Apparently these weren't really working. I added test coverage and fixed the
typo in the name and the parameter.

Added:
cfe/trunk/test/Frontend/optimization-remark-extra-analysis.c
Modified:
cfe/trunk/lib/CodeGen/CodeGenAction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=313653=313652=313653=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Tue Sep 19 10:59:40 2017
@@ -53,19 +53,20 @@ namespace clang {
 : CodeGenOpts(CGOpts), BackendCon(BCon) {}
   
 bool handleDiagnostics(const DiagnosticInfo ) override;
-bool isAnalysisRemarkEnable(const std::string ) {
+
+bool isAnalysisRemarkEnabled(StringRef PassName) const override {
   return (CodeGenOpts.OptimizationRemarkAnalysisPattern &&
   CodeGenOpts.OptimizationRemarkAnalysisPattern->match(PassName));
 }
-bool isMissedOptRemarkEnable(const std::string ) {
+bool isMissedOptRemarkEnabled(StringRef PassName) const override {
   return (CodeGenOpts.OptimizationRemarkMissedPattern &&
   CodeGenOpts.OptimizationRemarkMissedPattern->match(PassName));
 }
-bool isPassedOptRemarkEnable(const std::string ) {
+bool isPassedOptRemarkEnabled(StringRef PassName) const override {
   return (CodeGenOpts.OptimizationRemarkPattern &&
   CodeGenOpts.OptimizationRemarkPattern->match(PassName));
 }
-  
+
   private:
 const CodeGenOptions 
 BackendConsumer *BackendCon;

Added: cfe/trunk/test/Frontend/optimization-remark-extra-analysis.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/optimization-remark-extra-analysis.c?rev=313653=auto
==
--- cfe/trunk/test/Frontend/optimization-remark-extra-analysis.c (added)
+++ cfe/trunk/test/Frontend/optimization-remark-extra-analysis.c Tue Sep 19 
10:59:40 2017
@@ -0,0 +1,11 @@
+// Test that the is*RemarkEnabled overrides are working properly.  This remark
+// requiring extra analysis is only conditionally enabled.
+
+// RUN: %clang_cc1 %s -Rpass-missed=gvn -O2 -emit-llvm-only -verify
+
+int foo(int *x, int *y) {
+  int a = *x;
+  *y = 2;
+  // expected-remark@+1 {{load of type i32 not eliminated}}
+  return a + *x;
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r303093 - Revert "Fix windows buildbots - missing include and namespace"

2017-05-15 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Mon May 15 13:14:31 2017
New Revision: 303093

URL: http://llvm.org/viewvc/llvm-project?rev=303093=rev
Log:
Revert "Fix windows buildbots - missing include and namespace"

This reverts commit r303078.

One test is still failing even after this:
http://green.lab.llvm.org/green/job/clang-stage1-configure-RA_check/31374/consoleFull#18373900728254eaf0-7326-4999-85b0-388101f2d404

Modified:
clang-tools-extra/trunk/clangd/DraftStore.cpp
clang-tools-extra/trunk/clangd/DraftStore.h
clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.h

Modified: clang-tools-extra/trunk/clangd/DraftStore.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/DraftStore.cpp?rev=303093=303092=303093=diff
==
--- clang-tools-extra/trunk/clangd/DraftStore.cpp (original)
+++ clang-tools-extra/trunk/clangd/DraftStore.cpp Mon May 15 13:14:31 2017
@@ -29,7 +29,7 @@ DocVersion DraftStore::getVersion(PathRe
   return It->second.Version;
 }
 
-DocVersion DraftStore::updateDraft(PathRef File, llvm::StringRef Contents) {
+DocVersion DraftStore::updateDraft(PathRef File, StringRef Contents) {
   std::lock_guard Lock(Mutex);
 
   auto  = Drafts[File];

Modified: clang-tools-extra/trunk/clangd/DraftStore.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/DraftStore.h?rev=303093=303092=303093=diff
==
--- clang-tools-extra/trunk/clangd/DraftStore.h (original)
+++ clang-tools-extra/trunk/clangd/DraftStore.h Mon May 15 13:14:31 2017
@@ -45,7 +45,7 @@ public:
 
   /// Replace contents of the draft for \p File with \p Contents.
   /// \return The new version of the draft for \p File.
-  DocVersion updateDraft(PathRef File, llvm::StringRef Contents);
+  DocVersion updateDraft(PathRef File, StringRef Contents);
   /// Remove the contents of the draft
   /// \return The new version of the draft for \p File.
   DocVersion removeDraft(PathRef File);

Modified: clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.h?rev=303093=303092=303093=diff
==
--- clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.h (original)
+++ clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.h Mon May 15 
13:14:31 2017
@@ -14,7 +14,6 @@
 #include "llvm/ADT/StringMap.h"
 #include 
 #include 
-#include 
 
 namespace clang {
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r303094 - Revert "[ClangD] Refactor clangd into separate components"

2017-05-15 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Mon May 15 13:14:35 2017
New Revision: 303094

URL: http://llvm.org/viewvc/llvm-project?rev=303094=rev
Log:
Revert "[ClangD] Refactor clangd into separate components"

This reverts commit r303067.

Caused http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/34305/

And even after Simon's fix there is still a test failure.

Added:
clang-tools-extra/trunk/clangd/ASTManager.cpp
clang-tools-extra/trunk/clangd/ASTManager.h
clang-tools-extra/trunk/clangd/DocumentStore.h
Removed:
clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
clang-tools-extra/trunk/clangd/ClangdLSPServer.h
clang-tools-extra/trunk/clangd/ClangdServer.cpp
clang-tools-extra/trunk/clangd/ClangdServer.h
clang-tools-extra/trunk/clangd/ClangdUnit.cpp
clang-tools-extra/trunk/clangd/ClangdUnit.h
clang-tools-extra/trunk/clangd/ClangdUnitStore.cpp
clang-tools-extra/trunk/clangd/ClangdUnitStore.h
clang-tools-extra/trunk/clangd/DraftStore.cpp
clang-tools-extra/trunk/clangd/DraftStore.h
clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.cpp
clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.h
clang-tools-extra/trunk/clangd/Path.h
Modified:
clang-tools-extra/trunk/clangd/CMakeLists.txt
clang-tools-extra/trunk/clangd/ClangdMain.cpp
clang-tools-extra/trunk/clangd/ProtocolHandlers.cpp
clang-tools-extra/trunk/clangd/ProtocolHandlers.h

Added: clang-tools-extra/trunk/clangd/ASTManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ASTManager.cpp?rev=303094=auto
==
--- clang-tools-extra/trunk/clangd/ASTManager.cpp (added)
+++ clang-tools-extra/trunk/clangd/ASTManager.cpp Mon May 15 13:14:35 2017
@@ -0,0 +1,440 @@
+//===--- ASTManager.cpp - Clang AST manager 
---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "ASTManager.h"
+#include "JSONRPCDispatcher.h"
+#include "Protocol.h"
+#include "clang/Frontend/ASTUnit.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Tooling/CompilationDatabase.h"
+#include "llvm/Support/Format.h"
+#include "llvm/Support/Path.h"
+#include 
+#include 
+using namespace clang;
+using namespace clangd;
+
+void DocData::setAST(std::unique_ptr AST) {
+  this->AST = std::move(AST);
+}
+
+ASTUnit *DocData::getAST() const { return AST.get(); }
+
+void DocData::cacheFixIts(DiagnosticToReplacementMap FixIts) {
+  this->FixIts = std::move(FixIts);
+}
+
+std::vector
+DocData::getFixIts(const clangd::Diagnostic ) const {
+  auto it = FixIts.find(D);
+  if (it != FixIts.end())
+return it->second;
+  return {};
+}
+
+ASTManagerRequest::ASTManagerRequest(ASTManagerRequestType Type,
+ std::string File,
+ DocVersion Version)
+: Type(Type), File(File), Version(Version) {}
+
+/// Retrieve a copy of the contents of every file in the store, for feeding 
into
+/// ASTUnit.
+static std::vector
+getRemappedFiles(const DocumentStore ) {
+  // FIXME: Use VFS instead. This would allow us to get rid of the chdir below.
+  std::vector RemappedFiles;
+  for (const auto  : Docs.getAllDocuments()) {
+StringRef FileName = P.first;
+RemappedFiles.push_back(ASTUnit::RemappedFile(
+FileName,
+llvm::MemoryBuffer::getMemBufferCopy(P.second, FileName).release()));
+  }
+  return RemappedFiles;
+}
+
+/// Convert from clang diagnostic level to LSP severity.
+static int getSeverity(DiagnosticsEngine::Level L) {
+  switch (L) {
+  case DiagnosticsEngine::Remark:
+return 4;
+  case DiagnosticsEngine::Note:
+return 3;
+  case DiagnosticsEngine::Warning:
+return 2;
+  case DiagnosticsEngine::Fatal:
+  case DiagnosticsEngine::Error:
+return 1;
+  case DiagnosticsEngine::Ignored:
+return 0;
+  }
+  llvm_unreachable("Unknown diagnostic level!");
+}
+
+static CompletionItemKind getKind(CXCursorKind K) {
+  switch (K) {
+  case CXCursor_MacroInstantiation:
+  case CXCursor_MacroDefinition:
+return CompletionItemKind::Text;
+  case CXCursor_CXXMethod:
+return CompletionItemKind::Method;
+  case CXCursor_FunctionDecl:
+  case CXCursor_FunctionTemplate:
+return CompletionItemKind::Function;
+  case CXCursor_Constructor:
+  case CXCursor_Destructor:
+return CompletionItemKind::Constructor;
+  case CXCursor_FieldDecl:
+return CompletionItemKind::Field;
+  case CXCursor_VarDecl:
+  case CXCursor_ParmDecl:
+return CompletionItemKind::Variable;
+  case CXCursor_ClassDecl:
+  case CXCursor_StructDecl:
+  case CXCursor_UnionDecl:
+  case CXCursor_ClassTemplate:
+  case CXCursor_ClassTemplatePartialSpecialization:
+return CompletionItemKind::Class;
+ 

r300858 - Don't pass FPOpFusion::Strict to the backend

2017-04-20 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Thu Apr 20 12:09:35 2017
New Revision: 300858

URL: http://llvm.org/viewvc/llvm-project?rev=300858=rev
Log:
Don't pass FPOpFusion::Strict to the backend

This restores the behavior prior to D31167 where the code-gen default was
FPC_On which mapped to FPOpFusion::Standard.  After merging the FE
state (on/off) and the code-gen state (on/fast/off), the default became off to
match the front-end.

In other words, the front-end controls when to fuse along the language
standards and the backend shouldn't override this by splitting fused
intrinsics as FPOpFusion::Strict would imply.

Differential Revision: https://reviews.llvm.org/D32301

Added:
cfe/trunk/test/CodeGen/fp-contract-on-asm.c
Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=300858=300857=300858=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Apr 20 12:09:35 2017
@@ -369,7 +369,9 @@ static void initTargetOptions(llvm::Targ
   // Set FP fusion mode.
   switch (LangOpts.getDefaultFPContractMode()) {
   case LangOptions::FPC_Off:
-Options.AllowFPOpFusion = llvm::FPOpFusion::Strict;
+// Preserve any contraction performed by the front-end.  (Strict performs
+// splitting of the muladd instrinsic in the backend.)
+Options.AllowFPOpFusion = llvm::FPOpFusion::Standard;
 break;
   case LangOptions::FPC_On:
 Options.AllowFPOpFusion = llvm::FPOpFusion::Standard;

Added: cfe/trunk/test/CodeGen/fp-contract-on-asm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/fp-contract-on-asm.c?rev=300858=auto
==
--- cfe/trunk/test/CodeGen/fp-contract-on-asm.c (added)
+++ cfe/trunk/test/CodeGen/fp-contract-on-asm.c Thu Apr 20 12:09:35 2017
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -O3 -triple=aarch64-apple-ios -S -o - %s | FileCheck %s
+// REQUIRES: aarch64-registered-target
+
+float fma_test1(float a, float b, float c) {
+#pragma STDC FP_CONTRACT ON
+// CHECK-LABEL: fma_test1:
+// CHECK: fmadd
+  float x = a * b + c;
+  return x;
+}
+
+float fma_test2(float a, float b, float c) {
+// CHECK-LABEL: fma_test2:
+// CHECK: fmul
+// CHECK: fadd
+  float x = a * b + c;
+  return x;
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r299488 - Another attempt to fix the sphinx warning from r299470

2017-04-04 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Apr  4 18:46:34 2017
New Revision: 299488

URL: http://llvm.org/viewvc/llvm-project?rev=299488=rev
Log:
Another attempt to fix the sphinx warning from r299470

Modified:
cfe/trunk/docs/LanguageExtensions.rst

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=299488=299487=299488=diff
==
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Tue Apr  4 18:46:34 2017
@@ -2344,4 +2344,4 @@ statements in C)
 
 The pragma can also be used with ``off`` which turns FP contraction off for a
 section of the code. This can be useful when fast contraction is otherwise
-enabled for the translation unit with the ``-ffp-contract=fast` flag.
+enabled for the translation unit with the ``-ffp-contract=fast`` flag.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r299481 - Fix sphinx warning from r299470

2017-04-04 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Apr  4 17:45:20 2017
New Revision: 299481

URL: http://llvm.org/viewvc/llvm-project?rev=299481=rev
Log:
Fix sphinx warning from r299470

Modified:
cfe/trunk/docs/LanguageExtensions.rst

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=299481=299480=299481=diff
==
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Tue Apr  4 17:45:20 2017
@@ -2342,6 +2342,6 @@ statements in C)
   }
 
 
-The pragma can also be used with 'off' which turns FP contraction off for a
+The pragma can also be used with ``off`` which turns FP contraction off for a
 section of the code. This can be useful when fast contraction is otherwise
 enabled for the translation unit with the ``-ffp-contract=fast` flag.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r299470 - Add #pragma clang fp

2017-04-04 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Apr  4 16:18:36 2017
New Revision: 299470

URL: http://llvm.org/viewvc/llvm-project?rev=299470=rev
Log:
Add #pragma clang fp

This adds the new pragma and the first variant, contract(on/off/fast).

The pragma has the same block scope rules as STDC FP_CONTRACT, i.e. it can be
placed at the beginning of a compound statement or at file scope.

Similarly to STDC FP_CONTRACT there is no need to use attributes.  First an
annotate token is inserted with the parsed details of the pragma.  Then the
annotate token is parsed in the proper contexts and the Sema is updated with
the corresponding FPOptions using the shared ActOn function with STDC
FP_CONTRACT.

After this the FPOptions from the Sema is propagated into the AST expression
nodes.  There is no change here.

I was going to add a 'default' option besides 'on/off/fast' similar to STDC
FP_CONTRACT but then decided against it. I think that we'd have to make option
uppercase then to avoid using 'default' the keyword.  Also because of the
scoped activation of pragma I am not sure there is really a need a for this.

Differential Revision: https://reviews.llvm.org/D31276

Added:
cfe/trunk/test/CodeGen/fp-contract-fast-pragma.cpp
cfe/trunk/test/CodeGen/fp-contract-on-pragma.cpp
cfe/trunk/test/Parser/pragma-fp.cpp
Modified:
cfe/trunk/docs/LanguageExtensions.rst
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/TokenKinds.def
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Parse/ParsePragma.cpp
cfe/trunk/lib/Parse/ParseStmt.cpp
cfe/trunk/lib/Parse/Parser.cpp
cfe/trunk/lib/Sema/SemaAttr.cpp
cfe/trunk/test/Parser/cxx11-stmt-attributes.cpp

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=299470=299469=299470=diff
==
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Tue Apr  4 16:18:36 2017
@@ -2312,3 +2312,36 @@ For example, the hint ``vectorize_width(
 proven safe to vectorize. To identify and diagnose optimization issues use
 `-Rpass`, `-Rpass-missed`, and `-Rpass-analysis` command line options. See the
 user guide for details.
+
+Extensions to specify floating-point flags
+
+
+The ``#pragma clang fp`` pragma allows floating-point options to be specified
+for a section of the source code. This pragma can only appear at file scope or
+at the start of a compound statement (excluding comments). When using within a
+compound statement, the pragma is active within the scope of the compound
+statement.
+
+Currently, only FP contraction can be controlled with the pragma. ``#pragma
+clang fp contract`` specifies whether the compiler should contract a multiply
+and an addition (or subtraction) into a fused FMA operation when supported by
+the target.
+
+The pragma can take three values: ``on``, ``fast`` and ``off``.  The ``on``
+option is identical to using ``#pragma STDC FP_CONTRACT(ON)`` and it allows
+fusion as specified the language standard.  The ``fast`` option allows fusiong
+in cases when the language standard does not make this possible (e.g. across
+statements in C)
+
+.. code-block:: c++
+
+  for(...) {
+#pragma clang fp contract(fast)
+a = b[i] * c[i];
+d[i] += a;
+  }
+
+
+The pragma can also be used with 'off' which turns FP contraction off for a
+section of the code. This can be useful when fast contraction is otherwise
+enabled for the translation unit with the ``-ffp-contract=fast` flag.

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=299470=299469=299470=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Tue Apr  4 16:18:36 
2017
@@ -1040,6 +1040,16 @@ def err_pragma_loop_missing_argument : E
 def err_pragma_loop_invalid_option : Error<
   "%select{invalid|missing}0 option%select{ %1|}0; expected vectorize, "
   "vectorize_width, interleave, interleave_count, unroll, unroll_count, or 
distribute">;
+
+def err_pragma_fp_invalid_option : Error<
+  "%select{invalid|missing}0 option%select{ %1|}0; expected contract">;
+def err_pragma_fp_invalid_argument : Error<
+  "unexpected argument '%0' to '#pragma clang fp %1'; "
+  "expected 'on', 'fast' or 'off'">;
+def err_pragma_fp_scope : Error<
+  "'#pragma clang fp' can only appear at file scope or at the start of a "
+  "compound statement">;
+
 def err_pragma_invalid_keyword : Error<
   "invalid argument; expected 'enable'%select{|, 'full'}0%select{|, 
'assume_safety'}1 or 'disable'">;
 

Modified: 

r299469 - Set FMF for -ffp-contract=fast

2017-04-04 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Apr  4 16:18:30 2017
New Revision: 299469

URL: http://llvm.org/viewvc/llvm-project?rev=299469=rev
Log:
Set FMF for -ffp-contract=fast

With this, FMF(contract) becomes an alternative way to express the request to
contract.

These are currently only propagated for FMul, FAdd and FSub.  The rest will be
added as more FMFs are hooked up for this.

This is toward fixing PR25721.

Differential Revision: https://reviews.llvm.org/D31168

Added:
cfe/trunk/test/CodeGen/ffp-contract-fast-option.cpp
Modified:
cfe/trunk/lib/CodeGen/CGExprScalar.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=299469=299468=299469=diff
==
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Tue Apr  4 16:18:30 2017
@@ -113,6 +113,22 @@ static bool CanElideOverflowCheck(const
  (2 * Ctx.getTypeSize(RHSTy)) < PromotedSize;
 }
 
+/// Update the FastMathFlags of LLVM IR from the FPOptions in LangOptions.
+static void updateFastMathFlags(llvm::FastMathFlags ,
+FPOptions FPFeatures) {
+  FMF.setAllowContract(FPFeatures.allowFPContractAcrossStatement());
+}
+
+/// Propagate fast-math flags from \p Op to the instruction in \p V.
+static Value *propagateFMFlags(Value *V, const BinOpInfo ) {
+  if (auto *I = dyn_cast(V)) {
+llvm::FastMathFlags FMF = I->getFastMathFlags();
+updateFastMathFlags(FMF, Op.FPFeatures);
+I->setFastMathFlags(FMF);
+  }
+  return V;
+}
+
 class ScalarExprEmitter
   : public StmtVisitor {
   CodeGenFunction 
@@ -553,8 +569,10 @@ public:
 !CanElideOverflowCheck(CGF.getContext(), Ops))
   return EmitOverflowCheckedBinOp(Ops);
 
-if (Ops.LHS->getType()->isFPOrFPVectorTy())
-  return Builder.CreateFMul(Ops.LHS, Ops.RHS, "mul");
+if (Ops.LHS->getType()->isFPOrFPVectorTy()) {
+  Value *V = Builder.CreateFMul(Ops.LHS, Ops.RHS, "mul");
+  return propagateFMFlags(V, Ops);
+}
 return Builder.CreateMul(Ops.LHS, Ops.RHS, "mul");
   }
   /// Create a binary op that checks for overflow.
@@ -2722,7 +2740,8 @@ Value *ScalarExprEmitter::EmitAdd(const
 if (Value *FMulAdd = tryEmitFMulAdd(op, CGF, Builder))
   return FMulAdd;
 
-return Builder.CreateFAdd(op.LHS, op.RHS, "add");
+Value *V = Builder.CreateFAdd(op.LHS, op.RHS, "add");
+return propagateFMFlags(V, op);
   }
 
   return Builder.CreateAdd(op.LHS, op.RHS, "add");
@@ -2755,7 +2774,8 @@ Value *ScalarExprEmitter::EmitSub(const
   // Try to form an fmuladd.
   if (Value *FMulAdd = tryEmitFMulAdd(op, CGF, Builder, true))
 return FMulAdd;
-  return Builder.CreateFSub(op.LHS, op.RHS, "sub");
+  Value *V = Builder.CreateFSub(op.LHS, op.RHS, "sub");
+  return propagateFMFlags(V, op);
 }
 
 return Builder.CreateSub(op.LHS, op.RHS, "sub");

Added: cfe/trunk/test/CodeGen/ffp-contract-fast-option.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ffp-contract-fast-option.cpp?rev=299469=auto
==
--- cfe/trunk/test/CodeGen/ffp-contract-fast-option.cpp (added)
+++ cfe/trunk/test/CodeGen/ffp-contract-fast-option.cpp Tue Apr  4 16:18:30 2017
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -O3 -ffp-contract=fast -triple %itanium_abi_triple 
-emit-llvm -o - %s | FileCheck %s
+
+float fp_contract_1(float a, float b, float c) {
+  // CHECK-LABEL: fp_contract_1fff(
+  // CHECK: fmul contract float
+  // CHECK: fadd contract float
+  return a * b + c;
+}
+
+float fp_contract_2(float a, float b, float c) {
+  // CHECK-LABEL: fp_contract_2fff(
+  // CHECK: fmul contract float
+  // CHECK: fsub contract float
+  return a * b - c;
+}
+
+void fp_contract_3(float *a, float b, float c) {
+  // CHECK-LABEL: fp_contract_3Pfff(
+  // CHECK: fmul contract float
+  // CHECK: fadd contract float
+  a[0] += b * c;
+}
+
+void fp_contract_4(float *a, float b, float c) {
+  // CHECK-LABEL: fp_contract_4Pfff(
+  // CHECK: fmul contract float
+  // CHECK: fsub contract float
+  a[0] -= b * c;
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r299033 - Use FPContractModeKind universally

2017-03-29 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Wed Mar 29 16:54:24 2017
New Revision: 299033

URL: http://llvm.org/viewvc/llvm-project?rev=299033=rev
Log:
Use FPContractModeKind universally

FPContractModeKind is the codegen option flag which is already ternary (off,
on, fast).  This makes it universally the type for the contractable info
across the front-end:

* In FPOptions (i.e. in the Sema + in the expression nodes).
* In LangOpts::DefaultFPContractMode which is the option that initializes
FPOptions in the Sema.

Another way to look at this change is that before fp-contractable on/off were
the only states handled to the front-end:
 * For "on", FMA folding was performed by  the front-end
 * For "fast", we simply forwarded the flag to TargetOptions to handle it in
 LLVM

Now off/on/fast are all exposed because for fast we will generate
fast-math-flags during CodeGen.

This is toward moving fp-contraction=fast from an LLVM TargetOption to a
FastMathFlag in order to fix PR25721.

---
This is a recommit of r299027 with an adjustment to the test
CodeGenCUDA/fp-contract.cu.  The test assumed that even
though -ffp-contract=on is passed FE-based folding of FMA won't happen.

This is obviously wrong since the user is asking for this explicitly with the
option.  CUDA is different that -ffp-contract=fast is on by default.

The test used to "work" because contract=fast and contract=on were maintained
separately and we didn't fold in the FE because contract=fast was on due to
the target-default.  This patch consolidates the contract=on/fast/off state
into a ternary state hence the change in behavior.
---

Differential Revision: https://reviews.llvm.org/D31167

Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Basic/LangOptions.h
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/include/clang/Frontend/CodeGenOptions.h
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Sema/SemaAttr.cpp
cfe/trunk/test/CodeGenCUDA/fp-contract.cu

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=299033=299032=299033=diff
==
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Wed Mar 29 16:54:24 2017
@@ -2920,7 +2920,7 @@ private:
 
   // This is only meaningful for operations on floating point types and 0
   // otherwise.
-  unsigned FPFeatures : 1;
+  unsigned FPFeatures : 2;
   SourceLocation OpLoc;
 
   enum { LHS, RHS, END_EXPR };
@@ -3078,8 +3078,8 @@ public:
 
   // Get the FP contractability status of this operator. Only meaningful for
   // operations on floating point types.
-  bool isFPContractable() const {
-return FPOptions(FPFeatures).isFPContractable();
+  bool isFPContractableWithinStatement() const {
+return FPOptions(FPFeatures).allowFPContractWithinStatement();
   }
 
 protected:

Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=299033=299032=299033=diff
==
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Wed Mar 29 16:54:24 2017
@@ -117,7 +117,9 @@ public:
 
   // Get the FP contractability status of this operator. Only meaningful for
   // operations on floating point types.
-  bool isFPContractable() const { return FPFeatures.isFPContractable(); }
+  bool isFPContractableWithinStatement() const {
+return FPFeatures.allowFPContractWithinStatement();
+  }
 
   friend class ASTStmtReader;
   friend class ASTStmtWriter;

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=299033=299032=299033=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Wed Mar 29 16:54:24 2017
@@ -216,7 +216,8 @@ BENIGN_LANGOPT(DebuggerObjCLiteral , 1,
 BENIGN_LANGOPT(SpellChecking , 1, 1, "spell-checking")
 LANGOPT(SinglePrecisionConstants , 1, 0, "treating double-precision floating 
point constants as single precision constants")
 LANGOPT(FastRelaxedMath , 1, 0, "OpenCL fast relaxed math")
-LANGOPT(DefaultFPContract , 1, 0, "FP_CONTRACT")
+/// \brief FP_CONTRACT mode (on/off/fast).
+ENUM_LANGOPT(DefaultFPContractMode, FPContractModeKind, 2, FPC_Off, "FP 
contraction type")
 LANGOPT(NoBitFieldTypeAlign , 1, 0, "bit-field type alignment")
 LANGOPT(HexagonQdsp6Compat , 1, 0, "hexagon-qdsp6 backward compatibility")
 LANGOPT(ObjCAutoRefCount , 1, 0, "Objective-C automated reference counting")


r299029 - Revert "Use FPContractModeKind universally"

2017-03-29 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Wed Mar 29 16:24:19 2017
New Revision: 299029

URL: http://llvm.org/viewvc/llvm-project?rev=299029=rev
Log:
Revert "Use FPContractModeKind universally"

This reverts commit r299027.

It's causing a test failure in clang's CodeGenCUDE/fp-contract.cu

Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Basic/LangOptions.h
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/include/clang/Frontend/CodeGenOptions.h
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Sema/SemaAttr.cpp

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=299029=299028=299029=diff
==
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Wed Mar 29 16:24:19 2017
@@ -2920,7 +2920,7 @@ private:
 
   // This is only meaningful for operations on floating point types and 0
   // otherwise.
-  unsigned FPFeatures : 2;
+  unsigned FPFeatures : 1;
   SourceLocation OpLoc;
 
   enum { LHS, RHS, END_EXPR };
@@ -3078,8 +3078,8 @@ public:
 
   // Get the FP contractability status of this operator. Only meaningful for
   // operations on floating point types.
-  bool isFPContractableWithinStatement() const {
-return FPOptions(FPFeatures).allowFPContractWithinStatement();
+  bool isFPContractable() const {
+return FPOptions(FPFeatures).isFPContractable();
   }
 
 protected:

Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=299029=299028=299029=diff
==
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Wed Mar 29 16:24:19 2017
@@ -117,9 +117,7 @@ public:
 
   // Get the FP contractability status of this operator. Only meaningful for
   // operations on floating point types.
-  bool isFPContractableWithinStatement() const {
-return FPFeatures.allowFPContractWithinStatement();
-  }
+  bool isFPContractable() const { return FPFeatures.isFPContractable(); }
 
   friend class ASTStmtReader;
   friend class ASTStmtWriter;

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=299029=299028=299029=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Wed Mar 29 16:24:19 2017
@@ -216,8 +216,7 @@ BENIGN_LANGOPT(DebuggerObjCLiteral , 1,
 BENIGN_LANGOPT(SpellChecking , 1, 1, "spell-checking")
 LANGOPT(SinglePrecisionConstants , 1, 0, "treating double-precision floating 
point constants as single precision constants")
 LANGOPT(FastRelaxedMath , 1, 0, "OpenCL fast relaxed math")
-/// \brief FP_CONTRACT mode (on/off/fast).
-ENUM_LANGOPT(DefaultFPContractMode, FPContractModeKind, 2, FPC_Off, "FP 
contraction type")
+LANGOPT(DefaultFPContract , 1, 0, "FP_CONTRACT")
 LANGOPT(NoBitFieldTypeAlign , 1, 0, "bit-field type alignment")
 LANGOPT(HexagonQdsp6Compat , 1, 0, "hexagon-qdsp6 backward compatibility")
 LANGOPT(ObjCAutoRefCount , 1, 0, "Objective-C automated reference counting")

Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=299029=299028=299029=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Wed Mar 29 16:24:19 2017
@@ -88,12 +88,6 @@ public:
 MSVC2015 = 19
   };
 
-  enum FPContractModeKind {
-FPC_Off,// Form fused FP ops only where result will not be 
affected.
-FPC_On, // Form fused FP ops according to FP_CONTRACT rules.
-FPC_Fast// Aggressively fuse FP ops (E.g. FMA).
-  };
-
 public:
   /// \brief Set of enabled sanitizers.
   SanitizerSet Sanitize;
@@ -186,35 +180,22 @@ public:
 /// \brief Floating point control options
 class FPOptions {
 public:
-  FPOptions() : fp_contract(LangOptions::FPC_Off) {}
+  FPOptions() : fp_contract(0) {}
 
-  // Used for serializing.
-  explicit FPOptions(unsigned I)
-  : fp_contract(static_cast(I)) {}
+  explicit FPOptions(unsigned I) : fp_contract(I) {}
 
   explicit FPOptions(const LangOptions )
-  : fp_contract(LangOpts.getDefaultFPContractMode()) {}
+  : fp_contract(LangOpts.DefaultFPContract) {}
 
-  bool allowFPContractWithinStatement() const {
-return fp_contract == LangOptions::FPC_On;
-  }
-  bool allowFPContractAcrossStatement() const {
-

r299027 - Use FPContractModeKind universally

2017-03-29 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Wed Mar 29 15:39:49 2017
New Revision: 299027

URL: http://llvm.org/viewvc/llvm-project?rev=299027=rev
Log:
Use FPContractModeKind universally

FPContractModeKind is the codegen option flag which is already ternary (off,
on, fast).  This makes it universally the type for the contractable info
across the front-end:

* In FPOptions (i.e. in the Sema + in the expression nodes).
* In LangOpts::DefaultFPContractMode which is the option that initializes
FPOptions in the Sema.

Another way to look at this change is that before fp-contractable on/off were
the only states handled to the front-end:
 * For "on", FMA folding was performed by  the front-end
 * For "fast", we simply forwarded the flag to TargetOptions to handle it in
 LLVM

Now off/on/fast are all exposed because for fast we will generate
fast-math-flags during CodeGen.

This is toward moving fp-contraction=fast from an LLVM TargetOption to a
FastMathFlag in order to fix PR25721.

Differential Revision: https://reviews.llvm.org/D31167

Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Basic/LangOptions.h
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/include/clang/Frontend/CodeGenOptions.h
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Sema/SemaAttr.cpp

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=299027=299026=299027=diff
==
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Wed Mar 29 15:39:49 2017
@@ -2920,7 +2920,7 @@ private:
 
   // This is only meaningful for operations on floating point types and 0
   // otherwise.
-  unsigned FPFeatures : 1;
+  unsigned FPFeatures : 2;
   SourceLocation OpLoc;
 
   enum { LHS, RHS, END_EXPR };
@@ -3078,8 +3078,8 @@ public:
 
   // Get the FP contractability status of this operator. Only meaningful for
   // operations on floating point types.
-  bool isFPContractable() const {
-return FPOptions(FPFeatures).isFPContractable();
+  bool isFPContractableWithinStatement() const {
+return FPOptions(FPFeatures).allowFPContractWithinStatement();
   }
 
 protected:

Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=299027=299026=299027=diff
==
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Wed Mar 29 15:39:49 2017
@@ -117,7 +117,9 @@ public:
 
   // Get the FP contractability status of this operator. Only meaningful for
   // operations on floating point types.
-  bool isFPContractable() const { return FPFeatures.isFPContractable(); }
+  bool isFPContractableWithinStatement() const {
+return FPFeatures.allowFPContractWithinStatement();
+  }
 
   friend class ASTStmtReader;
   friend class ASTStmtWriter;

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=299027=299026=299027=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Wed Mar 29 15:39:49 2017
@@ -216,7 +216,8 @@ BENIGN_LANGOPT(DebuggerObjCLiteral , 1,
 BENIGN_LANGOPT(SpellChecking , 1, 1, "spell-checking")
 LANGOPT(SinglePrecisionConstants , 1, 0, "treating double-precision floating 
point constants as single precision constants")
 LANGOPT(FastRelaxedMath , 1, 0, "OpenCL fast relaxed math")
-LANGOPT(DefaultFPContract , 1, 0, "FP_CONTRACT")
+/// \brief FP_CONTRACT mode (on/off/fast).
+ENUM_LANGOPT(DefaultFPContractMode, FPContractModeKind, 2, FPC_Off, "FP 
contraction type")
 LANGOPT(NoBitFieldTypeAlign , 1, 0, "bit-field type alignment")
 LANGOPT(HexagonQdsp6Compat , 1, 0, "hexagon-qdsp6 backward compatibility")
 LANGOPT(ObjCAutoRefCount , 1, 0, "Objective-C automated reference counting")

Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=299027=299026=299027=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Wed Mar 29 15:39:49 2017
@@ -88,6 +88,12 @@ public:
 MSVC2015 = 19
   };
 
+  enum FPContractModeKind {
+FPC_Off,// Form fused FP ops only where result will not be 
affected.
+FPC_On, // Form fused FP ops according to FP_CONTRACT rules.
+FPC_Fast// Aggressively fuse FP ops (E.g. 

r298877 - Encapsulate FPOptions and use it consistently

2017-03-27 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Mon Mar 27 14:17:25 2017
New Revision: 298877

URL: http://llvm.org/viewvc/llvm-project?rev=298877=rev
Log:
Encapsulate FPOptions and use it consistently

Sema holds the current FPOptions which is adjusted by 'pragma STDC
FP_CONTRACT'.  This then gets propagated into expression nodes as they are
built.

This encapsulates FPOptions so that this propagation happens opaquely rather
than directly with the fp_contractable on/off bit.  This allows controlled
transitioning of fp_contractable to a ternary value (off, on, fast).  It will
also allow adding more fast-math flags later.

This is toward moving fp-contraction=fast from an LLVM TargetOption to a
FastMathFlag in order to fix PR25721.

Differential Revision: https://reviews.llvm.org/D31166

Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/Basic/LangOptions.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/lib/Analysis/BodyFarm.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp
cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp
cfe/trunk/lib/Sema/SemaAttr.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/lib/Sema/SemaPseudoObject.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=298877=298876=298877=diff
==
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Mon Mar 27 14:17:25 2017
@@ -2918,11 +2918,9 @@ public:
 private:
   unsigned Opc : 6;
 
-  // Records the FP_CONTRACT pragma status at the point that this binary
-  // operator was parsed. This bit is only meaningful for operations on
-  // floating point types. For all other types it should default to
-  // false.
-  unsigned FPContractable : 1;
+  // This is only meaningful for operations on floating point types and 0
+  // otherwise.
+  unsigned FPFeatures : 1;
   SourceLocation OpLoc;
 
   enum { LHS, RHS, END_EXPR };
@@ -2931,7 +2929,7 @@ public:
 
   BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy,
  ExprValueKind VK, ExprObjectKind OK,
- SourceLocation opLoc, bool fpContractable)
+ SourceLocation opLoc, FPOptions FPFeatures)
 : Expr(BinaryOperatorClass, ResTy, VK, OK,
lhs->isTypeDependent() || rhs->isTypeDependent(),
lhs->isValueDependent() || rhs->isValueDependent(),
@@ -2939,7 +2937,7 @@ public:
 rhs->isInstantiationDependent()),
(lhs->containsUnexpandedParameterPack() ||
 rhs->containsUnexpandedParameterPack())),
-  Opc(opc), FPContractable(fpContractable), OpLoc(opLoc) {
+  Opc(opc), FPFeatures(FPFeatures.getInt()), OpLoc(opLoc) {
 SubExprs[LHS] = lhs;
 SubExprs[RHS] = rhs;
 assert(!isCompoundAssignmentOp() &&
@@ -3074,16 +3072,20 @@ public:
 
   // Set the FP contractability status of this operator. Only meaningful for
   // operations on floating point types.
-  void setFPContractable(bool FPC) { FPContractable = FPC; }
+  void setFPFeatures(FPOptions F) { FPFeatures = F.getInt(); }
+
+  FPOptions getFPFeatures() const { return FPOptions(FPFeatures); }
 
   // Get the FP contractability status of this operator. Only meaningful for
   // operations on floating point types.
-  bool isFPContractable() const { return FPContractable; }
+  bool isFPContractable() const {
+return FPOptions(FPFeatures).isFPContractable();
+  }
 
 protected:
   BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy,
  ExprValueKind VK, ExprObjectKind OK,
- SourceLocation opLoc, bool fpContractable, bool dead2)
+ SourceLocation opLoc, FPOptions FPFeatures, bool dead2)
 : Expr(CompoundAssignOperatorClass, ResTy, VK, OK,
lhs->isTypeDependent() || rhs->isTypeDependent(),
lhs->isValueDependent() || rhs->isValueDependent(),
@@ -3091,7 +3093,7 @@ protected:
 rhs->isInstantiationDependent()),
(lhs->containsUnexpandedParameterPack() ||
 rhs->containsUnexpandedParameterPack())),
-  Opc(opc), FPContractable(fpContractable), OpLoc(opLoc) {
+  Opc(opc), FPFeatures(FPFeatures.getInt()), OpLoc(opLoc) {
 SubExprs[LHS] = lhs;
 SubExprs[RHS] = rhs;
   }
@@ -3113,8 +3115,8 @@ public:
   CompoundAssignOperator(Expr *lhs, Expr *rhs, Opcode opc, 

r298469 - Remove -ffp-contract=fast from this test

2017-03-21 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Mar 21 19:58:18 2017
New Revision: 298469

URL: http://llvm.org/viewvc/llvm-project?rev=298469=rev
Log:
Remove -ffp-contract=fast from this test

It does not need it and causes mismatch after -ffp-contract=fast is turned
into an FMF.

Modified:
cfe/trunk/test/CodeGen/aarch64-neon-intrinsics.c

Modified: cfe/trunk/test/CodeGen/aarch64-neon-intrinsics.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/aarch64-neon-intrinsics.c?rev=298469=298468=298469=diff
==
--- cfe/trunk/test/CodeGen/aarch64-neon-intrinsics.c (original)
+++ cfe/trunk/test/CodeGen/aarch64-neon-intrinsics.c Tue Mar 21 19:58:18 2017
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \
-// RUN: -fallow-half-arguments-and-returns -ffp-contract=fast -S 
-emit-llvm -o - %s \
+// RUN: -fallow-half-arguments-and-returns -S -emit-llvm -o - %s \
 // RUN: | opt -S -mem2reg \
 // RUN: | FileCheck %s
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r298468 - Change -ffp-contract=fast test to run on Aarch64

2017-03-21 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Mar 21 19:58:15 2017
New Revision: 298468

URL: http://llvm.org/viewvc/llvm-project?rev=298468=rev
Log:
Change -ffp-contract=fast test to run on Aarch64

(I don't have powerpc enabled in my build and I am changing
how -ffp-contract=fast works.)

Modified:
cfe/trunk/test/CodeGen/ffp-contract-option.c

Modified: cfe/trunk/test/CodeGen/ffp-contract-option.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ffp-contract-option.c?rev=298468=298467=298468=diff
==
--- cfe/trunk/test/CodeGen/ffp-contract-option.c (original)
+++ cfe/trunk/test/CodeGen/ffp-contract-option.c Tue Mar 21 19:58:15 2017
@@ -1,8 +1,8 @@
-// RUN: %clang_cc1 -O3 -ffp-contract=fast -triple=powerpc-apple-darwin10 -S -o 
- %s | FileCheck %s
-// REQUIRES: powerpc-registered-target
+// RUN: %clang_cc1 -O3 -ffp-contract=fast -triple=aarch64-apple-darwin -S -o - 
%s | FileCheck %s
+// REQUIRES: aarch64-registered-target
 
 float fma_test1(float a, float b, float c) {
-// CHECK: fmadds
+// CHECK: fmadd
   float x = a * b;
   float y = x + c;
   return y;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r293493 - Adjust tests after folding inlining analysis into missed remarks

2017-01-30 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Mon Jan 30 10:22:50 2017
New Revision: 293493

URL: http://llvm.org/viewvc/llvm-project?rev=293493=rev
Log:
Adjust tests after folding inlining analysis into missed remarks

Modified:
cfe/trunk/test/Frontend/optimization-remark-with-hotness.c
cfe/trunk/test/Frontend/optimization-remark.c

Modified: cfe/trunk/test/Frontend/optimization-remark-with-hotness.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/optimization-remark-with-hotness.c?rev=293493=293492=293493=diff
==
--- cfe/trunk/test/Frontend/optimization-remark-with-hotness.c (original)
+++ cfe/trunk/test/Frontend/optimization-remark-with-hotness.c Mon Jan 30 
10:22:50 2017
@@ -4,11 +4,13 @@
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
 // RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
 // RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
-// RUN: -Rpass-analysis=inline -fdiagnostics-show-hotness -verify
+// RUN: -Rpass-analysis=inline -Rpass-missed=inline \
+// RUN: -fdiagnostics-show-hotness -verify
 // The clang version of the previous test.
 // RUN: %clang -target x86_64-apple-macosx10.9 %s -c -emit-llvm -o /dev/null \
 // RUN: -fprofile-instr-use=%t.profdata -Rpass=inline \
-// RUN: -Rpass-analysis=inline -fdiagnostics-show-hotness -Xclang -verify
+// RUN: -Rpass-analysis=inline -Rpass-missed=inline \
+// RUN: -fdiagnostics-show-hotness -Xclang -verify
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
 // RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
 // RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
@@ -39,7 +41,7 @@ void bar(int x) {
 
 int main(int argc, const char *argv[]) {
   for (int i = 0; i < 30; i++)
-// expected-remark@+1 {{bar should never be inlined}}
+// expected-remark@+1 {{bar not inlined into main because it should never 
be inlined}}
 bar(argc);
   return sum;
 }

Modified: cfe/trunk/test/Frontend/optimization-remark.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/optimization-remark.c?rev=293493=293492=293493=diff
==
--- cfe/trunk/test/Frontend/optimization-remark.c (original)
+++ cfe/trunk/test/Frontend/optimization-remark.c Mon Jan 30 10:22:50 2017
@@ -42,10 +42,8 @@ float foz(int x, int y) { return x * y;
 // twice.
 //
 int bar(int j) {
-// expected-remark@+6 {{foz should never be inlined (cost=never)}}
-// expected-remark@+5 {{foz will not be inlined into bar}}
-// expected-remark@+4 {{foz should never be inlined}}
-// expected-remark@+3 {{foz will not be inlined into bar}}
+// expected-remark@+4 {{foz not inlined into bar because it should never be 
inlined (cost=never)}}
+// expected-remark@+3 {{foz not inlined into bar because it should never be 
inlined (cost=never)}}
 // expected-remark@+2 {{foo should always be inlined}}
 // expected-remark@+1 {{foo inlined into bar}}
   return foo(j, j - 2) * foz(j - 2, j);


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r293149 - Further fixes to test from r293146

2017-01-25 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Wed Jan 25 22:34:07 2017
New Revision: 293149

URL: http://llvm.org/viewvc/llvm-project?rev=293149=rev
Log:
Further fixes to test from r293146

Require aarch64 and avoid filename in YAML since it may require quotation.

Modified:
cfe/trunk/test/CodeGen/opt-record-MIR.c

Modified: cfe/trunk/test/CodeGen/opt-record-MIR.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/opt-record-MIR.c?rev=293149=293148=293149=diff
==
--- cfe/trunk/test/CodeGen/opt-record-MIR.c (original)
+++ cfe/trunk/test/CodeGen/opt-record-MIR.c Wed Jan 25 22:34:07 2017
@@ -1,3 +1,4 @@
+// REQUIRES: aarch64-registered-target
 // RUN: %clang_cc1 -triple arm64-apple-ios -S -o /dev/null %s -O2 
-dwarf-column-info -Rpass-missed=regalloc 2>&1 | FileCheck -check-prefix=REMARK 
%s
 // RUN: %clang_cc1 -triple arm64-apple-ios -S -o /dev/null %s -O2 
-dwarf-column-info 2>&1 | FileCheck -allow-empty -check-prefix=NO_REMARK %s
 // RUN: %clang_cc1 -triple arm64-apple-ios -S -o /dev/null %s -O2 
-dwarf-column-info -opt-record-file %t.yaml
@@ -14,14 +15,14 @@ void foo(float *p, int i) {
   }
 }
 
-// REMARK: opt-record-MIR.c:9:11: remark: {{.}} spills {{.}} reloads generated 
in loop
+// REMARK: opt-record-MIR.c:10:11: remark: {{.}} spills {{.}} reloads 
generated in loop
 // NO_REMARK-NOT: remark:
 
 // YAML: --- !Missed
 // YAML: Pass:regalloc
 // YAML: Name:LoopSpillReload
-// YAML: DebugLoc:{ File: {{.*}}opt-record-MIR.c,
-// YAML:Line: 9, Column: 11 }
+// YAML: DebugLoc:{ File: {{.*}},
+// YAML:Line: 10, Column: 11 }
 // YAML: Function:foo
 // YAML: Args:
 // YAML:   - NumSpills:   '{{.}}'


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r293147 - Fix test from r293146

2017-01-25 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Wed Jan 25 22:14:04 2017
New Revision: 293147

URL: http://llvm.org/viewvc/llvm-project?rev=293147=rev
Log:
Fix test from r293146

Modified:
cfe/trunk/test/CodeGen/opt-record-MIR.c

Modified: cfe/trunk/test/CodeGen/opt-record-MIR.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/opt-record-MIR.c?rev=293147=293146=293147=diff
==
--- cfe/trunk/test/CodeGen/opt-record-MIR.c (original)
+++ cfe/trunk/test/CodeGen/opt-record-MIR.c Wed Jan 25 22:14:04 2017
@@ -20,7 +20,7 @@ void foo(float *p, int i) {
 // YAML: --- !Missed
 // YAML: Pass:regalloc
 // YAML: Name:LoopSpillReload
-// YAML: DebugLoc:{ File: 
/Users/adam/proj/org/llvm/tools/clang/test/CodeGen/opt-record-MIR.c,
+// YAML: DebugLoc:{ File: {{.*}}opt-record-MIR.c,
 // YAML:Line: 9, Column: 11 }
 // YAML: Function:foo
 // YAML: Args:


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r293146 - Support MIR opt-remarks with -fsave-optimization-record

2017-01-25 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Wed Jan 25 22:07:11 2017
New Revision: 293146

URL: http://llvm.org/viewvc/llvm-project?rev=293146=rev
Log:
Support MIR opt-remarks with -fsave-optimization-record

The handler that deals with IR passed/missed/analysis remarks is extended to
also handle the corresponding MIR remarks.

The more thorough testing in done via llc (rL293113, rL293121).  Here we just
make sure that the functionality is accessible through clang.

Added:
cfe/trunk/test/CodeGen/opt-record-MIR.c
Modified:
cfe/trunk/lib/CodeGen/CodeGenAction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=293146=293145=293146=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Wed Jan 25 22:07:11 2017
@@ -23,6 +23,7 @@
 #include "clang/Frontend/FrontendDiagnostic.h"
 #include "clang/Lex/Preprocessor.h"
 #include "llvm/Bitcode/BitcodeReader.h"
+#include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h"
 #include "llvm/IR/DebugInfo.h"
 #include "llvm/IR/DiagnosticInfo.h"
 #include "llvm/IR/DiagnosticPrinter.h"
@@ -306,9 +307,8 @@ namespace clang {
 /// them.
 void EmitOptimizationMessage(const llvm::DiagnosticInfoOptimizationBase ,
  unsigned DiagID);
-void OptimizationRemarkHandler(const llvm::OptimizationRemark );
-void OptimizationRemarkHandler(const llvm::OptimizationRemarkMissed );
-void OptimizationRemarkHandler(const llvm::OptimizationRemarkAnalysis );
+void
+OptimizationRemarkHandler(const llvm::DiagnosticInfoOptimizationBase );
 void OptimizationRemarkHandler(
 const llvm::OptimizationRemarkAnalysisFPCommute );
 void OptimizationRemarkHandler(
@@ -576,36 +576,34 @@ void BackendConsumer::EmitOptimizationMe
 }
 
 void BackendConsumer::OptimizationRemarkHandler(
-const llvm::OptimizationRemark ) {
-  // Optimization remarks are active only if the -Rpass flag has a regular
-  // expression that matches the name of the pass name in \p D.
-  if (CodeGenOpts.OptimizationRemarkPattern &&
-  CodeGenOpts.OptimizationRemarkPattern->match(D.getPassName()))
-EmitOptimizationMessage(D, diag::remark_fe_backend_optimization_remark);
-}
-
-void BackendConsumer::OptimizationRemarkHandler(
-const llvm::OptimizationRemarkMissed ) {
-  // Missed optimization remarks are active only if the -Rpass-missed
-  // flag has a regular expression that matches the name of the pass
-  // name in \p D.
-  if (CodeGenOpts.OptimizationRemarkMissedPattern &&
-  CodeGenOpts.OptimizationRemarkMissedPattern->match(D.getPassName()))
-EmitOptimizationMessage(D,
-
diag::remark_fe_backend_optimization_remark_missed);
-}
-
-void BackendConsumer::OptimizationRemarkHandler(
-const llvm::OptimizationRemarkAnalysis ) {
-  // Optimization analysis remarks are active if the pass name is set to
-  // llvm::DiagnosticInfo::AlwasyPrint or if the -Rpass-analysis flag has a
-  // regular expression that matches the name of the pass name in \p D.
-
-  if (D.shouldAlwaysPrint() ||
-  (CodeGenOpts.OptimizationRemarkAnalysisPattern &&
-   CodeGenOpts.OptimizationRemarkAnalysisPattern->match(D.getPassName(
-EmitOptimizationMessage(
-D, diag::remark_fe_backend_optimization_remark_analysis);
+const llvm::DiagnosticInfoOptimizationBase ) {
+  if (D.isPassed()) {
+// Optimization remarks are active only if the -Rpass flag has a regular
+// expression that matches the name of the pass name in \p D.
+if (CodeGenOpts.OptimizationRemarkPattern &&
+CodeGenOpts.OptimizationRemarkPattern->match(D.getPassName()))
+  EmitOptimizationMessage(D, diag::remark_fe_backend_optimization_remark);
+  } else if (D.isMissed()) {
+// Missed optimization remarks are active only if the -Rpass-missed
+// flag has a regular expression that matches the name of the pass
+// name in \p D.
+if (CodeGenOpts.OptimizationRemarkMissedPattern &&
+CodeGenOpts.OptimizationRemarkMissedPattern->match(D.getPassName()))
+  EmitOptimizationMessage(
+  D, diag::remark_fe_backend_optimization_remark_missed);
+  } else {
+assert(D.isAnalysis() && "Unknown remark type");
+
+bool ShouldAlwaysPrint = false;
+if (auto *ORA = dyn_cast())
+  ShouldAlwaysPrint = ORA->shouldAlwaysPrint();
+
+if (ShouldAlwaysPrint ||
+(CodeGenOpts.OptimizationRemarkAnalysisPattern &&
+ 
CodeGenOpts.OptimizationRemarkAnalysisPattern->match(D.getPassName(
+  EmitOptimizationMessage(
+  D, diag::remark_fe_backend_optimization_remark_analysis);
+  }
 }
 
 void BackendConsumer::OptimizationRemarkHandler(
@@ -688,6 +686,21 @@ void BackendConsumer::DiagnosticHandlerI
 // handler. There is no generic way of emitting them.
 OptimizationRemarkHandler(cast(DI));

r288520 - With LTO and profile-use, enable hotness info in opt remarks

2016-12-02 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Fri Dec  2 11:54:34 2016
New Revision: 288520

URL: http://llvm.org/viewvc/llvm-project?rev=288520=rev
Log:
With LTO and profile-use, enable hotness info in opt remarks

This is to match the behavior of non-LTO;
when -fsave-optimization-record is passed and PGO is available we enable
the generation of hotness information in the optimization records.

Differential Revision: https://reviews.llvm.org/D27332

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/darwin-ld.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=288520=288519=288520=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Dec  2 11:54:34 2016
@@ -3644,6 +3644,19 @@ VersionTuple visualstudio::getMSVCVersio
   return VersionTuple();
 }
 
+static Arg *getLastProfileUseArg(const ArgList ) {
+  auto *ProfileUseArg = Args.getLastArg(
+  options::OPT_fprofile_instr_use, options::OPT_fprofile_instr_use_EQ,
+  options::OPT_fprofile_use, options::OPT_fprofile_use_EQ,
+  options::OPT_fno_profile_instr_use);
+
+  if (ProfileUseArg &&
+  ProfileUseArg->getOption().matches(options::OPT_fno_profile_instr_use))
+ProfileUseArg = nullptr;
+
+  return ProfileUseArg;
+}
+
 static void addPGOAndCoverageFlags(Compilation , const Driver ,
const InputInfo , const ArgList 
,
ArgStringList ) {
@@ -3668,13 +3681,7 @@ static void addPGOAndCoverageFlags(Compi
 D.Diag(diag::err_drv_argument_not_allowed_with)
 << PGOGenerateArg->getSpelling() << ProfileGenerateArg->getSpelling();
 
-  auto *ProfileUseArg = Args.getLastArg(
-  options::OPT_fprofile_instr_use, options::OPT_fprofile_instr_use_EQ,
-  options::OPT_fprofile_use, options::OPT_fprofile_use_EQ,
-  options::OPT_fno_profile_instr_use);
-  if (ProfileUseArg &&
-  ProfileUseArg->getOption().matches(options::OPT_fno_profile_instr_use))
-ProfileUseArg = nullptr;
+  auto *ProfileUseArg = getLastProfileUseArg(Args);
 
   if (PGOGenerateArg && ProfileUseArg)
 D.Diag(diag::err_drv_argument_not_allowed_with)
@@ -8436,6 +8443,11 @@ void darwin::Linker::ConstructJob(Compil
 F = Output.getFilename();
 F += ".opt.yaml";
 CmdArgs.push_back(Args.MakeArgString(F));
+
+if (getLastProfileUseArg(Args)) {
+  CmdArgs.push_back("-mllvm");
+  CmdArgs.push_back("-lto-pass-remarks-with-hotness");
+}
   }
 
   // It seems that the 'e' option is completely ignored for dynamic executables

Modified: cfe/trunk/test/Driver/darwin-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-ld.c?rev=288520=288519=288520=diff
==
--- cfe/trunk/test/Driver/darwin-ld.c (original)
+++ cfe/trunk/test/Driver/darwin-ld.c Fri Dec  2 11:54:34 2016
@@ -332,7 +332,12 @@
 // RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record 
-### -o foo/bar.out 2> %t.log
 // RUN: FileCheck -check-prefix=PASS_REMARKS_OUTPUT %s < %t.log
 // PASS_REMARKS_OUTPUT: "-mllvm" "-lto-pass-remarks-output" "-mllvm" 
"foo/bar.out.opt.yaml"
+// PASS_REMARKS_OUTPUT-NOT: -lto-pass-remarks-with-hotness
 
 // RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record 
-### 2> %t.log
 // RUN: FileCheck -check-prefix=PASS_REMARKS_OUTPUT_NO_O %s < %t.log
 // PASS_REMARKS_OUTPUT_NO_O: "-mllvm" "-lto-pass-remarks-output" "-mllvm" 
"a.out.opt.yaml"
+
+// RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record 
-fprofile-instr-use=blah -### -o foo/bar.out 2> %t.log
+// RUN: FileCheck -check-prefix=PASS_REMARKS_WITH_HOTNESS %s < %t.log
+// PASS_REMARKS_WITH_HOTNESS: "-mllvm" "-lto-pass-remarks-output" "-mllvm" 
"foo/bar.out.opt.yaml" "-mllvm" "-lto-pass-remarks-with-hotness"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r287628 - Rename option to -lto-pass-remarks-output

2016-11-21 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Nov 22 01:35:19 2016
New Revision: 287628

URL: http://llvm.org/viewvc/llvm-project?rev=287628=rev
Log:
Rename option to -lto-pass-remarks-output

The new option -pass-remarks-output broke LLVM_LINK_LLVM_DYLIB because
of the duplicate option name with opt.

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/darwin-ld.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=287628=287627=287628=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Nov 22 01:35:19 2016
@@ -8426,7 +8426,7 @@ void darwin::Linker::ConstructJob(Compil
   if (Args.hasFlag(options::OPT_fsave_optimization_record,
options::OPT_fno_save_optimization_record, false)) {
 CmdArgs.push_back("-mllvm");
-CmdArgs.push_back("-pass-remarks-output");
+CmdArgs.push_back("-lto-pass-remarks-output");
 CmdArgs.push_back("-mllvm");
 
 SmallString<128> F;

Modified: cfe/trunk/test/Driver/darwin-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-ld.c?rev=287628=287627=287628=diff
==
--- cfe/trunk/test/Driver/darwin-ld.c (original)
+++ cfe/trunk/test/Driver/darwin-ld.c Tue Nov 22 01:35:19 2016
@@ -328,11 +328,11 @@
 // LINK_VERSION_DIGITS: invalid version number in 
'-mlinker-version=133.3.0.1.a'
 // LINK_VERSION_DIGITS: invalid version number in '-mlinker-version=133.3.0.1a'
 
-// Check that we're passing -pass-remarks-output for LTO
+// Check that we're passing -lto-pass-remarks-output for LTO
 // RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record 
-### -o foo/bar.out 2> %t.log
 // RUN: FileCheck -check-prefix=PASS_REMARKS_OUTPUT %s < %t.log
-// PASS_REMARKS_OUTPUT: "-mllvm" "-pass-remarks-output" "-mllvm" 
"foo/bar.out.opt.yaml"
+// PASS_REMARKS_OUTPUT: "-mllvm" "-lto-pass-remarks-output" "-mllvm" 
"foo/bar.out.opt.yaml"
 
 // RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record 
-### 2> %t.log
 // RUN: FileCheck -check-prefix=PASS_REMARKS_OUTPUT_NO_O %s < %t.log
-// PASS_REMARKS_OUTPUT_NO_O: "-mllvm" "-pass-remarks-output" "-mllvm" 
"a.out.opt.yaml"
+// PASS_REMARKS_OUTPUT_NO_O: "-mllvm" "-lto-pass-remarks-output" "-mllvm" 
"a.out.opt.yaml"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26833: LTO support for -fsave-optimization-record on Darwin

2016-11-18 Thread Adam Nemet via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL287358: LTO support for -fsave-optimization-record on Darwin 
(authored by anemet).

Changed prior to commit:
  https://reviews.llvm.org/D26833?vs=78464=78552#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26833

Files:
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/darwin-ld.c


Index: cfe/trunk/test/Driver/darwin-ld.c
===
--- cfe/trunk/test/Driver/darwin-ld.c
+++ cfe/trunk/test/Driver/darwin-ld.c
@@ -327,3 +327,12 @@
 // LINK_VERSION_DIGITS: invalid version number in 
'-mlinker-version=133.3.0.1.2.6'
 // LINK_VERSION_DIGITS: invalid version number in 
'-mlinker-version=133.3.0.1.a'
 // LINK_VERSION_DIGITS: invalid version number in '-mlinker-version=133.3.0.1a'
+
+// Check that we're passing -pass-remarks-output for LTO
+// RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record 
-### -o foo/bar.out 2> %t.log
+// RUN: FileCheck -check-prefix=PASS_REMARKS_OUTPUT %s < %t.log
+// PASS_REMARKS_OUTPUT: "-mllvm" "-pass-remarks-output" "-mllvm" 
"foo/bar.out.opt.yaml"
+
+// RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record 
-### 2> %t.log
+// RUN: FileCheck -check-prefix=PASS_REMARKS_OUTPUT_NO_O %s < %t.log
+// PASS_REMARKS_OUTPUT_NO_O: "-mllvm" "-pass-remarks-output" "-mllvm" 
"a.out.opt.yaml"
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -8416,6 +8416,19 @@
   // we follow suite for ease of comparison.
   AddLinkArgs(C, Args, CmdArgs, Inputs);
 
+  // For LTO, pass the name of the optimization record file.
+  if (Args.hasFlag(options::OPT_fsave_optimization_record,
+   options::OPT_fno_save_optimization_record, false)) {
+CmdArgs.push_back("-mllvm");
+CmdArgs.push_back("-pass-remarks-output");
+CmdArgs.push_back("-mllvm");
+
+SmallString<128> F;
+F = Output.getFilename();
+F += ".opt.yaml";
+CmdArgs.push_back(Args.MakeArgString(F));
+  }
+
   // It seems that the 'e' option is completely ignored for dynamic executables
   // (the default), and with static executables, the last one wins, as 
expected.
   Args.AddAllArgs(CmdArgs, {options::OPT_d_Flag, options::OPT_s, 
options::OPT_t,


Index: cfe/trunk/test/Driver/darwin-ld.c
===
--- cfe/trunk/test/Driver/darwin-ld.c
+++ cfe/trunk/test/Driver/darwin-ld.c
@@ -327,3 +327,12 @@
 // LINK_VERSION_DIGITS: invalid version number in '-mlinker-version=133.3.0.1.2.6'
 // LINK_VERSION_DIGITS: invalid version number in '-mlinker-version=133.3.0.1.a'
 // LINK_VERSION_DIGITS: invalid version number in '-mlinker-version=133.3.0.1a'
+
+// Check that we're passing -pass-remarks-output for LTO
+// RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record -### -o foo/bar.out 2> %t.log
+// RUN: FileCheck -check-prefix=PASS_REMARKS_OUTPUT %s < %t.log
+// PASS_REMARKS_OUTPUT: "-mllvm" "-pass-remarks-output" "-mllvm" "foo/bar.out.opt.yaml"
+
+// RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record -### 2> %t.log
+// RUN: FileCheck -check-prefix=PASS_REMARKS_OUTPUT_NO_O %s < %t.log
+// PASS_REMARKS_OUTPUT_NO_O: "-mllvm" "-pass-remarks-output" "-mllvm" "a.out.opt.yaml"
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -8416,6 +8416,19 @@
   // we follow suite for ease of comparison.
   AddLinkArgs(C, Args, CmdArgs, Inputs);
 
+  // For LTO, pass the name of the optimization record file.
+  if (Args.hasFlag(options::OPT_fsave_optimization_record,
+   options::OPT_fno_save_optimization_record, false)) {
+CmdArgs.push_back("-mllvm");
+CmdArgs.push_back("-pass-remarks-output");
+CmdArgs.push_back("-mllvm");
+
+SmallString<128> F;
+F = Output.getFilename();
+F += ".opt.yaml";
+CmdArgs.push_back(Args.MakeArgString(F));
+  }
+
   // It seems that the 'e' option is completely ignored for dynamic executables
   // (the default), and with static executables, the last one wins, as expected.
   Args.AddAllArgs(CmdArgs, {options::OPT_d_Flag, options::OPT_s, options::OPT_t,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26807: Fix a comment for -fsave-optimization-record

2016-11-18 Thread Adam Nemet via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL287357: Fix a comment for -fsave-optimization-record 
(authored by anemet).

Changed prior to commit:
  https://reviews.llvm.org/D26807?vs=78389=78551#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26807

Files:
  cfe/trunk/lib/Driver/Tools.cpp


Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -6225,7 +6225,7 @@
   Args.hasArg(options::OPT_S))) {
 F = Output.getFilename();
   } else {
-// Use the compilation directory.
+// Use the input filename.
 F = llvm::sys::path::stem(Input.getBaseInput());
 
 // If we're compiling for an offload architecture (i.e. a CUDA device),


Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -6225,7 +6225,7 @@
   Args.hasArg(options::OPT_S))) {
 F = Output.getFilename();
   } else {
-// Use the compilation directory.
+// Use the input filename.
 F = llvm::sys::path::stem(Input.getBaseInput());
 
 // If we're compiling for an offload architecture (i.e. a CUDA device),
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r287357 - Fix a comment for -fsave-optimization-record

2016-11-18 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Fri Nov 18 12:17:33 2016
New Revision: 287357

URL: http://llvm.org/viewvc/llvm-project?rev=287357=rev
Log:
Fix a comment for -fsave-optimization-record

Differential Revision: https://reviews.llvm.org/D26807

Modified:
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=287357=287356=287357=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Nov 18 12:17:33 2016
@@ -6225,7 +6225,7 @@ void Clang::ConstructJob(Compilation ,
   Args.hasArg(options::OPT_S))) {
 F = Output.getFilename();
   } else {
-// Use the compilation directory.
+// Use the input filename.
 F = llvm::sys::path::stem(Input.getBaseInput());
 
 // If we're compiling for an offload architecture (i.e. a CUDA device),


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r287358 - LTO support for -fsave-optimization-record on Darwin

2016-11-18 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Fri Nov 18 12:17:36 2016
New Revision: 287358

URL: http://llvm.org/viewvc/llvm-project?rev=287358=rev
Log:
LTO support for -fsave-optimization-record on Darwin

I guess this would have to be added for each linker.

Differential Revision: https://reviews.llvm.org/D26833

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/darwin-ld.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=287358=287357=287358=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Nov 18 12:17:36 2016
@@ -8416,6 +8416,19 @@ void darwin::Linker::ConstructJob(Compil
   // we follow suite for ease of comparison.
   AddLinkArgs(C, Args, CmdArgs, Inputs);
 
+  // For LTO, pass the name of the optimization record file.
+  if (Args.hasFlag(options::OPT_fsave_optimization_record,
+   options::OPT_fno_save_optimization_record, false)) {
+CmdArgs.push_back("-mllvm");
+CmdArgs.push_back("-pass-remarks-output");
+CmdArgs.push_back("-mllvm");
+
+SmallString<128> F;
+F = Output.getFilename();
+F += ".opt.yaml";
+CmdArgs.push_back(Args.MakeArgString(F));
+  }
+
   // It seems that the 'e' option is completely ignored for dynamic executables
   // (the default), and with static executables, the last one wins, as 
expected.
   Args.AddAllArgs(CmdArgs, {options::OPT_d_Flag, options::OPT_s, 
options::OPT_t,

Modified: cfe/trunk/test/Driver/darwin-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-ld.c?rev=287358=287357=287358=diff
==
--- cfe/trunk/test/Driver/darwin-ld.c (original)
+++ cfe/trunk/test/Driver/darwin-ld.c Fri Nov 18 12:17:36 2016
@@ -327,3 +327,12 @@
 // LINK_VERSION_DIGITS: invalid version number in 
'-mlinker-version=133.3.0.1.2.6'
 // LINK_VERSION_DIGITS: invalid version number in 
'-mlinker-version=133.3.0.1.a'
 // LINK_VERSION_DIGITS: invalid version number in '-mlinker-version=133.3.0.1a'
+
+// Check that we're passing -pass-remarks-output for LTO
+// RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record 
-### -o foo/bar.out 2> %t.log
+// RUN: FileCheck -check-prefix=PASS_REMARKS_OUTPUT %s < %t.log
+// PASS_REMARKS_OUTPUT: "-mllvm" "-pass-remarks-output" "-mllvm" 
"foo/bar.out.opt.yaml"
+
+// RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record 
-### 2> %t.log
+// RUN: FileCheck -check-prefix=PASS_REMARKS_OUTPUT_NO_O %s < %t.log
+// PASS_REMARKS_OUTPUT_NO_O: "-mllvm" "-pass-remarks-output" "-mllvm" 
"a.out.opt.yaml"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26833: LTO support for -fsave-optimization-record on Darwin

2016-11-18 Thread Adam Nemet via cfe-commits
anemet added a comment.

Mehdi offered to help out making this work for ThinLTO on the LLVM side.  For 
now this option will be ignored by ThinLTO.


https://reviews.llvm.org/D26833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26833: LTO support for -fsave-optimization-record on Darwin

2016-11-17 Thread Adam Nemet via cfe-commits
anemet added a comment.

Nothing strong, just trying to go step-by-step.  I haven't thought about it how 
this should map to ThinLTO.  We can discuss it tomorrow.


https://reviews.llvm.org/D26833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26833: LTO support for -fsave-optimization-record on Darwin

2016-11-17 Thread Adam Nemet via cfe-commits
anemet added a comment.

In https://reviews.llvm.org/D26833#599382, @mehdi_amini wrote:

> Well, maybe not entirely, what do you expect for output with ThinLTO?


For now, I'd like to just ignore it.  So I need to somehow restrict this to 
LTO-only...


https://reviews.llvm.org/D26833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26833: LTO support for -fsave-optimization-record on Darwin

2016-11-17 Thread Adam Nemet via cfe-commits
anemet created this revision.
anemet added reviewers: hfinkel, mehdi_amini.
anemet added a subscriber: cfe-commits.

I guess this would have to be added for each linker.


https://reviews.llvm.org/D26833

Files:
  lib/Driver/Tools.cpp
  test/Driver/darwin-ld.c


Index: test/Driver/darwin-ld.c
===
--- test/Driver/darwin-ld.c
+++ test/Driver/darwin-ld.c
@@ -327,3 +327,12 @@
 // LINK_VERSION_DIGITS: invalid version number in 
'-mlinker-version=133.3.0.1.2.6'
 // LINK_VERSION_DIGITS: invalid version number in 
'-mlinker-version=133.3.0.1.a'
 // LINK_VERSION_DIGITS: invalid version number in '-mlinker-version=133.3.0.1a'
+
+// Check that we're passing -pass-remarks-output for LTO
+// RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record 
-### -o foo/bar.out 2> %t.log
+// RUN: FileCheck -check-prefix=PASS_REMARKS_OUTPUT %s < %t.log
+// PASS_REMARKS_OUTPUT: "-mllvm" "-pass-remarks-output" "-mllvm" 
"foo/bar.out.opt.yaml"
+
+// RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record 
-### 2> %t.log
+// RUN: FileCheck -check-prefix=PASS_REMARKS_OUTPUT_NO_O %s < %t.log
+// PASS_REMARKS_OUTPUT_NO_O: "-mllvm" "-pass-remarks-output" "-mllvm" 
"a.out.opt.yaml"
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -8416,6 +8416,19 @@
   // we follow suite for ease of comparison.
   AddLinkArgs(C, Args, CmdArgs, Inputs);
 
+  // For LTO, pass the name of the optimization record file.
+  if (Args.hasFlag(options::OPT_fsave_optimization_record,
+   options::OPT_fno_save_optimization_record, false)) {
+CmdArgs.push_back("-mllvm");
+CmdArgs.push_back("-pass-remarks-output");
+CmdArgs.push_back("-mllvm");
+
+SmallString<128> F;
+F = Output.getFilename();
+F += ".opt.yaml";
+CmdArgs.push_back(Args.MakeArgString(F));
+  }
+
   // It seems that the 'e' option is completely ignored for dynamic executables
   // (the default), and with static executables, the last one wins, as 
expected.
   Args.AddAllArgs(CmdArgs, {options::OPT_d_Flag, options::OPT_s, 
options::OPT_t,


Index: test/Driver/darwin-ld.c
===
--- test/Driver/darwin-ld.c
+++ test/Driver/darwin-ld.c
@@ -327,3 +327,12 @@
 // LINK_VERSION_DIGITS: invalid version number in '-mlinker-version=133.3.0.1.2.6'
 // LINK_VERSION_DIGITS: invalid version number in '-mlinker-version=133.3.0.1.a'
 // LINK_VERSION_DIGITS: invalid version number in '-mlinker-version=133.3.0.1a'
+
+// Check that we're passing -pass-remarks-output for LTO
+// RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record -### -o foo/bar.out 2> %t.log
+// RUN: FileCheck -check-prefix=PASS_REMARKS_OUTPUT %s < %t.log
+// PASS_REMARKS_OUTPUT: "-mllvm" "-pass-remarks-output" "-mllvm" "foo/bar.out.opt.yaml"
+
+// RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record -### 2> %t.log
+// RUN: FileCheck -check-prefix=PASS_REMARKS_OUTPUT_NO_O %s < %t.log
+// PASS_REMARKS_OUTPUT_NO_O: "-mllvm" "-pass-remarks-output" "-mllvm" "a.out.opt.yaml"
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -8416,6 +8416,19 @@
   // we follow suite for ease of comparison.
   AddLinkArgs(C, Args, CmdArgs, Inputs);
 
+  // For LTO, pass the name of the optimization record file.
+  if (Args.hasFlag(options::OPT_fsave_optimization_record,
+   options::OPT_fno_save_optimization_record, false)) {
+CmdArgs.push_back("-mllvm");
+CmdArgs.push_back("-pass-remarks-output");
+CmdArgs.push_back("-mllvm");
+
+SmallString<128> F;
+F = Output.getFilename();
+F += ".opt.yaml";
+CmdArgs.push_back(Args.MakeArgString(F));
+  }
+
   // It seems that the 'e' option is completely ignored for dynamic executables
   // (the default), and with static executables, the last one wins, as expected.
   Args.AddAllArgs(CmdArgs, {options::OPT_d_Flag, options::OPT_s, options::OPT_t,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25225: Add an option to save the backend-produced YAML optimization record to a file

2016-10-07 Thread Adam Nemet via cfe-commits
anemet added a comment.

LGTM, thanks.  I also like the option name but will let the the other reviewers 
official approve that part.


https://reviews.llvm.org/D25225



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25225: Add an option to save the backend-produced YAML optimization record to a file

2016-10-07 Thread Adam Nemet via cfe-commits
anemet added inline comments.



Comment at: lib/CodeGen/CodeGenAction.cpp:198
+
+Ctx.setDiagnosticsOutputFile(new yaml::Output(OptRecordFile->os()));
+  }

Sorry, one more thing: if PGO is available, I think we want to set 
Ctx.setDiagnosticHotnessRequested as well.  Without that, you'd have to pass 
-fsave-optimization-record and -fdiagnostics-show-hotness to get hotness info 
into the YAML file which feels strange.  I am certainly fine if we do this 
later but I wanted to bring it up since it's seems related.


https://reviews.llvm.org/D25225



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25225: Add an option to save the backend-produced YAML optimization record to a file

2016-10-07 Thread Adam Nemet via cfe-commits
anemet added inline comments.



Comment at: test/CodeGen/opt-record.c:17-25
+// CHECK: --- !Missed
+// CHECK: Pass:inline
+// CHECK: Name:NoDefinition
+// CHECK: Function:foo
+
+// CHECK: --- !Passed
+// CHECK: Pass:loop-vectorize

Wouldn't this be a good place to also check that we have -gline-tables-only 
properly hooked up, i.e. CHECK for DebugLoc: as well?


https://reviews.llvm.org/D25225



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [cfe-dev] [llvm-dev] Upgrading phabricator

2016-09-30 Thread Adam Nemet via cfe-commits
Hi Eric,

Thanks for your work.

> On Sep 29, 2016, at 11:04 PM, Eric Liu via cfe-dev  
> wrote:
> 
> I've switched the default email format to be plain text only now. This option 
> should be per-user configurable, but somehow it is not shown in the 
> "Settings"; I'll try if I can make the option personalized.
> 
> Regarding new features and bug fixes in this upgrade, I don't really have a 
> list since the Phabricator we are running is the open-source repo + some 
> local modification. The last merge was more than one year ago, so I guess 
> there should be a long list of new features and bug fixes.
> 
> Some new features that I am aware of:
> - Syntax highlighting.
> - Patch size in email headers
> - HTML email (disabled)
> - More compatible with modern arc (the reason for this upgrade)

Can you please elaborate?  Is this meant for bug-fixing only, or can we use 
some new features from arc?

Adam

> - and more to be discovered! :)
> 
> @Mehdi Deleting unposted inline comments works for me. At which patch did 
> this issue occur?
> 
> - Eric
> 
> On Fri, Sep 30, 2016 at 7:39 AM Mehdi Amini  > wrote:
> One of the new “feature” is that emails are HTML only right now. Not quite 
> nice for the archive (or for interacting by email). 
> See for instance: 
> http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160926/172081.html 
> 
> 
> (Also the funky "[Changed Subscribers] “ in the title)
> 
> Another issue is that we can’t delete unposted inline comment anymore.
> 
> — 
> Mehdi
> 
>> On Sep 29, 2016, at 9:35 PM, Zachary Turner via llvm-dev 
>> > wrote:
>> 
>> You mentioned this was for an upgrade. Are there any major new features or 
>> bugfixes to be aware of?
>> On Thu, Sep 29, 2016 at 9:26 PM Eric Liu via llvm-commits 
>> > wrote:
>> Hi all,
>> 
>> Phabricator is (finally) back online! Let me know if you have any feedback 
>> or problem :)
>> 
>> Thanks,
>> Eric
>> 
>> On Thu, Sep 29, 2016 at 10:23 PM Eric Liu > > wrote:
>> According to top and iotop, mysqld is still working, and the progress bar 
>> did move by a little bit, so I think it's just really slow. Apologies if 
>> this is blocking you.
>> 
>> On Thu, Sep 29, 2016 at 10:17 PM Zachary Turner via llvm-dev 
>> > wrote:
>> Still no word on when it will be back up?  It's not hung is it?  :D
>> 
>> On Thu, Sep 29, 2016 at 9:03 AM mats petersson via llvm-dev 
>> > wrote:
>> On 29 September 2016 at 16:11, Mehdi Amini via llvm-dev 
>> > wrote:
>> 
>>> On Sep 29, 2016, at 7:21 AM, Eric Liu via llvm-dev >> > wrote:
>>> 
>>> Sorry for blocking everyone for so long.
>> 
>> No pb, thanks very much for taking care of it :)
>> 
>>> It has been more than a year since the last upgrade, and mysql is adjusting 
>>> schema for a table with ~150G data on a single VM instance.
>> 
>> 150GB? I’m very surprised there is so much data in our phab! That seems 
>> huge...
>> 
>> My guess is that this includes all the diffs for every revision of every 
>> review (as well as all the comments, etc), and it probably isn't as clever 
>> with diffs as for example git. Which quite soon adds up to huge numbers when 
>> you have tens of thousands of reviews.
>> 
>> Purse speculation of course, I have never looked inside phabricator (or for 
>> that matter, any other code-review tool).
>> 
>> --
>> Mats
>> 
>> — 
>> Mehdi
>> 
>>> Sadly, the progress bar isn't giving useful information (plus I am not a 
>>> good system admin),  so I couldn't tell the ETA...
>>> 
>>> FYI: According to previous maintainer, it takes a couple of hours for the 
>>> last upgrade, so this should be done within a few hours (hopefully!).
>>> 
>>> On Thu, Sep 29, 2016 at 4:04 PM Krzysztof Parzyszek via llvm-dev 
>>> > wrote:
>>> Is there any ETA?
>>> 
>>> -Krzysztof
>>> 
>>> On 9/29/2016 5:34 AM, Eric Liu via llvm-dev wrote:
>>> > That was a bad estimation. Database upgrade is taking time.
>>> >
>>> > On Thu, Sep 29, 2016 at 11:03 AM Eric Liu >> > 
>>> > >> wrote:
>>> >
>>> > Hi all,
>>> >
>>> > Phabricator(reviews.llvm.org  
>>> > >) will be down
>>> > for ~30 mins for an upgrade. Sorry for the short notice.
>>> >
>>> > Regards,
>>> > Eric
>>> >
>>> >
>>> >
>>> > 

r282545 - Shorten DiagnosticInfoOptimizationRemark* to OptimizationRemark*. NFC

2016-09-27 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Sep 27 17:19:29 2016
New Revision: 282545

URL: http://llvm.org/viewvc/llvm-project?rev=282545=rev
Log:
Shorten DiagnosticInfoOptimizationRemark* to OptimizationRemark*. NFC

With the new streaming interface in LLVM, these class names need to be
typed a lot and it's way too looong.

Modified:
cfe/trunk/lib/CodeGen/CodeGenAction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=282545=282544=282545=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Tue Sep 27 17:19:29 2016
@@ -260,16 +260,13 @@ namespace clang {
 /// them.
 void EmitOptimizationMessage(const llvm::DiagnosticInfoOptimizationBase ,
  unsigned DiagID);
-void
-OptimizationRemarkHandler(const llvm::DiagnosticInfoOptimizationRemark );
+void OptimizationRemarkHandler(const llvm::OptimizationRemark );
+void OptimizationRemarkHandler(const llvm::OptimizationRemarkMissed );
+void OptimizationRemarkHandler(const llvm::OptimizationRemarkAnalysis );
 void OptimizationRemarkHandler(
-const llvm::DiagnosticInfoOptimizationRemarkMissed );
+const llvm::OptimizationRemarkAnalysisFPCommute );
 void OptimizationRemarkHandler(
-const llvm::DiagnosticInfoOptimizationRemarkAnalysis );
-void OptimizationRemarkHandler(
-const llvm::DiagnosticInfoOptimizationRemarkAnalysisFPCommute );
-void OptimizationRemarkHandler(
-const llvm::DiagnosticInfoOptimizationRemarkAnalysisAliasing );
+const llvm::OptimizationRemarkAnalysisAliasing );
 void OptimizationFailureHandler(
 const llvm::DiagnosticInfoOptimizationFailure );
   };
@@ -533,7 +530,7 @@ void BackendConsumer::EmitOptimizationMe
 }
 
 void BackendConsumer::OptimizationRemarkHandler(
-const llvm::DiagnosticInfoOptimizationRemark ) {
+const llvm::OptimizationRemark ) {
   // Optimization remarks are active only if the -Rpass flag has a regular
   // expression that matches the name of the pass name in \p D.
   if (CodeGenOpts.OptimizationRemarkPattern &&
@@ -542,7 +539,7 @@ void BackendConsumer::OptimizationRemark
 }
 
 void BackendConsumer::OptimizationRemarkHandler(
-const llvm::DiagnosticInfoOptimizationRemarkMissed ) {
+const llvm::OptimizationRemarkMissed ) {
   // Missed optimization remarks are active only if the -Rpass-missed
   // flag has a regular expression that matches the name of the pass
   // name in \p D.
@@ -553,7 +550,7 @@ void BackendConsumer::OptimizationRemark
 }
 
 void BackendConsumer::OptimizationRemarkHandler(
-const llvm::DiagnosticInfoOptimizationRemarkAnalysis ) {
+const llvm::OptimizationRemarkAnalysis ) {
   // Optimization analysis remarks are active if the pass name is set to
   // llvm::DiagnosticInfo::AlwasyPrint or if the -Rpass-analysis flag has a
   // regular expression that matches the name of the pass name in \p D.
@@ -566,7 +563,7 @@ void BackendConsumer::OptimizationRemark
 }
 
 void BackendConsumer::OptimizationRemarkHandler(
-const llvm::DiagnosticInfoOptimizationRemarkAnalysisFPCommute ) {
+const llvm::OptimizationRemarkAnalysisFPCommute ) {
   // Optimization analysis remarks are active if the pass name is set to
   // llvm::DiagnosticInfo::AlwasyPrint or if the -Rpass-analysis flag has a
   // regular expression that matches the name of the pass name in \p D.
@@ -579,7 +576,7 @@ void BackendConsumer::OptimizationRemark
 }
 
 void BackendConsumer::OptimizationRemarkHandler(
-const llvm::DiagnosticInfoOptimizationRemarkAnalysisAliasing ) {
+const llvm::OptimizationRemarkAnalysisAliasing ) {
   // Optimization analysis remarks are active if the pass name is set to
   // llvm::DiagnosticInfo::AlwasyPrint or if the -Rpass-analysis flag has a
   // regular expression that matches the name of the pass name in \p D.
@@ -623,30 +620,27 @@ void BackendConsumer::DiagnosticHandlerI
   case llvm::DK_OptimizationRemark:
 // Optimization remarks are always handled completely by this
 // handler. There is no generic way of emitting them.
-OptimizationRemarkHandler(cast(DI));
+OptimizationRemarkHandler(cast(DI));
 return;
   case llvm::DK_OptimizationRemarkMissed:
 // Optimization remarks are always handled completely by this
 // handler. There is no generic way of emitting them.
-
OptimizationRemarkHandler(cast(DI));
+OptimizationRemarkHandler(cast(DI));
 return;
   case llvm::DK_OptimizationRemarkAnalysis:
 // Optimization remarks are always handled completely by this
 // handler. There is no generic way of emitting them.
-OptimizationRemarkHandler(
-cast(DI));
+OptimizationRemarkHandler(cast(DI));
 return;
   case llvm::DK_OptimizationRemarkAnalysisFPCommute:
 // Optimization remarks are 

r282540 - Adapt to LLVM optimization remark interface change. NFC

2016-09-27 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Sep 27 15:55:12 2016
New Revision: 282540

URL: http://llvm.org/viewvc/llvm-project?rev=282540=rev
Log:
Adapt to LLVM optimization remark interface change. NFC

Modified:
cfe/trunk/lib/CodeGen/CodeGenAction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=282540=282539=282540=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Tue Sep 27 15:55:12 2016
@@ -514,7 +514,7 @@ void BackendConsumer::EmitOptimizationMe
 
   std::string Msg;
   raw_string_ostream MsgStream(Msg);
-  MsgStream << D.getMsg().str();
+  MsgStream << D.getMsg();
 
   if (D.getHotness())
 MsgStream << " (hotness: " << *D.getHotness() << ")";


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r282504 - Revert "Adapt to LLVM optimization remark interface change. NFC"

2016-09-27 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Sep 27 11:39:27 2016
New Revision: 282504

URL: http://llvm.org/viewvc/llvm-project?rev=282504=rev
Log:
Revert "Adapt to LLVM optimization remark interface change. NFC"

This reverts commit r282500.

Modified:
cfe/trunk/lib/CodeGen/CodeGenAction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=282504=282503=282504=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Tue Sep 27 11:39:27 2016
@@ -514,7 +514,7 @@ void BackendConsumer::EmitOptimizationMe
 
   std::string Msg;
   raw_string_ostream MsgStream(Msg);
-  MsgStream << D.getMsg();
+  MsgStream << D.getMsg().str();
 
   if (D.getHotness())
 MsgStream << " (hotness: " << *D.getHotness() << ")";


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r282500 - Adapt to LLVM optimization remark interface change. NFC

2016-09-27 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Sep 27 11:15:21 2016
New Revision: 282500

URL: http://llvm.org/viewvc/llvm-project?rev=282500=rev
Log:
Adapt to LLVM optimization remark interface change. NFC

Modified:
cfe/trunk/lib/CodeGen/CodeGenAction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=282500=282499=282500=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Tue Sep 27 11:15:21 2016
@@ -514,7 +514,7 @@ void BackendConsumer::EmitOptimizationMe
 
   std::string Msg;
   raw_string_ostream MsgStream(Msg);
-  MsgStream << D.getMsg().str();
+  MsgStream << D.getMsg();
 
   if (D.getHotness())
 MsgStream << " (hotness: " << *D.getHotness() << ")";


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r281293 - Reapply r281276 with passing -emit-llvm in one of the tests

2016-09-12 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Mon Sep 12 23:32:40 2016
New Revision: 281293

URL: http://llvm.org/viewvc/llvm-project?rev=281293=rev
Log:
Reapply r281276 with passing -emit-llvm in one of the tests

Original commit message:

Add -fdiagnostics-show-hotness

Summary:
I've recently added the ability for optimization remarks to include the
hotness of the corresponding code region.  This uses PGO and allows
filtering of the optimization remarks by relevance.  The idea was first
discussed here:
http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334

The general goal is to produce a YAML file with the remarks.  Then, an
external tool could dynamically filter these by hotness and perhaps by
other things.

That said it makes sense to also expose this at the more basic level
where we just include the hotness info with each optimization remark.
For example, in D22694, the clang flag was pretty useful to measure the
overhead of the additional analyses required to include hotness.
(Without the flag we don't even run the analyses.)

For the record, Hal has already expressed support for the idea of this
patch on IRC.

Differential Revision: https://reviews.llvm.org/D23284

Added:
cfe/trunk/test/Frontend/Inputs/optimization-remark-with-hotness.proftext
cfe/trunk/test/Frontend/optimization-remark-with-hotness.c
Modified:
cfe/trunk/docs/UsersManual.rst
cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/lib/CodeGen/CodeGenAction.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/docs/UsersManual.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=281293=281292=281293=diff
==
--- cfe/trunk/docs/UsersManual.rst (original)
+++ cfe/trunk/docs/UsersManual.rst Mon Sep 12 23:32:40 2016
@@ -317,6 +317,28 @@ output format of the diagnostics that it
by category, so it should be a high level category. We want dozens
of these, not hundreds or thousands of them.
 
+.. _opt_fdiagnostics-show-hotness:
+
+**-f[no-]diagnostics-show-hotness**
+   Enable profile hotness information in diagnostic line.
+
+   This option, which defaults to off, controls whether Clang prints the
+   profile hotness associated with a diagnostics in the presence of
+   profile-guided optimization information.  This is currently supported with
+   optimization remarks (see :ref:`Options to Emit Optimization Reports
+   `).  The hotness information allows users to focus on the hot
+   optimization remarks that are likely to be more relevant for run-time
+   performance.
+
+   For example, in this output, the block containing the callsite of `foo` was
+   executed 3000 times according to the profile data:
+
+   ::
+
+ s.c:7:10: remark: foo inlined into bar (hotness: 3000) 
[-Rpass-analysis=inline]
+   sum += foo(x, x - 2);
+  ^
+
 .. _opt_fdiagnostics-fixit-info:
 
 **-f[no-]diagnostics-fixit-info**
@@ -535,6 +557,8 @@ control the crash diagnostics.
 The -fno-crash-diagnostics flag can be helpful for speeding the process
 of generating a delta reduced test case.
 
+.. _rpass:
+
 Options to Emit Optimization Reports
 
 
@@ -578,6 +602,10 @@ outside of the major transformations (e.
 loop optimizations) and not every optimization pass supports this
 feature.
 
+Note that when using profile-guided optimization information, profile hotness
+information can be included in the remarks (see
+:ref:`-fdiagnostics-show-hotness `).
+
 Current limitations
 ^^^
 

Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=281293=281292=281293=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Mon Sep 12 23:32:40 
2016
@@ -189,6 +189,9 @@ def warn_drv_unused_argument : Warning<
 def warn_drv_empty_joined_argument : Warning<
   "joined argument expects additional value: '%0'">,
   InGroup;
+def warn_drv_fdiagnostics_show_hotness_requires_pgo : Warning<
+  "argument '-fdiagnostics-show-hotness' requires profile-guided optimization 
information">,
+  InGroup;
 def warn_drv_clang_unsupported : Warning<
   "the clang compiler does not support '%0'">;
 def warn_drv_deprecated_arg : Warning<

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=281293=281292=281293=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Sep 

Re: [PATCH] D23284: Add -fdiagnostics-show-hotness

2016-09-12 Thread Adam Nemet via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL281276: Add -fdiagnostics-show-hotness (authored by anemet).

Changed prior to commit:
  https://reviews.llvm.org/D23284?vs=70547=71078#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23284

Files:
  cfe/trunk/docs/UsersManual.rst
  cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/include/clang/Frontend/CodeGenOptions.def
  cfe/trunk/lib/CodeGen/CodeGenAction.cpp
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/test/Frontend/Inputs/optimization-remark-with-hotness.proftext
  cfe/trunk/test/Frontend/optimization-remark-with-hotness.c

Index: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
===
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp
@@ -179,6 +179,7 @@
   Ctx.getDiagnosticHandler();
   void *OldDiagnosticContext = Ctx.getDiagnosticContext();
   Ctx.setDiagnosticHandler(DiagnosticHandler, this);
+  Ctx.setDiagnosticHotnessRequested(CodeGenOpts.DiagnosticsWithHotness);
 
   // Link LinkModule into this module if present, preserving its validity.
   for (auto  : LinkModules) {
@@ -511,9 +512,16 @@
   FullSourceLoc Loc = getBestLocationFromDebugLoc(D, BadDebugInfo, Filename,
   Line, Column);
 
+  std::string Msg;
+  raw_string_ostream MsgStream(Msg);
+  MsgStream << D.getMsg().str();
+
+  if (D.getHotness())
+MsgStream << " (hotness: " << *D.getHotness() << ")";
+
   Diags.Report(Loc, DiagID)
   << AddFlagValue(D.getPassName() ? D.getPassName() : "")
-  << D.getMsg().str();
+  << MsgStream.str();
 
   if (BadDebugInfo)
 // If we were not able to translate the file:line:col information
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -4902,6 +4902,7 @@
   claimNoWarnArgs(Args);
 
   Args.AddAllArgs(CmdArgs, options::OPT_R_Group);
+
   Args.AddAllArgs(CmdArgs, options::OPT_W_Group);
   if (Args.hasFlag(options::OPT_pedantic, options::OPT_no_pedantic, false))
 CmdArgs.push_back("-pedantic");
@@ -5904,6 +5905,10 @@
 CmdArgs.push_back(A->getValue());
   }
 
+  if (Args.hasFlag(options::OPT_fdiagnostics_show_hotness,
+   options::OPT_fno_diagnostics_show_hotness, false))
+CmdArgs.push_back("-fdiagnostics-show-hotness");
+
   if (const Arg *A = Args.getLastArg(options::OPT_fdiagnostics_format_EQ)) {
 CmdArgs.push_back("-fdiagnostics-format");
 CmdArgs.push_back(A->getValue());
Index: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
===
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp
@@ -839,6 +839,12 @@
 NeedLocTracking = true;
   }
 
+  Opts.DiagnosticsWithHotness =
+  Args.hasArg(options::OPT_fdiagnostics_show_hotness);
+  if (Opts.DiagnosticsWithHotness &&
+  Opts.getProfileUse() == CodeGenOptions::ProfileNone)
+Diags.Report(diag::warn_drv_fdiagnostics_show_hotness_requires_pgo);
+
   // If the user requested to use a sample profile for PGO, then the
   // backend will need to track source location information so the profile
   // can be incorporated into the IR.
Index: cfe/trunk/docs/UsersManual.rst
===
--- cfe/trunk/docs/UsersManual.rst
+++ cfe/trunk/docs/UsersManual.rst
@@ -317,6 +317,28 @@
by category, so it should be a high level category. We want dozens
of these, not hundreds or thousands of them.
 
+.. _opt_fdiagnostics-show-hotness:
+
+**-f[no-]diagnostics-show-hotness**
+   Enable profile hotness information in diagnostic line.
+
+   This option, which defaults to off, controls whether Clang prints the
+   profile hotness associated with a diagnostics in the presence of
+   profile-guided optimization information.  This is currently supported with
+   optimization remarks (see :ref:`Options to Emit Optimization Reports
+   `).  The hotness information allows users to focus on the hot
+   optimization remarks that are likely to be more relevant for run-time
+   performance.
+
+   For example, in this output, the block containing the callsite of `foo` was
+   executed 3000 times according to the profile data:
+
+   ::
+
+ s.c:7:10: remark: foo inlined into bar (hotness: 3000) [-Rpass-analysis=inline]
+   sum += foo(x, x - 2);
+  ^
+
 .. _opt_fdiagnostics-fixit-info:
 
 **-f[no-]diagnostics-fixit-info**
@@ -535,6 +557,8 @@
 The -fno-crash-diagnostics flag can be helpful for speeding the process
 of generating a delta reduced test case.
 
+.. _rpass:
+
 Options to Emit Optimization Reports
 
 
@@ -578,6 +602,10 @@
 loop 

r281276 - Add -fdiagnostics-show-hotness

2016-09-12 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Mon Sep 12 18:48:16 2016
New Revision: 281276

URL: http://llvm.org/viewvc/llvm-project?rev=281276=rev
Log:
Add -fdiagnostics-show-hotness

Summary:
I've recently added the ability for optimization remarks to include the
hotness of the corresponding code region.  This uses PGO and allows
filtering of the optimization remarks by relevance.  The idea was first
discussed here:
http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334

The general goal is to produce a YAML file with the remarks.  Then, an
external tool could dynamically filter these by hotness and perhaps by
other things.

That said it makes sense to also expose this at the more basic level
where we just include the hotness info with each optimization remark.
For example, in D22694, the clang flag was pretty useful to measure the
overhead of the additional analyses required to include hotness.
(Without the flag we don't even run the analyses.)

For the record, Hal has already expressed support for the idea of this
patch on IRC.

Differential Revision: https://reviews.llvm.org/D23284

Added:
cfe/trunk/test/Frontend/Inputs/optimization-remark-with-hotness.proftext
cfe/trunk/test/Frontend/optimization-remark-with-hotness.c
Modified:
cfe/trunk/docs/UsersManual.rst
cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/lib/CodeGen/CodeGenAction.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/docs/UsersManual.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=281276=281275=281276=diff
==
--- cfe/trunk/docs/UsersManual.rst (original)
+++ cfe/trunk/docs/UsersManual.rst Mon Sep 12 18:48:16 2016
@@ -317,6 +317,28 @@ output format of the diagnostics that it
by category, so it should be a high level category. We want dozens
of these, not hundreds or thousands of them.
 
+.. _opt_fdiagnostics-show-hotness:
+
+**-f[no-]diagnostics-show-hotness**
+   Enable profile hotness information in diagnostic line.
+
+   This option, which defaults to off, controls whether Clang prints the
+   profile hotness associated with a diagnostics in the presence of
+   profile-guided optimization information.  This is currently supported with
+   optimization remarks (see :ref:`Options to Emit Optimization Reports
+   `).  The hotness information allows users to focus on the hot
+   optimization remarks that are likely to be more relevant for run-time
+   performance.
+
+   For example, in this output, the block containing the callsite of `foo` was
+   executed 3000 times according to the profile data:
+
+   ::
+
+ s.c:7:10: remark: foo inlined into bar (hotness: 3000) 
[-Rpass-analysis=inline]
+   sum += foo(x, x - 2);
+  ^
+
 .. _opt_fdiagnostics-fixit-info:
 
 **-f[no-]diagnostics-fixit-info**
@@ -535,6 +557,8 @@ control the crash diagnostics.
 The -fno-crash-diagnostics flag can be helpful for speeding the process
 of generating a delta reduced test case.
 
+.. _rpass:
+
 Options to Emit Optimization Reports
 
 
@@ -578,6 +602,10 @@ outside of the major transformations (e.
 loop optimizations) and not every optimization pass supports this
 feature.
 
+Note that when using profile-guided optimization information, profile hotness
+information can be included in the remarks (see
+:ref:`-fdiagnostics-show-hotness `).
+
 Current limitations
 ^^^
 

Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=281276=281275=281276=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Mon Sep 12 18:48:16 
2016
@@ -189,6 +189,9 @@ def warn_drv_unused_argument : Warning<
 def warn_drv_empty_joined_argument : Warning<
   "joined argument expects additional value: '%0'">,
   InGroup;
+def warn_drv_fdiagnostics_show_hotness_requires_pgo : Warning<
+  "argument '-fdiagnostics-show-hotness' requires profile-guided optimization 
information">,
+  InGroup;
 def warn_drv_clang_unsupported : Warning<
   "the clang compiler does not support '%0'">;
 def warn_drv_deprecated_arg : Warning<

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=281276=281275=281276=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Sep 12 18:48:16 2016
@@ -583,6 +583,8 @@ def fdiagnostics_parseable_fixits : Flag
 def 

r281275 - Fix a long comment line

2016-09-12 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Mon Sep 12 18:48:11 2016
New Revision: 281275

URL: http://llvm.org/viewvc/llvm-project?rev=281275=rev
Log:
Fix a long comment line

Modified:
cfe/trunk/include/clang/Frontend/CodeGenOptions.def

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=281275=281274=281275=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Mon Sep 12 18:48:11 2016
@@ -1,4 +1,4 @@
-//===--- CodeGenOptions.def - Code generation option database -- C++ 
-*-===//
+//===--- CodeGenOptions.def - Code generation option database - C++ 
-*-===//
 //
 // The LLVM Compiler Infrastructure
 //


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23284: Add -fdiagnostics-show-hotness

2016-09-07 Thread Adam Nemet via cfe-commits
anemet updated this revision to Diff 70547.
anemet updated the summary for this revision.
anemet added a comment.

Address Richard's comment


https://reviews.llvm.org/D23284

Files:
  docs/UsersManual.rst
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/CodeGenAction.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Frontend/Inputs/optimization-remark-with-hotness.proftext
  test/Frontend/optimization-remark-with-hotness.c

Index: test/Frontend/optimization-remark-with-hotness.c
===
--- /dev/null
+++ test/Frontend/optimization-remark-with-hotness.c
@@ -0,0 +1,45 @@
+// RUN: llvm-profdata merge \
+// RUN: %S/Inputs/optimization-remark-with-hotness.proftext   \
+// RUN: -o %t.profdata
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline -fdiagnostics-show-hotness -verify
+// The clang version of the previous test.
+// RUN: %clang -target x86_64-apple-macosx10.9 %s -o /dev/null \
+// RUN: -fprofile-instr-use=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline -fdiagnostics-show-hotness -Xclang -verify
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline 2>&1 | FileCheck -check-prefix=HOTNESS_OFF %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline -Rno-pass-with-hotness  2>&1 | FileCheck \
+// RUN: -check-prefix=HOTNESS_OFF %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -Rpass=inline -Rpass-analysis=inline -fdiagnostics-show-hotness  2>&1 \
+// RUN: | FileCheck -check-prefix=NO_PGO %s
+
+int foo(int x, int y) __attribute__((always_inline));
+int foo(int x, int y) { return x + y; }
+
+int sum = 0;
+
+void bar(int x) {
+  // HOTNESS_OFF: foo inlined into bar
+  // HOTNESS_OFF-NOT: hotness:
+  // NO_PGO: '-fdiagnostics-show-hotness' requires profile-guided optimization information
+  // expected-remark@+2 {{foo should always be inlined (cost=always) (hotness: 30)}}
+  // expected-remark@+1 {{foo inlined into bar (hotness: 30)}}
+  sum += foo(x, x - 2);
+}
+
+int main(int argc, const char *argv[]) {
+  for (int i = 0; i < 30; i++)
+// expected-remark@+1 {{bar should never be inlined}}
+bar(argc);
+  return sum;
+}
Index: test/Frontend/Inputs/optimization-remark-with-hotness.proftext
===
--- /dev/null
+++ test/Frontend/Inputs/optimization-remark-with-hotness.proftext
@@ -0,0 +1,25 @@
+foo
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+30
+
+bar
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+30
+
+main
+# Func Hash:
+4
+# Num Counters:
+2
+# Counter Values:
+1
+30
+
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -839,6 +839,12 @@
 NeedLocTracking = true;
   }
 
+  Opts.DiagnosticsWithHotness =
+  Args.hasArg(options::OPT_fdiagnostics_show_hotness);
+  if (Opts.DiagnosticsWithHotness &&
+  Opts.getProfileUse() == CodeGenOptions::ProfileNone)
+Diags.Report(diag::warn_drv_fdiagnostics_show_hotness_requires_pgo);
+
   // If the user requested to use a sample profile for PGO, then the
   // backend will need to track source location information so the profile
   // can be incorporated into the IR.
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4896,6 +4896,7 @@
   claimNoWarnArgs(Args);
 
   Args.AddAllArgs(CmdArgs, options::OPT_R_Group);
+
   Args.AddAllArgs(CmdArgs, options::OPT_W_Group);
   if (Args.hasFlag(options::OPT_pedantic, options::OPT_no_pedantic, false))
 CmdArgs.push_back("-pedantic");
@@ -5898,6 +5899,10 @@
 CmdArgs.push_back(A->getValue());
   }
 
+  if (Args.hasFlag(options::OPT_fdiagnostics_show_hotness,
+   options::OPT_fno_diagnostics_show_hotness, false))
+CmdArgs.push_back("-fdiagnostics-show-hotness");
+
   if (const Arg *A = Args.getLastArg(options::OPT_fdiagnostics_format_EQ)) {
 CmdArgs.push_back("-fdiagnostics-format");
 CmdArgs.push_back(A->getValue());
Index: lib/CodeGen/CodeGenAction.cpp

Re: [PATCH] D23284: Add -fdiagnostics-show-hotness

2016-09-07 Thread Adam Nemet via cfe-commits
anemet marked an inline comment as done.
anemet added a comment.

https://reviews.llvm.org/D23284



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23284: Add -Rpass-with-hotness

2016-09-07 Thread Adam Nemet via cfe-commits
anemet updated this revision to Diff 70502.
anemet added a comment.

This renames the flag to -fdiagnostics-show-hotness as requested by Richard.
Also added the missing documentation bits.


https://reviews.llvm.org/D23284

Files:
  docs/UsersManual.rst
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/CodeGenAction.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Frontend/Inputs/optimization-remark-with-hotness.proftext
  test/Frontend/optimization-remark-with-hotness.c

Index: test/Frontend/optimization-remark-with-hotness.c
===
--- /dev/null
+++ test/Frontend/optimization-remark-with-hotness.c
@@ -0,0 +1,45 @@
+// RUN: llvm-profdata merge \
+// RUN: %S/Inputs/optimization-remark-with-hotness.proftext   \
+// RUN: -o %t.profdata
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline -fdiagnostics-show-hotness -verify
+// The clang version of the previous test.
+// RUN: %clang -target x86_64-apple-macosx10.9 %s -o /dev/null \
+// RUN: -fprofile-instr-use=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline -fdiagnostics-show-hotness -Xclang -verify
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline 2>&1 | FileCheck -check-prefix=HOTNESS_OFF %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline -Rno-pass-with-hotness  2>&1 | FileCheck \
+// RUN: -check-prefix=HOTNESS_OFF %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -Rpass=inline -Rpass-analysis=inline -fdiagnostics-show-hotness  2>&1 \
+// RUN: | FileCheck -check-prefix=NO_PGO %s
+
+int foo(int x, int y) __attribute__((always_inline));
+int foo(int x, int y) { return x + y; }
+
+int sum = 0;
+
+void bar(int x) {
+  // HOTNESS_OFF: foo inlined into bar
+  // HOTNESS_OFF-NOT: hotness:
+  // NO_PGO: '-fdiagnostics-show-hotness' requires profile-guided optimization information
+  // expected-remark@+2 {{foo should always be inlined (cost=always) (hotness: 30)}}
+  // expected-remark@+1 {{foo inlined into bar (hotness: 30)}}
+  sum += foo(x, x - 2);
+}
+
+int main(int argc, const char *argv[]) {
+  for (int i = 0; i < 30; i++)
+// expected-remark@+1 {{bar should never be inlined}}
+bar(argc);
+  return sum;
+}
Index: test/Frontend/Inputs/optimization-remark-with-hotness.proftext
===
--- /dev/null
+++ test/Frontend/Inputs/optimization-remark-with-hotness.proftext
@@ -0,0 +1,25 @@
+foo
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+30
+
+bar
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+30
+
+main
+# Func Hash:
+4
+# Num Counters:
+2
+# Counter Values:
+1
+30
+
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -839,6 +839,14 @@
 NeedLocTracking = true;
   }
 
+  Opts.DiagnosticsWithHotness =
+  Args.hasFlag(options::OPT_fdiagnostics_show_hotness,
+   options::OPT_fno_diagnostics_show_hotness,
+   /*default*/ false);
+  if (Opts.DiagnosticsWithHotness &&
+  Opts.getProfileUse() == CodeGenOptions::ProfileNone)
+Diags.Report(diag::warn_drv_fdiagnostics_show_hotness_requires_pgo);
+
   // If the user requested to use a sample profile for PGO, then the
   // backend will need to track source location information so the profile
   // can be incorporated into the IR.
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4896,6 +4896,7 @@
   claimNoWarnArgs(Args);
 
   Args.AddAllArgs(CmdArgs, options::OPT_R_Group);
+
   Args.AddAllArgs(CmdArgs, options::OPT_W_Group);
   if (Args.hasFlag(options::OPT_pedantic, options::OPT_no_pedantic, false))
 CmdArgs.push_back("-pedantic");
@@ -5898,6 +5899,10 @@
 CmdArgs.push_back(A->getValue());
   }
 
+  if (Args.hasFlag(options::OPT_fdiagnostics_show_hotness,
+   options::OPT_fno_diagnostics_show_hotness, false))
+CmdArgs.push_back("-fdiagnostics-show-hotness");
+
   if (const Arg *A = Args.getLastArg(options::OPT_fdiagnostics_format_EQ)) {
 

Re: [PATCH] D23284: Add -Rpass-with-hotness

2016-09-06 Thread Adam Nemet via cfe-commits
anemet added a comment.

In https://reviews.llvm.org/D23284#535258, @rsmith wrote:

> I think this should start with `-fdiagnostics` to group it with other similar 
> flags. `-fdiagnostics-include-hotness-in-remarks` seems too specific to me -- 
> I could imagine generating warnings from the middle-end including hotness 
> information, not just remarks. How about `-fdiagnostics-show-hotness`? (This 
> would fit nicely with the existing `-fdiagnostics-show-*` flags.)


SGTM.  I'll update the patch.


https://reviews.llvm.org/D23284



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23284: Add -Rpass-with-hotness

2016-09-06 Thread Adam Nemet via cfe-commits
anemet added a comment.

In https://reviews.llvm.org/D23284#534879, @rsmith wrote:

> I think this should not be an -R option at all; like -W flags, the idea is 
> for -R to only act as a filter for which diagnostics are shown. This option 
> seems much more closely related to options like -fdiagnostics-show-option and 
> -fdiagnostics-format=, and so should probably have a -fdiagnostics-something 
> name.


Sounds fine to me.  Any preference from:

-fdiagnostics-include-hotness-in-remarks
-fpass-diagnostics-with-hotness
-fpass-diagnostics-include-hotness

or something else?


https://reviews.llvm.org/D23284



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23284: Add -Rpass-with-hotness

2016-09-06 Thread Adam Nemet via cfe-commits
anemet added a comment.

In https://reviews.llvm.org/D23284#526413, @dnovillo wrote:

> I'm fine with it, but I don't have much of a say in how option groups are 
> organized.  If Richard agrees, then it LGTM.


Ping.  Would it be OK to commit this with the two LGTMs?  I am around to fix 
any fall-outs or post-commit reviews from Richard.


https://reviews.llvm.org/D23284



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23284: Add -Rpass-with-hotness

2016-08-26 Thread Adam Nemet via cfe-commits
anemet added a comment.

@dnovillo or @rsmith, can you please confirm if you agree that this new option 
-Rpass-with-hotness should not be part of R_group.  R_group options 
enable/disable groups of remarks whereas this one is only modifying the text of 
the remarks.  Thanks!


https://reviews.llvm.org/D23284



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r279608 - [Pragma] Clear loop distribution attribute between loops

2016-08-23 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Aug 23 23:31:56 2016
New Revision: 279608

URL: http://llvm.org/viewvc/llvm-project?rev=279608=rev
Log:
[Pragma] Clear loop distribution attribute between loops

Added:
cfe/trunk/test/CodeGenCXX/pragma-loop-distribute.cpp
Modified:
cfe/trunk/lib/CodeGen/CGLoopInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGLoopInfo.cpp?rev=279608=279607=279608=diff
==
--- cfe/trunk/lib/CodeGen/CGLoopInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGLoopInfo.cpp Tue Aug 23 23:31:56 2016
@@ -112,6 +112,7 @@ void LoopAttributes::clear() {
   UnrollCount = 0;
   VectorizeEnable = LoopAttributes::Unspecified;
   UnrollEnable = LoopAttributes::Unspecified;
+  DistributeEnable = LoopAttributes::Unspecified;
 }
 
 LoopInfo::LoopInfo(BasicBlock *Header, const LoopAttributes ,

Added: cfe/trunk/test/CodeGenCXX/pragma-loop-distribute.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pragma-loop-distribute.cpp?rev=279608=auto
==
--- cfe/trunk/test/CodeGenCXX/pragma-loop-distribute.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/pragma-loop-distribute.cpp Tue Aug 23 23:31:56 
2016
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm -o - %s | 
FileCheck %s
+
+void while_test(int *List, int Length, int *List2, int Length2) {
+  // CHECK: define {{.*}} @_Z10while_test
+  int i = 0;
+
+#pragma clang loop distribute(enable)
+  while (i < Length) {
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP_1:.*]]
+List[i] = i * 2;
+i++;
+  }
+
+  i = 0;
+  while (i < Length2) {
+// CHECK-NOT: br label {{.*}}, !llvm.loop
+List2[i] = i * 2;
+i++;
+  }
+}
+
+// CHECK: ![[LOOP_1]] = distinct !{![[LOOP_1]], ![[DISTRIBUTE_ENABLE:.*]]}
+// CHECK: ![[DISTRIBUTE_ENABLE]] = !{!"llvm.loop.distribute.enable", i1 true}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23284: Add -Rpass-with-hotness

2016-08-10 Thread Adam Nemet via cfe-commits
anemet updated this revision to Diff 67653.
anemet added a comment.

Since -Rpass-with-hotness is not part of R_group, we need to manually forward
it to clang -cc1.  I've also extended the test to cover this bug.


https://reviews.llvm.org/D23284

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/CodeGenAction.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Frontend/Inputs/optimization-remark-with-hotness.proftext
  test/Frontend/optimization-remark-with-hotness.c

Index: test/Frontend/optimization-remark-with-hotness.c
===
--- /dev/null
+++ test/Frontend/optimization-remark-with-hotness.c
@@ -0,0 +1,45 @@
+// RUN: llvm-profdata merge \
+// RUN: %S/Inputs/optimization-remark-with-hotness.proftext   \
+// RUN: -o %t.profdata
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline -Rpass-with-hotness -verify
+// The clang version of the previous test.
+// RUN: %clang -target x86_64-apple-macosx10.9 %s -o /dev/null \
+// RUN: -fprofile-instr-use=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline -Rpass-with-hotness -Xclang -verify
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline 2>&1 | FileCheck -check-prefix=HOTNESS_OFF %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline -Rno-pass-with-hotness  2>&1 | FileCheck \
+// RUN: -check-prefix=HOTNESS_OFF %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -Rpass=inline -Rpass-analysis=inline -Rpass-with-hotness  2>&1 \
+// RUN: | FileCheck -check-prefix=NO_PGO %s
+
+int foo(int x, int y) __attribute__((always_inline));
+int foo(int x, int y) { return x + y; }
+
+int sum = 0;
+
+void bar(int x) {
+  // HOTNESS_OFF: foo inlined into bar
+  // HOTNESS_OFF-NOT: hotness:
+  // NO_PGO: '-Rpass-with-hotness' requires profile-guided optimization information
+  // expected-remark@+2 {{foo should always be inlined (cost=always) (hotness: 30)}}
+  // expected-remark@+1 {{foo inlined into bar (hotness: 30)}}
+  sum += foo(x, x - 2);
+}
+
+int main(int argc, const char *argv[]) {
+  for (int i = 0; i < 30; i++)
+// expected-remark@+1 {{bar should never be inlined}}
+bar(argc);
+  return sum;
+}
Index: test/Frontend/Inputs/optimization-remark-with-hotness.proftext
===
--- /dev/null
+++ test/Frontend/Inputs/optimization-remark-with-hotness.proftext
@@ -0,0 +1,25 @@
+foo
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+30
+
+bar
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+30
+
+main
+# Func Hash:
+4
+# Num Counters:
+2
+# Counter Values:
+1
+30
+
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -822,6 +822,13 @@
 NeedLocTracking = true;
   }
 
+  Opts.PassRemarksWithHotness =
+  Args.hasFlag(options::OPT_Rpass_with_hotness,
+   options::OPT_Rno_pass_with_hotness, /*default*/ false);
+  if (Opts.PassRemarksWithHotness &&
+  Opts.getProfileUse() == CodeGenOptions::ProfileNone)
+Diags.Report(diag::warn_drv_rpass_with_hotness_requires_pgo);
+
   // If the user requested to use a sample profile for PGO, then the
   // backend will need to track source location information so the profile
   // can be incorporated into the IR.
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4837,6 +4837,10 @@
   claimNoWarnArgs(Args);
 
   Args.AddAllArgs(CmdArgs, options::OPT_R_Group);
+  if (Args.hasFlag(options::OPT_Rpass_with_hotness,
+   options::OPT_Rno_pass_with_hotness, false))
+CmdArgs.push_back("-Rpass-with-hotness");
+
   Args.AddAllArgs(CmdArgs, options::OPT_W_Group);
   if (Args.hasFlag(options::OPT_pedantic, options::OPT_no_pedantic, false))
 CmdArgs.push_back("-pedantic");
Index: lib/CodeGen/CodeGenAction.cpp
===
--- lib/CodeGen/CodeGenAction.cpp
+++ lib/CodeGen/CodeGenAction.cpp
@@ -179,6 +179,7 @@
   Ctx.getDiagnosticHandler();
   void 

Re: [PATCH] D23284: Add -Rpass-with-hotness

2016-08-09 Thread Adam Nemet via cfe-commits
anemet added reviewers: dnovillo, rsmith.
anemet marked an inline comment as done.
anemet added subscribers: dnovillo, rsmith.
anemet added a comment.

Add more reviewers suggested by Aaron.  @dnovillo, @rsmith, is my thinking 
correct that this new flag does not belong to the R_Group.


https://reviews.llvm.org/D23284



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23284: Add -Rpass-with-hotness

2016-08-09 Thread Adam Nemet via cfe-commits
anemet updated this revision to Diff 67379.
anemet added a comment.

Address Aaron's comment


https://reviews.llvm.org/D23284

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/CodeGenAction.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Frontend/Inputs/optimization-remark-with-hotness.proftext
  test/Frontend/optimization-remark-with-hotness.c

Index: test/Frontend/optimization-remark-with-hotness.c
===
--- /dev/null
+++ test/Frontend/optimization-remark-with-hotness.c
@@ -0,0 +1,41 @@
+// RUN: llvm-profdata merge \
+// RUN: %S/Inputs/optimization-remark-with-hotness.proftext   \
+// RUN: -o %t.profdata
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline -Rpass-with-hotness -verify
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline 2>&1 | FileCheck -check-prefix=HOTNESS_OFF %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline -Rno-pass-with-hotness  2>&1 | FileCheck \
+// RUN: -check-prefix=HOTNESS_OFF %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -Rpass=inline -Rpass-analysis=inline -Rpass-with-hotness  2>&1 \
+// RUN: | FileCheck -check-prefix=NO_PGO %s
+
+int foo(int x, int y) __attribute__((always_inline));
+int foo(int x, int y) { return x + y; }
+
+int sum = 0;
+
+void bar(int x) {
+  // HOTNESS_OFF: foo inlined into bar
+  // HOTNESS_OFF-NOT: hotness:
+  // NO_PGO: '-Rpass-with-hotness' requires profile-guided optimization information
+  // expected-remark@+2 {{foo should always be inlined (cost=always) (hotness: 30)}}
+  // expected-remark@+1 {{foo inlined into bar (hotness: 30)}}
+  sum += foo(x, x - 2);
+}
+
+int main(int argc, const char *argv[]) {
+  for (int i = 0; i < 30; i++)
+// expected-remark@+1 {{bar should never be inlined}}
+bar(argc);
+  return sum;
+}
Index: test/Frontend/Inputs/optimization-remark-with-hotness.proftext
===
--- /dev/null
+++ test/Frontend/Inputs/optimization-remark-with-hotness.proftext
@@ -0,0 +1,25 @@
+foo
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+30
+
+bar
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+30
+
+main
+# Func Hash:
+4
+# Num Counters:
+2
+# Counter Values:
+1
+30
+
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -818,6 +818,13 @@
 NeedLocTracking = true;
   }
 
+  Opts.PassRemarksWithHotness =
+  Args.hasFlag(options::OPT_Rpass_with_hotness,
+   options::OPT_Rno_pass_with_hotness, /*default*/ false);
+  if (Opts.PassRemarksWithHotness &&
+  Opts.getProfileUse() == CodeGenOptions::ProfileNone)
+Diags.Report(diag::warn_drv_rpass_with_hotness_requires_pgo);
+
   // If the user requested to use a sample profile for PGO, then the
   // backend will need to track source location information so the profile
   // can be incorporated into the IR.
Index: lib/CodeGen/CodeGenAction.cpp
===
--- lib/CodeGen/CodeGenAction.cpp
+++ lib/CodeGen/CodeGenAction.cpp
@@ -179,6 +179,7 @@
   Ctx.getDiagnosticHandler();
   void *OldDiagnosticContext = Ctx.getDiagnosticContext();
   Ctx.setDiagnosticHandler(DiagnosticHandler, this);
+  Ctx.setDiagnosticHotnessRequested(CodeGenOpts.PassRemarksWithHotness);
 
   // Link LinkModule into this module if present, preserving its validity.
   for (auto  : LinkModules) {
@@ -511,9 +512,16 @@
   FullSourceLoc Loc = getBestLocationFromDebugLoc(D, BadDebugInfo, Filename,
   Line, Column);
 
+  std::string Msg;
+  raw_string_ostream MsgStream(Msg);
+  MsgStream << D.getMsg().str();
+
+  if (D.getHotness())
+MsgStream << " (hotness: " << *D.getHotness() << ")";
+
   Diags.Report(Loc, DiagID)
   << AddFlagValue(D.getPassName() ? D.getPassName() : "")
-  << D.getMsg().str();
+  << MsgStream.str();
 
   if (BadDebugInfo)
 // If we were not able to translate the file:line:col information
Index: include/clang/Frontend/CodeGenOptions.def
===

[PATCH] D23284: Add -Rpass-with-hotness

2016-08-08 Thread Adam Nemet via cfe-commits
anemet created this revision.
anemet added reviewers: hfinkel, rjmccall, aaron.ballman.
anemet added a subscriber: cfe-commits.

I've recently added the ability for optimization remarks to include the
hotness of the corresponding code region.  This uses PGO and allows
filtering of the optimization remarks by relevance.  The idea was first
discussed here:
http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334

The general goal is to produce a YAML file with the remarks.  Then, an
external tool could dynamically filter these by hotness and perhaps by
other things.

That said it makes sense to also expose this at the more basic level
where we just include the hotness info with each optimization remark.
For example, in D22694, the clang flag was pretty useful to measure the
overhead of the additional analyses required to include hotness.
(Without the flag we don't even run the analyses.)

For the record, Hal has already expressed support for the idea of this
patch on IRC.

I didn't make -R{,no-}pass-with-hotness member of Group.
I *think* that this is right because unlike other -Rpass flags this one
does not enable any remark group, so it shouldn't be processed by
ProcessWarningOptions.

https://reviews.llvm.org/D23284

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/CodeGenAction.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Frontend/Inputs/optimization-remark-with-hotness.proftext
  test/Frontend/optimization-remark-with-hotness.c

Index: test/Frontend/optimization-remark-with-hotness.c
===
--- /dev/null
+++ test/Frontend/optimization-remark-with-hotness.c
@@ -0,0 +1,41 @@
+// RUN: llvm-profdata merge \
+// RUN: %S/Inputs/optimization-remark-with-hotness.proftext   \
+// RUN: -o %t.profdata
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline -Rpass-with-hotness -verify
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline 2>&1 | FileCheck -check-prefix=HOTNESS_OFF %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
+// RUN: -Rpass-analysis=inline -Rno-pass-with-hotness  2>&1 | FileCheck \
+// RUN: -check-prefix=HOTNESS_OFF %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
+// RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
+// RUN: -Rpass=inline -Rpass-analysis=inline -Rpass-with-hotness  2>&1 \
+// RUN: | FileCheck -check-prefix=NO_PGO %s
+
+int foo(int x, int y) __attribute__((always_inline));
+int foo(int x, int y) { return x + y; }
+
+int sum = 0;
+
+void bar(int x) {
+  // HOTNESS_OFF: foo inlined into bar
+  // HOTNESS_OFF-NOT: hotness:
+  // NO_PGO: '-Rpass-with-hotness' requires profile information
+  // expected-remark@+2 {{foo should always be inlined (cost=always) (hotness: 30)}}
+  // expected-remark@+1 {{foo inlined into bar (hotness: 30)}}
+  sum += foo(x, x - 2);
+}
+
+int main(int argc, const char *argv[]) {
+  for (int i = 0; i < 30; i++)
+// expected-remark@+1 {{bar should never be inlined}}
+bar(argc);
+  return sum;
+}
Index: test/Frontend/Inputs/optimization-remark-with-hotness.proftext
===
--- /dev/null
+++ test/Frontend/Inputs/optimization-remark-with-hotness.proftext
@@ -0,0 +1,25 @@
+foo
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+30
+
+bar
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+30
+
+main
+# Func Hash:
+4
+# Num Counters:
+2
+# Counter Values:
+1
+30
+
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -818,6 +818,14 @@
 NeedLocTracking = true;
   }
 
+  Opts.PassRemarksWithHotness =
+  Args.hasFlag(options::OPT_Rpass_with_hotness,
+   options::OPT_Rno_pass_with_hotness, /*default*/ false);
+  if (Opts.PassRemarksWithHotness &&
+  Opts.getProfileUse() == CodeGenOptions::ProfileNone)
+Diags.Report(diag::warn_drv_argument_requires) << "-Rpass-with-hotness"
+   << "profile information";
+
   // If the user requested to use a sample profile for PGO, then the
   // backend will need to track source location information so the profile
   // can be incorporated into the IR.
Index: 

r274101 - [Diag] Add getter shouldAlwaysPrint. NFC

2016-06-28 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Jun 28 23:55:31 2016
New Revision: 274101

URL: http://llvm.org/viewvc/llvm-project?rev=274101=rev
Log:
[Diag] Add getter shouldAlwaysPrint. NFC

For the new hotness attribute, the API will take the pass rather than
the pass name so we can no longer play the trick of AlwaysPrint being a
special pass name. This adds a getter to help the transition.

There is also a corresponding llvm patch.

Modified:
cfe/trunk/lib/CodeGen/CodeGenAction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=274101=274100=274101=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Tue Jun 28 23:55:31 2016
@@ -535,7 +535,7 @@ void BackendConsumer::OptimizationRemark
   // llvm::DiagnosticInfo::AlwasyPrint or if the -Rpass-analysis flag has a
   // regular expression that matches the name of the pass name in \p D.
 
-  if (D.getPassName() == llvm::DiagnosticInfo::AlwaysPrint ||
+  if (D.shouldAlwaysPrint() ||
   (CodeGenOpts.OptimizationRemarkAnalysisPattern &&
CodeGenOpts.OptimizationRemarkAnalysisPattern->match(D.getPassName(
 EmitOptimizationMessage(
@@ -548,7 +548,7 @@ void BackendConsumer::OptimizationRemark
   // llvm::DiagnosticInfo::AlwasyPrint or if the -Rpass-analysis flag has a
   // regular expression that matches the name of the pass name in \p D.
 
-  if (D.getPassName() == llvm::DiagnosticInfo::AlwaysPrint ||
+  if (D.shouldAlwaysPrint() ||
   (CodeGenOpts.OptimizationRemarkAnalysisPattern &&
CodeGenOpts.OptimizationRemarkAnalysisPattern->match(D.getPassName(
 EmitOptimizationMessage(
@@ -561,7 +561,7 @@ void BackendConsumer::OptimizationRemark
   // llvm::DiagnosticInfo::AlwasyPrint or if the -Rpass-analysis flag has a
   // regular expression that matches the name of the pass name in \p D.
 
-  if (D.getPassName() == llvm::DiagnosticInfo::AlwaysPrint ||
+  if (D.shouldAlwaysPrint() ||
   (CodeGenOpts.OptimizationRemarkAnalysisPattern &&
CodeGenOpts.OptimizationRemarkAnalysisPattern->match(D.getPassName(
 EmitOptimizationMessage(


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21773: [clang] Update an optimization remark test for change D18777

2016-06-28 Thread Adam Nemet via cfe-commits
anemet added a comment.

In http://reviews.llvm.org/D21773#469596, @lihuang wrote:

> IV is promoted to 64-bit but the trunc/zext cannot be eliminated (at least 
> cannot be eliminated with the -O1 pass pipeline). Then optimzation remark 
> becomes:
>
>   optimization-remark-options.c:17:3: remark: loop not vectorized: cannot 
> identify array bounds
>  [-Rpass-analysis=loop-vectorize]
>   for (int i = 0; i < N; i++) {


That sounds like an optimization regression.  It seems to me that you could 
create a testcase with fewer arrays than in the above test such that you don't 
exceed the max number of memchecks.  This new testcase would be vectorized 
before http://reviews.llvm.org/D18777 but not after.

Adam


http://reviews.llvm.org/D21773



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21773: [clang] Update an optimization remark test for change D18777

2016-06-28 Thread Adam Nemet via cfe-commits
anemet added a comment.

> This test checks the loop-vectorization remarks when pointer checking 
> threshold is exceeded. The change in http://reviews.llvm.org/D18777 would 
> introduce zexts that cannot be removed so that the "loop not vectorized" 
> reason is changed, hence breaking this test.


Can you please elaborate?  The "loop not vectorized" reason is changed, to what?


http://reviews.llvm.org/D21773



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r272656 - Add loop pragma for Loop Distribution

2016-06-14 Thread Adam Nemet via cfe-commits
r272699 should do it.

> On Jun 14, 2016, at 9:32 PM, Adam Nemet via cfe-commits 
> <cfe-commits@lists.llvm.org> wrote:
> 
> On it, sorry about it.
> 
>> On Jun 14, 2016, at 4:51 PM, Rafael Espíndola <rafael.espind...@gmail.com> 
>> wrote:
>> 
>> Looks like this broke the docs:
>> http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/14690/steps/docs-clang-html/logs/stdio
>> 
>> Cheers,
>> Rafael
>> 
>> 
>> On 14 June 2016 at 08:04, Adam Nemet via cfe-commits
>> <cfe-commits@lists.llvm.org> wrote:
>>> Author: anemet
>>> Date: Tue Jun 14 07:04:26 2016
>>> New Revision: 272656
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=272656=rev
>>> Log:
>>> Add loop pragma for Loop Distribution
>>> 
>>> Summary:
>>> This is similar to other loop pragmas like 'vectorize'.  Currently it
>>> only has state values: distribute(enable) and distribute(disable).  When
>>> one of these is specified the corresponding loop metadata is generated:
>>> 
>>> !{!"llvm.loop.distribute.enable", i1 true/false}
>>> 
>>> As a result, loop distribution will be attempted on the loop even if
>>> Loop Distribution in not enabled globally.  Analogously, with 'disable'
>>> distribution can be turned off for an individual loop even when the pass
>>> is otherwise enabled.
>>> 
>>> There are some slight differences compared to the existing loop pragmas.
>>> 
>>> 1. There is no 'assume_safety' variant which makes its handling slightly
>>> different from 'vectorize'/'interleave'.
>>> 
>>> 2. Unlike the existing loop pragmas, it does not have a corresponding
>>> numeric pragma like 'vectorize' -> 'vectorize_width'.  So for the
>>> consistency checks in CheckForIncompatibleAttributes we don't need to
>>> check it against other pragmas.  We just need to check for duplicates of
>>> the same pragma.
>>> 
>>> Reviewers: rsmith, dexonsmith, aaron.ballman
>>> 
>>> Subscribers: bob.wilson, cfe-commits, hfinkel
>>> 
>>> Differential Revision: http://reviews.llvm.org/D19403
>>> 
>>> Modified:
>>>   cfe/trunk/docs/LanguageExtensions.rst
>>>   cfe/trunk/include/clang/Basic/Attr.td
>>>   cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
>>>   cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
>>>   cfe/trunk/lib/CodeGen/CGLoopInfo.h
>>>   cfe/trunk/lib/Parse/ParsePragma.cpp
>>>   cfe/trunk/lib/Sema/SemaStmtAttr.cpp
>>>   cfe/trunk/test/CodeGenCXX/pragma-loop.cpp
>>>   cfe/trunk/test/Misc/ast-print-pragmas.cpp
>>>   cfe/trunk/test/PCH/pragma-loop.cpp
>>>   cfe/trunk/test/Parser/pragma-loop-safety.cpp
>>>   cfe/trunk/test/Parser/pragma-loop.cpp
>>> 
>>> Modified: cfe/trunk/docs/LanguageExtensions.rst
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=272656=272655=272656=diff
>>> ==
>>> --- cfe/trunk/docs/LanguageExtensions.rst (original)
>>> +++ cfe/trunk/docs/LanguageExtensions.rst Tue Jun 14 07:04:26 2016
>>> @@ -2050,9 +2050,9 @@ Extensions for loop hint optimizations
>>> 
>>> The ``#pragma clang loop`` directive is used to specify hints for 
>>> optimizing the
>>> subsequent for, while, do-while, or c++11 range-based for loop. The 
>>> directive
>>> -provides options for vectorization, interleaving, and unrolling. Loop 
>>> hints can
>>> -be specified before any loop and will be ignored if the optimization is 
>>> not safe
>>> -to apply.
>>> +provides options for vectorization, interleaving, unrolling and
>>> +distribution. Loop hints can be specified before any loop and will be 
>>> ignored if
>>> +the optimization is not safe to apply.
>>> 
>>> Vectorization and Interleaving
>>> --
>>> @@ -2147,6 +2147,38 @@ to the same code size limit as with ``un
>>> 
>>> Unrolling of a loop can be prevented by specifying ``unroll(disable)``.
>>> 
>>> +Loop Distribution
>>> +-
>>> +
>>> +Loop Distribution allows splitting a loop into multiple loops.  This is
>>> +beneficial for example when the entire loop cannot be vectorized but some 
>>> of the
>>> +resulting loops can.
>>> +
>>> +If ``distribute(enable))''

r272699 - Fix documentation bot after r272656

2016-06-14 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Jun 14 14:33:16 2016
New Revision: 272699

URL: http://llvm.org/viewvc/llvm-project?rev=272699=rev
Log:
Fix documentation bot after r272656

Modified:
cfe/trunk/docs/LanguageExtensions.rst

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=272699=272698=272699=diff
==
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Tue Jun 14 14:33:16 2016
@@ -2154,7 +2154,7 @@ Loop Distribution allows splitting a loo
 beneficial for example when the entire loop cannot be vectorized but some of 
the
 resulting loops can.
 
-If ``distribute(enable))'' is specified and the loop has memory dependencies
+If ``distribute(enable))`` is specified and the loop has memory dependencies
 that inhibit vectorization, the compiler will attempt to isolate the offending
 operations into a new loop.  This optimization is not enabled by default, only
 loops marked with the pragma are considered.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r272656 - Add loop pragma for Loop Distribution

2016-06-14 Thread Adam Nemet via cfe-commits
On it, sorry about it.

> On Jun 14, 2016, at 4:51 PM, Rafael Espíndola <rafael.espind...@gmail.com> 
> wrote:
> 
> Looks like this broke the docs:
> http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/14690/steps/docs-clang-html/logs/stdio
> 
> Cheers,
> Rafael
> 
> 
> On 14 June 2016 at 08:04, Adam Nemet via cfe-commits
> <cfe-commits@lists.llvm.org> wrote:
>> Author: anemet
>> Date: Tue Jun 14 07:04:26 2016
>> New Revision: 272656
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=272656=rev
>> Log:
>> Add loop pragma for Loop Distribution
>> 
>> Summary:
>> This is similar to other loop pragmas like 'vectorize'.  Currently it
>> only has state values: distribute(enable) and distribute(disable).  When
>> one of these is specified the corresponding loop metadata is generated:
>> 
>>  !{!"llvm.loop.distribute.enable", i1 true/false}
>> 
>> As a result, loop distribution will be attempted on the loop even if
>> Loop Distribution in not enabled globally.  Analogously, with 'disable'
>> distribution can be turned off for an individual loop even when the pass
>> is otherwise enabled.
>> 
>> There are some slight differences compared to the existing loop pragmas.
>> 
>> 1. There is no 'assume_safety' variant which makes its handling slightly
>> different from 'vectorize'/'interleave'.
>> 
>> 2. Unlike the existing loop pragmas, it does not have a corresponding
>> numeric pragma like 'vectorize' -> 'vectorize_width'.  So for the
>> consistency checks in CheckForIncompatibleAttributes we don't need to
>> check it against other pragmas.  We just need to check for duplicates of
>> the same pragma.
>> 
>> Reviewers: rsmith, dexonsmith, aaron.ballman
>> 
>> Subscribers: bob.wilson, cfe-commits, hfinkel
>> 
>> Differential Revision: http://reviews.llvm.org/D19403
>> 
>> Modified:
>>cfe/trunk/docs/LanguageExtensions.rst
>>cfe/trunk/include/clang/Basic/Attr.td
>>cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
>>cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
>>cfe/trunk/lib/CodeGen/CGLoopInfo.h
>>cfe/trunk/lib/Parse/ParsePragma.cpp
>>cfe/trunk/lib/Sema/SemaStmtAttr.cpp
>>cfe/trunk/test/CodeGenCXX/pragma-loop.cpp
>>cfe/trunk/test/Misc/ast-print-pragmas.cpp
>>cfe/trunk/test/PCH/pragma-loop.cpp
>>cfe/trunk/test/Parser/pragma-loop-safety.cpp
>>cfe/trunk/test/Parser/pragma-loop.cpp
>> 
>> Modified: cfe/trunk/docs/LanguageExtensions.rst
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=272656=272655=272656=diff
>> ==
>> --- cfe/trunk/docs/LanguageExtensions.rst (original)
>> +++ cfe/trunk/docs/LanguageExtensions.rst Tue Jun 14 07:04:26 2016
>> @@ -2050,9 +2050,9 @@ Extensions for loop hint optimizations
>> 
>> The ``#pragma clang loop`` directive is used to specify hints for optimizing 
>> the
>> subsequent for, while, do-while, or c++11 range-based for loop. The directive
>> -provides options for vectorization, interleaving, and unrolling. Loop hints 
>> can
>> -be specified before any loop and will be ignored if the optimization is not 
>> safe
>> -to apply.
>> +provides options for vectorization, interleaving, unrolling and
>> +distribution. Loop hints can be specified before any loop and will be 
>> ignored if
>> +the optimization is not safe to apply.
>> 
>> Vectorization and Interleaving
>> --
>> @@ -2147,6 +2147,38 @@ to the same code size limit as with ``un
>> 
>> Unrolling of a loop can be prevented by specifying ``unroll(disable)``.
>> 
>> +Loop Distribution
>> +-
>> +
>> +Loop Distribution allows splitting a loop into multiple loops.  This is
>> +beneficial for example when the entire loop cannot be vectorized but some 
>> of the
>> +resulting loops can.
>> +
>> +If ``distribute(enable))'' is specified and the loop has memory dependencies
>> +that inhibit vectorization, the compiler will attempt to isolate the 
>> offending
>> +operations into a new loop.  This optimization is not enabled by default, 
>> only
>> +loops marked with the pragma are considered.
>> +
>> +.. code-block:: c++
>> +
>> +  #pragma clang loop distribute(enable)
>> +  for (i = 0; i < N; ++i) {
>> +S1: A[i + 1] = A[i] + B[i];
>> +S2: C[i] = D[i] * E[i];
>> +  }
>> +
>

Re: [PATCH] D19403: Add loop pragma for Loop Distribution

2016-06-14 Thread Adam Nemet via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272656: Add loop pragma for Loop Distribution (authored by 
anemet).

Changed prior to commit:
  http://reviews.llvm.org/D19403?vs=55445=60665#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19403

Files:
  cfe/trunk/docs/LanguageExtensions.rst
  cfe/trunk/include/clang/Basic/Attr.td
  cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
  cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
  cfe/trunk/lib/CodeGen/CGLoopInfo.h
  cfe/trunk/lib/Parse/ParsePragma.cpp
  cfe/trunk/lib/Sema/SemaStmtAttr.cpp
  cfe/trunk/test/CodeGenCXX/pragma-loop.cpp
  cfe/trunk/test/Misc/ast-print-pragmas.cpp
  cfe/trunk/test/PCH/pragma-loop.cpp
  cfe/trunk/test/Parser/pragma-loop-safety.cpp
  cfe/trunk/test/Parser/pragma-loop.cpp

Index: cfe/trunk/docs/LanguageExtensions.rst
===
--- cfe/trunk/docs/LanguageExtensions.rst
+++ cfe/trunk/docs/LanguageExtensions.rst
@@ -2050,9 +2050,9 @@
 
 The ``#pragma clang loop`` directive is used to specify hints for optimizing the
 subsequent for, while, do-while, or c++11 range-based for loop. The directive
-provides options for vectorization, interleaving, and unrolling. Loop hints can
-be specified before any loop and will be ignored if the optimization is not safe
-to apply.
+provides options for vectorization, interleaving, unrolling and
+distribution. Loop hints can be specified before any loop and will be ignored if
+the optimization is not safe to apply.
 
 Vectorization and Interleaving
 --
@@ -2147,6 +2147,38 @@
 
 Unrolling of a loop can be prevented by specifying ``unroll(disable)``.
 
+Loop Distribution
+-
+
+Loop Distribution allows splitting a loop into multiple loops.  This is
+beneficial for example when the entire loop cannot be vectorized but some of the
+resulting loops can.
+
+If ``distribute(enable))'' is specified and the loop has memory dependencies
+that inhibit vectorization, the compiler will attempt to isolate the offending
+operations into a new loop.  This optimization is not enabled by default, only
+loops marked with the pragma are considered.
+
+.. code-block:: c++
+
+  #pragma clang loop distribute(enable)
+  for (i = 0; i < N; ++i) {
+S1: A[i + 1] = A[i] + B[i];
+S2: C[i] = D[i] * E[i];
+  }
+
+This loop will be split into two loops between statements S1 and S2.  The
+second loop containing S2 will be vectorized.
+
+Loop Distribution is currently not enabled by default in the optimizer because
+it can hurt performance in some cases.  For example, instruction-level
+parallelism could be reduced by sequentializing the execution of the
+statements S1 and S2 above.
+
+If Loop Distribution is turned on globally with
+``-mllvm -enable-loop-distribution``, specifying ``distribute(disable)`` can
+be used the disable it on a per-loop basis.
+
 Additional Information
 --
 
Index: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
@@ -977,12 +977,12 @@
 // Pragma loop support.
 def err_pragma_loop_missing_argument : Error<
   "missing argument; expected %select{an integer value|"
-  "'enable', %select{'assume_safety'|'full'}1 or 'disable'}0">;
+  "'enable'%select{|, 'full'}1%select{|, 'assume_safety'}2 or 'disable'}0">;
 def err_pragma_loop_invalid_option : Error<
   "%select{invalid|missing}0 option%select{ %1|}0; expected vectorize, "
-  "vectorize_width, interleave, interleave_count, unroll, or unroll_count">;
+  "vectorize_width, interleave, interleave_count, unroll, unroll_count, or distribute">;
 def err_pragma_invalid_keyword : Error<
-  "invalid argument; expected 'enable', %select{'assume_safety'|'full'}0 or 'disable'">;
+  "invalid argument; expected 'enable'%select{|, 'full'}0%select{|, 'assume_safety'}1 or 'disable'">;
 
 // Pragma unroll support.
 def warn_pragma_unroll_cuda_value_in_parens : Warning<
Index: cfe/trunk/include/clang/Basic/Attr.td
===
--- cfe/trunk/include/clang/Basic/Attr.td
+++ cfe/trunk/include/clang/Basic/Attr.td
@@ -2186,6 +2186,7 @@
   /// interleave_count: interleaves 'Value' loop interations.
   /// unroll: fully unroll loop if State == Enable.
   /// unroll_count: unrolls loop 'Value' times.
+  /// distribute: attempt to distribute loop if State == Enable
 
   /// #pragma unroll  directive
   /// : fully unrolls loop.
@@ -2198,9 +2199,9 @@
   /// State of the loop optimization specified by the spelling.
   let Args = [EnumArgument<"Option", "OptionType",
   ["vectorize", "vectorize_width", "interleave", "interleave_count",
-   "unroll", "unroll_count"],
+   "unroll", "unroll_count", "distribute"],
  

r272656 - Add loop pragma for Loop Distribution

2016-06-14 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Jun 14 07:04:26 2016
New Revision: 272656

URL: http://llvm.org/viewvc/llvm-project?rev=272656=rev
Log:
Add loop pragma for Loop Distribution

Summary:
This is similar to other loop pragmas like 'vectorize'.  Currently it
only has state values: distribute(enable) and distribute(disable).  When
one of these is specified the corresponding loop metadata is generated:

  !{!"llvm.loop.distribute.enable", i1 true/false}

As a result, loop distribution will be attempted on the loop even if
Loop Distribution in not enabled globally.  Analogously, with 'disable'
distribution can be turned off for an individual loop even when the pass
is otherwise enabled.

There are some slight differences compared to the existing loop pragmas.

1. There is no 'assume_safety' variant which makes its handling slightly
different from 'vectorize'/'interleave'.

2. Unlike the existing loop pragmas, it does not have a corresponding
numeric pragma like 'vectorize' -> 'vectorize_width'.  So for the
consistency checks in CheckForIncompatibleAttributes we don't need to
check it against other pragmas.  We just need to check for duplicates of
the same pragma.

Reviewers: rsmith, dexonsmith, aaron.ballman

Subscribers: bob.wilson, cfe-commits, hfinkel

Differential Revision: http://reviews.llvm.org/D19403

Modified:
cfe/trunk/docs/LanguageExtensions.rst
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
cfe/trunk/lib/CodeGen/CGLoopInfo.h
cfe/trunk/lib/Parse/ParsePragma.cpp
cfe/trunk/lib/Sema/SemaStmtAttr.cpp
cfe/trunk/test/CodeGenCXX/pragma-loop.cpp
cfe/trunk/test/Misc/ast-print-pragmas.cpp
cfe/trunk/test/PCH/pragma-loop.cpp
cfe/trunk/test/Parser/pragma-loop-safety.cpp
cfe/trunk/test/Parser/pragma-loop.cpp

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=272656=272655=272656=diff
==
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Tue Jun 14 07:04:26 2016
@@ -2050,9 +2050,9 @@ Extensions for loop hint optimizations
 
 The ``#pragma clang loop`` directive is used to specify hints for optimizing 
the
 subsequent for, while, do-while, or c++11 range-based for loop. The directive
-provides options for vectorization, interleaving, and unrolling. Loop hints can
-be specified before any loop and will be ignored if the optimization is not 
safe
-to apply.
+provides options for vectorization, interleaving, unrolling and
+distribution. Loop hints can be specified before any loop and will be ignored 
if
+the optimization is not safe to apply.
 
 Vectorization and Interleaving
 --
@@ -2147,6 +2147,38 @@ to the same code size limit as with ``un
 
 Unrolling of a loop can be prevented by specifying ``unroll(disable)``.
 
+Loop Distribution
+-
+
+Loop Distribution allows splitting a loop into multiple loops.  This is
+beneficial for example when the entire loop cannot be vectorized but some of 
the
+resulting loops can.
+
+If ``distribute(enable))'' is specified and the loop has memory dependencies
+that inhibit vectorization, the compiler will attempt to isolate the offending
+operations into a new loop.  This optimization is not enabled by default, only
+loops marked with the pragma are considered.
+
+.. code-block:: c++
+
+  #pragma clang loop distribute(enable)
+  for (i = 0; i < N; ++i) {
+S1: A[i + 1] = A[i] + B[i];
+S2: C[i] = D[i] * E[i];
+  }
+
+This loop will be split into two loops between statements S1 and S2.  The
+second loop containing S2 will be vectorized.
+
+Loop Distribution is currently not enabled by default in the optimizer because
+it can hurt performance in some cases.  For example, instruction-level
+parallelism could be reduced by sequentializing the execution of the
+statements S1 and S2 above.
+
+If Loop Distribution is turned on globally with
+``-mllvm -enable-loop-distribution``, specifying ``distribute(disable)`` can
+be used the disable it on a per-loop basis.
+
 Additional Information
 --
 

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=272656=272655=272656=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Tue Jun 14 07:04:26 2016
@@ -2186,6 +2186,7 @@ def LoopHint : Attr {
   /// interleave_count: interleaves 'Value' loop interations.
   /// unroll: fully unroll loop if State == Enable.
   /// unroll_count: unrolls loop 'Value' times.
+  /// distribute: attempt to distribute loop if State == Enable
 
   /// #pragma unroll  directive
   /// : fully unrolls loop.
@@ -2198,9 +2199,9 @@ def 

Re: [PATCH] D19403: Add loop pragma for Loop Distribution

2016-06-13 Thread Adam Nemet via cfe-commits
anemet added a comment.

Thanks, Aaron!


http://reviews.llvm.org/D19403



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19403: Add loop pragma for Loop Distribution

2016-06-13 Thread Adam Nemet via cfe-commits
anemet added a comment.

Ping^3


http://reviews.llvm.org/D19403



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19403: Add loop pragma for Loop Distribution

2016-05-02 Thread Adam Nemet via cfe-commits
anemet added a comment.

@rsmith, hi!  Do you have any comments on this or you're OK with this per 
Aaron's LGTM?

Thanks,
Adam


http://reviews.llvm.org/D19403



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19678: Annotated-source optimization reports (a.k.a. "listing" files)

2016-04-28 Thread Adam Nemet via cfe-commits
anemet added inline comments.


Comment at: lib/CodeGen/CodeGenAction.cpp:734-737
@@ +733,6 @@
+
+  OS << llvm::format_decimal(L + 1, LNDigits) << " ";
+  OS << (LLI.Inlined.Transformed && InlinedCols < 2 ? "I" : " ");
+  OS << (LLI.Unrolled.Transformed && UnrolledCols < 2 ? "U" : " ");
+  OS << (LLI.Vectorized.Transformed && VectorizedCols < 2 ? "V" : " ");
+

Should the abbreviation be somehow part of the optimization remark API and 
passed in just like the pass name?

It would be nice if someone added optimization remark for a new opt, it would 
show up here automatically.  I could see how that could make the output too 
busy but at least have the option?



http://reviews.llvm.org/D19678



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19403: Add loop pragma for Loop Distribution

2016-04-28 Thread Adam Nemet via cfe-commits
anemet updated this revision to Diff 55445.
anemet added a comment.

A little tweak to the example to make it clear that 'i' is the induction
variable


http://reviews.llvm.org/D19403

Files:
  docs/LanguageExtensions.rst
  include/clang/Basic/Attr.td
  include/clang/Basic/DiagnosticParseKinds.td
  lib/CodeGen/CGLoopInfo.cpp
  lib/CodeGen/CGLoopInfo.h
  lib/Parse/ParsePragma.cpp
  lib/Sema/SemaStmtAttr.cpp
  test/CodeGenCXX/pragma-loop.cpp
  test/Misc/ast-print-pragmas.cpp
  test/PCH/pragma-loop.cpp
  test/Parser/pragma-loop-safety.cpp
  test/Parser/pragma-loop.cpp

Index: test/Parser/pragma-loop.cpp
===
--- test/Parser/pragma-loop.cpp
+++ test/Parser/pragma-loop.cpp
@@ -116,25 +116,38 @@
 VList[j] = List[j];
   }
 
+#pragma clang loop distribute(enable)
+  for (int j : VList) {
+VList[j] = List[j];
+  }
+
+#pragma clang loop distribute(disable)
+  for (int j : VList) {
+VList[j] = List[j];
+  }
+
   test_nontype_template_param<4, 8>(List, Length);
 
 /* expected-error {{expected '('}} */ #pragma clang loop vectorize
 /* expected-error {{expected '('}} */ #pragma clang loop interleave
 /* expected-error {{expected '('}} */ #pragma clang loop unroll
+/* expected-error {{expected '('}} */ #pragma clang loop distribute
 
 /* expected-error {{expected ')'}} */ #pragma clang loop vectorize(enable
 /* expected-error {{expected ')'}} */ #pragma clang loop interleave(enable
 /* expected-error {{expected ')'}} */ #pragma clang loop unroll(full
+/* expected-error {{expected ')'}} */ #pragma clang loop distribute(enable
 
 /* expected-error {{expected ')'}} */ #pragma clang loop vectorize_width(4
 /* expected-error {{expected ')'}} */ #pragma clang loop interleave_count(4
 /* expected-error {{expected ')'}} */ #pragma clang loop unroll_count(4
 
 /* expected-error {{missing argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop vectorize()
 /* expected-error {{missing argument; expected an integer value}} */ #pragma clang loop interleave_count()
 /* expected-error {{missing argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll()
+/* expected-error {{missing argument; expected 'enable' or 'disable'}} */ #pragma clang loop distribute()
 
-/* expected-error {{missing option; expected vectorize, vectorize_width, interleave, interleave_count, unroll, or unroll_count}} */ #pragma clang loop
+/* expected-error {{missing option; expected vectorize, vectorize_width, interleave, interleave_count, unroll, unroll_count, or distribute}} */ #pragma clang loop
 /* expected-error {{invalid option 'badkeyword'}} */ #pragma clang loop badkeyword
 /* expected-error {{invalid option 'badkeyword'}} */ #pragma clang loop badkeyword(enable)
 /* expected-error {{invalid option 'badkeyword'}} */ #pragma clang loop vectorize(enable) badkeyword(4)
@@ -187,6 +200,7 @@
 /* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop vectorize(badidentifier)
 /* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop interleave(badidentifier)
 /* expected-error {{invalid argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll(badidentifier)
+/* expected-error {{invalid argument; expected 'enable' or 'disable'}} */ #pragma clang loop distribute(badidentifier)
   while (i-7 < Length) {
 List[i] = i;
   }
@@ -196,6 +210,7 @@
 /* expected-error {{expected ')'}} */ #pragma clang loop vectorize(()
 /* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop interleave(*)
 /* expected-error {{invalid argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll(=)
+/* expected-error {{invalid argument; expected 'enable' or 'disable'}} */ #pragma clang loop distribute(+)
 /* expected-error {{type name requires a specifier or qualifier}} expected-error {{expected expression}} */ #pragma clang loop vectorize_width(^)
 /* expected-error {{expected expression}} expected-error {{expected expression}} */ #pragma clang loop interleave_count(/)
 /* expected-error {{expected expression}} expected-error {{expected expression}} */ #pragma clang loop unroll_count(==)
@@ -232,6 +247,8 @@
 #pragma clang loop interleave(disable)
 /* expected-error {{duplicate directives 'unroll(disable)' and 'unroll(full)'}} */ #pragma clang loop unroll(full)
 #pragma clang loop unroll(disable)
+/* expected-error {{duplicate directives 'distribute(disable)' and 'distribute(enable)'}} */ #pragma clang loop distribute(enable)
+#pragma clang loop distribute(disable)
   while (i-9 < Length) {
 List[i] = i;
   }
Index: test/Parser/pragma-loop-safety.cpp
===
--- test/Parser/pragma-loop-safety.cpp
+++ test/Parser/pragma-loop-safety.cpp
@@ -16,6 +16,7 @@
 /* expected-error {{expected ')'}} */ #pragma clang 

Re: [PATCH] D19403: Add loop pragma for Loop Distribution

2016-04-28 Thread Adam Nemet via cfe-commits
anemet updated this revision to Diff 55439.
anemet added a comment.

Added more context to the documentation per Aaron's comments.


http://reviews.llvm.org/D19403

Files:
  docs/LanguageExtensions.rst
  include/clang/Basic/Attr.td
  include/clang/Basic/DiagnosticParseKinds.td
  lib/CodeGen/CGLoopInfo.cpp
  lib/CodeGen/CGLoopInfo.h
  lib/Parse/ParsePragma.cpp
  lib/Sema/SemaStmtAttr.cpp
  test/CodeGenCXX/pragma-loop.cpp
  test/Misc/ast-print-pragmas.cpp
  test/PCH/pragma-loop.cpp
  test/Parser/pragma-loop-safety.cpp
  test/Parser/pragma-loop.cpp

Index: test/Parser/pragma-loop.cpp
===
--- test/Parser/pragma-loop.cpp
+++ test/Parser/pragma-loop.cpp
@@ -116,25 +116,38 @@
 VList[j] = List[j];
   }
 
+#pragma clang loop distribute(enable)
+  for (int j : VList) {
+VList[j] = List[j];
+  }
+
+#pragma clang loop distribute(disable)
+  for (int j : VList) {
+VList[j] = List[j];
+  }
+
   test_nontype_template_param<4, 8>(List, Length);
 
 /* expected-error {{expected '('}} */ #pragma clang loop vectorize
 /* expected-error {{expected '('}} */ #pragma clang loop interleave
 /* expected-error {{expected '('}} */ #pragma clang loop unroll
+/* expected-error {{expected '('}} */ #pragma clang loop distribute
 
 /* expected-error {{expected ')'}} */ #pragma clang loop vectorize(enable
 /* expected-error {{expected ')'}} */ #pragma clang loop interleave(enable
 /* expected-error {{expected ')'}} */ #pragma clang loop unroll(full
+/* expected-error {{expected ')'}} */ #pragma clang loop distribute(enable
 
 /* expected-error {{expected ')'}} */ #pragma clang loop vectorize_width(4
 /* expected-error {{expected ')'}} */ #pragma clang loop interleave_count(4
 /* expected-error {{expected ')'}} */ #pragma clang loop unroll_count(4
 
 /* expected-error {{missing argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop vectorize()
 /* expected-error {{missing argument; expected an integer value}} */ #pragma clang loop interleave_count()
 /* expected-error {{missing argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll()
+/* expected-error {{missing argument; expected 'enable' or 'disable'}} */ #pragma clang loop distribute()
 
-/* expected-error {{missing option; expected vectorize, vectorize_width, interleave, interleave_count, unroll, or unroll_count}} */ #pragma clang loop
+/* expected-error {{missing option; expected vectorize, vectorize_width, interleave, interleave_count, unroll, unroll_count, or distribute}} */ #pragma clang loop
 /* expected-error {{invalid option 'badkeyword'}} */ #pragma clang loop badkeyword
 /* expected-error {{invalid option 'badkeyword'}} */ #pragma clang loop badkeyword(enable)
 /* expected-error {{invalid option 'badkeyword'}} */ #pragma clang loop vectorize(enable) badkeyword(4)
@@ -187,6 +200,7 @@
 /* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop vectorize(badidentifier)
 /* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop interleave(badidentifier)
 /* expected-error {{invalid argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll(badidentifier)
+/* expected-error {{invalid argument; expected 'enable' or 'disable'}} */ #pragma clang loop distribute(badidentifier)
   while (i-7 < Length) {
 List[i] = i;
   }
@@ -196,6 +210,7 @@
 /* expected-error {{expected ')'}} */ #pragma clang loop vectorize(()
 /* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop interleave(*)
 /* expected-error {{invalid argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll(=)
+/* expected-error {{invalid argument; expected 'enable' or 'disable'}} */ #pragma clang loop distribute(+)
 /* expected-error {{type name requires a specifier or qualifier}} expected-error {{expected expression}} */ #pragma clang loop vectorize_width(^)
 /* expected-error {{expected expression}} expected-error {{expected expression}} */ #pragma clang loop interleave_count(/)
 /* expected-error {{expected expression}} expected-error {{expected expression}} */ #pragma clang loop unroll_count(==)
@@ -232,6 +247,8 @@
 #pragma clang loop interleave(disable)
 /* expected-error {{duplicate directives 'unroll(disable)' and 'unroll(full)'}} */ #pragma clang loop unroll(full)
 #pragma clang loop unroll(disable)
+/* expected-error {{duplicate directives 'distribute(disable)' and 'distribute(enable)'}} */ #pragma clang loop distribute(enable)
+#pragma clang loop distribute(disable)
   while (i-9 < Length) {
 List[i] = i;
   }
Index: test/Parser/pragma-loop-safety.cpp
===
--- test/Parser/pragma-loop-safety.cpp
+++ test/Parser/pragma-loop-safety.cpp
@@ -16,6 +16,7 @@
 /* expected-error {{expected ')'}} */ #pragma clang loop 

Re: [PATCH] D19403: Add loop pragma for Loop Distribution

2016-04-28 Thread Adam Nemet via cfe-commits
anemet added inline comments.


Comment at: docs/LanguageExtensions.rst:2161
@@ +2160,3 @@
+
+  #pragma clang loop distribute(enable)
+  for(...) {

aaron.ballman wrote:
> It would be nice to use a more compelling example than an empty for loop. 
> Also, it would be helpful if the user understood why they wouldn't use this 
> pragma for every loop (or why it doesn't happen by default).
Sure, I just followed the vectorizer example but you're right this needs more 
context.  Let me update the patch.

Thanks for the review!


http://reviews.llvm.org/D19403



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D19403: Add loop pragma for Loop Distribution

2016-04-21 Thread Adam Nemet via cfe-commits
anemet created this revision.
anemet added reviewers: aaron.ballman, rsmith.
anemet added subscribers: hfinkel, cfe-commits.

This is similar to other loop pragmas like 'vectorize'.  Currently it
only has state values: distribute(enable) and distribute(disable).  When
one of these is specified the corresponding loop metadata is generated:

  !{!"llvm.loop.distribute.enable", i1 true/false}

As a result, loop distribution will be attempted on the loop even if
Loop Distribution in not enabled globally.  Analogously, with 'disable'
distribution can be turned off for an individual loop even when the pass
is otherwise enabled.

There are some slight differences compared to the existing loop pragmas.

1. There is no 'assume_safety' variant which makes its handling slightly
different from 'vectorize'/'interleave'.

2. Unlike the existing loop pragmas, it does not have a corresponding
numeric pragma like 'vectorize' -> 'vectorize_width'.  So for the
consistency checks in CheckForIncompatibleAttributes we don't need to
check it against other pragmas.  We just need to check for duplicates of
the same pragma.

http://reviews.llvm.org/D19403

Files:
  docs/LanguageExtensions.rst
  include/clang/Basic/Attr.td
  include/clang/Basic/DiagnosticParseKinds.td
  lib/CodeGen/CGLoopInfo.cpp
  lib/CodeGen/CGLoopInfo.h
  lib/Parse/ParsePragma.cpp
  lib/Sema/SemaStmtAttr.cpp
  test/CodeGenCXX/pragma-loop.cpp
  test/Misc/ast-print-pragmas.cpp
  test/PCH/pragma-loop.cpp
  test/Parser/pragma-loop-safety.cpp
  test/Parser/pragma-loop.cpp

Index: test/Parser/pragma-loop.cpp
===
--- test/Parser/pragma-loop.cpp
+++ test/Parser/pragma-loop.cpp
@@ -116,25 +116,38 @@
 VList[j] = List[j];
   }
 
+#pragma clang loop distribute(enable)
+  for (int j : VList) {
+VList[j] = List[j];
+  }
+
+#pragma clang loop distribute(disable)
+  for (int j : VList) {
+VList[j] = List[j];
+  }
+
   test_nontype_template_param<4, 8>(List, Length);
 
 /* expected-error {{expected '('}} */ #pragma clang loop vectorize
 /* expected-error {{expected '('}} */ #pragma clang loop interleave
 /* expected-error {{expected '('}} */ #pragma clang loop unroll
+/* expected-error {{expected '('}} */ #pragma clang loop distribute
 
 /* expected-error {{expected ')'}} */ #pragma clang loop vectorize(enable
 /* expected-error {{expected ')'}} */ #pragma clang loop interleave(enable
 /* expected-error {{expected ')'}} */ #pragma clang loop unroll(full
+/* expected-error {{expected ')'}} */ #pragma clang loop distribute(enable
 
 /* expected-error {{expected ')'}} */ #pragma clang loop vectorize_width(4
 /* expected-error {{expected ')'}} */ #pragma clang loop interleave_count(4
 /* expected-error {{expected ')'}} */ #pragma clang loop unroll_count(4
 
 /* expected-error {{missing argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop vectorize()
 /* expected-error {{missing argument; expected an integer value}} */ #pragma clang loop interleave_count()
 /* expected-error {{missing argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll()
+/* expected-error {{missing argument; expected 'enable' or 'disable'}} */ #pragma clang loop distribute()
 
-/* expected-error {{missing option; expected vectorize, vectorize_width, interleave, interleave_count, unroll, or unroll_count}} */ #pragma clang loop
+/* expected-error {{missing option; expected vectorize, vectorize_width, interleave, interleave_count, unroll, unroll_count, or distribute}} */ #pragma clang loop
 /* expected-error {{invalid option 'badkeyword'}} */ #pragma clang loop badkeyword
 /* expected-error {{invalid option 'badkeyword'}} */ #pragma clang loop badkeyword(enable)
 /* expected-error {{invalid option 'badkeyword'}} */ #pragma clang loop vectorize(enable) badkeyword(4)
@@ -187,6 +200,7 @@
 /* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop vectorize(badidentifier)
 /* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop interleave(badidentifier)
 /* expected-error {{invalid argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll(badidentifier)
+/* expected-error {{invalid argument; expected 'enable' or 'disable'}} */ #pragma clang loop distribute(badidentifier)
   while (i-7 < Length) {
 List[i] = i;
   }
@@ -196,6 +210,7 @@
 /* expected-error {{expected ')'}} */ #pragma clang loop vectorize(()
 /* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop interleave(*)
 /* expected-error {{invalid argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll(=)
+/* expected-error {{invalid argument; expected 'enable' or 'disable'}} */ #pragma clang loop distribute(+)
 /* expected-error {{type name requires a specifier or qualifier}} expected-error {{expected expression}} */ #pragma clang 

Re: [PATCH] D18624: [PGO] PGOFuncName meta data if PGOFuncName is different from function's raw name.

2016-04-21 Thread Adam Nemet via cfe-commits
anemet added a comment.

> How did you build povray?

>  can you show me your command line in building (for example, csg.cpp) for

>  both--fprofile-instr-use and -fprofile-instr-generate?


Sent it in an email.


http://reviews.llvm.org/D18624



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18624: [PGO] PGOFuncName meta data if PGOFuncName is different from function's raw name.

2016-04-20 Thread Adam Nemet via cfe-commits
anemet added a comment.

Rong, do you have full paths or just the filename?


http://reviews.llvm.org/D18624



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r266829 - [Parse] Reuse OptionUnroll rather than matching it again. NFC

2016-04-19 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Apr 19 17:29:24 2016
New Revision: 266829

URL: http://llvm.org/viewvc/llvm-project?rev=266829=rev
Log:
[Parse] Reuse OptionUnroll rather than matching it again. NFC

Modified:
cfe/trunk/lib/Parse/ParsePragma.cpp

Modified: cfe/trunk/lib/Parse/ParsePragma.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=266829=266828=266829=diff
==
--- cfe/trunk/lib/Parse/ParsePragma.cpp (original)
+++ cfe/trunk/lib/Parse/ParsePragma.cpp Tue Apr 19 17:29:24 2016
@@ -824,8 +824,7 @@ bool Parser::HandlePragmaLoopHint(LoopHi
 StateOption = llvm::StringSwitch(OptionInfo->getName())
   .Case("vectorize", true)
   .Case("interleave", true)
-  .Case("unroll", true)
-  .Default(false);
+  .Default(false) || OptionUnroll;
   }
 
   // Verify loop hint has an argument.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r266827 - [Parse] Use StringSwitch to improve readability. NFC

2016-04-19 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Apr 19 17:17:45 2016
New Revision: 266827

URL: http://llvm.org/viewvc/llvm-project?rev=266827=rev
Log:
[Parse] Use StringSwitch to improve readability. NFC

A subsequent patch will propose a "distribute" loop hint.  Similarly to
unroll, this does not have a "assume_safety" argument either so this
condition will get more complex.

Modified:
cfe/trunk/lib/Parse/ParsePragma.cpp

Modified: cfe/trunk/lib/Parse/ParsePragma.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=266827=266826=266827=diff
==
--- cfe/trunk/lib/Parse/ParsePragma.cpp (original)
+++ cfe/trunk/lib/Parse/ParsePragma.cpp Tue Apr 19 17:17:45 2016
@@ -841,10 +841,14 @@ bool Parser::HandlePragmaLoopHint(LoopHi
 ConsumeToken(); // The annotation token.
 SourceLocation StateLoc = Toks[0].getLocation();
 IdentifierInfo *StateInfo = Toks[0].getIdentifierInfo();
-if (!StateInfo ||
-(!StateInfo->isStr("enable") && !StateInfo->isStr("disable") &&
- ((OptionUnroll && !StateInfo->isStr("full")) ||
-  (!OptionUnroll && !StateInfo->isStr("assume_safety") {
+
+bool Valid = StateInfo &&
+ llvm::StringSwitch(StateInfo->getName())
+ .Cases("enable", "disable", true)
+ .Case("full", OptionUnroll)
+ .Case("assume_safety", !OptionUnroll)
+ .Default(false);
+if (!Valid) {
   Diag(Toks[0].getLocation(), diag::err_pragma_invalid_keyword)
   << /*FullKeyword=*/OptionUnroll;
   return false;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18624: [PGO] PGOFuncName meta data if PGOFuncName is different from function's raw name.

2016-04-19 Thread Adam Nemet via cfe-commits
anemet added a comment.

Sure, I'll try.

Also sounds like you are missing a test in this patch that fails with the old 
version but passes with the new?!


http://reviews.llvm.org/D18624



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18624: [PGO] PGOFuncName meta data if PGOFuncName is different from function's raw name.

2016-04-19 Thread Adam Nemet via cfe-commits
anemet added a comment.

Thanks, the indirect call is via the All_Intersections macro in 
All_CSG_Intersect_Intersections and the top targets are: 
All_Sphere_Intersections and All_Plane_Intersections.


http://reviews.llvm.org/D18624



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18624: [PGO] PGOFuncName meta data if PGOFuncName is different from function's raw name.

2016-04-19 Thread Adam Nemet via cfe-commits
anemet added a comment.

As discussed under http://reviews.llvm.org/D17864, I did a run with this and I 
don't get the indirect call promoted that calls static functions in povray.   I 
will dig more but do I need to pass some extra flag?


http://reviews.llvm.org/D18624



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r264681 - [PGO] More comments how function pointers for indirect calls are mapped

2016-03-28 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Mon Mar 28 17:18:53 2016
New Revision: 264681

URL: http://llvm.org/viewvc/llvm-project?rev=264681=rev
Log:
[PGO] More comments how function pointers for indirect calls are mapped
to function names

Summary:
Hopefully this will make it easier for the next person to figure all
this out...

Reviewers: bogner, davidxl

Subscribers: davidxl, cfe-commits

Differential Revision: http://reviews.llvm.org/D18489

Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=264681=264680=264681=diff
==
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Mon Mar 28 17:18:53 2016
@@ -3817,7 +3817,9 @@ RValue CodeGenFunction::EmitCall(const C
   CS.setAttributes(Attrs);
   CS.setCallingConv(static_cast(CallingConv));
 
-  // Insert instrumentation or attach profile metadata at indirect call sites
+  // Insert instrumentation or attach profile metadata at indirect call sites.
+  // For more details, see the comment before the definition of
+  // IPVK_IndirectCallTarget in InstrProfData.inc.
   if (!CS.getCalledFunction())
 PGO.valueProfile(Builder, llvm::IPVK_IndirectCallTarget,
  CS.getInstruction(), Callee);


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18489: [PGO, clang] Comment how function pointers for indirect calls are mapped to function names

2016-03-28 Thread Adam Nemet via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL264678: [PGO] More comments how function pointers for 
indirect calls are mapped (authored by anemet).

Changed prior to commit:
  http://reviews.llvm.org/D18489?vs=51713=51845#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D18489

Files:
  llvm/trunk/include/llvm/ProfileData/InstrProfData.inc

Index: llvm/trunk/include/llvm/ProfileData/InstrProfData.inc
===
--- llvm/trunk/include/llvm/ProfileData/InstrProfData.inc
+++ llvm/trunk/include/llvm/ProfileData/InstrProfData.inc
@@ -133,6 +133,15 @@
 #else
 #define INSTR_PROF_DATA_DEFINED
 #endif
+/* For indirect function call value profiling, the addresses of the target
+ * functions are profiled by the instrumented code. The target addresses are
+ * written in the raw profile data and converted to target function name's MD5
+ * hash by the profile reader during deserialization.  Typically, this happens
+ * when the the raw profile data is read during profile merging.
+ *
+ * For this remapping the ProfData is used.  ProfData contains both the 
function
+ * name hash and the function address.
+ */
 VALUE_PROF_KIND(IPVK_IndirectCallTarget, 0)
 /* These two kinds must be the last to be
  * declared. This is to make sure the string


Index: llvm/trunk/include/llvm/ProfileData/InstrProfData.inc
===
--- llvm/trunk/include/llvm/ProfileData/InstrProfData.inc
+++ llvm/trunk/include/llvm/ProfileData/InstrProfData.inc
@@ -133,6 +133,15 @@
 #else
 #define INSTR_PROF_DATA_DEFINED
 #endif
+/* For indirect function call value profiling, the addresses of the target
+ * functions are profiled by the instrumented code. The target addresses are
+ * written in the raw profile data and converted to target function name's MD5
+ * hash by the profile reader during deserialization.  Typically, this happens
+ * when the the raw profile data is read during profile merging.
+ *
+ * For this remapping the ProfData is used.  ProfData contains both the function
+ * name hash and the function address.
+ */
 VALUE_PROF_KIND(IPVK_IndirectCallTarget, 0)
 /* These two kinds must be the last to be
  * declared. This is to make sure the string
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18489: [PGO, clang] Comment how function pointers for indirect calls are mapped to function names

2016-03-28 Thread Adam Nemet via cfe-commits
anemet accepted this revision.
anemet added a reviewer: anemet.
anemet added a comment.
This revision is now accepted and ready to land.

Was accepted by davidxl.


http://reviews.llvm.org/D18489



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18489: [PGO, clang] Comment how function pointers for indirect calls are mapped to function names

2016-03-28 Thread Adam Nemet via cfe-commits
anemet added a comment.

In http://reviews.llvm.org/D18489#384851, @davidxl wrote:

> What I meant is that putting the comments in InstrProfData.inc file, and
>  update the one in CodeGenPGO.cpp to reference that.


Sounds good.  You mean CGCall.cpp instead of CodeGenPGO.cpp though, correct?

So to summarize, I'll move this comment to InstrProfData.inc and just have a 
reference to it in CGCall.cpp before the call to valueProfile.

OK?


http://reviews.llvm.org/D18489



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18489: [PGO, clang] Comment how function pointers for indirect calls are mapped to function names

2016-03-28 Thread Adam Nemet via cfe-commits
anemet added inline comments.


Comment at: lib/CodeGen/CodeGenPGO.cpp:758
@@ -757,1 +757,3 @@
 
+  // During instrumentation, function pointers are collected for the different
+  // indirect call targets.  Then as part of the conversion from raw to merged

anemet wrote:
> davidxl wrote:
> > anemet wrote:
> > > davidxl wrote:
> > > > CodeGenPGO::valueProfile is a common API which can also be used for 
> > > > other kinds of value profile, so the comments belong to the callsite of 
> > > > this method in CGCall.cpp.
> > > > 
> > > > Suggested wording:
> > > > 
> > > > For indirect function call value profiling, the addresses of the target 
> > > > functions are profiled by the instrumented code. The target addresses 
> > > > are written in the raw profile data and converted to target function 
> > > > name's MD5 hash by the profile reader during deserialization.
> > > Hi David,
> > > 
> > > Thanks for taking a look.
> > > 
> > > I don't mind rewording the comment if you have some specific issues but 
> > > your version drops many of the details that was painful for me to 
> > > discover.  I carefully worded my comment to describe some of the design 
> > > details for indirect profiling that are not covered elsewhere:
> > > 
> > > 1) the remapping from function pointer to hashes of function names 
> > > happens during profdata merging
> > > 
> > >   It was surprisingly hard to figure out what the PGO file contained for 
> > > indirect call targets: function pointers or func name hashes?  And of 
> > > course as stated, the answer is -- it depends.
> > > 
> > > 2) the remapping happens pretty deep in the infrastructure code during 
> > > deserializing of the rawdata
> > > 
> > >   I was looking at several more logical places to find where this happens 
> > > and this was a bit unexpected location for this functionality.
> > > 
> > > 3) how do we know the function addresses necessary for the mapping from 
> > > function address -> func name -> hash
> > > 
> > >   The entire code to populate the FunctionAddr using macro magic in 
> > > InstrProfiling::getOrCreateRegionCounters is pretty hard to follow.  I 
> > > much rather have an overview of the logic somewhere centrally.
> > > 
> > > From the above list I feel that your version dropped 1 and 3 and only 
> > > kept 2.  Of course, feel free to add more context to my comments and fix 
> > > inaccuracies/oversimplifications but I would want want to drop any of the 
> > > points mentioned above.
> > > 
> > > Thanks.
> > Actually bullet 1 is not dropped from my suggested version: each time when 
> > a raw profile data is read, the reader interface will covert the address 
> > into MD5 -- profile merging is simply a user of the reader. 
> > 
> > About bullet 3, it is ok to add it if you think it is useful. ( I did not 
> > suggest it because ProfData is needed here is not for the purpose of 
> > conversion, but to pass the context for the runtime to find/set the counter 
> > arrays.)
> > Actually bullet 1 is not dropped from my suggested version: each time when 
> > a raw profile data is read, the reader interface will covert the address 
> > into MD5 -- profile merging is simply a user of the reader.
> 
> Sure but that is still pretty implicit.  I'd like to describe this in terms 
> of the well established phases of PGO: instrumentation, profile merge,  
> recompile with profile data.
> 
> How about:
> 
> ```
> For indirect function call value profiling, the addresses of the target 
> functions are profiled by the instrumented code. The target addresses are 
> written in the raw profile data and converted to target function name's MD5 
> hash by the profile reader during deserialization.  Typically, this happens 
> when the the raw profile data is read during profile merging.
> ``` 
> 
> > About bullet 3, it is ok to add it if you think it is useful. ( I did not 
> > suggest it because ProfData is needed here is not for the purpose of 
> > conversion, but to pass the context for the runtime to find/set the counter 
> > arrays.)
> 
> I am not completely sure I understand what you're saying here but if you mean 
> that the comment does not really apply to the surrounding code then that I 
> guess is expected.  I wanted to give a high-level overview of *what* we 
> collect at run-time, and *how* we map that into function names hashes that 
> are then used in the IR.
> 
> I can also put this in the function comment if you think that's better.
> 
David,

> CodeGenPGO::valueProfile is a common API which can also be used for other 
> kinds of value profile, so the comments belong to the callsite of this method 
> in CGCall.cpp.

How would you actually feel about moving this comment to InstrProfData.inc as 
well, just before the definition of IPVK_IndirectCallTarget?

I think that's a better place in terms of its centrality since this applies to 
both early and late instrumentation.  What do you think?

Adam 




Re: [PATCH] D18489: [PGO, clang] Comment how function pointers for indirect calls are mapped to function names

2016-03-28 Thread Adam Nemet via cfe-commits
anemet added inline comments.


Comment at: lib/CodeGen/CodeGenPGO.cpp:758
@@ -757,1 +757,3 @@
 
+  // During instrumentation, function pointers are collected for the different
+  // indirect call targets.  Then as part of the conversion from raw to merged

davidxl wrote:
> anemet wrote:
> > davidxl wrote:
> > > CodeGenPGO::valueProfile is a common API which can also be used for other 
> > > kinds of value profile, so the comments belong to the callsite of this 
> > > method in CGCall.cpp.
> > > 
> > > Suggested wording:
> > > 
> > > For indirect function call value profiling, the addresses of the target 
> > > functions are profiled by the instrumented code. The target addresses are 
> > > written in the raw profile data and converted to target function name's 
> > > MD5 hash by the profile reader during deserialization.
> > Hi David,
> > 
> > Thanks for taking a look.
> > 
> > I don't mind rewording the comment if you have some specific issues but 
> > your version drops many of the details that was painful for me to discover. 
> >  I carefully worded my comment to describe some of the design details for 
> > indirect profiling that are not covered elsewhere:
> > 
> > 1) the remapping from function pointer to hashes of function names happens 
> > during profdata merging
> > 
> >   It was surprisingly hard to figure out what the PGO file contained for 
> > indirect call targets: function pointers or func name hashes?  And of 
> > course as stated, the answer is -- it depends.
> > 
> > 2) the remapping happens pretty deep in the infrastructure code during 
> > deserializing of the rawdata
> > 
> >   I was looking at several more logical places to find where this happens 
> > and this was a bit unexpected location for this functionality.
> > 
> > 3) how do we know the function addresses necessary for the mapping from 
> > function address -> func name -> hash
> > 
> >   The entire code to populate the FunctionAddr using macro magic in 
> > InstrProfiling::getOrCreateRegionCounters is pretty hard to follow.  I much 
> > rather have an overview of the logic somewhere centrally.
> > 
> > From the above list I feel that your version dropped 1 and 3 and only kept 
> > 2.  Of course, feel free to add more context to my comments and fix 
> > inaccuracies/oversimplifications but I would want want to drop any of the 
> > points mentioned above.
> > 
> > Thanks.
> Actually bullet 1 is not dropped from my suggested version: each time when a 
> raw profile data is read, the reader interface will covert the address into 
> MD5 -- profile merging is simply a user of the reader. 
> 
> About bullet 3, it is ok to add it if you think it is useful. ( I did not 
> suggest it because ProfData is needed here is not for the purpose of 
> conversion, but to pass the context for the runtime to find/set the counter 
> arrays.)
> Actually bullet 1 is not dropped from my suggested version: each time when a 
> raw profile data is read, the reader interface will covert the address into 
> MD5 -- profile merging is simply a user of the reader.

Sure but that is still pretty implicit.  I'd like to describe this in terms of 
the well established phases of PGO: instrumentation, profile merge,  recompile 
with profile data.

How about:

```
For indirect function call value profiling, the addresses of the target 
functions are profiled by the instrumented code. The target addresses are 
written in the raw profile data and converted to target function name's MD5 
hash by the profile reader during deserialization.  Typically, this happens 
when the the raw profile data is read during profile merging.
``` 

> About bullet 3, it is ok to add it if you think it is useful. ( I did not 
> suggest it because ProfData is needed here is not for the purpose of 
> conversion, but to pass the context for the runtime to find/set the counter 
> arrays.)

I am not completely sure I understand what you're saying here but if you mean 
that the comment does not really apply to the surrounding code then that I 
guess is expected.  I wanted to give a high-level overview of *what* we collect 
at run-time, and *how* we map that into function names hashes that are then 
used in the IR.

I can also put this in the function comment if you think that's better.



http://reviews.llvm.org/D18489



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18489: [PGO, clang] Comment how function pointers for indirect calls are mapped to function names

2016-03-28 Thread Adam Nemet via cfe-commits
anemet added inline comments.


Comment at: lib/CodeGen/CodeGenPGO.cpp:758
@@ -757,1 +757,3 @@
 
+  // During instrumentation, function pointers are collected for the different
+  // indirect call targets.  Then as part of the conversion from raw to merged

davidxl wrote:
> CodeGenPGO::valueProfile is a common API which can also be used for other 
> kinds of value profile, so the comments belong to the callsite of this method 
> in CGCall.cpp.
> 
> Suggested wording:
> 
> For indirect function call value profiling, the addresses of the target 
> functions are profiled by the instrumented code. The target addresses are 
> written in the raw profile data and converted to target function name's MD5 
> hash by the profile reader during deserialization.
Hi David,

Thanks for taking a look.

I don't mind rewording the comment if you have some specific issues but your 
version drops many of the details that was painful for me to discover.  I 
carefully worded my comment to describe some of the design details for indirect 
profiling that are not covered elsewhere:

1) the remapping from function pointer to hashes of function names happens 
during profdata merging

  It was surprisingly hard to figure out what the PGO file contained for 
indirect call targets: function pointers or func name hashes?  And of course as 
stated, the answer is -- it depends.

2) the remapping happens pretty deep in the infrastructure code during 
deserializing of the rawdata

  I was looking at several more logical places to find where this happens and 
this was a bit unexpected location for this functionality.

3) how do we know the function addresses necessary for the mapping from 
function address -> func name -> hash

  The entire code to populate the FunctionAddr using macro magic in 
InstrProfiling::getOrCreateRegionCounters is pretty hard to follow.  I much 
rather have an overview of the logic somewhere centrally.

From the above list I feel that your version dropped 1 and 3 and only kept 2.  
Of course, feel free to add more context to my comments and fix 
inaccuracies/oversimplifications but I would want want to drop any of the 
points mentioned above.

Thanks.


http://reviews.llvm.org/D18489



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D18489: [PGO] Comment how function pointers for indirect calls are mapped to function names

2016-03-26 Thread Adam Nemet via cfe-commits
anemet created this revision.
anemet added reviewers: bogner, davidxl.
anemet added a subscriber: cfe-commits.

Hopefully this will make it easier for the next person to figure all
this out...

http://reviews.llvm.org/D18489

Files:
  lib/CodeGen/CodeGenPGO.cpp

Index: lib/CodeGen/CodeGenPGO.cpp
===
--- lib/CodeGen/CodeGenPGO.cpp
+++ lib/CodeGen/CodeGenPGO.cpp
@@ -755,6 +755,14 @@
   if (!ValuePtr || !ValueSite || !Builder.GetInsertBlock())
 return;
 
+  // During instrumentation, function pointers are collected for the different
+  // indirect call targets.  Then as part of the conversion from raw to merged
+  // profile data, these get replaced with md5 function name hashes.  (This
+  // actually happens during deserialization of the raw profdata.)
+  //
+  // For this remapping the ProfData is used.  ProfData contains both the
+  // function name hash and the function address.
+
   bool InstrumentValueSites = CGM.getCodeGenOpts().hasProfileClangInstr();
   if (InstrumentValueSites && RegionCounterMap) {
 llvm::LLVMContext  = CGM.getLLVMContext();


Index: lib/CodeGen/CodeGenPGO.cpp
===
--- lib/CodeGen/CodeGenPGO.cpp
+++ lib/CodeGen/CodeGenPGO.cpp
@@ -755,6 +755,14 @@
   if (!ValuePtr || !ValueSite || !Builder.GetInsertBlock())
 return;
 
+  // During instrumentation, function pointers are collected for the different
+  // indirect call targets.  Then as part of the conversion from raw to merged
+  // profile data, these get replaced with md5 function name hashes.  (This
+  // actually happens during deserialization of the raw profdata.)
+  //
+  // For this remapping the ProfData is used.  ProfData contains both the
+  // function name hash and the function address.
+
   bool InstrumentValueSites = CGM.getCodeGenOpts().hasProfileClangInstr();
   if (InstrumentValueSites && RegionCounterMap) {
 llvm::LLVMContext  = CGM.getLLVMContext();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   >