[llvm] r294926 - NewGVN: Reverse order of congruence class elimination to maximize trivial deadness

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 12 15:24:45 PST 2017


Author: dannyb
Date: Sun Feb 12 17:24:45 2017
New Revision: 294926

URL: http://llvm.org/viewvc/llvm-project?rev=294926&view=rev
Log:
NewGVN: Reverse order of congruence class elimination to maximize trivial deadness

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

Modified: llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp?rev=294926&r1=294925&r2=294926&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp Sun Feb 12 17:24:45 2017
@@ -2059,7 +2059,7 @@ void NewGVN::convertDenseToLoadsAndStore
 }
 
 static void patchReplacementInstruction(Instruction *I, Value *Repl) {
-    auto *ReplInst = dyn_cast<Instruction>(Repl);
+  auto *ReplInst = dyn_cast<Instruction>(Repl);
   if (!ReplInst)
     return;
 
@@ -2220,7 +2220,7 @@ bool NewGVN::eliminateInstructions(Funct
     }
   }
 
-  for (CongruenceClass *CC : CongruenceClasses) {
+  for (CongruenceClass *CC : reverse(CongruenceClasses)) {
     // Track the equivalent store info so we can decide whether to try
     // dead store elimination.
     SmallVector<ValueDFS, 8> PossibleDeadStores;




More information about the llvm-commits mailing list