From 731b2d7df57d4ca97e15b1136594f23055c083f7 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 13 Feb 2003 19:09:00 +0000 Subject: [PATCH] Move node forwarding code from being inlined to being out-of-line. This brings a 11.6% speedup to steens, and a 3.6 overall speedup to ds-aa git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5552 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/DSNode.h | 17 +-------------- include/llvm/Analysis/DSSupport.h | 2 ++ include/llvm/Analysis/DataStructure/DSNode.h | 17 +-------------- .../llvm/Analysis/DataStructure/DSSupport.h | 2 ++ lib/Analysis/DataStructure/DataStructure.cpp | 21 +++++++++++++++++++ 5 files changed, 27 insertions(+), 32 deletions(-) diff --git a/include/llvm/Analysis/DSNode.h b/include/llvm/Analysis/DSNode.h index c7edc5547e9..ce7f53be6b5 100644 --- a/include/llvm/Analysis/DSNode.h +++ b/include/llvm/Analysis/DSNode.h @@ -276,22 +276,7 @@ inline DSNode *DSNodeHandle::getNode() const { if (!N || N->ForwardNH.isNull()) return N; - // Handle node forwarding here! - DSNode *Next = N->ForwardNH.getNode(); // Cause recursive shrinkage - Offset += N->ForwardNH.getOffset(); - - if (--N->NumReferrers == 0) { - // Removing the last referrer to the node, sever the forwarding link - N->stopForwarding(); - } - - N = Next; - N->NumReferrers++; - if (N->Size <= Offset) { - assert(N->Size <= 1 && "Forwarded to shrunk but not collapsed node?"); - Offset = 0; - } - return N; + return HandleForwarding(); } inline void DSNodeHandle::setNode(DSNode *n) { diff --git a/include/llvm/Analysis/DSSupport.h b/include/llvm/Analysis/DSSupport.h index a36ce66b34c..d36be9bb3af 100644 --- a/include/llvm/Analysis/DSSupport.h +++ b/include/llvm/Analysis/DSSupport.h @@ -112,6 +112,8 @@ public: inline DSNodeHandle &getLink(unsigned Num); inline void setLink(unsigned Num, const DSNodeHandle &NH); +private: + DSNode *HandleForwarding() const; }; namespace std { diff --git a/include/llvm/Analysis/DataStructure/DSNode.h b/include/llvm/Analysis/DataStructure/DSNode.h index c7edc5547e9..ce7f53be6b5 100644 --- a/include/llvm/Analysis/DataStructure/DSNode.h +++ b/include/llvm/Analysis/DataStructure/DSNode.h @@ -276,22 +276,7 @@ inline DSNode *DSNodeHandle::getNode() const { if (!N || N->ForwardNH.isNull()) return N; - // Handle node forwarding here! - DSNode *Next = N->ForwardNH.getNode(); // Cause recursive shrinkage - Offset += N->ForwardNH.getOffset(); - - if (--N->NumReferrers == 0) { - // Removing the last referrer to the node, sever the forwarding link - N->stopForwarding(); - } - - N = Next; - N->NumReferrers++; - if (N->Size <= Offset) { - assert(N->Size <= 1 && "Forwarded to shrunk but not collapsed node?"); - Offset = 0; - } - return N; + return HandleForwarding(); } inline void DSNodeHandle::setNode(DSNode *n) { diff --git a/include/llvm/Analysis/DataStructure/DSSupport.h b/include/llvm/Analysis/DataStructure/DSSupport.h index a36ce66b34c..d36be9bb3af 100644 --- a/include/llvm/Analysis/DataStructure/DSSupport.h +++ b/include/llvm/Analysis/DataStructure/DSSupport.h @@ -112,6 +112,8 @@ public: inline DSNodeHandle &getLink(unsigned Num); inline void setLink(unsigned Num, const DSNodeHandle &NH); +private: + DSNode *HandleForwarding() const; }; namespace std { diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp index 80586de2f14..f2817623d22 100644 --- a/lib/Analysis/DataStructure/DataStructure.cpp +++ b/lib/Analysis/DataStructure/DataStructure.cpp @@ -24,6 +24,27 @@ namespace DS { // TODO: FIXME } using namespace DS; +DSNode *DSNodeHandle::HandleForwarding() const { + assert(!N->ForwardNH.isNull() && "Can only be invoked if forwarding!"); + + // Handle node forwarding here! + DSNode *Next = N->ForwardNH.getNode(); // Cause recursive shrinkage + Offset += N->ForwardNH.getOffset(); + + if (--N->NumReferrers == 0) { + // Removing the last referrer to the node, sever the forwarding link + N->stopForwarding(); + } + + N = Next; + N->NumReferrers++; + if (N->Size <= Offset) { + assert(N->Size <= 1 && "Forwarded to shrunk but not collapsed node?"); + Offset = 0; + } + return N; +} + //===----------------------------------------------------------------------===// // DSNode Implementation //===----------------------------------------------------------------------===// -- 2.40.0