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

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 16 11:33:00 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);
----------------
farzonl wrote:

When I was first designing this feature I had 
```c++
 bool isTargetIntrinsicTriviallyScalarizable(Intrinsic::ID ID) {
  if (!Function::isTargetIntrinsic(ID))
    return false;
...
}
```
Hence why the names are so similar. However, after I implemented the DirectX part I realized that i'd be returning false anyways if it wasn't a dx intrinsic.

What we could do since I switched the order is to add an assert?

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


More information about the llvm-commits mailing list