From 5f92e2b11f68624f9003e710f44e3bc324cbf89a Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 6 Oct 2003 15:23:43 +0000 Subject: Avoid doing pointless work. Amazingly, this makes us go faster. Running the inliner on 252.eon used to take 48.4763s, now it takes 14.4148s. In release mode, it went from taking 25.8741s to taking 11.5712s. This also fixes a FIXME. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8890 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/ValueMapper.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/Transforms/Utils/ValueMapper.cpp') diff --git a/lib/Transforms/Utils/ValueMapper.cpp b/lib/Transforms/Utils/ValueMapper.cpp index 484765a7e2..d79c21f474 100644 --- a/lib/Transforms/Utils/ValueMapper.cpp +++ b/lib/Transforms/Utils/ValueMapper.cpp @@ -13,6 +13,11 @@ Value *MapValue(const Value *V, std::map &VM) { Value *&VMSlot = VM[V]; if (VMSlot) return VMSlot; // Does it exist in the map yet? + // Global values do not need to be seeded into the ValueMap if they are using + // the identity mapping. + if (isa(V)) + return VMSlot = const_cast(V); + if (Constant *C = const_cast(dyn_cast(V))) { if (isa(C) || isa(C) || isa(C)) -- cgit v1.2.3