[llvm] [AMDGPU] Cope with SelectionDAG::UpdateNodeOperands returning a different SDNode (PR #65765)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 8 07:37:17 PDT 2023


================
@@ -13464,7 +13464,11 @@ SDNode *SITargetLowering::adjustWritemask(MachineSDNode *&Node,
         continue;
     } else {
       SDValue Op = DAG.getTargetConstant(Idx, SDLoc(User), MVT::i32);
-      DAG.UpdateNodeOperands(User, SDValue(NewNode, 0), Op);
+      SDNode *NewUser = DAG.UpdateNodeOperands(User, SDValue(NewNode, 0), Op);
+      if (NewUser != User) {
+        DAG.ReplaceAllUsesWith(SDValue(User, 0), SDValue(NewUser, 0));
+        DAG.RemoveDeadNode(User);
----------------
jayfoad wrote:

This line is the fix for the asan error.

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


More information about the llvm-commits mailing list