[llvm] [Scalarizer][DirectX] Add support for scalarization of Target intrinsics (PR #108776)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 16 11:52:19 PDT 2024


================
@@ -689,8 +698,10 @@ bool ScalarizerVisitor::splitBinary(Instruction &I, const Splitter &Split) {
   return true;
 }
 
-static bool isTriviallyScalariable(Intrinsic::ID ID) {
-  return isTriviallyVectorizable(ID);
+bool ScalarizerVisitor::isTriviallyScalarizable(Intrinsic::ID ID) {
+
+  return TTI->isTargetIntrinsicTriviallyScalarizable(ID) ||
+         isTriviallyVectorizable(ID);
----------------
nikic wrote:

I think this check should be here in Scalarizer, so that isTargetIntrinsicTriviallyScalarizable() doesn't get called with a non-target intrinsic -- it shouldn't be able to influence whether generic intrinsics are scalarizable. So something like

```
if (isTriviallyVectorizable(ID))
  return true;
return Function::isTargetIntrinsic(ID) && TTI->isTargetIntrinsicTriviallyScalarizable(ID);
```
is what I'd do.

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


More information about the llvm-commits mailing list