[llvm] [DirectX] Clean up extra vectors when lowering to buffer store (PR #116721)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 09:42:00 PST 2024


================
@@ -531,23 +531,46 @@ class OpLowerer {
         return make_error<StringError>(
             "typedBufferStore data must be a vector of 4 elements",
             inconvertibleErrorCode());
-      Value *Data0 =
-          IRB.CreateExtractElement(Data, ConstantInt::get(Int32Ty, 0));
-      Value *Data1 =
-          IRB.CreateExtractElement(Data, ConstantInt::get(Int32Ty, 1));
-      Value *Data2 =
-          IRB.CreateExtractElement(Data, ConstantInt::get(Int32Ty, 2));
-      Value *Data3 =
-          IRB.CreateExtractElement(Data, ConstantInt::get(Int32Ty, 3));
-
-      std::array<Value *, 8> Args{Handle, Index0, Index1, Data0,
-                                  Data1,  Data2,  Data3,  Mask};
+
+      // Since we're post-scalarizer, we likely have a vector that's constructed
+      // solely for the argument of the store.
----------------
bogner wrote:

Added "If so, just use the scalar values from before they're inserted into the temporary." to the comment.

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


More information about the llvm-commits mailing list