This is an archive of the discontinued LLVM Phabricator instance.

[WIP][Utils] Fix conflicting checkline generation.
AbandonedPublic

Authored by kuter on Feb 1 2021, 9:39 AM.

Details

Reviewers
None
Summary

Example:
We have 3 run lines.

; RUN: opt ..... | FileChek --check-prefixes=A,D
; RUN: opt ..... | FileChek --check-prefixes=B,C
; RUN: opt ..... | FileChek --check-prefixes=A,B

For a function, three run lines generates the same output
but this is just a coincidence so check lines are correct.

Before this patch generated output is.
; A-LABEL: define .....
; A ......

; B-LABEL: define .....
; B ......

The third run line is going to fail since it can't match the "B-LABEL"
check since the "A-LABEL" line have consumed the function signature

This patch corrects this issue by excluding all checkprefixes
that exist in the same run line as the choosen prefix.

For "-LABEL" generation this is shouldn't affect existing checks.
There is no way that tests that are affected by this change are
valid.

[WIP] Are other users of common.py effected by this change ?

Diff Detail

Event Timeline

kuter created this revision.Feb 1 2021, 9:39 AM
kuter requested review of this revision.Feb 1 2021, 9:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 1 2021, 9:39 AM
kuter edited the summary of this revision. (Show Details)Feb 1 2021, 9:39 AM
kuter added a comment.Feb 1 2021, 3:04 PM

A real example that doesn't work.

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S < %s | FileCheck --check-prefixes=A,B,C
; RUN: opt -S < %s | FileCheck --check-prefixes=A,E
; RUN: opt -S < %s | FileCheck --check-prefixes=B,D

define i32 @negated_operand(i32 %x) {
; A-LABEL: @negated_operand(
; A-NEXT:    [[NEGX:%.*]] = sub i32 0, [[X:%.*]]
; A-NEXT:    [[R:%.*]] = add i32 [[NEGX]], [[X]]
; A-NEXT:    ret i32 [[R]]
;
; B-LABEL: @negated_operand(
; B-NEXT:    [[NEGX:%.*]] = sub i32 0, [[X:%.*]]
; B-NEXT:    [[R:%.*]] = add i32 [[NEGX]], [[X]]
; B-NEXT:    ret i32 [[R]]
;
  %negx = sub i32 0, %x
  %r = add i32 %negx, %x
  ret i32 %r
}
kuter abandoned this revision.Feb 28 2021, 8:37 PM

The fix here only works if the run lines are ordered in a specific way.
I don't think there are any trivial solutions to this problem.

Abandoning the revision.