[clang] [llvm] [RFC][CodeGen] Add generic target feature checks for intrinsics (PR #201470)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 30 01:27:14 PDT 2026


================
@@ -87,6 +89,10 @@ class LLVM_ABI TargetSubtargetInfo : public MCSubtargetInfo {
 
   virtual bool isXRaySupported() const { return false; }
 
+  /// \returns true if the target intrinsic \p IntrinsicID used by \p CB is
+  /// supported by this subtarget.
+  bool isIntrinsicSupported(unsigned IntrinsicID, const CallBase &CB) const;
----------------
arsenm wrote:

> I'm thinking about the case where an intrinsic might only be allowed in certain functions, like certain calling conventions, but I can see the argument that this would need to be captured by verifier, probably.

This sounds like a rule that shouldn't exist. If it would, it probably should be UB rather than treated as invalid IR

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


More information about the cfe-commits mailing list