From 4d54796f87a803b54228eb128c4ac641a37d1e8a Mon Sep 17 00:00:00 2001 From: Daniel Berlin Date: Sun, 12 Feb 2017 23:24:45 +0000 Subject: [PATCH] NewGVN: Reverse order of congruence class elimination to maximize trivial deadness llvm-svn: 294926 --- llvm/lib/Transforms/Scalar/NewGVN.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp index 25455c75b4e0..ab195e4000c8 100644 --- a/llvm/lib/Transforms/Scalar/NewGVN.cpp +++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp @@ -2059,7 +2059,7 @@ void NewGVN::convertDenseToLoadsAndStores( } static void patchReplacementInstruction(Instruction *I, Value *Repl) { - auto *ReplInst = dyn_cast(Repl); + auto *ReplInst = dyn_cast(Repl); if (!ReplInst) return; @@ -2220,7 +2220,7 @@ bool NewGVN::eliminateInstructions(Function &F) { } } - 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 PossibleDeadStores;