[PATCH] D154852: [FuncSpec] Add Phi nodes to the InstCostVisitor.

Alexandros Lamprineas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 06:24:54 PDT 2023


labrinea added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/FunctionSpecialization.cpp:253-254
+    if (auto *Inst = dyn_cast<Instruction>(V))
+      if (DeadBlocks.contains(Inst->getParent()) || Inst == &I)
+        continue;
+    auto *C = dyn_cast<Constant>(V);
----------------
I am wondering whether we should be checking `DeadBlocks.contains(I.getIncomingBlock(Idx))`. Imagine this scenario:


```
        x = 2
       /     \
      /    aliveBB
  deadBB
      \     y = 3
       \     /
  phi ( x , y )
```
The basic block where x is defined is alive, therefore we can't fold the PHI because `x != y`. Is it not a pessimization?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154852



More information about the llvm-commits mailing list