[PATCH] D112717: [IR] Replace *all* uses of a constant expression by corresponding instruction

Mahesha S via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 29 12:02:52 PDT 2021


hsmhsm added inline comments.


================
Comment at: llvm/lib/IR/ReplaceConstant.cpp:93
+  for (auto Item : Visited)
+    Item.first->removeDeadConstantUsers();
 }
----------------
rampitec wrote:
> Why not to remove it immediately?
Consider below example, where C2 uses lds.  In this case, we have two paths, but both the paths have same sequence, that is (C1, C2).  So,  it again causes the same bug which https://reviews.llvm.org/D104425 has fixed. That is, we land up replacing already dead constant expression. 


```
                                   I
                                 /  \
                               C1   C1
                              /        \
                             C2        C2
```



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112717/new/

https://reviews.llvm.org/D112717



More information about the llvm-commits mailing list