[llvm] Make RAUW skip instances where operand is the replacement node (PR #212724)

Soham Karandikar via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 02:34:00 PDT 2026


================
@@ -13307,6 +13301,18 @@ void SelectionDAG::ReplaceAllUsesOfValueWith(SDValue From, SDValue To){
   RAUWUpdateListener Listener(*this, UI, UE);
   while (UI != UE) {
     SDNode *User = UI->getUser();
+    
+    // Don't replace uses of the To node if is is self-referential.
----------------
skadewdl3 wrote:

The DAG dump does show there's a self-referential token factor created. Afais, `makeEquivalentMemoryOrdering` calls UpdateNodeOperands` to fix that, but the assertion is hit before that happens in this case.

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


More information about the llvm-commits mailing list