Skip to content

Commit 746bef5

Browse files
committed
Remove --skip-check-label
Simplify regexp based on suggestions and update testcase (now broken).
1 parent d8548c4 commit 746bef5

File tree

4 files changed

+11
-22
lines changed

4 files changed

+11
-22
lines changed

llvm/lib/Target/SPIRV/SPIRVAsmPrinter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ void SPIRVAsmPrinter::emitFunctionHeader() {
118118
OutStreamer->getCommentOS()
119119
<< "-- Begin function "
120120
<< GlobalValue::dropLLVMManglingEscape(F.getName()) << '\n';
121-
OutStreamer->addBlankLine();
122121
}
123122

124123
auto Section = getObjFileLowering().SectionForGlobal(&F, TM);

llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_optnone.ll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --skip-check-label --version 3
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
22
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown --spirv-extensions=SPV_INTEL_optnone %s -o - | FileCheck %s --check-prefix=CHECK-EXTENSION
33
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-NO-EXTENSION
44

@@ -13,12 +13,14 @@
1313

1414
; Function Attrs: nounwind optnone noinline
1515
define spir_func void @_Z3foov() #0 {
16-
; CHECK-EXTENSION: %4 = OpFunction %2 DontInline %3
16+
; CHECK-EXTENSION-LABEL: _Z3foov:
17+
; CHECK-EXTENSION: %4 = OpFunction %2 DontInline %3
1718
; CHECK-EXTENSION-NEXT: %5 = OpLabel
1819
; CHECK-EXTENSION-NEXT: OpReturn
1920
; CHECK-EXTENSION-NEXT: OpFunctionEnd
2021
;
21-
; CHECK-NO-EXTENSION: %4 = OpFunction %2 DontInline %3
22+
; CHECK-NO-EXTENSION-LABEL: _Z3foov:
23+
; CHECK-NO-EXTENSION: %4 = OpFunction %2 DontInline %3
2224
; CHECK-NO-EXTENSION-NEXT: %5 = OpLabel
2325
; CHECK-NO-EXTENSION-NEXT: OpReturn
2426
; CHECK-NO-EXTENSION-NEXT: OpFunctionEnd

llvm/utils/UpdateTestChecks/asm.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,11 @@ class string:
202202
flags=(re.M | re.S),
203203
)
204204

205-
# We parse the function name from the comments issued by the backend:
206-
# ; -- Begin function <name>
207-
# and then the final comment
208-
# ; -- End function
209-
# If these change in the future, we need to change the regex.
205+
# We parse the function name from OpName, and grab the variable name 'var'
206+
# for this function. Then we match that when the variable is assigned with
207+
# OpFunction and match its body.
210208
ASM_FUNCTION_SPIRV_RE = re.compile(
211-
r"[ \t]+; \-\- Begin function (?P<func>[^\n]+)\n"
212-
r"(?P<body>.*?)\n"
213-
r"[ \t]+; \-\- End function",
209+
r'OpName (?P<var>%[0-9]+) "(?P<func>[^"]+)".*(?P<body>(?P=var) = OpFunction.+?OpFunctionEnd)',
214210
flags=(re.M | re.S),
215211
)
216212

llvm/utils/UpdateTestChecks/common.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,6 @@ def __call__(self, parser, namespace, values, option_string=None):
196196
default=[],
197197
help="List of regular expressions such that, for matching global value declarations, literal integer values should be encoded in hex in the associated FileCheck directives",
198198
)
199-
parser.add_argument(
200-
"--skip-check-label",
201-
action="store_true",
202-
dest="skip_check_label",
203-
default=False,
204-
help="Skip CHECK-LABEL line generation per function",
205-
)
206199
# FIXME: in 3.9, we can use argparse.BooleanOptionalAction. At that point,
207200
# we need to rename the flag to just -generate-body-for-unused-prefixes.
208201
parser.add_argument(
@@ -219,11 +212,10 @@ def __call__(self, parser, namespace, values, option_string=None):
219212
)
220213
args = parser.parse_args()
221214
# TODO: This should not be handled differently from the other options
222-
global _verbose, _global_value_regex, _global_hex_value_regex, _skip_check_label
215+
global _verbose, _global_value_regex, _global_hex_value_regex
223216
_verbose = args.verbose
224217
_global_value_regex = args.global_value_regex
225218
_global_hex_value_regex = args.global_hex_value_regex
226-
_skip_check_label = args.skip_check_label
227219
return args
228220

229221

@@ -1314,7 +1306,7 @@ def add_checks(
13141306
output_lines.append(
13151307
"%s %s-SAME: %s" % (comment_marker, checkprefix, args_and_sig)
13161308
)
1317-
elif not _skip_check_label:
1309+
else:
13181310
output_lines.append(
13191311
check_label_format
13201312
% (

0 commit comments

Comments
 (0)