[PATCH] D54071: [Bug 39548][Clang] PGO bootstrap fails with python3: errors in perf-helper.py

2019-01-11 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL350955: [Bug 39548][Clang] PGO bootstrap fails with python3: 
errors in perf-helper.py (authored by serge_sans_paille, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D54071?vs=181140=181327#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54071/new/

https://reviews.llvm.org/D54071

Files:
  cfe/trunk/utils/perf-training/perf-helper.py


Index: cfe/trunk/utils/perf-training/perf-helper.py
===
--- cfe/trunk/utils/perf-training/perf-helper.py
+++ cfe/trunk/utils/perf-training/perf-helper.py
@@ -114,7 +114,7 @@
   # Find the cc1 command used by the compiler. To do this we execute the
   # compiler with '-###' to figure out what it wants to do.
   cmd = cmd + ['-###']
-  cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, 
env=env).strip()
+  cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env, 
universal_newlines=True).strip()
   cc_commands = []
   for ln in cc_output.split('\n'):
   # Filter out known garbage.
@@ -340,7 +340,7 @@
   # If the user gave us a binary, get all the symbols in the binary by
   # snarfing 'nm' output.
   if opts.binary_path is not None:
- output = subprocess.check_output(['nm', '-P', opts.binary_path])
+ output = subprocess.check_output(['nm', '-P', opts.binary_path], 
universal_newlines=True)
  lines = output.split("\n")
  all_symbols = [ln.split(' ',1)[0]
 for ln in lines


Index: cfe/trunk/utils/perf-training/perf-helper.py
===
--- cfe/trunk/utils/perf-training/perf-helper.py
+++ cfe/trunk/utils/perf-training/perf-helper.py
@@ -114,7 +114,7 @@
   # Find the cc1 command used by the compiler. To do this we execute the
   # compiler with '-###' to figure out what it wants to do.
   cmd = cmd + ['-###']
-  cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env).strip()
+  cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env, universal_newlines=True).strip()
   cc_commands = []
   for ln in cc_output.split('\n'):
   # Filter out known garbage.
@@ -340,7 +340,7 @@
   # If the user gave us a binary, get all the symbols in the binary by
   # snarfing 'nm' output.
   if opts.binary_path is not None:
- output = subprocess.check_output(['nm', '-P', opts.binary_path])
+ output = subprocess.check_output(['nm', '-P', opts.binary_path], universal_newlines=True)
  lines = output.split("\n")
  all_symbols = [ln.split(' ',1)[0]
 for ln in lines
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D54071: [Bug 39548][Clang] PGO bootstrap fails with python3: errors in perf-helper.py

2019-01-11 Thread Romain Geissler via Phabricator via cfe-commits
Romain-Geissler-1A added a comment.

Thank you !

Since I have no write access to the repository, can anyone of you commit this 
patch ?

Cheers,
Romain


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54071/new/

https://reviews.llvm.org/D54071



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


[PATCH] D54071: [Bug 39548][Clang] PGO bootstrap fails with python3: errors in perf-helper.py

2019-01-11 Thread serge via Phabricator via cfe-commits
serge-sans-paille accepted this revision.
serge-sans-paille added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54071/new/

https://reviews.llvm.org/D54071



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


[PATCH] D54071: [Bug 39548][Clang] PGO bootstrap fails with python3: errors in perf-helper.py

2019-01-10 Thread Romain Geissler via Phabricator via cfe-commits
Romain-Geissler-1A updated this revision to Diff 181140.
Romain-Geissler-1A added a comment.

Rebased to master


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54071/new/

https://reviews.llvm.org/D54071

Files:
  utils/perf-training/perf-helper.py


Index: utils/perf-training/perf-helper.py
===
--- utils/perf-training/perf-helper.py
+++ utils/perf-training/perf-helper.py
@@ -114,7 +114,7 @@
   # Find the cc1 command used by the compiler. To do this we execute the
   # compiler with '-###' to figure out what it wants to do.
   cmd = cmd + ['-###']
-  cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, 
env=env).strip()
+  cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env, 
universal_newlines=True).strip()
   cc_commands = []
   for ln in cc_output.split('\n'):
   # Filter out known garbage.
