From cf14e71c5e6efdf4323b150cc52a5411a2ce6e4d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 25 Feb 2004 23:36:08 +0000 Subject: Two changes: 1. Functions do not make things incomplete, only variables 2. Constant global variables no longer need to be marked incomplete, because we are guaranteed that the initializer for the global will be in the graph we are hacking on now. This makes resolution of indirect calls happen a lot more in the bu pass, supports things like vtables and the C counterparts (giant constant arrays of function pointers), etc... Testcase here: test/Regression/Analysis/DSGraph/constant_globals.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11852 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/DataStructure/DataStructure.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/Analysis/DataStructure/DataStructure.cpp') diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp index 3339d6152f..686655637b 100644 --- a/lib/Analysis/DataStructure/DataStructure.cpp +++ b/lib/Analysis/DataStructure/DataStructure.cpp @@ -13,6 +13,7 @@ #include "llvm/Analysis/DSGraph.h" #include "llvm/Function.h" +#include "llvm/GlobalVariable.h" #include "llvm/iOther.h" #include "llvm/DerivedTypes.h" #include "llvm/Target/TargetData.h" @@ -1353,7 +1354,9 @@ void DSGraph::markIncompleteNodes(unsigned Flags) { if ((Flags & DSGraph::IgnoreGlobals) == 0) for (DSScalarMap::global_iterator I = ScalarMap.global_begin(), E = ScalarMap.global_end(); I != E; ++I) - markIncompleteNode(ScalarMap[*I].getNode()); + if (GlobalVariable *GV = dyn_cast(*I)) + if (!GV->isConstant()) + markIncompleteNode(ScalarMap[GV].getNode()); } static inline void killIfUselessEdge(DSNodeHandle &Edge) { -- cgit v1.2.3-18-g5258