[llvm] [SDAG] Fix CSE for ADDRSPACECAST nodes (PR #122912)
Alex MacLean via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 19 16:24:08 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]
----------------
AlexMaclean wrote:
Okay, I've done my best to update the test using @arsenm's suggestion in https://github.com/llvm/llvm-project/pull/122912#issuecomment-2591770353. I've also removed the `-NOT` checks and tried to make the checks as generic as possible to avoid unnecessary dependencies on debug printing format.
However, I'm still not yet able to prevent some other sort of CSE in SDAG from making the effects of this change difficult to observe even directly after SDAG via -stop-after=finalize-isel.
Does the updated version look good?
https://github.com/llvm/llvm-project/pull/122912
More information about the llvm-commits
mailing list