@@ -340,7 +340,7 @@
   # If the user gave us a binary, get all the symbols in the binary by
   # snarfing 'nm' output.
   if opts.binary_path is not None:
- output = subprocess.check_output(['nm', '-P', opts.binary_path])
+ output = subprocess.check_output(['nm', '-P', opts.binary_path], 
universal_newlines=True)
  lines = output.split("\n")
  all_symbols = [ln.split(' ',1)[0]
 for ln in lines


Index: utils/perf-training/perf-helper.py
===
--- utils/perf-training/perf-helper.py
+++ utils/perf-training/perf-helper.py
@@ -114,7 +114,7 @@
   # Find the cc1 command used by the compiler. To do this we execute the
   # compiler with '-###' to figure out what it wants to do.
   cmd = cmd + ['-###']
-  cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env).strip()
+  cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env, universal_newlines=True).strip()
   cc_commands = []
   for ln in cc_output.split('\n'):
   # Filter out known garbage.
@@ -340,7 +340,7 @@
   # If the user gave us a binary, get all the symbols in the binary by
   # snarfing 'nm' output.
   if opts.binary_path is not None:
- output = subprocess.check_output(['nm', '-P', opts.binary_path])
+ output = subprocess.check_output(['nm', '-P', opts.binary_path], universal_newlines=True)
  lines = output.split("\n")
  all_symbols = [ln.split(' ',1)[0]
 for ln in lines
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D54071: [Bug 39548][Clang] PGO bootstrap fails with python3: errors in perf-helper.py

2019-01-10 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

@Romain-Geissler-1A sure thing. Can you rebase your patch on master first?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54071/new/

https://reviews.llvm.org/D54071



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


[PATCH] D54071: [Bug 39548][Clang] PGO bootstrap fails with python3: errors in perf-helper.py

2019-01-09 Thread Romain Geissler via Phabricator via cfe-commits
Romain-Geissler-1A added subscribers: michaelplatings, serge-sans-paille.
Romain-Geissler-1A added a comment.
Herald added a reviewer: serge-sans-paille.

Hi @serge-sans-paille @michaelplatings,

I saw you recently merged some Python 3 related stuff. Here is an older review 
from November still never reviewed. You fixed already the fix around the 
lambda, yet I still need to add "universal_newlines" on current trunk otherwise 
I have some bytes vs str objects error. Do you think you can land this small 
change too ?

Cheers,
Romain


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54071/new/

https://reviews.llvm.org/D54071



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


[PATCH] D54071: [Bug 39548][Clang] PGO bootstrap fails with python3: errors in perf-helper.py

2018-11-03 Thread Romain Geissler via Phabricator via cfe-commits
Romain-Geissler-1A created this revision.
Romain-Geissler-1A added reviewers: rsmith, vsk, beanz.
Herald added a subscriber: cfe-commits.
Romain-Geissler-1A edited the summary of this revision.

Hi,

Current clang fail to bootstrap in PGO mode when only python3 is available, 
because perf-helper.py is not compatible with python 3. We can see two errors:

File 
"/workdir/src/llvm-7.0.0.src/tools/clang/utils/perf-training/perf-helper.py", 
line 299
  by_count.sort(key = lambda (_,n): -n)
 ^
  SyntaxError: invalid syntax

which can be fixed by removing the parameter parenthesis.

And

  $ "/usr/bin/python3.6" 
"/workdir/src/llvm-7.0.0.src/tools/clang/utils/perf-training/perf-helper.py" 
"cc1" 
"/workdir/build/final-system/llvm-build/tools/clang/stage2-instrumented-bins/bin/clang"
 "-Wall" "-pedantic" "-c" 
"/home/jenkins/workspace/OTF_Toolchain_release_2.0-HLXHYRKCVDYQJLF23VGZ3MVAU6VGURX537LUE3KFVM2SSPMZ6IOA/output/src/llvm-7.0.0.src/tools/clang/utils/perf-training/cxx/hello_world.cpp"
  # command stderr:
  Traceback (most recent call last):
File 
"/workdir/src/llvm-7.0.0.src/tools/clang/utils/perf-training/perf-helper.py", 
line 408, in 
  main()
File 
"/workdir/src/llvm-7.0.0.src/tools/clang/utils/perf-training/perf-helper.py", 
line 405, in main
  sys.exit(f(sys.argv[2:]))
File 
"/workdir/src/llvm-7.0.0.src/tools/clang/utils/perf-training/perf-helper.py", 
line 159, in cc1
  cc1_cmd = get_cc1_command_for_args(cmd, cc1_env)
File 
"/workdir/src/llvm-7.0.0.src/tools/clang/utils/perf-training/perf-helper.py", 
line 119, in get_cc1_command_for_args
  for ln in cc_output.split('\n'):
  TypeError: a bytes-like object is required, not 'str'
  
  error: command failed with exit status: 1

which can be made both 2 and 3 compatible by using the attribute 
universal_newlines=True

Cheers,
Romain


Repository:
  rC Clang

https://reviews.llvm.org/D54071

Files:
  utils/perf-training/perf-helper.py


Index: utils/perf-training/perf-helper.py
===
--- utils/perf-training/perf-helper.py
+++ utils/perf-training/perf-helper.py
@@ -114,7 +114,7 @@
   # Find the cc1 command used by the compiler. To do this we execute the
   # compiler with '-###' to figure out what it wants to do.
   cmd = cmd + ['-###']
-  cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, 
env=env).strip()
+  cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env, 
universal_newlines=True).strip()
   cc_commands = []
   for ln in cc_output.split('\n'):
   # Filter out known garbage.
