[llvm] 35e1a2f - [llvm][tools][opt-viewer] Remove Python2 compatability code in optrecord.py (#163744)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 31 02:50:18 PDT 2025


Author: David Spickett
Date: 2025-10-31T09:50:14Z
New Revision: 35e1a2f0a375b4cdc809d2bab911fdb197284f55

URL: https://github.com/llvm/llvm-project/commit/35e1a2f0a375b4cdc809d2bab911fdb197284f55
DIFF: https://github.com/llvm/llvm-project/commit/35e1a2f0a375b4cdc809d2bab911fdb197284f55.diff

LOG: [llvm][tools][opt-viewer] Remove Python2 compatability code in optrecord.py (#163744)

LLVM requires Python >= 3.8.

itervalues was unused so I have removed it.

Added: 
    

Modified: 
    llvm/tools/opt-viewer/optrecord.py

Removed: 
    


################################################################################
diff  --git a/llvm/tools/opt-viewer/optrecord.py b/llvm/tools/opt-viewer/optrecord.py
index 8014204a64f45..d49ebae12cd5f 100644
--- a/llvm/tools/opt-viewer/optrecord.py
+++ b/llvm/tools/opt-viewer/optrecord.py
@@ -19,35 +19,14 @@
 from multiprocessing import Lock
 import os, os.path
 import subprocess
-
-try:
-    # The previously builtin function `intern()` was moved
-    # to the `sys` module in Python 3.
-    from sys import intern
-except:
-    pass
-
+from sys import intern
 import re
 
 import optpmap
 
-try:
-    dict.iteritems
-except AttributeError:
-    # Python 3
-    def itervalues(d):
-        return iter(d.values())
-
-    def iteritems(d):
-        return iter(d.items())
-
-else:
-    # Python 2
-    def itervalues(d):
-        return d.itervalues()
-
-    def iteritems(d):
-        return d.iteritems()
+
+def iteritems(d):
+    return iter(d.items())
 
 
 def html_file_name(filename):


        


More information about the llvm-commits mailing list