[PATCH] D128913: [IR] Have Value::takeName() transfer intrinsic properties

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 1 07:22:56 PDT 2022


frasercrmck added a comment.

In D128913#3623784 <https://reviews.llvm.org/D128913#3623784>, @aeubanks wrote:

> what's the use case for having a function take the name of an intrinsic function?

It's a good question. I can't think of a reason you'd do this for intrinsics with intrinsic IDs, but if the meaning of intrinsic is indeed "starts with 'llvm.'", as is documented, then I think we should transfer that property over when naming functions in all cases. It's unintuitive to me to have a function beginning with "llvm." be an intrinsic if it's named through one method but not another.

As a more concrete example, downstream we have some passes which add parameters to functions, remove parameters from functions, change parameter types, etc., so we create new functions from old ones and this means we generally take the name. If, for whatever reason, we had a user using a "custom" intrinsic (if I may call them that - just a function starting with "llvm.") so they can make use of intrinsic semantics (e.g., they can use intrinsic-only function parameters like `immarg` or `elementtype`) then if we drop the fact that it's an intrinsic then at the very least the verifier would complain. That's how I originally caught this issue.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128913/new/

https://reviews.llvm.org/D128913



More information about the llvm-commits mailing list