@@ -296,7 +296,7 @@
   counts[a] = counts.get(a,0) + 1
 
   by_count = counts.items()
-  by_count.sort(key = lambda (_,n): -n)
+  by_count.sort(key = lambda _,n: -n)
   return [s for s,n in by_count]
  
 def form_by_random(symbol_lists):
@@ -340,7 +340,7 @@
   # If the user gave us a binary, get all the symbols in the binary by
   # snarfing 'nm' output.
   if opts.binary_path is not None:
- output = subprocess.check_output(['nm', '-P', opts.binary_path])
+ output = subprocess.check_output(['nm', '-P', opts.binary_path], 
universal_newlines=True)
  lines = output.split("\n")
  all_symbols = [ln.split(' ',1)[0]
 for ln in lines


Index: utils/perf-training/perf-helper.py
===
--- utils/perf-training/perf-helper.py
+++ utils/perf-training/perf-helper.py
@@ -114,7 +114,7 @@
   # Find the cc1 command used by the compiler. To do this we execute the
   # compiler with '-###' to figure out what it wants to do.
   cmd = cmd + ['-###']
-  cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env).strip()
+  cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env, universal_newlines=True).strip()
   cc_commands = []
   for ln in cc_output.split('\n'):
   # Filter out known garbage.
@@ -296,7 +296,7 @@
   counts[a] = counts.get(a,0) + 1
 
   by_count = counts.items()
-  by_count.sort(key = lambda (_,n): -n)
+  by_count.sort(key = lambda _,n: -n)
   return [s for s,n in by_count]
  
 def form_by_random(symbol_lists):
@@ -340,7 +340,7 @@
   # If the user gave us a binary, get all the symbols in the binary by
   # snarfing 'nm' output.
   if opts.binary_path is not None:
- output = subprocess.check_output(['nm', '-P', opts.binary_path])
+ output = subprocess.check_output(['nm', '-P', opts.binary_path], universal_newlines=True)
  lines = output.split("\n")
  all_symbols = [ln.split(' ',1)[0]
 for ln in lines
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits