[llvm] [SDAG] Fix CSE for ADDRSPACECAST nodes (PR #122912)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 14 18:53:55 PST 2025
================
@@ -0,0 +1,19 @@
+; RUN: llc < %s -mcpu=sm_80 -mattr=+ptx73 -debug-only=isel -o /dev/null 2>&1 | FileCheck %s
+
+; REQUIRES: asserts
+
+target triple = "nvptx64-nvidia-cuda"
+
+;; Selection DAG CSE is hard to test since we run CSE/GVN on the IR before and
+;; after selection DAG ISel so most cases will be handled by one of these.
+define void @foo(ptr %p) {
+; CHECK-LABEL: Optimized legalized selection DAG: %bb.0 'foo:'
+; CHECK: addrspacecast[0 -> 5]
+; CHECK-NOT: addrspacecast[0 -> 5]
+; CHECK-LABEL: ===== Instruction selection begins
+;
+ %a1 = addrspacecast ptr %p to ptr addrspace(5)
+ call void @llvm.stackrestore(ptr %p)
----------------
arsenm wrote:
```suggestion
call void @llvm.stackrestore.p0(ptr %p)
```
https://github.com/llvm/llvm-project/pull/122912
More information about the llvm-commits
mailing list