[llvm] 0199449 - llvm-reduce: Use FileCheck instead of python for interestingness test

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 13 15:11:04 PDT 2022


Author: Matt Arsenault
Date: 2022-09-13T18:10:56-04:00
New Revision: 0199449fad8362240afb3e5dbeb2683408d8069a

URL: https://github.com/llvm/llvm-project/commit/0199449fad8362240afb3e5dbeb2683408d8069a
DIFF: https://github.com/llvm/llvm-project/commit/0199449fad8362240afb3e5dbeb2683408d8069a.diff

LOG: llvm-reduce: Use FileCheck instead of python for interestingness test

Also avoid using cat for no reason.

Added: 
    

Modified: 
    llvm/test/tools/llvm-reduce/mir/instr-reduce.mir

Removed: 
    llvm/test/tools/llvm-reduce/mir/instr-reduce.py


################################################################################
diff  --git a/llvm/test/tools/llvm-reduce/mir/instr-reduce.mir b/llvm/test/tools/llvm-reduce/mir/instr-reduce.mir
index 2f90e69e4c149..176c089bb8817 100644
--- a/llvm/test/tools/llvm-reduce/mir/instr-reduce.mir
+++ b/llvm/test/tools/llvm-reduce/mir/instr-reduce.mir
@@ -1,7 +1,8 @@
-# RUN: llvm-reduce -abort-on-invalid-reduction --delta-passes=instructions -mtriple=riscv32 --test %python --test-arg %p/instr-reduce.py %s -o %t
-# RUN: cat %t | FileCheck --match-full-lines %s
-
 # REQUIRES: riscv-registered-target
+# RUN: llvm-reduce -abort-on-invalid-reduction --delta-passes=instructions -mtriple=riscv32 --test FileCheck --test-arg --check-prefix=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+# RUN: FileCheck --match-full-lines %s < %t
+
+# CHECK-INTERESTINGNESS: %{{[0-9]+}}:gpr = ADDI %{{[0-9]+}}, 5
 
 # Verify that after reduction the following instruction sequence remains. The
 # interestingness-test 'instr-reduce.py' matches a '%[0-9]+:gpr = ADDI %[0-9]+, 5'

diff  --git a/llvm/test/tools/llvm-reduce/mir/instr-reduce.py b/llvm/test/tools/llvm-reduce/mir/instr-reduce.py
deleted file mode 100755
index 75e2cc54bbcfa..0000000000000
--- a/llvm/test/tools/llvm-reduce/mir/instr-reduce.py
+++ /dev/null
@@ -1,16 +0,0 @@
-from subprocess import run, PIPE
-import re
-import sys
-
-llc = run( [ 'llc', '-disable-symbolication','-verify-machineinstrs', '-mtriple=riscv32', '-run-pass=none', '-o', '-', sys.argv[1]], stdout=PIPE, stderr=PIPE )
-
-stdout = llc.stdout.decode()
-
-p = re.compile(r'^\s*%[0-9]+:gpr = ADDI %[0-9]+, 5$', flags=re.MULTILINE)
-
-if (llc.returncode == 0 and p.search(stdout)):
-  print('This is interesting!')
-  sys.exit(0)
-else:
-  print('This is NOT interesting!')
-  sys.exit(1)


        


More information about the llvm-commits mailing list