[llvm] [UpdateTestChecks] Add support for SPIRV in update_llc_test_checks.py (PR #66213)

Paulo Matos via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 15 06:04:43 PDT 2023


pmatos wrote:

> Why not just match OpName ? ASM_FUNCTION_X86_RE does something similar in matching the func name a few lines before the "Begin function" tag

As far as I understand we need to grab the body of the function. In the case of SPIRV, the body doesn't come after the name. Take the case of 2 functions called void1 and void2:

```
	OpCapability Kernel
	OpCapability Addresses
	OpCapability Linkage
	OpCapability OptNoneINTEL
	OpExtension "SPV_INTEL_optnone"
	%1 = OpExtInstImport "OpenCL.std"
	OpMemoryModel Physical32 OpenCL
	OpExecutionMode %4 ContractionOff
	OpExecutionMode %5 ContractionOff
	OpSource Unknown 0
	OpName %4 "void1"
	OpName %5 "void2"
	OpDecorate %4 LinkageAttributes "void1" Export
	OpDecorate %5 LinkageAttributes "void2" Export
	%2 = OpTypeVoid
	%3 = OpTypeFunction %2
	%4 = OpFunction %2 DontInline %3        ; -- Begin function void1
	%6 = OpLabel
	OpReturn
	OpFunctionEnd
                                        ; -- End function
	%5 = OpFunction %2 DontInline %3        ; -- Begin function void2
	%7 = OpLabel
	OpReturn
	OpFunctionEnd
                                        ; -- End function
```

How would you grab with a regex the body of void2 if I parse the name from OpName?

https://github.com/llvm/llvm-project/pull/66213


More information about the llvm-commits mailing list