[llvm] [TableGen, CodeGen, CHERI] Add support for the cPTR wildcard value type. (PR #158426)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 30 10:06:07 PDT 2025


arichardson wrote:

> > Changes to llvm/include/llvm/IR/Intrinsics.td will trip up this test:
> > ```
> > // CHECK-NEXT:/* 3*/ OPC_CheckChild0Integer, 42,
> >               ^
> > <stdin>:59:61: note: scanning from here
> > /* 0*/ OPC_CheckOpcode, TARGET_VAL(ISD::INTRINSIC_WO_CHAIN),
> >                                                             ^
> > <stdin>:60:1: note: possible intended match here
> > /* 3*/ OPC_CheckChild0Integer, 44,
> > ^
> > ```
> > 
> > 
> >     
> >       
> >     
> > 
> >       
> >     
> > 
> >     
> >   
> > This is pretty annoying, as it's completely unrelated to such changes, but only the constants are changing. Is it possible to change this test to be tolerant to changes to intrinsics?
> 
> Changing it like this would help make it tolerant:
> 
> ```
> --- a/llvm/test/TableGen/CPtrWildcard.td
> +++ b/llvm/test/TableGen/CPtrWildcard.td
> @@ -5,19 +5,19 @@
> 
>  // CHECK:        static const unsigned char MatcherTable[] = {
>  // CHECK-NEXT: /*     0*/ OPC_CheckOpcode, TARGET_VAL(ISD::INTRINSIC_WO_CHAIN),
> -// CHECK-NEXT:/*     3*/ OPC_CheckChild0Integer, 42,
> +// CHECK-NEXT:/*     3*/ OPC_CheckChild0Integer, {{.*}},
>  // CHECK-NEXT:/*     5*/ OPC_RecordChild1, // #0 = $src
>  // CHECK-NEXT:/*     6*/ OPC_Scope, 9, /*->17*/ // 2 children in Scope
>  // CHECK-NEXT:/*     8*/  OPC_CheckChild1Type, /*MVT::c64*/126|128,1/*254*/,
>  // CHECK-NEXT:/*    11*/  OPC_MorphNodeTo1None, TARGET_VAL(MyTarget::C64_TO_I64),
>  // CHECK-NEXT:                /*MVT::i64*/8, 1/*#Ops*/, 0,
> -// CHECK-NEXT:            // Src: (intrinsic_wo_chain:{ *:[i64] } 21:{ *:[iPTR] }, c64:{ *:[c64] }:$src) - Complexity = 8
> +// CHECK-NEXT:            // Src: (intrinsic_wo_chain:{ *:[i64] } {{.*}}:{ *:[iPTR] }, c64:{ *:[c64] }:$src) - Complexity = 8
>  // CHECK-NEXT:            // Dst: (C64_TO_I64:{ *:[i64] } ?:{ *:[c64] }:$src)
>  // CHECK-NEXT:/*    17*/ /*Scope*/ 9, /*->27*/
>  // CHECK-NEXT:/*    18*/  OPC_CheckChild1Type, /*MVT::c128*/127|128,1/*255*/,
>  // CHECK-NEXT:/*    21*/  OPC_MorphNodeTo1None, TARGET_VAL(MyTarget::C128_TO_I64),
>  // CHECK-NEXT:                /*MVT::i64*/8, 1/*#Ops*/, 0,
> -// CHECK-NEXT:            // Src: (intrinsic_wo_chain:{ *:[i64] } 21:{ *:[iPTR] }, c128:{ *:[c128] }:$src) - Complexity = 8
> +// CHECK-NEXT:            // Src: (intrinsic_wo_chain:{ *:[i64] } {{.*}}:{ *:[iPTR] }, c128:{ *:[c128] }:$src) - Complexity = 8
>  // CHECK-NEXT:            // Dst: (C128_TO_I64:{ *:[i64] } ?:{ *:[c128] }:$src)
>  // CHECK-NEXT:/*    27*/ 0, /*End of Scope*/
>  // CHECK-NEXT:    0
> ```
> 
> But I'm not sure that's what you'd like.

Yeah those values do not matter for the purpose of this test, so using a `[[#]]` wildcard sounds like the best approach.

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


More information about the llvm-commits mailing list