DAG: Prevent store value forwarding to distinct addrspace load
authorDmitry Borisenkov <dmitriy.borisenkov89@gmail.com>
Thu, 29 Dec 2022 23:04:55 +0000 (18:04 -0500)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 29 Dec 2022 23:19:55 +0000 (18:19 -0500)
commit0ec51a460a308f10a21bbaa9d96cd6c3e8e6d834
tree4cd017e2a277bc50f503b996db7db4be4b05ddfc
parente50976e56933c3e907246e01deb14b5dd485032b
DAG: Prevent store value forwarding to distinct addrspace load

DAGCombiner replaces (load const_addr1) directly chained with (store
(val, const_addr2)) with val if address space stripped const_addr1 ==
const_addr2. The patch fixes the issue by checking address spaces as
well.  However, it might makes sense to not to chain together side
effects that belong to different address spaces in the first place and
make SelectionDAG::root address space aware.
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/NVPTX/chain-different-as.ll [new file with mode: 0644]