From 41a1550ef59b0eaab87e55393d6441ec06b6f2a7 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Tue, 4 Jan 2011 18:54:18 +0000 Subject: [PATCH] Branch instructions don't produce values, so there's no need to generate a value number for them. This avoids adding them to the various value numbering tables, resulting in a minor (~3%) speedup for GVN on 40.gcc. llvm-svn: 122819 --- llvm/lib/Transforms/Scalar/GVN.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index 43e850c65e88..cf82ebc027f8 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -1670,14 +1670,9 @@ bool GVN::processInstruction(Instruction *I, return Changed; } - uint32_t NextNum = VN.getNextUnusedValueNumber(); - unsigned Num = VN.lookup_or_add(I); - // For conditions branches, we can perform simple conditional propagation on // the condition value itself. if (BranchInst *BI = dyn_cast(I)) { - insert_table(Num, I, I->getParent()); - if (!BI->isConditional() || isa(BI->getCondition())) return false; @@ -1699,6 +1694,9 @@ bool GVN::processInstruction(Instruction *I, return false; } + uint32_t NextNum = VN.getNextUnusedValueNumber(); + unsigned Num = VN.lookup_or_add(I); + // Allocations are always uniquely numbered, so we can save time and memory // by fast failing them. if (isa(I) || isa(I) || isa(I)) {