[llvm] [DeadStoreElimination] Optimize tautological assignments (PR #75744)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 13 01:06:24 PST 2024


================
@@ -1901,6 +1901,52 @@ struct DSEState {
     return true;
   }
 
+  // Check if there is a dominating condition, that implies that the value
+  // being stored in a ptr is already present in the ptr.
+  bool dominatingConditionImpliesValue(MemoryDef *Def) {
+    StoreInst *StoreI = dyn_cast<StoreInst>(Def->getMemoryInst());
----------------
nikic wrote:

```suggestion
    auto *StoreI = dyn_cast<StoreInst>(Def->getMemoryInst());
```
Prefer `auto` when the type is also written inside a `dyn_cast`.

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


More information about the llvm-commits mailing list