[PATCH] D125764: Assert on polymorphic pointer intrinsic param
Thomas Preud'homme via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 18 03:47:25 PDT 2022
thopre added a comment.
In D125764#3521604 <https://reviews.llvm.org/D125764#3521604>, @nikic wrote:
> In D125764#3519427 <https://reviews.llvm.org/D125764#3519427>, @thopre wrote:
>
>> In D125764#3519318 <https://reviews.llvm.org/D125764#3519318>, @nikic wrote:
>>
>>> Could you please share an example of a problematic intrinsic signature?
>>
>>
>>
>> def int_colossus_ststep :
>> Intrinsic<
>> [LLVMPointerType<llvm_any_ty>],
>> [llvm_any_ty,
>> LLVMPointerType<LLVMMatchType<0>>,
>> llvm_i32_ty],
>> [IntrWriteMem, IntrArgMemOnly]>;
>
> Okay, I don't think I really understand the issue you're fixing then. This kind of intrinsic declaration //should// work with opaque pointers. The `LLVMMatchType<0>` predicate inside `LLVMPointerType<>` should just be ignored, which is what the current code is doing (right?)
>
> It looks like we also have some in-tree intrinsics that are using this pattern, such as int_riscv_vlm.
int_riscv_vlm is different because it matches a non-pointer polymorphic type. (the return value). In our case, the polymorphic type is on the pointed type. When that happens, matchIntrinsicType will *not* recurse for the pointed type since there is no pointed type for opaque pointers and thus will *not* push the pointed type into ArgTys. When processing the first parameter (the llvm_any_ty), the function exits with a match failure during deferred checks because of:
if (D.getArgumentNumber() > ArgTys.size() ||
D.getArgumentKind() == IITDescriptor::AK_MatchType)
return IsDeferredCheck || DeferCheck(Ty);
This is because the argument number is 1 but argTys.size() is 0 since the pointed to type was not pushed. Any polymorphic type after a polymorphic pointer type will fail because of that problem.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125764/new/
https://reviews.llvm.org/D125764
More information about the llvm-commits
mailing list