[llvm] r370824 - [GVN] Remove a todo introduced w/rL370791

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 3 14:56:17 PDT 2019


Author: reames
Date: Tue Sep  3 14:56:17 2019
New Revision: 370824

URL: http://llvm.org/viewvc/llvm-project?rev=370824&view=rev
Log:
[GVN] Remove a todo introduced w/rL370791

When I dug into this, it turns out to be *much* more involved than I'd realized and doesn't actually simplify anything.  

The general purpose of the leader table is that we want to find the most-dominating definition quickly.  The problem for equivalance folding is slightly different; we want to find the most dominating *value* whose definition block dominates our use quickly.

To make this change, we'd end up having to restructure the leader table (either the sorting thereof, or maybe even introducing multiple leader tables per value) and that complexity is just not worth it.


Modified:
    llvm/trunk/lib/Transforms/Scalar/GVN.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=370824&r1=370823&r2=370824&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Tue Sep  3 14:56:17 2019
@@ -1754,9 +1754,6 @@ void GVN::assignBlockRPONumber(Function
 }
 
 bool GVN::replaceOperandsForInBlockEquality(Instruction *Instr) const {
-  // TODO: We can remove the separate ReplaceOperandsWithMap data structure in
-  // favor of putting equalitys into the leader table and using findLeader
-  // here. 
   bool Changed = false;
   for (unsigned OpNum = 0; OpNum < Instr->getNumOperands(); ++OpNum) {
     Value *Operand = Instr->getOperand(OpNum); 




More information about the llvm-commits mailing list