[PATCH] D65888: [UpdateTestChecks] Drop and update test checks
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 7 08:45:14 PDT 2019
xbolva00 created this revision.
xbolva00 added reviewers: RKSimon, lebedev.ri, MaskRay, spatel, gbedwell.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Motivation: Regeneration of correct test actually breaks it.
Example:
define i32 @test1(i64 %x) nounwind readnone {
%count = tail call i64 @llvm.ctpop.i64(i64 %x)
%cast = trunc i64 %count to i32
%cmp = icmp ugt i32 %cast, 1
%conv = zext i1 %cmp to i32
ret i32 %conv
}
; CHECK-LABEL: test1:
; CHECK: # %bb.0:
; CHECK-NEXT: leaq -1(%rdi), %rcx
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: testq %rcx, %rdi
; CHECK-NEXT: setne %al
; CHECK-NEXT: retq
-> PASS
Script updates it:
define i32 @test1(i64 %x) nounwind readnone {
; CHECK-LABEL: test1:
; CHECK: # %bb.0:
; CHECK-NEXT: leaq -1(%rdi), %rcx
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: testq %rcx, %rdi
; CHECK-NEXT: setne %al
; CHECK-NEXT: retq
%count = tail call i64 @llvm.ctpop.i64(i64 %x)
%cast = trunc i64 %count to i32
%cmp = icmp ugt i32 %cast, 1
%conv = zext i1 %cmp to i32
ret i32 %conv
}
; CHECK-LABEL: test1:
; CHECK: # %bb.0:
; CHECK-NEXT: leaq -1(%rdi), %rcx
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: testq %rcx, %rdi
; CHECK-NEXT: setne %al
; CHECK-NEXT: retq
-> FAIL
Proposed solution:
-du option: Drop all test checks and then regenerate them.
Repository:
rL LLVM
https://reviews.llvm.org/D65888
Files:
utils/update_llc_test_checks.py
Index: utils/update_llc_test_checks.py
===================================================================
--- utils/update_llc_test_checks.py
+++ utils/update_llc_test_checks.py
@@ -40,6 +40,8 @@
'--no_x86_scrub_rip', action='store_false', dest='x86_scrub_rip')
parser.add_argument('-u', '--update-only', action='store_true',
help='Only update test if it was already autogened')
+ parser.add_argument('-du', '--drop-update', action='store_true',
+ help='Drop and update test checks')
parser.add_argument('tests', nargs='+')
args = parser.parse_args()
@@ -154,6 +156,9 @@
output_lines = []
output_lines.append(autogenerated_note)
+ if args.drop_update:
+ input_lines = [l for l in input_lines if not l.startswith((";CHECK", "; CHECK"))]
+
for input_line in input_lines:
if is_in_function_start:
if input_line == '':
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65888.213914.patch
Type: text/x-patch
Size: 924 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190807/bb8d4180/attachment.bin>
More information about the llvm-commits
mailing list