The attached patch adds an extra hook to TargetLowering that allows a target to change the Intrinsic ID and Values associated with an intrinsic call during SelectionDAG construction. The existing getTgtMemIntrinsic hook allows a target to change the Intrinsic ID but not the associated Values. Further, we wish to use this hook for more than just memory-touching intrinsics.
We would like to get the community’s feedback on this so as to make sure this patch is as universally applicable as possible. While not currently used in the open-source tree, this patch lays some groundwork for submission of the NVIDIA NVPTX back-end into the open-source tree.