[llvm] [DirectX] Scalarize Allocas as part of data scalarization (PR #140165)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Thu May 15 18:47:24 PDT 2025


================
@@ -40,9 +41,10 @@ static bool findAndReplaceVectors(Module &M);
 class DataScalarizerVisitor : public InstVisitor<DataScalarizerVisitor, bool> {
 public:
   DataScalarizerVisitor() : GlobalMap() {}
-  bool visit(Instruction &I);
+  bool visit(Function &F);
----------------
farzonl wrote:

This is actually exactly how the scalarizer does it:
https://github.com/llvm/llvm-project/blob/dae5c4e1e7deef1fddad6e83d0f109b6fc9c5cc4/llvm/lib/Transforms/Scalar/Scalarizer.cpp#L280

https://github.com/llvm/llvm-project/blob/dae5c4e1e7deef1fddad6e83d0f109b6fc9c5cc4/llvm/lib/Transforms/Scalar/Scalarizer.cpp#L459

Creating a `visit(Instruction &I);` doesn't really do anything unique for us because we call  the parent  visit anyways via `InstVisitor::visit(I);`.

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


More information about the llvm-commits mailing list