From 9c2024a7509baae921083d49a56e1321c51f00ec Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Tue, 23 Sep 2025 23:47:30 -0700 Subject: Remove unnecessary Load and Store pair (#8433) This commit removes unnecessary Load and Store pairs in IR. When the IR is like ``` let %1 = var let %2 = load(%ptr) store(%1 %2) ``` This PR will replace all uses of %1 with %ptr. And the load and store instructions will be removed. But I found that there can be cases where %2 might be still used later in other IRs. For these cases, the removal of load instruction relies on DCE. --------- Co-authored-by: slangbot --- tests/metal/vector-get-element-ptr.slang | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/metal/vector-get-element-ptr.slang b/tests/metal/vector-get-element-ptr.slang index af2acabbc..1c616b37e 100644 --- a/tests/metal/vector-get-element-ptr.slang +++ b/tests/metal/vector-get-element-ptr.slang @@ -14,11 +14,11 @@ void modify(inout int v) void computeMain(int3 v : SV_DispatchThreadID) { int3 u = v; - // CHECK: int [[TEMP:[a-zA-Z0-9_]+]] = u{{.*}}.x; + // CHECK: int [[TEMP:[a-zA-Z0-9_]+]] = [[OUT:[a-zA-Z0-9_]+]].x; // CHECK: modify{{.*}}(&[[TEMP]]) - // CHECK: u{{.*}}.x = [[TEMP]]; + // CHECK: [[OUT]].x = [[TEMP]]; modify(u.x); // BUF: 2 outputBuffer[0] = u.x + u.y; -} \ No newline at end of file +} -- cgit v1.2.3