From lattner at cs.uiuc.edu Mon Jan 27 16:10:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Jan 27 16:10:02 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Instructions.h Message-ID: <200301272209.QAA05342@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Instructions.h added (r1.1) --- Log message: New helper header --- Diffs of the changes: From lattner at cs.uiuc.edu Mon Jan 27 17:42:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Jan 27 17:42:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Reoptimizer/TraceCache/MemoryManager.cpp VirtualMem.cpp Message-ID: <200301272341.RAA07249@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Reoptimizer/TraceCache: MemoryManager.cpp updated: 1.1 -> 1.2 VirtualMem.cpp updated: 1.7 -> 1.8 --- Log message: Fix warnings for anand --- Diffs of the changes: Index: llvm/lib/Reoptimizer/TraceCache/MemoryManager.cpp diff -u llvm/lib/Reoptimizer/TraceCache/MemoryManager.cpp:1.1 llvm/lib/Reoptimizer/TraceCache/MemoryManager.cpp:1.2 --- llvm/lib/Reoptimizer/TraceCache/MemoryManager.cpp:1.1 Sun Sep 15 15:36:36 2002 +++ llvm/lib/Reoptimizer/TraceCache/MemoryManager.cpp Mon Jan 27 17:41:43 2003 @@ -32,9 +32,9 @@ int dummyFunction(int i); //the function that provides memory! MemoryManager::MemoryManager(){ - memStart = (uint64_t)&dummyFunction; - memEnd = (uint64_t)&dummyFunction+globalMemSize*4; - std::cerr<<"Dummy address :"<<(void *)memStart<<"\n"; + memStart = (intptr_t)&dummyFunction; + memEnd = (intptr_t)&dummyFunction+globalMemSize*4; + std::cerr<<"Dummy address :"<<(void *)(intptr_t)memStart<<"\n"; freeMemList.push_back(std::make_pair(memStart, memEnd)); } @@ -49,11 +49,11 @@ for(std::list >::iterator LI = freeMemList.begin(), LE = freeMemList.end(); LI!=LE; ++LI){ - if(LI->second - LI->first >= sz-1){ + if(int64_t(LI->second - LI->first) >= sz-1){ uint64_t temp = LI->first; //reassign the pair - if(LI->second - LI->first == sz-1) + if(int64_t(LI->second - LI->first) == sz-1) freeMemList.erase(LI); else LI->first += sz; Index: llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp diff -u llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp:1.7 llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp:1.8 --- llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp:1.7 Mon Nov 4 18:50:24 2002 +++ llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp Mon Jan 27 17:41:43 2003 @@ -102,7 +102,7 @@ #ifdef GET_TRACE_TIME //write call instruction to llvm_start_time, followed by nop void VirtualMem::writeCallLLVMTime(uint64_t instAddr){ - unsigned int callInst = getCallInstr((uint64_t)&llvm_time_start, instAddr); + unsigned int callInst = getCallInstr((uint64_t)(intptr_t)&llvm_time_start, instAddr); writeInstToVM(instAddr, callInst); writeInstToVM(instAddr+4, 0x01000000); } From lattner at cs.uiuc.edu Tue Jan 28 14:02:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Jan 28 14:02:00 2003 Subject: [llvm-commits] CVS: llvm/include/Support/VectorExtras.h Message-ID: <200301282001.OAA19159@apoc.cs.uiuc.edu> Changes in directory llvm/include/Support: VectorExtras.h added (r1.1) --- Log message: Initial checking: defult the make_vector function --- Diffs of the changes: From lattner at cs.uiuc.edu Tue Jan 28 15:01:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Jan 28 15:01:00 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp Message-ID: <200301282100.PAA19654@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Local.cpp updated: 1.42 -> 1.43 --- Log message: free instructions mark their operands as being heap nodes. --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.42 llvm/lib/Analysis/DataStructure/Local.cpp:1.43 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.42 Thu Jan 23 16:05:33 2003 +++ llvm/lib/Analysis/DataStructure/Local.cpp Tue Jan 28 14:59:57 2003 @@ -394,7 +394,8 @@ void GraphBuilder::visitFreeInst(FreeInst &FI) { // Mark that the node is written to... - getValueDest(*FI.getOperand(0)).getNode()->NodeType |= DSNode::Modified; + getValueDest(*FI.getOperand(0)).getNode()->NodeType + |= DSNode::Modified | DSNode::HeapNode; } /// Handle casts... From lattner at cs.uiuc.edu Wed Jan 29 10:27:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Jan 29 10:27:01 2003 Subject: [llvm-commits] CVS: llvm/utils/Burg/map.c Message-ID: <200301291626.KAA10043@trinity.cs.uiuc.edu> Changes in directory llvm/utils/Burg: map.c updated: 1.1 -> 1.2 --- Log message: Fix warning on sparc --- Diffs of the changes: Index: llvm/utils/Burg/map.c diff -u llvm/utils/Burg/map.c:1.1 llvm/utils/Burg/map.c:1.2 --- llvm/utils/Burg/map.c:1.1 Tue Sep 17 18:03:29 2002 +++ llvm/utils/Burg/map.c Wed Jan 29 10:26:46 2003 @@ -1,4 +1,4 @@ -char rcsid_map[] = "$Id: map.c,v 1.1 2002/09/17 23:03:29 lattner Exp $"; +char rcsid_map[] = "$Id: map.c,v 1.2 2003/01/29 16:26:46 lattner Exp $"; #include #include @@ -54,7 +54,7 @@ v = 0; for (; (nt = *r) != 0; r++) { - v ^= ((int)p[nt].rule) + (PRINCIPLECOST(p[nt].delta)<<4); + v ^= ((long)p[nt].rule) + (PRINCIPLECOST(p[nt].delta)<<4); } v >>= 4; v &= (mod-1); From lattner at cs.uiuc.edu Wed Jan 29 12:03:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Jan 29 12:03:00 2003 Subject: [llvm-commits] CVS: llvm/tools/lli/JIT/Emitter.cpp Message-ID: <200301291802.MAA00351@apoc.cs.uiuc.edu> Changes in directory llvm/tools/lli/JIT: Emitter.cpp updated: 1.2 -> 1.3 --- Log message: Fix warnings on sparc --- Diffs of the changes: Index: llvm/tools/lli/JIT/Emitter.cpp diff -u llvm/tools/lli/JIT/Emitter.cpp:1.2 llvm/tools/lli/JIT/Emitter.cpp:1.3 --- llvm/tools/lli/JIT/Emitter.cpp:1.2 Sun Jan 12 19:00:12 2003 +++ llvm/tools/lli/JIT/Emitter.cpp Wed Jan 29 12:02:02 2003 @@ -69,14 +69,15 @@ for (unsigned i = 0, e = BBRefs.size(); i != e; ++i) { unsigned Location = BBLocations[BBRefs[i].first]; unsigned *Ref = BBRefs[i].second; - *Ref = Location-(unsigned)Ref-4; + *Ref = Location-(unsigned)(intptr_t)Ref-4; } BBRefs.clear(); BBLocations.clear(); NumBytes += CurByte-CurBlock; - DEBUG(std::cerr << "Finished CodeGen of [0x" << std::hex << (unsigned)CurBlock + DEBUG(std::cerr << "Finished CodeGen of [0x" << std::hex + << (unsigned)(intptr_t)CurBlock << std::dec << "] Function: " << F.getFunction()->getName() << ": " << CurByte-CurBlock << " bytes of text\n"); } @@ -95,7 +96,7 @@ void Emitter::startBasicBlock(MachineBasicBlock &BB) { - BBLocations[BB.getBasicBlock()] = (unsigned)CurByte; + BBLocations[BB.getBasicBlock()] = (unsigned)(intptr_t)CurByte; } @@ -121,7 +122,7 @@ // void Emitter::emitAddress(void *Addr, bool isPCRelative) { if (isPCRelative) { - *(unsigned*)CurByte = (unsigned)Addr - (unsigned)CurByte-4; + *(intptr_t*)CurByte = (intptr_t)Addr - (intptr_t)CurByte-4; } else { *(void**)CurByte = Addr; } From lattner at cs.uiuc.edu Wed Jan 29 12:16:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Jan 29 12:16:01 2003 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/SystemUtils.cpp Message-ID: <200301291815.MAA01115@apoc.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: SystemUtils.cpp updated: 1.2 -> 1.3 --- Log message: Fix build problem on sparc --- Diffs of the changes: Index: llvm/tools/bugpoint/SystemUtils.cpp diff -u llvm/tools/bugpoint/SystemUtils.cpp:1.2 llvm/tools/bugpoint/SystemUtils.cpp:1.3 --- llvm/tools/bugpoint/SystemUtils.cpp:1.2 Mon Dec 23 18:44:34 2002 +++ llvm/tools/bugpoint/SystemUtils.cpp Wed Jan 29 12:15:34 2003 @@ -9,7 +9,8 @@ #include #include #include -#include +#include +#include #include #include #include From lattner at cs.uiuc.edu Wed Jan 29 12:38:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Jan 29 12:38:03 2003 Subject: [llvm-commits] CVS: llvm/test/Libraries/libpoolalloc/ Message-ID: <200301291837.MAA01905@apoc.cs.uiuc.edu> Changes in directory llvm/test/Libraries/libpoolalloc: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Libraries/libpoolalloc added to the repository --- Diffs of the changes: From lattner at cs.uiuc.edu Wed Jan 29 12:39:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Jan 29 12:39:01 2003 Subject: [llvm-commits] CVS: llvm/test/Libraries/libpoolalloc/Makefile PoolAllocatorChained.c Message-ID: <200301291838.MAA01970@apoc.cs.uiuc.edu> Changes in directory llvm/test/Libraries/libpoolalloc: Makefile added (r1.1) PoolAllocatorChained.c added (r1.1) --- Log message: Initial checkin of pool allocator library --- Diffs of the changes: From lattner at cs.uiuc.edu Wed Jan 29 15:11:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Jan 29 15:11:02 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSNode.h DSSupport.h Message-ID: <200301292110.PAA06826@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSNode.h updated: 1.16 -> 1.17 DSSupport.h updated: 1.8 -> 1.9 --- Log message: New API for traversing graph --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSNode.h diff -u llvm/include/llvm/Analysis/DSNode.h:1.16 llvm/include/llvm/Analysis/DSNode.h:1.17 --- llvm/include/llvm/Analysis/DSNode.h:1.16 Fri Dec 6 15:10:17 2002 +++ llvm/include/llvm/Analysis/DSNode.h Wed Jan 29 15:09:59 2003 @@ -218,6 +218,12 @@ /// specified mapping. void remapLinks(std::map &OldNodeMap); + /// markReachableNodes - This method recursively traverses the specified + /// DSNodes, marking any nodes which are reachable. All reachable nodes it + /// adds to the set, which allows it to only traverse visited nodes once. + /// + void markReachableNodes(std::set &ReachableNodes); + private: friend class DSNodeHandle; Index: llvm/include/llvm/Analysis/DSSupport.h diff -u llvm/include/llvm/Analysis/DSSupport.h:1.8 llvm/include/llvm/Analysis/DSSupport.h:1.9 --- llvm/include/llvm/Analysis/DSSupport.h:1.8 Mon Nov 18 15:45:07 2002 +++ llvm/include/llvm/Analysis/DSSupport.h Wed Jan 29 15:09:59 2003 @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -213,6 +214,12 @@ for (unsigned a = 0; a != MinArgs; ++a) getPtrArg(a).mergeWith(CS.getPtrArg(a)); } + + /// markReachableNodes - This method recursively traverses the specified + /// DSNodes, marking any nodes which are reachable. All reachable nodes it + /// adds to the set, which allows it to only traverse visited nodes once. + /// + void markReachableNodes(std::set &Nodes); bool operator<(const DSCallSite &CS) const { if (Callee < CS.Callee) return true; // This must sort by callee first! From lattner at cs.uiuc.edu Wed Jan 29 15:11:04 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Jan 29 15:11:04 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200301292110.PAA06838@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.74 -> 1.75 --- Log message: Use and implement API for graph traversals --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.74 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.75 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.74 Thu Jan 23 16:05:33 2003 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Wed Jan 29 15:10:20 2003 @@ -13,7 +13,6 @@ #include "Support/Statistic.h" #include "Support/Timer.h" #include -#include using std::vector; @@ -938,17 +937,27 @@ } -// markAlive - Simple graph walker that recursively traverses the graph, marking -// stuff to be alive. -// -static void markAlive(DSNode *N, std::set &Alive) { - if (N == 0) return; - std::set::iterator I = Alive.lower_bound(N); - if (I != Alive.end() && *I == N) return; // Already marked alive - Alive.insert(I, N); // Is alive now +/// markReachableNodes - This method recursively traverses the specified +/// DSNodes, marking any nodes which are reachable. All reachable nodes it adds +/// to the set, which allows it to only traverse visited nodes once. +/// +void DSNode::markReachableNodes(std::set &ReachableNodes) { + if (this == 0) return; + std::set::iterator I = ReachableNodes.lower_bound(this); + if (I != ReachableNodes.end() && *I == this) + return; // Already marked reachable + ReachableNodes.insert(I, this); // Is reachable now + + for (unsigned i = 0, e = getSize(); i < e; i += DS::PointerSize) + getLink(i).getNode()->markReachableNodes(ReachableNodes); +} - for (unsigned i = 0, e = N->getSize(); i < e; i += DS::PointerSize) - markAlive(N->getLink(i).getNode(), Alive); +void DSCallSite::markReachableNodes(std::set &Nodes) { + getRetVal().getNode()->markReachableNodes(Nodes); + getCallee().getNode()->markReachableNodes(Nodes); + + for (unsigned j = 0, e = getNumPtrArgs(); j != e; ++j) + getPtrArg(j).getNode()->markReachableNodes(Nodes); } // markAliveIfCanReachAlive - Simple graph walker that recursively traverses the @@ -981,7 +990,7 @@ ChildrenAreAlive |= markAliveIfCanReachAlive(N->getLink(i).getNode(), Alive, Visited); if (ChildrenAreAlive) - markAlive(N, Alive); + N->markReachableNodes(Alive); return ChildrenAreAlive; } @@ -996,14 +1005,6 @@ return false; } -static void markAlive(DSCallSite &CS, std::set &Alive) { - markAlive(CS.getRetVal().getNode(), Alive); - markAlive(CS.getCallee().getNode(), Alive); - - for (unsigned j = 0, e = CS.getNumPtrArgs(); j != e; ++j) - markAlive(CS.getPtrArg(j).getNode(), Alive); -} - // removeDeadNodes - Use a more powerful reachability analysis to eliminate // subgraphs that are unreachable. This often occurs because the data // structure doesn't "escape" into it's caller, and thus should be eliminated @@ -1025,12 +1026,12 @@ E = ScalarMap.end(); I != E; ++I) if (!(Flags & DSGraph::RemoveUnreachableGlobals) || !isa(I->first)) // Don't mark globals! - markAlive(I->second.getNode(), Alive); + I->second.getNode()->markReachableNodes(Alive); else // Keep track of global nodes GlobalNodes.push_back(std::make_pair(I->first, I->second.getNode())); // The return value is alive as well... - markAlive(RetNode.getNode(), Alive); + RetNode.getNode()->markReachableNodes(Alive); // If any global nodes points to a non-global that is "alive", the global is // "alive" as well... @@ -1042,14 +1043,14 @@ std::vector FCallsAlive(FunctionCalls.size()); for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) if (CallSiteUsesAliveArgs(FunctionCalls[i], Alive, Visited)) { - markAlive(FunctionCalls[i], Alive); + FunctionCalls[i].markReachableNodes(Alive); FCallsAlive[i] = true; } std::vector AuxFCallsAlive(AuxFunctionCalls.size()); for (unsigned i = 0, e = AuxFunctionCalls.size(); i != e; ++i) if (CallSiteUsesAliveArgs(AuxFunctionCalls[i], Alive, Visited)) { - markAlive(AuxFunctionCalls[i], Alive); + AuxFunctionCalls[i].markReachableNodes(Alive); AuxFCallsAlive[i] = true; } From lattner at cs.uiuc.edu Wed Jan 29 15:13:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Jan 29 15:13:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/PoolAllocate.cpp Message-ID: <200301292112.PAA06871@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: PoolAllocate.cpp added (r1.1) --- Log message: Initial checkin of pool allocation code --- Diffs of the changes: From lattner at cs.uiuc.edu Wed Jan 29 15:14:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Jan 29 15:14:00 2003 Subject: [llvm-commits] CVS: llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp Message-ID: <200301292113.PAA06947@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Reoptimizer/TraceCache: InstrUtils.cpp updated: 1.7 -> 1.8 --- Log message: Fix warnings --- Diffs of the changes: Index: llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp diff -u llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp:1.7 llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp:1.8 --- llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp:1.7 Tue Oct 8 11:54:03 2002 +++ llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp Wed Jan 29 15:13:41 2003 @@ -12,7 +12,7 @@ #include #include -uint64_t getBranchTarget(unsigned int br, uint64_t pc){ +uint64_t getBranchTarget(unsigned br, uint64_t pc){ if(isNonDepJump(br)) return getNonDepJmpTarget(br, pc); else if(isDepJump(br)) @@ -20,12 +20,13 @@ else if(isBPR(br)) return getBPRTarget(br, pc); else{ - std::cerr<<(void *)br<<"\n"; + std::cerr< Changes in directory llvm/test/Programs: TEST.poolalloc.Makefile updated: 1.2 -> 1.3 --- Log message: Updates for use with current pool allocator --- Diffs of the changes: Index: llvm/test/Programs/TEST.poolalloc.Makefile diff -u llvm/test/Programs/TEST.poolalloc.Makefile:1.2 llvm/test/Programs/TEST.poolalloc.Makefile:1.3 --- llvm/test/Programs/TEST.poolalloc.Makefile:1.2 Fri Jan 17 16:58:49 2003 +++ llvm/test/Programs/TEST.poolalloc.Makefile Wed Jan 29 15:13:56 2003 @@ -1,63 +1,62 @@ ##===- test/Programs/TEST.poolalloc.Makefile ---------------*- Makefile -*-===## # -# Old tests for pool allocation. These will almost certainly have to be updated -# to be useful in the future. +# Simple tests for pool allocation. # -# Note that this is Sparc specific! +# At the moment this doesn't do anything meaningful. In the future, this should +# do timings to see if we improve performance. # ##===----------------------------------------------------------------------===## -.PRECIOUS: Output/%.poolalloc.bc - -N32Objects := $(addprefix Output/n32/,$(NObjs)) -.PRECIOUS: $(N32Objects) Output/n32/.dir -Output/%.native32: $(N32Objects) - $(CC) -o $@ $(N32Objects) $(LDFLAGS) - -Output/n32/%.o: %.c Output/n32/.dir - $(CC) -DTORONTO -g -xarch=v8 -c $< -o $@ - -.PRECIOUS: Output/%.poolalloc8.llvm.bc Output/%.poolalloc16.llvm.bc Output/%.poolalloc32.llvm.bc Output/%.poolalloc16nle.llvm.bc Output/%.poolalloc32nle.llvm.bc - -# Pool allocate memory objects if possible -Output/%.poolalloc8.llvm.bc: Output/%.linked.bc $(LOPT) - $(LOPT) -internalize -poolalloc -ptrsize=8 -globaldce -instcombine -die -gcse < $< -o $@ -f -Output/%.poolalloc16.llvm.bc: Output/%.linked.bc $(LOPT) - $(LOPT) -internalize -poolalloc -ptrsize=16 -globaldce -instcombine -die -gcse < $< -o $@ -f -Output/%.poolalloc32.llvm.bc: Output/%.linked.bc $(LOPT) - $(LOPT) -internalize -poolalloc -ptrsize=32 -globaldce -instcombine -die -gcse < $< -o $@ -f - -Output/%.poolalloc8nle.llvm.bc: Output/%.linked.bc $(LOPT) - $(LOPT) -internalize -poolalloc -no-pool-load-elim -ptrsize=8 -globaldce -instcombine -die < $< -o $@ -f -Output/%.poolalloc16nle.llvm.bc: Output/%.linked.bc $(LOPT) - $(LOPT) -internalize -poolalloc -no-pool-load-elim -ptrsize=16 -globaldce -instcombine -die < $< -o $@ -f -Output/%.poolalloc32nle.llvm.bc: Output/%.linked.bc $(LOPT) - $(LOPT) -internalize -poolalloc -no-pool-load-elim -ptrsize=32 -globaldce -instcombine -die < $< -o $@ -f - - - -# Link the pool allocator into the programs... -LLC_PROG_LIBS += /home/vadve/lattner/PoolAllocated/PoolAllocator.o - -.PRECIOUS: Output/%.out-pa Output/%.diff-pa -Output/%.out-pa: Output/%.llc - -$< > $@ 2>&1 - -Output/%.diff-pa: Output/%.out-pa Output/%.out-llc - @echo "DIFFING pool allocated vs nonpoolallocated output:" - diff $< $(<:%-pa=%-llc) - @touch $@ - -TESTNAME = $(subst test.example.,,$@) - -test.poolalloc.%: Output/%.poolalloc32.diff-pa Output/%.poolalloc32.llc \ - Output/%.poolalloc16.llc Output/%.poolalloc32nle.llc \ - Output/%.poolalloc16nle.llc Output/%.native32 - $(TIMEPROG) 'Normal LLC build...' Output/$(TESTNAME).llc - $(TIMEPROG) '32 bit pool alloc NLE...' Output/$(TESTNAME).poolalloc32nle.llc - $(TIMEPROG) '32 bit pool allocation...' Output/$(TESTNAME).poolalloc32.llc - $(TIMEPROG) '16 bit pool alloc NLE...' Output/$(TESTNAME).poolalloc16nle.llc - $(TIMEPROG) '16 bit pool allocation...' Output/$(TESTNAME).poolalloc16.llc +# PALIB - The path to the runtime library which provides the pool allocator +# itself. +# +PALIB := $(LEVEL)/test/Libraries/Output/libpoolalloc.bc +PASRC := $(LEVEL)/test/Libraries/libdummy - $(TIMEPROG) 'Native Sun CC 64...' Output/$(TESTNAME).native - $(TIMEPROG) 'Native Sun CC 32...' Output/$(TESTNAME).native32 +# Rebuild libpoolalloc if neccesary... +$(PALIB) : $(wildcard $(PASRC)/*.c) + cd $(PASRC); $(MAKE) + +# LINKED_PROGS - All of the programs linked to libpoolalloc +LINKED_PROGS := $(PROGRAMS_TO_TEST:%=Output/%.pa.llvm.bc) + +IPO_OPTS := -internalize -funcresolve -instcombine -globaldce +$(LINKED_PROGS): Output/%.pa.llvm.bc: Output/%.pa.bc $(PALIB) + $(LLINK) $< $(PALIB) | $(LOPT) $(IPO_OPTS) > $@ + +# Pool allocation target... + +PA_OPTS := -load /localhome/lattner/cvs/llvm/lib/Debug/libpoolalloc.so +$(PROGRAMS_TO_TEST:%=Output/%.pa.bc): Output/%.pa.bc: Output/%.llvm.bc + $(LOPT) $(PA_OPTS) -poolalloc < $< > $@ || as < /dev/null > $@ + +$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ +Output/%.$(TEST).report.txt: Output/%.pa.llvm.bc + echo "good" > $@ + +test.$(TEST).%: Output/%.$(TEST).report.txt + @echo "---------------------------------------------------------------" + @echo ">>> ========= '$*' Program" + @echo "---------------------------------------------------------------" + @cat $< + +#.PRECIOUS: Output/%.out-pa Output/%.diff-pa +#Output/%.out-pa: Output/%.llc +# -$< > $@ 2>&1 + +#Output/%.diff-pa: Output/%.out-pa Output/%.out-llc +# @echo "DIFFING pool allocated vs nonpoolallocated output:" +# diff $< $(<:%-pa=%-llc) +# @touch $@ + +#test.poolalloc.%: Output/%.poolalloc32.diff-pa Output/%.poolalloc32.llc \ +# Output/%.poolalloc16.llc Output/%.poolalloc32nle.llc \ +# Output/%.poolalloc16nle.llc Output/%.native32 +# $(TIMEPROG) 'Normal LLC build...' Output/$*.llc +# $(TIMEPROG) '32 bit pool alloc NLE...' Output/$*.poolalloc32nle.llc +# $(TIMEPROG) '32 bit pool allocation...' Output/$*.poolalloc32.llc +# $(TIMEPROG) '16 bit pool alloc NLE...' Output/$*.poolalloc16nle.llc +# $(TIMEPROG) '16 bit pool allocation...' Output/$*.poolalloc16.llc +# +# $(TIMEPROG) 'Native Sun CC 64...' Output/$*.native +# $(TIMEPROG) 'Native Sun CC 32...' Output/$*.native32 From lattner at cs.uiuc.edu Thu Jan 30 11:09:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 30 11:09:02 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LevelRaise/2003-01-30-ShiftCrash.ll Message-ID: <200301301708.LAA31760@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LevelRaise: 2003-01-30-ShiftCrash.ll added (r1.1) --- Log message: New testcase --- Diffs of the changes: From lattner at cs.uiuc.edu Thu Jan 30 11:11:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 30 11:11:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp Message-ID: <200301301710.LAA32060@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms: ExprTypeConvert.cpp updated: 1.67 -> 1.68 --- Log message: Fix levelraise/2003-01-30-ShiftCrash.ll --- Diffs of the changes: Index: llvm/lib/Transforms/ExprTypeConvert.cpp diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.67 llvm/lib/Transforms/ExprTypeConvert.cpp:1.68 --- llvm/lib/Transforms/ExprTypeConvert.cpp:1.67 Tue Jan 14 13:04:43 2003 +++ llvm/lib/Transforms/ExprTypeConvert.cpp Thu Jan 30 11:10:41 2003 @@ -658,7 +658,7 @@ if (Ty->isSigned() != V->getType()->isSigned()) return false; // FALL THROUGH case Instruction::Shl: - assert(I->getOperand(0) == V); + if (I->getOperand(1) == V) return false; // Cannot change shift amount type if (!Ty->isInteger()) return false; return ValueConvertableToType(I, Ty, CTMap); From lattner at cs.uiuc.edu Thu Jan 30 11:35:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 30 11:35:00 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2003-01-30-UnionInit.c Message-ID: <200301301734.LAA01007@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2003-01-30-UnionInit.c added (r1.1) --- Log message: Bug that is unfixable with current frontend --- Diffs of the changes: From lattner at cs.uiuc.edu Thu Jan 30 12:23:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 30 12:23:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp Message-ID: <200301301822.MAA03910@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: FunctionResolution.cpp updated: 1.17 -> 1.18 --- Log message: * Fix function resolution for varargs function to generate incorrect bytecode instead of crashing * remove using decls CVS: ---------------------------------------------------------------------- --- Diffs of the changes: Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.17 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.18 --- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.17 Wed Nov 20 12:34:36 2002 +++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Thu Jan 30 12:22:32 2003 @@ -18,13 +18,10 @@ #include "llvm/Pass.h" #include "llvm/iOther.h" #include "llvm/Constants.h" +#include "llvm/Assembly/Writer.h" // FIXME: remove when varargs implemented #include "Support/Statistic.h" #include -using std::vector; -using std::string; -using std::cerr; - namespace { Statistic<>NumResolved("funcresolve", "Number of varargs functions resolved"); Statistic<> NumGlobals("funcresolve", "Number of global variables resolved"); @@ -51,14 +48,21 @@ // argument types don't agree. // BasicBlock::iterator BBI = CI; - assert(CI->getNumOperands()-1 == ParamTys.size() && - "Function calls resolved funny somehow, incompatible number of args"); + if (CI->getNumOperands()-1 != ParamTys.size()) { + std::cerr << "WARNING: Call arguments do not match expected number of" + << " parameters.\n"; + std::cerr << "WARNING: In function '" + << CI->getParent()->getParent()->getName() << "': call: " << *CI; + std::cerr << "Function resolved to: "; + WriteAsOperand(std::cerr, Dest); + std::cerr << "\n"; + } - vector Params; + std::vector Params; // Convert all of the call arguments over... inserting cast instructions if // the types are not compatible. - for (unsigned i = 1; i < CI->getNumOperands(); ++i) { + for (unsigned i = 1; i <= ParamTys.size(); ++i) { Value *V = CI->getOperand(i); if (V->getType() != ParamTys[i-1]) // Must insert a cast... @@ -112,7 +116,7 @@ } -static bool ResolveFunctions(Module &M, vector &Globals, +static bool ResolveFunctions(Module &M, std::vector &Globals, Function *Concrete) { bool Changed = false; for (unsigned i = 0; i != Globals.size(); ++i) @@ -130,8 +134,8 @@ // for (unsigned i = 0; i < OldMT->getParamTypes().size(); ++i) if (OldMT->getParamTypes()[i] != ConcreteMT->getParamTypes()[i]) { - cerr << "Parameter types conflict for: '" << OldMT - << "' and '" << ConcreteMT << "'\n"; + std::cerr << "Parameter types conflict for: '" << OldMT + << "' and '" << ConcreteMT << "'\n"; return Changed; } @@ -159,12 +163,12 @@ Changed = true; ++NumResolved; } else { - cerr << "Couldn't cleanup this function call, must be an" - << " argument or something!" << CI; + std::cerr << "Couldn't cleanup this function call, must be an" + << " argument or something!" << CI; ++i; } } else { - cerr << "Cannot convert use of function: " << U << "\n"; + std::cerr << "Cannot convert use of function: " << U << "\n"; ++i; } } @@ -173,7 +177,8 @@ } -static bool ResolveGlobalVariables(Module &M, vector &Globals, +static bool ResolveGlobalVariables(Module &M, + std::vector &Globals, GlobalVariable *Concrete) { bool Changed = false; assert(isa(Concrete->getType()->getElementType()) && @@ -214,7 +219,7 @@ } static bool ProcessGlobalsWithSameName(Module &M, - vector &Globals) { + std::vector &Globals) { assert(!Globals.empty() && "Globals list shouldn't be empty here!"); bool isFunction = isa(Globals[0]); // Is this group all functions? @@ -284,13 +289,13 @@ // uses to use it instead. // if (!Concrete) { - cerr << "WARNING: Found function types that are not compatible:\n"; + std::cerr << "WARNING: Found function types that are not compatible:\n"; for (unsigned i = 0; i < Globals.size(); ++i) { - cerr << "\t" << Globals[i]->getType()->getDescription() << " %" - << Globals[i]->getName() << "\n"; + std::cerr << "\t" << Globals[i]->getType()->getDescription() << " %" + << Globals[i]->getName() << "\n"; } - cerr << " No linkage of globals named '" << Globals[0]->getName() - << "' performed!\n"; + std::cerr << " No linkage of globals named '" << Globals[0]->getName() + << "' performed!\n"; return Changed; } @@ -306,7 +311,7 @@ bool FunctionResolvingPass::run(Module &M) { SymbolTable &ST = M.getSymbolTable(); - std::map > Globals; + std::map > Globals; // Loop over the entries in the symbol table. If an entry is a func pointer, // then add it to the Functions map. We do a two pass algorithm here to avoid @@ -330,8 +335,8 @@ // Now we have a list of all functions with a particular name. If there is // more than one entry in a list, merge the functions together. // - for (std::map >::iterator I = Globals.begin(), - E = Globals.end(); I != E; ++I) + for (std::map >::iterator + I = Globals.begin(), E = Globals.end(); I != E; ++I) Changed |= ProcessGlobalsWithSameName(M, I->second); // Now loop over all of the globals, checking to see if any are trivially From lattner at cs.uiuc.edu Thu Jan 30 13:29:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 30 13:29:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Linker/2003-01-30-LinkerRename.ll Message-ID: <200301301928.NAA06008@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Linker: 2003-01-30-LinkerRename.ll added (r1.1) --- Log message: NEw testcase --- Diffs of the changes: From lattner at cs.uiuc.edu Thu Jan 30 13:54:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 30 13:54:00 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/Linker.cpp Message-ID: <200301301953.NAA07644@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: Linker.cpp updated: 1.35 -> 1.36 --- Log message: Eliminate using decls --- Diffs of the changes: Index: llvm/lib/Transforms/Utils/Linker.cpp diff -u llvm/lib/Transforms/Utils/Linker.cpp:1.35 llvm/lib/Transforms/Utils/Linker.cpp:1.36 --- llvm/lib/Transforms/Utils/Linker.cpp:1.35 Tue Dec 3 12:32:30 2002 +++ llvm/lib/Transforms/Utils/Linker.cpp Thu Jan 30 13:53:34 2003 @@ -15,14 +15,11 @@ #include "llvm/DerivedTypes.h" #include "llvm/iOther.h" #include "llvm/Constants.h" -using std::cerr; -using std::string; -using std::map; // Error - Simple wrapper function to conditionally assign to E and return true. // This just makes error return conditions a little bit simpler... // -static inline bool Error(string *E, string Message) { +static inline bool Error(std::string *E, std::string Message) { if (E) *E = Message; return true; } @@ -31,7 +28,7 @@ // types are named in the src module that are not named in the Dst module. // Make sure there are no type name conflicts. // -static bool LinkTypes(Module *Dest, const Module *Src, string *Err = 0) { +static bool LinkTypes(Module *Dest, const Module *Src, std::string *Err) { SymbolTable *DestST = &Dest->getSymbolTable(); const SymbolTable *SrcST = &Src->getSymbolTable(); @@ -42,13 +39,14 @@ const SymbolTable::VarMap &VM = PI->second; for (SymbolTable::type_const_iterator I = VM.begin(), E = VM.end(); I != E; ++I) { - const string &Name = I->first; + const std::string &Name = I->first; const Type *RHS = cast(I->second); // Check to see if this type name is already in the dest module... const Type *Entry = cast_or_null(DestST->lookup(Type::TypeTy, Name)); - if (Entry) { // Yup, the value already exists... - if (Entry != RHS) // If it's the same, noop. Otherwise, error. + if (Entry && !isa(Entry)) { // Yup, the value already exists... + if (Entry != RHS && !isa(RHS)) + // If it's the same, noop. Otherwise, error. return Error(Err, "Type named '" + Name + "' of different shape in modules.\n Src='" + Entry->getDescription() + "'.\n Dst='" + @@ -61,14 +59,14 @@ return false; } -static void PrintMap(const map &M) { - for (map::const_iterator I = M.begin(), E = M.end(); +static void PrintMap(const std::map &M) { + for (std::map::const_iterator I = M.begin(), E =M.end(); I != E; ++I) { - cerr << " Fr: " << (void*)I->first << " "; + std::cerr << " Fr: " << (void*)I->first << " "; I->first->dump(); - cerr << " To: " << (void*)I->second << " "; + std::cerr << " To: " << (void*)I->second << " "; I->second->dump(); - cerr << "\n"; + std::cerr << "\n"; } } @@ -77,9 +75,10 @@ // module to another. This is somewhat sophisticated in that it can // automatically handle constant references correctly as well... // -static Value *RemapOperand(const Value *In, map &LocalMap, - map *GlobalMap = 0) { - map::const_iterator I = LocalMap.find(In); +static Value *RemapOperand(const Value *In, + std::map &LocalMap, + std::map *GlobalMap) { + std::map::const_iterator I = LocalMap.find(In); if (I != LocalMap.end()) return I->second; if (GlobalMap) { @@ -152,15 +151,15 @@ return Result; } - cerr << "XXX LocalMap: \n"; + std::cerr << "XXX LocalMap: \n"; PrintMap(LocalMap); if (GlobalMap) { - cerr << "XXX GlobalMap: \n"; + std::cerr << "XXX GlobalMap: \n"; PrintMap(*GlobalMap); } - cerr << "Couldn't remap value: " << (void*)In << " " << *In << "\n"; + std::cerr << "Couldn't remap value: " << (void*)In << " " << *In << "\n"; assert(0 && "Couldn't remap value!"); return 0; } @@ -170,7 +169,8 @@ // them into the dest module... // static bool LinkGlobals(Module *Dest, const Module *Src, - map &ValueMap, string *Err = 0) { + std::map &ValueMap, + std::string *Err) { // We will need a module level symbol table if the src module has a module // level symbol table... SymbolTable *ST = (SymbolTable*)&Dest->getSymbolTable(); @@ -225,8 +225,8 @@ // globals that may be referenced are in Dest. // static bool LinkGlobalInits(Module *Dest, const Module *Src, - map &ValueMap, - string *Err = 0) { + std::map &ValueMap, + std::string *Err) { // Loop over all of the globals in the src module, mapping them over as we go // @@ -259,10 +259,8 @@ // to the Dest function... // static bool LinkFunctionProtos(Module *Dest, const Module *Src, - map &ValueMap, - string *Err = 0) { - // We will need a module level symbol table if the src module has a module - // level symbol table... + std::map &ValueMap, + std::string *Err) { SymbolTable *ST = (SymbolTable*)&Dest->getSymbolTable(); // Loop over all of the functions in the src module, mapping them over as we @@ -314,10 +312,10 @@ // function, and that Src is not. // static bool LinkFunctionBody(Function *Dest, const Function *Src, - map &GlobalMap, - string *Err = 0) { + std::map &GlobalMap, + std::string *Err) { assert(Src && Dest && Dest->isExternal() && !Src->isExternal()); - map LocalMap; // Map for function local values + std::map LocalMap; // Map for function local values // Go through and convert function arguments over... Function::aiterator DI = Dest->abegin(); @@ -371,8 +369,8 @@ // function over and fixing up references to values. // static bool LinkFunctionBodies(Module *Dest, const Module *Src, - map &ValueMap, - string *Err = 0) { + std::map &ValueMap, + std::string *Err) { // Loop over all of the functions in the src module, mapping them over as we // go @@ -384,8 +382,8 @@ // DF not external SF external? if (!DF->isExternal()) { if (Err) - *Err = "Function '" + (SF->hasName() ? SF->getName() : string("")) + - "' body multiply defined!"; + *Err = "Function '" + (SF->hasName() ? SF->getName() :std::string("")) + + "' body multiply defined!"; return true; } @@ -403,7 +401,7 @@ // the problem. Upon failure, the Dest module could be in a modified state, and // shouldn't be relied on to be consistent. // -bool LinkModules(Module *Dest, const Module *Src, string *ErrorMsg) { +bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { // LinkTypes - Go through the symbol table of the Src module and see if any // types are named in the src module that are not named in the Dst module. @@ -414,7 +412,7 @@ // ValueMap - Mapping of values from what they used to be in Src, to what they // are now in Dest. // - map ValueMap; + std::map ValueMap; // Insert all of the globals in src into the Dest module... without // initializers From lattner at cs.uiuc.edu Thu Jan 30 14:04:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 30 14:04:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Linker/2003-01-30-LinkerTypeRename.ll Message-ID: <200301302003.OAA08421@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Linker: 2003-01-30-LinkerTypeRename.ll added (r1.1) --- Log message: New testcase --- Diffs of the changes: From lattner at cs.uiuc.edu Thu Jan 30 14:54:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 30 14:54:00 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/Linker.cpp Message-ID: <200301302053.OAA11053@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: Linker.cpp updated: 1.36 -> 1.37 --- Log message: * Fix linking of opaque types and their non-opaque versions * Fix bug: Linker/2003-01-30-LinkerTypeRename.ll --- Diffs of the changes: Index: llvm/lib/Transforms/Utils/Linker.cpp diff -u llvm/lib/Transforms/Utils/Linker.cpp:1.36 llvm/lib/Transforms/Utils/Linker.cpp:1.37 --- llvm/lib/Transforms/Utils/Linker.cpp:1.36 Thu Jan 30 13:53:34 2003 +++ llvm/lib/Transforms/Utils/Linker.cpp Thu Jan 30 14:53:43 2003 @@ -45,13 +45,23 @@ // Check to see if this type name is already in the dest module... const Type *Entry = cast_or_null(DestST->lookup(Type::TypeTy, Name)); if (Entry && !isa(Entry)) { // Yup, the value already exists... - if (Entry != RHS && !isa(RHS)) - // If it's the same, noop. Otherwise, error. - return Error(Err, "Type named '" + Name + - "' of different shape in modules.\n Src='" + - Entry->getDescription() + "'.\n Dst='" + - RHS->getDescription() + "'"); + if (Entry != RHS) { + if (OpaqueType *OT = dyn_cast(const_cast(RHS))) { + OT->refineAbstractTypeTo(Entry); + } else { + // If it's the same, noop. Otherwise, error. + return Error(Err, "Type named '" + Name + + "' of different shape in modules.\n Src='" + + Entry->getDescription() + "'.\n Dst='" + + RHS->getDescription() + "'"); + } + } } else { // Type not in dest module. Add it now. + if (Entry) { + OpaqueType *OT = cast(const_cast(Entry)); + OT->refineAbstractTypeTo(RHS); + } + // TODO: FIXME WHEN TYPES AREN'T CONST DestST->insert(Name, const_cast(RHS)); } @@ -236,7 +246,7 @@ if (SGV->hasInitializer()) { // Only process initialized GV's // Figure out what the initializer looks like in the dest module... Constant *DInit = - cast(RemapOperand(SGV->getInitializer(), ValueMap)); + cast(RemapOperand(SGV->getInitializer(), ValueMap, 0)); GlobalVariable *DGV = cast(ValueMap[SGV]); if (DGV->hasInitializer() && SGV->hasExternalLinkage() && From lattner at cs.uiuc.edu Thu Jan 30 14:55:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 30 14:55:01 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/SymbolTable.h Message-ID: <200301302054.OAA11072@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: SymbolTable.h updated: 1.19 -> 1.20 --- Log message: Add new function to allow removal of typed named elements --- Diffs of the changes: Index: llvm/include/llvm/SymbolTable.h diff -u llvm/include/llvm/SymbolTable.h:1.19 llvm/include/llvm/SymbolTable.h:1.20 --- llvm/include/llvm/SymbolTable.h:1.19 Tue Oct 15 16:26:24 2002 +++ llvm/include/llvm/SymbolTable.h Thu Jan 30 14:54:03 2003 @@ -41,6 +41,11 @@ insertEntry(N->getName(), N->getType(), N); } + void remove(Value *N); + Value *type_remove(const type_iterator &It) { + return removeEntry(find(It->second->getType()), It); + } + // insert - Insert a constant or type into the symbol table with the specified // name... There can be a many to one mapping between names and // (constant/type)s. @@ -51,9 +56,11 @@ insertEntry(Name, V->getType(), V); } - void remove(Value *N); - Value *type_remove(const type_iterator &It) { - return removeEntry(find(It->second->getType()), It); + /// remove - Remove a constant or type from the symbol table with the + /// specified name. + Value *remove(const std::string &Name, Value *V) { + iterator TI = find(V->getType()); + return removeEntry(TI, TI->second.find(Name)); } // getUniqueName - Given a base name, return a string that is either equal to From lattner at cs.uiuc.edu Thu Jan 30 15:34:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 30 15:34:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp Message-ID: <200301302133.PAA14309@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: FunctionResolution.cpp updated: 1.18 -> 1.19 --- Log message: Actually print the function _name_ if there is a problem --- Diffs of the changes: Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.18 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.19 --- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.18 Thu Jan 30 12:22:32 2003 +++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Thu Jan 30 15:33:07 2003 @@ -134,7 +134,8 @@ // for (unsigned i = 0; i < OldMT->getParamTypes().size(); ++i) if (OldMT->getParamTypes()[i] != ConcreteMT->getParamTypes()[i]) { - std::cerr << "Parameter types conflict for: '" << OldMT + std::cerr << "funcresolve: Function [" << Old->getName() + << "]: Parameter types conflict for: '" << OldMT << "' and '" << ConcreteMT << "'\n"; return Changed; } From lattner at cs.uiuc.edu Thu Jan 30 16:25:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 30 16:25:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Assembler/2003-01-30-UnsignedString.ll Message-ID: <200301302224.QAA16353@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Assembler: 2003-01-30-UnsignedString.ll added (r1.1) --- Log message: New testcase --- Diffs of the changes: From lattner at cs.uiuc.edu Thu Jan 30 16:25:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 30 16:25:02 2003 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y Message-ID: <200301302224.QAA16363@apoc.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.99 -> 1.100 --- Log message: Fix bug: Assembler/2003-01-30-UnsignedString.ll --- Diffs of the changes: Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.99 llvm/lib/AsmParser/llvmAsmParser.y:1.100 --- llvm/lib/AsmParser/llvmAsmParser.y:1.99 Wed Nov 20 12:31:57 2002 +++ llvm/lib/AsmParser/llvmAsmParser.y Thu Jan 30 16:24:26 2003 @@ -903,7 +903,7 @@ Vals.push_back(ConstantSInt::get(ETy, *C)); } else if (ETy == Type::UByteTy) { for (char *C = $3; C != EndStr; ++C) - Vals.push_back(ConstantUInt::get(ETy, *C)); + Vals.push_back(ConstantUInt::get(ETy, (unsigned char)*C)); } else { free($3); ThrowException("Cannot build string arrays of non byte sized elements!"); From lattner at cs.uiuc.edu Thu Jan 30 16:41:48 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 30 16:41:48 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp Message-ID: <200301302238.QAA16557@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: FunctionResolution.cpp updated: 1.19 -> 1.20 --- Log message: Fix a bug resolving sprintf(...) to sprintf(char*, char*, ...) --- Diffs of the changes: Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.19 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.20 --- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.19 Thu Jan 30 15:33:07 2003 +++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Thu Jan 30 16:38:44 2003 @@ -48,7 +48,10 @@ // argument types don't agree. // BasicBlock::iterator BBI = CI; - if (CI->getNumOperands()-1 != ParamTys.size()) { + unsigned NumArgsToCopy = CI->getNumOperands()-1; + if (CI->getNumOperands()-1 != ParamTys.size() && + !(CI->getNumOperands()-1 > ParamTys.size() && + Dest->getFunctionType()->isVarArg())) { std::cerr << "WARNING: Call arguments do not match expected number of" << " parameters.\n"; std::cerr << "WARNING: In function '" @@ -62,11 +65,13 @@ // Convert all of the call arguments over... inserting cast instructions if // the types are not compatible. - for (unsigned i = 1; i <= ParamTys.size(); ++i) { + for (unsigned i = 1; i <= NumArgsToCopy; ++i) { Value *V = CI->getOperand(i); - if (V->getType() != ParamTys[i-1]) // Must insert a cast... + if (i-1 < ParamTys.size() && V->getType() != ParamTys[i-1]) { + // Must insert a cast... V = new CastInst(V, ParamTys[i-1], "argcast", BBI); + } Params.push_back(V); } From lattner at cs.uiuc.edu Thu Jan 30 16:42:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 30 16:42:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Moria-5.5.2/ Message-ID: <200301302239.QAA16566@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Moria-5.5.2: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Programs/MultiSource/Moria-5.5.2 added to the repository --- Diffs of the changes: From lattner at cs.uiuc.edu Thu Jan 30 16:42:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 30 16:42:02 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Moria-5.5.2/Makefile Message-ID: <200301302239.QAA16582@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Moria-5.5.2: Makefile added (r1.1) --- Log message: Initial checkin of moria benchmark --- Diffs of the changes: From lattner at cs.uiuc.edu Thu Jan 30 17:10:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jan 30 17:10:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Support/Timer.cpp Message-ID: <200301302309.RAA16793@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Support: Timer.cpp updated: 1.10 -> 1.11 --- Log message: * Add new -track-memory option to tools which enables the mem usage column in the reports. This is now optional (and defaults to off) because mallinfo can be VERY slow as it seems to touch every page of allocated memory. --- Diffs of the changes: Index: llvm/lib/Support/Timer.cpp diff -u llvm/lib/Support/Timer.cpp:1.10 llvm/lib/Support/Timer.cpp:1.11 --- llvm/lib/Support/Timer.cpp:1.10 Mon Nov 18 15:47:09 2002 +++ llvm/lib/Support/Timer.cpp Thu Jan 30 17:08:50 2003 @@ -5,6 +5,7 @@ //===----------------------------------------------------------------------===// #include "Support/Timer.h" +#include "Support/CommandLine.h" #include #include #include @@ -15,6 +16,13 @@ #include #include +namespace { + cl::opt + TrackSpace("track-memory", cl::desc("Enable -time-passes memory " + "tracking (this may be slow)"), + cl::Hidden); +} + // getNumBytesToNotCount - This function is supposed to return the number of // bytes that are to be considered not allocated, even though malloc thinks they // are allocated. @@ -65,8 +73,12 @@ } static long getMemUsage() { - struct mallinfo MI = mallinfo(); - return MI.uordblks/*+MI.hblkhd-getNumBytesToNotCount()*/; + if (TrackSpace) { + struct mallinfo MI = mallinfo(); + return MI.uordblks/*+MI.hblkhd-getNumBytesToNotCount()*/; + } else { + return 0; + } } struct TimeRecord { From lattner at cs.uiuc.edu Fri Jan 31 13:01:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Jan 31 13:01:01 2003 Subject: [llvm-commits] CVS: llvm/Makefile.common Makefile.Linux Makefile.SunOS Message-ID: <200301311900.NAA18792@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.common updated: 1.75 -> 1.76 Makefile.Linux updated: 1.7 -> 1.8 Makefile.SunOS updated: 1.6 -> 1.7 --- Log message: Fix strip issue Joel ran into --- Diffs of the changes: Index: llvm/Makefile.common diff -u llvm/Makefile.common:1.75 llvm/Makefile.common:1.76 --- llvm/Makefile.common:1.75 Thu Jan 23 10:33:10 2003 +++ llvm/Makefile.common Fri Jan 31 13:00:26 2003 @@ -142,10 +142,10 @@ # By default, strip symbol information from executable ifdef KEEP_SYMBOLS STRIP = -WARN_MSG = +STRIP_WARN_MSG = else -STRIP = -Wl,-x -WARN_MSG = "(without symbols) " +STRIP = $(PLATFORMSTRIPOPTS) +STRIP_WARN_MSG = "(without symbols) " endif # Allow gnu extensions... @@ -406,7 +406,7 @@ $(VERB) rm -f $(TOOLEXENAMES) $(TOOLEXENAME_G): $(ObjectsG) $(USED_LIB_PATHS_G) $(TOOLDEBUG)/.dir - @echo ======= Linking $(TOOLNAME) debug executable $(WARN_MSG) ======= + @echo ======= Linking $(TOOLNAME) debug executable $(STRIP_WARN_MSG) ======= $(VERB) $(LinkG) -o $@ $(ObjectsG) $(USED_LIBS_OPTIONS_G) $(LINK_OPTS) $(TOOLEXENAME_O): $(ObjectsO) $(USED_LIB_PATHS_O) $(TOOLRELEASE)/.dir Index: llvm/Makefile.Linux diff -u llvm/Makefile.Linux:1.7 llvm/Makefile.Linux:1.8 --- llvm/Makefile.Linux:1.7 Sun Jan 12 18:13:19 2003 +++ llvm/Makefile.Linux Fri Jan 31 13:00:26 2003 @@ -18,6 +18,10 @@ # PLATFORMLINKOPTS := -Wl,--export-dynamic +# PLATFORMSTRIPOPTS - Command to pass to the link phase to cause symbols to be +# stripped from the resultant binary. +PLATFORMSTRIPOPTS := -Wl,-x + # Path to location for LLVM front-end for this architecture. This setting may # be overriden by the Makefile.config option, and should not override it if set. # Index: llvm/Makefile.SunOS diff -u llvm/Makefile.SunOS:1.6 llvm/Makefile.SunOS:1.7 --- llvm/Makefile.SunOS:1.6 Thu Dec 5 21:45:20 2002 +++ llvm/Makefile.SunOS Fri Jan 31 13:00:26 2003 @@ -17,6 +17,13 @@ # of mallinfo. PLATFORMLINKOPTS := -lmalloc +# PLATFORMSTRIPOPTS - Command to pass to the link phase to cause symbols to be +# stripped from the resultant binary. +# +# FIXME: I don't know what this is for sun, so leave it alone +# +PLATFORMSTRIPOPTS := + # Path to location for LLVM front-end for this architecture. This setting may # be overriden by the Makefile.config option, and should not override it if set. # From lattner at cs.uiuc.edu Fri Jan 31 17:58:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Jan 31 17:58:00 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200301312357.RAA01048@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.75 -> 1.76 --- Log message: Remove globals on the bottom up pass which do not contain any information --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.75 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.76 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.75 Wed Jan 29 15:10:20 2003 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Fri Jan 31 17:57:36 2003 @@ -1005,6 +1005,24 @@ return false; } +// GlobalIsAlivenessRoot - Return true if the specified global node is +// intrinsically alive in the context of the current graph (ie, it is a root of +// aliveness). For TD graphs, no globals are. For the BU graphs all are unless +// they are trivial globals... +// +static bool GlobalIsAlivenessRoot(DSNode *N, unsigned Flags) { + if (Flags & DSGraph::RemoveUnreachableGlobals) + return false; // If we are to remove all globals, go for it. + + // Ok, we are keeping globals... hrm, we can still delete it if it has no + // links, and no mod/ref or other info... If it is not modified, it can't + // have links... + // + if ((N->NodeType & ~(DSNode::Composition | DSNode::Array)) == 0) + return false; + return true; +} + // removeDeadNodes - Use a more powerful reachability analysis to eliminate // subgraphs that are unreachable. This often occurs because the data // structure doesn't "escape" into it's caller, and thus should be eliminated @@ -1024,8 +1042,8 @@ // Mark all nodes reachable by (non-global) scalar nodes as alive... for (std::map::iterator I = ScalarMap.begin(), E = ScalarMap.end(); I != E; ++I) - if (!(Flags & DSGraph::RemoveUnreachableGlobals) || - !isa(I->first)) // Don't mark globals! + if (!isa(I->first) || + GlobalIsAlivenessRoot(I->second.getNode(), Flags)) I->second.getNode()->markReachableNodes(Alive); else // Keep track of global nodes GlobalNodes.push_back(std::make_pair(I->first, I->second.getNode())); @@ -1042,7 +1060,8 @@ std::vector FCallsAlive(FunctionCalls.size()); for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) - if (CallSiteUsesAliveArgs(FunctionCalls[i], Alive, Visited)) { + if (!(Flags & DSGraph::RemoveUnreachableGlobals) || + CallSiteUsesAliveArgs(FunctionCalls[i], Alive, Visited)) { FunctionCalls[i].markReachableNodes(Alive); FCallsAlive[i] = true; } From lattner at cs.uiuc.edu Fri Jan 31 17:58:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Jan 31 17:58:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Message-ID: <200301312357.RAA01053@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.47 -> 1.48 --- Log message: Add functions to the ban list --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.47 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.48 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.47 Thu Jan 23 16:05:33 2003 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Fri Jan 31 17:57:10 2003 @@ -33,7 +33,8 @@ GlobalValue &FI = cast(*Callees[i]); if (FI.getName() != "printf" && FI.getName() != "sscanf" && FI.getName() != "fprintf" && FI.getName() != "open" && - FI.getName() != "sprintf" && FI.getName() != "fputs") + FI.getName() != "sprintf" && FI.getName() != "fputs" && + FI.getName() != "fscanf") return false; // External function found... } return true; // otherwise ok From jstanley at cs.uiuc.edu Fri Jan 31 18:41:01 2003 From: jstanley at cs.uiuc.edu (Joel Stanley) Date: Fri Jan 31 18:41:01 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/iCall.cpp Message-ID: <200302010040.SAA06315@tank.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: iCall.cpp updated: 1.14 -> 1.15 --- Log message: Added implementation of alternate CallInst constructors (one ctor is for no actual parameters, and one ctor is for one actual parameter). --- Diffs of the changes: Index: llvm/lib/VMCore/iCall.cpp diff -u llvm/lib/VMCore/iCall.cpp:1.14 llvm/lib/VMCore/iCall.cpp:1.15 --- llvm/lib/VMCore/iCall.cpp:1.14 Tue Sep 10 10:45:53 2002 +++ llvm/lib/VMCore/iCall.cpp Fri Jan 31 18:39:58 2003 @@ -32,6 +32,41 @@ Operands.push_back(Use(params[i], this)); } +CallInst::CallInst(Value *Func, const std::string &Name, + Instruction *InsertBefore) + : Instruction(cast(cast(Func->getType()) + ->getElementType())->getReturnType(), + Instruction::Call, Name, InsertBefore) { + Operands.reserve(1); + Operands.push_back(Use(Func, this)); + + const FunctionType *MTy = + cast(cast(Func->getType())->getElementType()); + + const FunctionType::ParamTypes &PL = MTy->getParamTypes(); + assert((0 == PL.size()) || + (MTy->isVarArg() && 0 >= PL.size()) && + "Calling a function with bad signature"); +} + +CallInst::CallInst(Value *Func, Value* A, const std::string &Name, + Instruction *InsertBefore) + : Instruction(cast(cast(Func->getType()) + ->getElementType())->getReturnType(), + Instruction::Call, Name, InsertBefore) { + Operands.reserve(2); + Operands.push_back(Use(Func, this)); + + const FunctionType *MTy = + cast(cast(Func->getType())->getElementType()); + + const FunctionType::ParamTypes &PL = MTy->getParamTypes(); + assert((1 == PL.size()) || + (MTy->isVarArg() && 1 >= PL.size()) && + "Calling a function with bad signature"); + Operands.push_back(Use(A, this)); +} + CallInst::CallInst(const CallInst &CI) : Instruction(CI.getType(), Instruction::Call) { Operands.reserve(CI.Operands.size()); From jstanley at cs.uiuc.edu Fri Jan 31 18:42:00 2003 From: jstanley at cs.uiuc.edu (Joel Stanley) Date: Fri Jan 31 18:42:00 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/iOther.h Message-ID: <200302010041.SAA06391@tank.cs.uiuc.edu> Changes in directory llvm/include/llvm: iOther.h updated: 1.30 -> 1.31 --- Log message: Added protos for two alternate, convenient CallInst constructors. --- Diffs of the changes: Index: llvm/include/llvm/iOther.h diff -u llvm/include/llvm/iOther.h:1.30 llvm/include/llvm/iOther.h:1.31 --- llvm/include/llvm/iOther.h:1.30 Tue Sep 10 10:36:10 2002 +++ llvm/include/llvm/iOther.h Fri Jan 31 18:41:27 2003 @@ -53,6 +53,12 @@ CallInst(Value *F, const std::vector &Par, const std::string &Name = "", Instruction *InsertBefore = 0); + // Alternate CallInst ctors; no actuals one actual, respectively. + CallInst(Value *F, const std::string &Name = "", + Instruction *InsertBefore = 0); + CallInst(Value *F, Value *Actual, const std::string& Name = "", + Instruction* InsertBefore = 0); + virtual Instruction *clone() const { return new CallInst(*this); } bool hasSideEffects() const { return true; } From lattner at cs.uiuc.edu Fri Jan 31 21:29:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Jan 31 21:29:01 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSNode.h Message-ID: <200302010328.VAA26782@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSNode.h updated: 1.17 -> 1.18 --- Log message: Add new composition mask --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSNode.h diff -u llvm/include/llvm/Analysis/DSNode.h:1.17 llvm/include/llvm/Analysis/DSNode.h:1.18 --- llvm/include/llvm/Analysis/DSNode.h:1.17 Wed Jan 29 15:09:59 2003 +++ llvm/include/llvm/Analysis/DSNode.h Fri Jan 31 21:28:26 2003 @@ -62,6 +62,8 @@ #if 1 DEAD = 1 << 8, // This node is dead and should not be pointed to #endif + + Composition = AllocaNode | HeapNode | GlobalNode | UnknownNode, }; /// NodeType - A union of the above bits. "Shadow" nodes do not add any flags From lattner at cs.uiuc.edu Fri Jan 31 21:34:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Jan 31 21:34:01 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/iCall.cpp Message-ID: <200302010333.VAA26871@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: iCall.cpp updated: 1.15 -> 1.16 --- Log message: Simplify assertions --- Diffs of the changes: Index: llvm/lib/VMCore/iCall.cpp diff -u llvm/lib/VMCore/iCall.cpp:1.15 llvm/lib/VMCore/iCall.cpp:1.16 --- llvm/lib/VMCore/iCall.cpp:1.15 Fri Jan 31 18:39:58 2003 +++ llvm/lib/VMCore/iCall.cpp Fri Jan 31 21:33:22 2003 @@ -25,15 +25,15 @@ cast(cast(Func->getType())->getElementType()); const FunctionType::ParamTypes &PL = MTy->getParamTypes(); - assert((params.size() == PL.size()) || - (MTy->isVarArg() && params.size() >= PL.size()) && + assert(params.size() == PL.size() || + (MTy->isVarArg() && params.size() > PL.size()) && "Calling a function with bad signature"); for (unsigned i = 0; i < params.size(); i++) Operands.push_back(Use(params[i], this)); } CallInst::CallInst(Value *Func, const std::string &Name, - Instruction *InsertBefore) + Instruction *InsertBefore) : Instruction(cast(cast(Func->getType()) ->getElementType())->getReturnType(), Instruction::Call, Name, InsertBefore) { @@ -44,9 +44,7 @@ cast(cast(Func->getType())->getElementType()); const FunctionType::ParamTypes &PL = MTy->getParamTypes(); - assert((0 == PL.size()) || - (MTy->isVarArg() && 0 >= PL.size()) && - "Calling a function with bad signature"); + assert(PL.empty() && "Calling a function with bad signature"); } CallInst::CallInst(Value *Func, Value* A, const std::string &Name, @@ -61,8 +59,7 @@ cast(cast(Func->getType())->getElementType()); const FunctionType::ParamTypes &PL = MTy->getParamTypes(); - assert((1 == PL.size()) || - (MTy->isVarArg() && 1 >= PL.size()) && + assert(PL.size() == 1 || (MTy->isVarArg() && PL.empty()) && "Calling a function with bad signature"); Operands.push_back(Use(A, this)); } From lattner at cs.uiuc.edu Fri Jan 31 22:02:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Jan 31 22:02:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp DataStructure.cpp Local.cpp Printer.cpp Message-ID: <200302010401.WAA27080@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.48 -> 1.49 DataStructure.cpp updated: 1.76 -> 1.77 Local.cpp updated: 1.43 -> 1.44 Printer.cpp updated: 1.42 -> 1.43 --- Log message: Remove using declarations --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.48 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.49 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.48 Fri Jan 31 17:57:10 2003 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Fri Jan 31 22:01:20 2003 @@ -11,7 +11,6 @@ #include "llvm/Analysis/DSGraph.h" #include "llvm/Module.h" #include "Support/Statistic.h" -using std::map; namespace { Statistic<> MaxSCC("budatastructure", "Maximum SCC Size in Call Graph"); @@ -284,7 +283,7 @@ // our memory... here... // void BUDataStructures::releaseMemory() { - for (map::iterator I = DSInfo.begin(), + for (std::map::iterator I = DSInfo.begin(), E = DSInfo.end(); I != E; ++I) delete I->second; Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.76 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.77 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.76 Fri Jan 31 17:57:36 2003 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Fri Jan 31 22:01:20 2003 @@ -14,8 +14,6 @@ #include "Support/Timer.h" #include -using std::vector; - namespace { Statistic<> NumFolds ("dsnode", "Number of nodes completely folded"); Statistic<> NumCallNodesMerged("dsnode", "Number of call nodes merged"); @@ -45,7 +43,7 @@ void DSNode::removeReferrer(DSNodeHandle *H) { // Search backwards, because we depopulate the list from the back for // efficiency (because it's a vector). - vector::reverse_iterator I = + std::vector::reverse_iterator I = std::find(Referrers.rbegin(), Referrers.rend(), H); assert(I != Referrers.rend() && "Referrer not pointing to node!"); Referrers.erase(I.base()-1); @@ -56,7 +54,7 @@ // void DSNode::addGlobal(GlobalValue *GV) { // Keep the list sorted. - vector::iterator I = + std::vector::iterator I = std::lower_bound(Globals.begin(), Globals.end(), GV); if (I == Globals.end() || *I != GV) { @@ -83,8 +81,8 @@ // Loop over all of our referrers, making them point to our zero bytes of // space. - for (vector::iterator I = Referrers.begin(), E=Referrers.end(); - I != E; ++I) + for (std::vector::iterator I = Referrers.begin(), + E = Referrers.end(); I != E; ++I) (*I)->setOffset(0); // If we have links, merge all of our outgoing links together... @@ -339,8 +337,8 @@ // duplicates are not allowed and both are sorted. This assumes that 'T's are // efficiently copyable and have sane comparison semantics. // -static void MergeSortedVectors(vector &Dest, - const vector &Src) { +static void MergeSortedVectors(std::vector &Dest, + const std::vector &Src) { // By far, the most common cases will be the simple ones. In these cases, // avoid having to allocate a temporary vector... // @@ -350,21 +348,21 @@ Dest = Src; } else if (Src.size() == 1) { // Insert a single element... const GlobalValue *V = Src[0]; - vector::iterator I = + std::vector::iterator I = std::lower_bound(Dest.begin(), Dest.end(), V); if (I == Dest.end() || *I != Src[0]) // If not already contained... Dest.insert(I, Src[0]); } else if (Dest.size() == 1) { GlobalValue *Tmp = Dest[0]; // Save value in temporary... Dest = Src; // Copy over list... - vector::iterator I = + std::vector::iterator I = std::lower_bound(Dest.begin(), Dest.end(), Tmp); if (I == Dest.end() || *I != Tmp) // If not already contained... Dest.insert(I, Tmp); } else { // Make a copy to the side of Dest... - vector Old(Dest); + std::vector Old(Dest); // Make space for all of the type entries now... Dest.resize(Dest.size()+Src.size()); @@ -847,7 +845,7 @@ return false; } -static void removeIdenticalCalls(vector &Calls, +static void removeIdenticalCalls(std::vector &Calls, const std::string &where) { // Remove trivially identical function calls unsigned NumFns = Calls.size(); @@ -1097,7 +1095,7 @@ ScalarMap.erase(GlobalNodes[i].first); // Loop over all unreachable nodes, dropping their references... - vector DeadNodes; + std::vector DeadNodes; DeadNodes.reserve(Nodes.size()); // Only one allocation is allowed. for (unsigned i = 0; i != Nodes.size(); ++i) if (!Alive.count(Nodes[i])) { @@ -1211,7 +1209,7 @@ // void GlobalDSGraph::cloneCalls(DSGraph& Graph) { std::map NodeCache; - vector& FromCalls =Graph.FunctionCalls; + std::vector& FromCalls =Graph.FunctionCalls; FunctionCalls.reserve(FunctionCalls.size() + FromCalls.size()); Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.43 llvm/lib/Analysis/DataStructure/Local.cpp:1.44 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.43 Tue Jan 28 14:59:57 2003 +++ llvm/lib/Analysis/DataStructure/Local.cpp Fri Jan 31 22:01:21 2003 @@ -25,9 +25,6 @@ // #include "llvm/Module.h" -using std::map; -using std::vector; - static RegisterAnalysis X("datastructure", "Local Data Structure Analysis"); @@ -57,15 +54,15 @@ /// class GraphBuilder : InstVisitor { DSGraph &G; - vector &Nodes; + std::vector &Nodes; DSNodeHandle &RetNode; // Node that gets returned... - map &ScalarMap; - vector &FunctionCalls; + std::map &ScalarMap; + std::vector &FunctionCalls; public: - GraphBuilder(DSGraph &g, vector &nodes, DSNodeHandle &retNode, - map &SM, - vector &fc) + GraphBuilder(DSGraph &g, std::vector &nodes, DSNodeHandle &retNode, + std::map &SM, + std::vector &fc) : G(g), Nodes(nodes), RetNode(retNode), ScalarMap(SM), FunctionCalls(fc) { // Create scalar nodes for all pointer arguments... Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.42 llvm/lib/Analysis/DataStructure/Printer.cpp:1.43 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.42 Mon Nov 18 15:42:45 2002 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Fri Jan 31 22:01:21 2003 @@ -14,7 +14,6 @@ #include "Support/Statistic.h" #include #include -using std::string; // OnlyPrintMain - The DataStructure printer exposes this option to allow // printing of only the graph for "main". @@ -28,7 +27,7 @@ void DSNode::dump() const { print(std::cerr, 0); } -static string getCaption(const DSNode *N, const DSGraph *G) { +static std::string getCaption(const DSNode *N, const DSGraph *G) { std::stringstream OS; Module *M = G && &G->getFunction() ? G->getFunction().getParent() : 0; @@ -153,8 +152,9 @@ WriteGraph(O, this, "DataStructures"); } -void DSGraph::writeGraphToFile(std::ostream &O, const string &GraphName) const { - string Filename = GraphName + ".dot"; +void DSGraph::writeGraphToFile(std::ostream &O, + const std::string &GraphName) const { + std::string Filename = GraphName + ".dot"; O << "Writing '" << Filename << "'..."; std::ofstream F(Filename.c_str()); @@ -170,7 +170,7 @@ template static void printCollection(const Collection &C, std::ostream &O, - const Module *M, const string &Prefix) { + const Module *M, const std::string &Prefix) { if (M == 0) { O << "Null Module pointer, cannot continue!\n"; return; From lattner at cs.uiuc.edu Fri Jan 31 22:15:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Jan 31 22:15:01 2003 Subject: [llvm-commits] CVS: llvm/include/Support/hash_map Message-ID: <200302010414.WAA28013@apoc.cs.uiuc.edu> Changes in directory llvm/include/Support: hash_map updated: 1.5 -> 1.6 --- Log message: Add hash_multimap support --- Diffs of the changes: Index: llvm/include/Support/hash_map diff -u llvm/include/Support/hash_map:1.5 llvm/include/Support/hash_map:1.6 --- llvm/include/Support/hash_map:1.5 Fri Nov 8 08:07:33 2002 +++ llvm/include/Support/hash_map Fri Jan 31 22:14:28 2003 @@ -37,6 +37,7 @@ #endif using HASH_NAMESPACE::hash_map; +using HASH_NAMESPACE::hash_multimap; using HASH_NAMESPACE::hash; #include From lattner at cs.uiuc.edu Fri Jan 31 22:52:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Jan 31 22:52:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/GCSE.cpp Message-ID: <200302010451.WAA31018@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: GCSE.cpp updated: 1.26 -> 1.27 --- Log message: Fix typo --- Diffs of the changes: Index: llvm/lib/Transforms/Scalar/GCSE.cpp diff -u llvm/lib/Transforms/Scalar/GCSE.cpp:1.26 llvm/lib/Transforms/Scalar/GCSE.cpp:1.27 --- llvm/lib/Transforms/Scalar/GCSE.cpp:1.26 Sat Dec 7 12:42:13 2002 +++ llvm/lib/Transforms/Scalar/GCSE.cpp Fri Jan 31 22:50:59 2003 @@ -233,7 +233,7 @@ // // Here there are no shared dominators. Additionally, this had the habit of // moving computations where they were not always computed. For example, in - // a cast like this: + // a case like this: // if (c) { // if (d) ... // else ... X+Y ... From lattner at cs.uiuc.edu Fri Jan 31 22:52:04 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Jan 31 22:52:04 2003 Subject: [llvm-commits] CVS: llvm/test/Libraries/libdummy/dummylib.c Message-ID: <200302010451.WAA31029@apoc.cs.uiuc.edu> Changes in directory llvm/test/Libraries/libdummy: dummylib.c updated: 1.1 -> 1.2 --- Log message: Add a bunch more stubs --- Diffs of the changes: Index: llvm/test/Libraries/libdummy/dummylib.c diff -u llvm/test/Libraries/libdummy/dummylib.c:1.1 llvm/test/Libraries/libdummy/dummylib.c:1.2 --- llvm/test/Libraries/libdummy/dummylib.c:1.1 Fri Jan 17 13:09:29 2003 +++ llvm/test/Libraries/libdummy/dummylib.c Fri Jan 31 22:51:12 2003 @@ -1,7 +1,11 @@ #include #include #include +#include +#include +int gettimeofday(struct timeval *tv, void *tz) { return 0; } + void srand(unsigned x) {} double exp(double x) { return 0; } double log(double x) { return 0; } @@ -13,19 +17,29 @@ char *fgets(char*Ptr, int x, FILE*F) { return Ptr; } int fclose(FILE*F) { return 0; } FILE *fopen(const char *n, const char*x) { return malloc(sizeof(FILE)); } +FILE *freopen(const char *path, const char *mode, FILE *stream) { return 0; } int fflush(FILE *F) { return 0; } size_t fwrite(const void* str, size_t N, size_t n, FILE *F) { return N; } void *memset(void *P, int X, size_t N) { return P; } +void *memcpy(void *P, void *S, size_t N) { return P; } +void *memmove(void *P, void *S, size_t N) { return P; } char *strcpy(char*Str1, const char *Str) { return Str1; } +char *strcat(char*Str1, const char *Str) { return Str1; } +size_t strlen(char *X) { return 0; } #undef putchar int putchar(int N) { return N; } int putc(int c, FILE *stream) { return c; } int fputc(int c, FILE *stream) { return c; } int fgetc(FILE *S) { return 0; } +long ftell(FILE *F) { return 0; } int getc(FILE *S) { return 0; } size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream) { return 0; } int fseek(FILE *stream, long offset, int whence) { return 0; } int fputs(const char *s, FILE *stream) { return 0; } +int ferror(FILE *F) { return 0; } +FILE *fdopen(int fildes, const char *mode) { return 0;} +int ungetc(int c, FILE *stream) { return 0; } +int setvbuf(FILE *stream, char *buf, int mode , size_t size) { return 0; } void rewind(FILE*F) { } int fileno(FILE *stream) { return 1; } char *ttyname(int desc) { return 0; } @@ -47,6 +61,14 @@ pid_t getppid(void) { return 0; } void setbuf(FILE *stream, char *buf) {} int isatty(int desc) { return 0; } +int vsprintf(char *str, const char *format, va_list ap) { return 0; } +char *getcwd(char *buf, size_t size) { return buf; } + +void qsort(void *base, size_t nmemb, size_t size, + int(*compar)(const void *, const void *)) { + compar(base, base); +} + #include @@ -73,6 +95,8 @@ char *strpbrk(const char *s, const char *accept) { return (char*)s; } char *strncat(char *dest, const char *src, size_t n) { return dest; } +double atof(const char *C) { return 0; } + long clock() { return 0; } char *ctime(const time_t *timep) { return 0; } @@ -80,8 +104,19 @@ double sin(double x) { return x; } double cos(double x) { return x; } +double tan(double x) { return x; } +double asin(double x) { return x; } +double acos(double x) { return x; } double atan(double x) { return x; } +double cosh(double x) { return x; } +double sinh(double x) { return x; } +double ceil(double x) { return x; } +double floor(double x) { return x; } + +double atan2(double x, double y) { return x; } +double fmod(double x, double y) { return x; } double pow(double x, double y) { return x; } + int tolower(int x) { return x; } int toupper(int x) { return x; } From lattner at cs.uiuc.edu Fri Jan 31 22:53:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Jan 31 22:53:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/PoolAllocate.cpp Message-ID: <200302010452.WAA31055@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: PoolAllocate.cpp updated: 1.1 -> 1.2 --- Log message: Change DSGraph stuff to use hash_(set|map) instead of std::(set|map) This change provides a small (3%) but consistent speedup --- Diffs of the changes: Index: llvm/lib/Transforms/IPO/PoolAllocate.cpp diff -u llvm/lib/Transforms/IPO/PoolAllocate.cpp:1.1 llvm/lib/Transforms/IPO/PoolAllocate.cpp:1.2 --- llvm/lib/Transforms/IPO/PoolAllocate.cpp:1.1 Wed Jan 29 15:12:13 2003 +++ llvm/lib/Transforms/IPO/PoolAllocate.cpp Fri Jan 31 22:52:08 2003 @@ -43,7 +43,7 @@ /// MarkedNodes - The set of nodes which are not locally pool allocatable in /// the current function. /// - std::set MarkedNodes; + hash_set MarkedNodes; /// Clone - The cloned version of the function, if applicable. Function *Clone; @@ -204,7 +204,7 @@ // Find DataStructure nodes which are allocated in pools non-local to the // current function. This set will contain all of the DSNodes which require // pools to be passed in from outside of the function. - std::set &MarkedNodes = FI.MarkedNodes; + hash_set &MarkedNodes = FI.MarkedNodes; // Mark globals and incomplete nodes as live... (this handles arguments) if (F.getName() != "main") @@ -225,7 +225,7 @@ ArgTys.reserve(OldFuncTy->getParamTypes().size() + MarkedNodes.size()); FI.ArgNodes.reserve(MarkedNodes.size()); - for (std::set::iterator I = MarkedNodes.begin(), + for (hash_set::iterator I = MarkedNodes.begin(), E = MarkedNodes.end(); I != E; ++I) if ((*I)->NodeType & DSNode::Incomplete) { ArgTys.push_back(PoolDescPtr); // Add the appropriate # of pool descs @@ -289,7 +289,7 @@ if (Nodes.empty()) return; // Quick exit if nothing to do... FuncInfo &FI = FunctionInfo[&F]; // Get FuncInfo for F - std::set &MarkedNodes = FI.MarkedNodes; + hash_set &MarkedNodes = FI.MarkedNodes; DEBUG(std::cerr << "[" << F.getName() << "] Pool Allocate: "); @@ -414,8 +414,8 @@ // Remove old malloc instruction MI.getParent()->getInstList().erase(&MI); - std::map &SM = G.getScalarMap(); - std::map::iterator MII = SM.find(&MI); + hash_map &SM = G.getScalarMap(); + hash_map::iterator MII = SM.find(&MI); // If we are modifying the original function, update the DSGraph... if (MII != SM.end()) { From lattner at cs.uiuc.edu Fri Jan 31 22:53:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Jan 31 22:53:03 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h DSNode.h DSSupport.h DataStructure.h IPModRef.h Message-ID: <200302010452.WAA31068@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.40 -> 1.41 DSNode.h updated: 1.18 -> 1.19 DSSupport.h updated: 1.9 -> 1.10 DataStructure.h updated: 1.60 -> 1.61 IPModRef.h updated: 1.8 -> 1.9 --- Log message: Change DSGraph stuff to use hash_(set|map) instead of std::(set|map) This change provides a small (3%) but consistent speedup --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.40 llvm/include/llvm/Analysis/DSGraph.h:1.41 --- llvm/include/llvm/Analysis/DSGraph.h:1.40 Thu Jan 23 16:06:22 2003 +++ llvm/include/llvm/Analysis/DSGraph.h Fri Jan 31 22:51:52 2003 @@ -19,7 +19,7 @@ DSNodeHandle RetNode; // The node that gets returned... std::vector Nodes; - std::map ScalarMap; + hash_map ScalarMap; // FunctionCalls - This vector maintains a single entry for each call // instruction in the current graph. The first entry in the vector is the @@ -49,7 +49,7 @@ // method. // DSGraph(const DSGraph &DSG); - DSGraph(const DSGraph &DSG, std::map &NodeMap); + DSGraph(const DSGraph &DSG, hash_map &NodeMap); ~DSGraph(); bool hasFunction() const { return Func != 0; } @@ -76,8 +76,8 @@ /// getScalarMap - Get a map that describes what the nodes the scalars in this /// function point to... /// - std::map &getScalarMap() { return ScalarMap; } - const std::map &getScalarMap() const {return ScalarMap;} + hash_map &getScalarMap() { return ScalarMap; } + const hash_map &getScalarMap() const {return ScalarMap;} /// getFunctionCalls - Return the list of call sites in the original local /// graph... @@ -102,7 +102,7 @@ DSNodeHandle &getNodeForValue(Value *V) { return ScalarMap[V]; } const DSNodeHandle &getNodeForValue(Value *V) const { - std::map::const_iterator I = ScalarMap.find(V); + hash_map::const_iterator I = ScalarMap.find(V); assert(I != ScalarMap.end() && "Use non-const lookup function if node may not be in the map"); return I->second; @@ -168,8 +168,8 @@ // being cloned. // DSNodeHandle cloneInto(const DSGraph &G, - std::map &OldValMap, - std::map &OldNodeMap, + hash_map &OldValMap, + hash_map &OldNodeMap, unsigned CloneFlags = 0); /// mergeInGraph - The method is used for merging graphs together. If the Index: llvm/include/llvm/Analysis/DSNode.h diff -u llvm/include/llvm/Analysis/DSNode.h:1.18 llvm/include/llvm/Analysis/DSNode.h:1.19 --- llvm/include/llvm/Analysis/DSNode.h:1.18 Fri Jan 31 21:28:26 2003 +++ llvm/include/llvm/Analysis/DSNode.h Fri Jan 31 22:51:53 2003 @@ -218,13 +218,13 @@ /// remapLinks - Change all of the Links in the current node according to the /// specified mapping. - void remapLinks(std::map &OldNodeMap); + void remapLinks(hash_map &OldNodeMap); /// markReachableNodes - This method recursively traverses the specified /// DSNodes, marking any nodes which are reachable. All reachable nodes it /// adds to the set, which allows it to only traverse visited nodes once. /// - void markReachableNodes(std::set &ReachableNodes); + void markReachableNodes(hash_set &ReachableNodes); private: friend class DSNodeHandle; Index: llvm/include/llvm/Analysis/DSSupport.h diff -u llvm/include/llvm/Analysis/DSSupport.h:1.9 llvm/include/llvm/Analysis/DSSupport.h:1.10 --- llvm/include/llvm/Analysis/DSSupport.h:1.9 Wed Jan 29 15:09:59 2003 +++ llvm/include/llvm/Analysis/DSSupport.h Fri Jan 31 22:51:53 2003 @@ -8,10 +8,10 @@ #define LLVM_ANALYSIS_DSSUPPORT_H #include -#include -#include #include #include +#include "Support/HashExtras.h" +#include "Support/hash_set" class Function; class CallInst; @@ -118,9 +118,9 @@ Function *ResolvingCaller; // See comments above static void InitNH(DSNodeHandle &NH, const DSNodeHandle &Src, - const std::map &NodeMap) { + const hash_map &NodeMap) { if (DSNode *N = Src.getNode()) { - std::map::const_iterator I = NodeMap.find(N); + hash_map::const_iterator I = NodeMap.find(N); assert(I != NodeMap.end() && "Not not in mapping!"); NH.setOffset(Src.getOffset()); @@ -129,9 +129,9 @@ } static void InitNH(DSNodeHandle &NH, const DSNodeHandle &Src, - const std::map &NodeMap) { + const hash_map &NodeMap) { if (DSNode *N = Src.getNode()) { - std::map::const_iterator I = NodeMap.find(N); + hash_map::const_iterator I = NodeMap.find(N); assert(I != NodeMap.end() && "Not not in mapping!"); NH.setOffset(Src.getOffset()+I->second.getOffset()); @@ -219,7 +219,7 @@ /// DSNodes, marking any nodes which are reachable. All reachable nodes it /// adds to the set, which allows it to only traverse visited nodes once. /// - void markReachableNodes(std::set &Nodes); + void markReachableNodes(hash_set &Nodes); bool operator<(const DSCallSite &CS) const { if (Callee < CS.Callee) return true; // This must sort by callee first! Index: llvm/include/llvm/Analysis/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure.h:1.60 llvm/include/llvm/Analysis/DataStructure.h:1.61 --- llvm/include/llvm/Analysis/DataStructure.h:1.60 Wed Dec 11 23:28:39 2002 +++ llvm/include/llvm/Analysis/DataStructure.h Fri Jan 31 22:51:53 2003 @@ -8,7 +8,8 @@ #define LLVM_ANALYSIS_DATA_STRUCTURE_H #include "llvm/Pass.h" -#include +#include "Support/HashExtras.h" +#include "Support/hash_set" class Type; class DSGraph; @@ -32,7 +33,7 @@ // class LocalDataStructures : public Pass { // DSInfo, one graph for each function - std::map DSInfo; + hash_map DSInfo; DSGraph *GlobalsGraph; public: ~LocalDataStructures() { releaseMemory(); } @@ -45,7 +46,7 @@ // getDSGraph - Return the data structure graph for the specified function. DSGraph &getDSGraph(const Function &F) const { - std::map::const_iterator I = DSInfo.find(&F); + hash_map::const_iterator I = DSInfo.find(&F); assert(I != DSInfo.end() && "Function not in module!"); return *I->second; } @@ -71,7 +72,7 @@ // class BUDataStructures : public Pass { // DSInfo, one graph for each function - std::map DSInfo; + hash_map DSInfo; DSGraph *GlobalsGraph; public: ~BUDataStructures() { releaseMemory(); } @@ -84,7 +85,7 @@ // getDSGraph - Return the data structure graph for the specified function. DSGraph &getDSGraph(const Function &F) const { - std::map::const_iterator I = DSInfo.find(&F); + hash_map::const_iterator I = DSInfo.find(&F); assert(I != DSInfo.end() && "Function not in module!"); return *I->second; } @@ -110,10 +111,10 @@ // functions IN the SCC at all. // DSGraph &inlineNonSCCGraphs(Function &F, - std::set &SCCFunctions); + hash_set &SCCFunctions); DSGraph &calculateSCCGraph(Function &F, - std::set &InlinedSCCFunctions); + hash_set &InlinedSCCFunctions); void calculateReachableGraphs(Function *F); @@ -121,7 +122,7 @@ unsigned calculateGraphs(Function *F, std::vector &Stack, unsigned &NextID, - std::map &ValMap); + hash_map &ValMap); }; @@ -131,8 +132,8 @@ // class TDDataStructures : public Pass { // DSInfo, one graph for each function - std::map DSInfo; - std::set GraphDone; + hash_map DSInfo; + hash_set GraphDone; DSGraph *GlobalsGraph; public: ~TDDataStructures() { releaseMemory(); } @@ -145,7 +146,7 @@ // getDSGraph - Return the data structure graph for the specified function. DSGraph &getDSGraph(const Function &F) const { - std::map::const_iterator I = DSInfo.find(&F); + hash_map::const_iterator I = DSInfo.find(&F); assert(I != DSInfo.end() && "Function not in module!"); return *I->second; } Index: llvm/include/llvm/Analysis/IPModRef.h diff -u llvm/include/llvm/Analysis/IPModRef.h:1.8 llvm/include/llvm/Analysis/IPModRef.h:1.9 --- llvm/include/llvm/Analysis/IPModRef.h:1.8 Fri Dec 6 15:19:07 2002 +++ llvm/include/llvm/Analysis/IPModRef.h Fri Jan 31 22:51:53 2003 @@ -41,6 +41,7 @@ #include "llvm/Pass.h" #include "Support/BitSetVector.h" +#include "Support/hash_map" class Module; class Function; @@ -125,7 +126,7 @@ void computeModRef (const Function &func); void computeModRef (const CallInst& callInst); DSGraph *ResolveCallSiteModRefInfo(CallInst &CI, - std::map &NodeMap); + hash_map &NodeMap); public: /* ctor */ FunctionModRefInfo (const Function& func, From lattner at cs.uiuc.edu Fri Jan 31 22:53:05 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Jan 31 22:53:05 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp DataStructure.cpp Local.cpp Printer.cpp Steensgaard.cpp TopDownClosure.cpp Message-ID: <200302010452.WAA31083@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.49 -> 1.50 DataStructure.cpp updated: 1.77 -> 1.78 Local.cpp updated: 1.44 -> 1.45 Printer.cpp updated: 1.43 -> 1.44 Steensgaard.cpp updated: 1.15 -> 1.16 TopDownClosure.cpp updated: 1.32 -> 1.33 --- Log message: Change DSGraph stuff to use hash_(set|map) instead of std::(set|map) This change provides a small (3%) but consistent speedup --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.49 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.50 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.49 Fri Jan 31 22:01:20 2003 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Fri Jan 31 22:51:55 2003 @@ -11,6 +11,7 @@ #include "llvm/Analysis/DSGraph.h" #include "llvm/Module.h" #include "Support/Statistic.h" +#include "Support/hash_map" namespace { Statistic<> MaxSCC("budatastructure", "Maximum SCC Size in Call Graph"); @@ -128,7 +129,7 @@ void BUDataStructures::calculateReachableGraphs(Function *F) { std::vector Stack; - std::map ValMap; + hash_map ValMap; unsigned NextID = 1; calculateGraphs(F, Stack, NextID, ValMap); } @@ -152,7 +153,7 @@ unsigned BUDataStructures::calculateGraphs(Function *F, std::vector &Stack, unsigned &NextID, - std::map &ValMap) { + hash_map &ValMap) { assert(ValMap.find(F) == ValMap.end() && "Shouldn't revisit functions!"); unsigned Min = NextID++, MyID = Min; ValMap[F] = Min; @@ -173,7 +174,7 @@ Function *Callee = *I; unsigned M; // Have we visited the destination function yet? - std::map::iterator It = ValMap.find(Callee); + hash_map::iterator It = ValMap.find(Callee); if (It == ValMap.end()) // No, visit it now. M = calculateGraphs(Callee, Stack, NextID, ValMap); else // Yes, get it's number. @@ -206,7 +207,7 @@ } else { // SCCFunctions - Keep track of the functions in the current SCC // - std::set SCCFunctions; + hash_set SCCFunctions; Function *NF; std::vector::iterator FirstInSCC = Stack.end(); @@ -283,7 +284,7 @@ // our memory... here... // void BUDataStructures::releaseMemory() { - for (std::map::iterator I = DSInfo.begin(), + for (hash_map::iterator I = DSInfo.begin(), E = DSInfo.end(); I != E; ++I) delete I->second; @@ -383,7 +384,7 @@ // IN the SCC at all. // DSGraph &BUDataStructures::inlineNonSCCGraphs(Function &F, - std::set &SCCFunctions){ + hash_set &SCCFunctions){ DSGraph &Graph = getDSGraph(F); DEBUG(std::cerr << " [BU] Inlining Non-SCC graphs for: " << F.getName() << "\n"); @@ -452,12 +453,12 @@ DSGraph &BUDataStructures::calculateSCCGraph(Function &F, - std::set &SCCFunctions){ + hash_set &SCCFunctions){ DSGraph &Graph = getDSGraph(F); DEBUG(std::cerr << " [BU] Calculating SCC graph for: " << F.getName()<<"\n"); std::vector UnresolvableCalls; - std::map SCCCallSiteMap; + hash_map SCCCallSiteMap; std::vector &AuxCallsList = Graph.getAuxFunctionCalls(); while (1) { // Loop until we run out of resolvable call sites! Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.77 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.78 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.77 Fri Jan 31 22:01:20 2003 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Fri Jan 31 22:51:55 2003 @@ -540,12 +540,12 @@ DSGraph::DSGraph(const DSGraph &G) : Func(G.Func), GlobalsGraph(0) { PrintAuxCalls = false; - std::map NodeMap; + hash_map NodeMap; RetNode = cloneInto(G, ScalarMap, NodeMap); } DSGraph::DSGraph(const DSGraph &G, - std::map &NodeMap) + hash_map &NodeMap) : Func(G.Func), GlobalsGraph(0) { PrintAuxCalls = false; RetNode = cloneInto(G, ScalarMap, NodeMap); @@ -572,7 +572,7 @@ /// remapLinks - Change all of the Links in the current node according to the /// specified mapping. /// -void DSNode::remapLinks(std::map &OldNodeMap) { +void DSNode::remapLinks(hash_map &OldNodeMap) { for (unsigned i = 0, e = Links.size(); i != e; ++i) { DSNodeHandle &H = OldNodeMap[Links[i].getNode()]; Links[i].setNode(H.getNode()); @@ -588,8 +588,8 @@ // calling function's graph. // DSNodeHandle DSGraph::cloneInto(const DSGraph &G, - std::map &OldValMap, - std::map &OldNodeMap, + hash_map &OldValMap, + hash_map &OldNodeMap, unsigned CloneFlags) { assert(OldNodeMap.empty() && "Returned OldNodeMap should be empty!"); assert(&G != this && "Cannot clone graph into itself!"); @@ -625,7 +625,7 @@ } // Copy the value map... and merge all of the global nodes... - for (std::map::const_iterator I = G.ScalarMap.begin(), + for (hash_map::const_iterator I = G.ScalarMap.begin(), E = G.ScalarMap.end(); I != E; ++I) { DSNodeHandle &H = OldValMap[I->first]; DSNodeHandle &MappedNode = OldNodeMap[I->second.getNode()]; @@ -633,7 +633,7 @@ H.setOffset(I->second.getOffset()+MappedNode.getOffset()); if (isa(I->first)) { // Is this a global? - std::map::iterator GVI = ScalarMap.find(I->first); + hash_map::iterator GVI = ScalarMap.find(I->first); if (GVI != ScalarMap.end()) { // Is the global value in this fn already? GVI->second.mergeWith(H); } else { @@ -671,16 +671,16 @@ /// void DSGraph::mergeInGraph(DSCallSite &CS, const DSGraph &Graph, unsigned CloneFlags) { - std::map OldValMap; + hash_map OldValMap; DSNodeHandle RetVal; - std::map *ScalarMap = &OldValMap; + hash_map *ScalarMap = &OldValMap; // If this is not a recursive call, clone the graph into this graph... if (&Graph != this) { // Clone the callee's graph into the current graph, keeping // track of where scalars in the old graph _used_ to point, // and of the new nodes matching nodes of the old graph. - std::map OldNodeMap; + hash_map OldNodeMap; // The clone call may invalidate any of the vectors in the data // structure graph. Strip locals and don't copy the list of callers @@ -811,7 +811,7 @@ // removeRefsToGlobal - Helper function that removes globals from the // ScalarMap so that the referrer count will go down to zero. static void removeRefsToGlobal(DSNode* N, - std::map &ScalarMap) { + hash_map &ScalarMap) { while (!N->getGlobals().empty()) { GlobalValue *GV = N->getGlobals().back(); N->getGlobals().pop_back(); @@ -939,18 +939,16 @@ /// DSNodes, marking any nodes which are reachable. All reachable nodes it adds /// to the set, which allows it to only traverse visited nodes once. /// -void DSNode::markReachableNodes(std::set &ReachableNodes) { +void DSNode::markReachableNodes(hash_set &ReachableNodes) { if (this == 0) return; - std::set::iterator I = ReachableNodes.lower_bound(this); - if (I != ReachableNodes.end() && *I == this) - return; // Already marked reachable - ReachableNodes.insert(I, this); // Is reachable now + if (ReachableNodes.count(this)) return; // Already marked reachable + ReachableNodes.insert(this); // Is reachable now for (unsigned i = 0, e = getSize(); i < e; i += DS::PointerSize) getLink(i).getNode()->markReachableNodes(ReachableNodes); } -void DSCallSite::markReachableNodes(std::set &Nodes) { +void DSCallSite::markReachableNodes(hash_set &Nodes) { getRetVal().getNode()->markReachableNodes(Nodes); getCallee().getNode()->markReachableNodes(Nodes); @@ -965,8 +963,8 @@ // // This function returns true if the specified node is alive. // -static bool markAliveIfCanReachAlive(DSNode *N, std::set &Alive, - std::set &Visited) { +static bool markAliveIfCanReachAlive(DSNode *N, hash_set &Alive, + hash_set &Visited) { if (N == 0) return false; // If we know that this node is alive, return so! @@ -974,10 +972,9 @@ // Otherwise, we don't think the node is alive yet, check for infinite // recursion. - std::set::iterator VI = Visited.lower_bound(N); - if (VI != Visited.end() && *VI == N) return false; // Found a cycle + if (Visited.count(N)) return false; // Found a cycle // No recursion, insert into Visited... - Visited.insert(VI, N); + Visited.insert(N); if (N->NodeType & DSNode::GlobalNode) return false; // Global nodes will be marked on their own @@ -992,8 +989,8 @@ return ChildrenAreAlive; } -static bool CallSiteUsesAliveArgs(DSCallSite &CS, std::set &Alive, - std::set &Visited) { +static bool CallSiteUsesAliveArgs(DSCallSite &CS, hash_set &Alive, + hash_set &Visited) { if (markAliveIfCanReachAlive(CS.getRetVal().getNode(), Alive, Visited) || markAliveIfCanReachAlive(CS.getCallee().getNode(), Alive, Visited)) return true; @@ -1034,11 +1031,11 @@ // FIXME: Merge nontrivially identical call nodes... // Alive - a set that holds all nodes found to be reachable/alive. - std::set Alive; + hash_set Alive; std::vector > GlobalNodes; // Mark all nodes reachable by (non-global) scalar nodes as alive... - for (std::map::iterator I = ScalarMap.begin(), + for (hash_map::iterator I = ScalarMap.begin(), E = ScalarMap.end(); I != E; ++I) if (!isa(I->first) || GlobalIsAlivenessRoot(I->second.getNode(), Flags)) @@ -1052,7 +1049,7 @@ // If any global nodes points to a non-global that is "alive", the global is // "alive" as well... // - std::set Visited; + hash_set Visited; for (unsigned i = 0, e = GlobalNodes.size(); i != e; ++i) markAliveIfCanReachAlive(GlobalNodes[i].second, Alive, Visited); @@ -1129,7 +1126,7 @@ // This is a helper function for cloneGlobals and cloneCalls. // DSNode* GlobalDSGraph::cloneNodeInto(DSNode *OldNode, - std::map &NodeCache, + hash_map &NodeCache, bool GlobalsAreFinal) { if (OldNode == 0) return 0; @@ -1208,7 +1205,7 @@ // links (and recursively their such links) into this graph. // void GlobalDSGraph::cloneCalls(DSGraph& Graph) { - std::map NodeCache; + hash_map NodeCache; std::vector& FromCalls =Graph.FunctionCalls; FunctionCalls.reserve(FunctionCalls.size() + FromCalls.size()); Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.44 llvm/lib/Analysis/DataStructure/Local.cpp:1.45 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.44 Fri Jan 31 22:01:21 2003 +++ llvm/lib/Analysis/DataStructure/Local.cpp Fri Jan 31 22:51:55 2003 @@ -56,12 +56,12 @@ DSGraph &G; std::vector &Nodes; DSNodeHandle &RetNode; // Node that gets returned... - std::map &ScalarMap; + hash_map &ScalarMap; std::vector &FunctionCalls; public: GraphBuilder(DSGraph &g, std::vector &nodes, DSNodeHandle &retNode, - std::map &SM, + hash_map &SM, std::vector &fc) : G(g), Nodes(nodes), RetNode(retNode), ScalarMap(SM), FunctionCalls(fc) { @@ -166,7 +166,7 @@ return NH = getValueDest(*CE->getOperand(0)); if (CE->getOpcode() == Instruction::GetElementPtr) { visitGetElementPtrInst(*CE); - std::map::iterator I = ScalarMap.find(CE); + hash_map::iterator I = ScalarMap.find(CE); assert(I != ScalarMap.end() && "GEP didn't get processed right?"); return NH = I->second; } @@ -431,7 +431,7 @@ // our memory... here... // void LocalDataStructures::releaseMemory() { - for (std::map::iterator I = DSInfo.begin(), + for (hash_map::iterator I = DSInfo.begin(), E = DSInfo.end(); I != E; ++I) delete I->second; Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.43 llvm/lib/Analysis/DataStructure/Printer.cpp:1.44 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.43 Fri Jan 31 22:01:21 2003 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Fri Jan 31 22:51:55 2003 @@ -87,8 +87,8 @@ static void addCustomGraphFeatures(const DSGraph *G, GraphWriter &GW) { // Add scalar nodes to the graph... - const std::map &VM = G->getScalarMap(); - for (std::map::const_iterator I = VM.begin(); + const hash_map &VM = G->getScalarMap(); + for (hash_map::const_iterator I = VM.begin(); I != VM.end(); ++I) if (!isa(I->first)) { std::stringstream OS; Index: llvm/lib/Analysis/DataStructure/Steensgaard.cpp diff -u llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.15 llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.16 --- llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.15 Thu Jan 23 16:05:33 2003 +++ llvm/lib/Analysis/DataStructure/Steensgaard.cpp Fri Jan 31 22:51:55 2003 @@ -89,7 +89,7 @@ const DSCallSite &Call, DSNodeHandle &RetVal) { assert(ResultGraph != 0 && "Result graph not allocated!"); - std::map &ValMap = ResultGraph->getScalarMap(); + hash_map &ValMap = ResultGraph->getScalarMap(); // Handle the return value of the function... if (Call.getRetVal().getNode() && RetVal.getNode()) @@ -98,7 +98,7 @@ // Loop over all pointer arguments, resolving them to their provided pointers unsigned PtrArgIdx = 0; for (Function::aiterator AI = F->abegin(), AE = F->aend(); AI != AE; ++AI) { - std::map::iterator I = ValMap.find(AI); + hash_map::iterator I = ValMap.find(AI); if (I != ValMap.end()) // If its a pointer argument... I->second.addEdgeTo(Call.getPtrArg(PtrArgIdx++)); } @@ -120,16 +120,16 @@ // RetValMap - Keep track of the return values for all functions that return // valid pointers. // - std::map RetValMap; + hash_map RetValMap; // Loop over the rest of the module, merging graphs for non-external functions // into this graph. // for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) if (!I->isExternal()) { - std::map ValMap; + hash_map ValMap; { // Scope to free NodeMap memory ASAP - std::map NodeMap; + hash_map NodeMap; const DSGraph &FDSG = LDS.getDSGraph(*I); DSNodeHandle RetNode = ResultGraph->cloneInto(FDSG, ValMap, NodeMap); @@ -142,11 +142,11 @@ // Incorporate the inlined Function's ScalarMap into the global // ScalarMap... - std::map &GVM = ResultGraph->getScalarMap(); + hash_map &GVM = ResultGraph->getScalarMap(); while (!ValMap.empty()) { // Loop over value map, moving entries over... const std::pair &DSN = *ValMap.begin(); - std::map::iterator I = GVM.find(DSN.first); + hash_map::iterator I = GVM.find(DSN.first); if (I == GVM.end()) GVM[DSN.first] = DSN.second; else @@ -209,12 +209,12 @@ AliasAnalysis::Result Steens::alias(const Value *V1, const Value *V2) { assert(ResultGraph && "Result graph has not been computed yet!"); - std::map &GVM = ResultGraph->getScalarMap(); + hash_map &GVM = ResultGraph->getScalarMap(); - std::map::iterator I = GVM.find(const_cast(V1)); + hash_map::iterator I = GVM.find(const_cast(V1)); if (I != GVM.end() && I->second.getNode()) { DSNodeHandle &V1H = I->second; - std::map::iterator J=GVM.find(const_cast(V2)); + hash_map::iterator J=GVM.find(const_cast(V2)); if (J != GVM.end() && J->second.getNode()) { DSNodeHandle &V2H = J->second; // If the two pointers point to different data structure graph nodes, they Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.32 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.33 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.32 Thu Jan 23 16:05:33 2003 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Fri Jan 31 22:51:55 2003 @@ -40,7 +40,7 @@ // our memory... here... // void TDDataStructures::releaseMemory() { - for (std::map::iterator I = DSInfo.begin(), + for (hash_map::iterator I = DSInfo.begin(), E = DSInfo.end(); I != E; ++I) delete I->second; @@ -140,8 +140,8 @@ << "'\n"); // Clone our current graph into the callee... - std::map OldValMap; - std::map OldNodeMap; + hash_map OldValMap; + hash_map OldNodeMap; CG.cloneInto(Graph, OldValMap, OldNodeMap, DSGraph::StripModRefBits | DSGraph::KeepAllocaBit | DSGraph::DontCloneCallNodes); From lattner at cs.uiuc.edu Fri Jan 31 22:53:07 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Jan 31 22:53:07 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/IPModRef.cpp Message-ID: <200302010452.WAA31088@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: IPModRef.cpp updated: 1.12 -> 1.13 --- Log message: Change DSGraph stuff to use hash_(set|map) instead of std::(set|map) This change provides a small (3%) but consistent speedup --- Diffs of the changes: Index: llvm/lib/Analysis/IPA/IPModRef.cpp diff -u llvm/lib/Analysis/IPA/IPModRef.cpp:1.12 llvm/lib/Analysis/IPA/IPModRef.cpp:1.13 --- llvm/lib/Analysis/IPA/IPModRef.cpp:1.12 Thu Jan 23 16:06:33 2003 +++ llvm/lib/Analysis/IPA/IPModRef.cpp Fri Jan 31 22:51:57 2003 @@ -118,7 +118,7 @@ // function or we cannot determine the complete set of functions invoked). // DSGraph* FunctionModRefInfo::ResolveCallSiteModRefInfo(CallInst &CI, - std::map &NodeMap) + hash_map &NodeMap) { // Step #0: Quick check if we are going to fail anyway: avoid // all the graph cloning and map copying in steps #1 and #2. @@ -194,7 +194,7 @@ callSiteModRefInfo[&callInst] = callModRefInfo; // Get a copy of the graph for the callee with the callee inlined - std::map NodeMap; + hash_map NodeMap; DSGraph* csgp = ResolveCallSiteModRefInfo(const_cast(callInst), NodeMap); if (!csgp) @@ -238,7 +238,7 @@ knownValues.resize(tdGraph.getGraphSize()); // For every identifiable value, save Value pointer in knownValues[i] - for (std::map::const_iterator + for (hash_map::const_iterator I = tdGraph.getScalarMap().begin(), E = tdGraph.getScalarMap().end(); I != E; ++I) if (isa(I->first) || From lattner at cs.uiuc.edu Sat Feb 1 00:18:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Feb 1 00:18:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200302010617.AAA31557@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.78 -> 1.79 --- Log message: Improve efficiency of aliveness traversal code --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.78 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.79 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.78 Fri Jan 31 22:51:55 2003 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Feb 1 00:17:02 2003 @@ -956,15 +956,13 @@ getPtrArg(j).getNode()->markReachableNodes(Nodes); } -// markAliveIfCanReachAlive - Simple graph walker that recursively traverses the -// graph looking for a node that is marked alive. If the node is marked alive, -// the recursive unwind marks node alive that can point to the alive node. This -// is basically just a post-order traversal. +// CanReachAliveNodes - Simple graph walker that recursively traverses the graph +// looking for a node that is marked alive. If an alive node is found, return +// true, otherwise return false. If an alive node is reachable, this node is +// marked as alive... // -// This function returns true if the specified node is alive. -// -static bool markAliveIfCanReachAlive(DSNode *N, hash_set &Alive, - hash_set &Visited) { +static bool CanReachAliveNodes(DSNode *N, hash_set &Alive, + hash_set &Visited) { if (N == 0) return false; // If we know that this node is alive, return so! @@ -973,29 +971,29 @@ // Otherwise, we don't think the node is alive yet, check for infinite // recursion. if (Visited.count(N)) return false; // Found a cycle - // No recursion, insert into Visited... - Visited.insert(N); + Visited.insert(N); // No recursion, insert into Visited... if (N->NodeType & DSNode::GlobalNode) return false; // Global nodes will be marked on their own - bool ChildrenAreAlive = false; - for (unsigned i = 0, e = N->getSize(); i < e; i += DS::PointerSize) - ChildrenAreAlive |= markAliveIfCanReachAlive(N->getLink(i).getNode(), - Alive, Visited); - if (ChildrenAreAlive) - N->markReachableNodes(Alive); - return ChildrenAreAlive; + if (CanReachAliveNodes(N->getLink(i).getNode(), Alive, Visited)) { + N->markReachableNodes(Alive); + return true; + } + return false; } +// CallSiteUsesAliveArgs - Return true if the specified call site can reach any +// alive nodes. +// static bool CallSiteUsesAliveArgs(DSCallSite &CS, hash_set &Alive, hash_set &Visited) { - if (markAliveIfCanReachAlive(CS.getRetVal().getNode(), Alive, Visited) || - markAliveIfCanReachAlive(CS.getCallee().getNode(), Alive, Visited)) + if (CanReachAliveNodes(CS.getRetVal().getNode(), Alive, Visited) || + CanReachAliveNodes(CS.getCallee().getNode(), Alive, Visited)) return true; for (unsigned j = 0, e = CS.getNumPtrArgs(); j != e; ++j) - if (markAliveIfCanReachAlive(CS.getPtrArg(j).getNode(), Alive, Visited)) + if (CanReachAliveNodes(CS.getPtrArg(j).getNode(), Alive, Visited)) return true; return false; } @@ -1051,7 +1049,7 @@ // hash_set Visited; for (unsigned i = 0, e = GlobalNodes.size(); i != e; ++i) - markAliveIfCanReachAlive(GlobalNodes[i].second, Alive, Visited); + CanReachAliveNodes(GlobalNodes[i].second, Alive, Visited); std::vector FCallsAlive(FunctionCalls.size()); for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) From lattner at cs.uiuc.edu Sat Feb 1 00:24:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Feb 1 00:24:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200302010623.AAA31646@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.79 -> 1.80 --- Log message: Remove dead nodes more efficiently --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.79 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.80 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.79 Sat Feb 1 00:17:02 2003 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Feb 1 00:23:33 2003 @@ -1095,7 +1095,8 @@ for (unsigned i = 0; i != Nodes.size(); ++i) if (!Alive.count(Nodes[i])) { DSNode *N = Nodes[i]; - Nodes.erase(Nodes.begin()+i--); // Erase node from alive list. + std::swap(Nodes[i--], Nodes.back()); // move node to end of vector + Nodes.pop_back(); // Erase node from alive list. DeadNodes.push_back(N); // Add node to our list of dead nodes N->dropAllReferences(); // Drop all outgoing edges } From lattner at cs.uiuc.edu Sat Feb 1 00:42:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Feb 1 00:42:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200302010641.AAA32057@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.80 -> 1.81 --- Log message: Delete nodes more efficiently --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.80 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.81 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.80 Sat Feb 1 00:23:33 2003 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Feb 1 00:41:15 2003 @@ -1090,19 +1090,17 @@ ScalarMap.erase(GlobalNodes[i].first); // Loop over all unreachable nodes, dropping their references... - std::vector DeadNodes; - DeadNodes.reserve(Nodes.size()); // Only one allocation is allowed. for (unsigned i = 0; i != Nodes.size(); ++i) if (!Alive.count(Nodes[i])) { DSNode *N = Nodes[i]; std::swap(Nodes[i--], Nodes.back()); // move node to end of vector Nodes.pop_back(); // Erase node from alive list. - DeadNodes.push_back(N); // Add node to our list of dead nodes N->dropAllReferences(); // Drop all outgoing edges + + while (!N->getReferrers().empty()) + N->getReferrers().back()->setNode(0); + delete N; } - - // Delete all dead nodes... - std::for_each(DeadNodes.begin(), DeadNodes.end(), deleter); } #if 0 From lattner at cs.uiuc.edu Sat Feb 1 00:52:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Feb 1 00:52:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200302010651.AAA32151@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.81 -> 1.82 --- Log message: Fix a bug where we would incorrectly delete globals which had edges to alive nodes in a graph in the t-d pass. This slows down the TD pass by quite a bit (1/3), but is needed for correctness. --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.81 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.82 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.81 Sat Feb 1 00:41:15 2003 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Feb 1 00:51:17 2003 @@ -973,9 +973,6 @@ if (Visited.count(N)) return false; // Found a cycle Visited.insert(N); // No recursion, insert into Visited... - if (N->NodeType & DSNode::GlobalNode) - return false; // Global nodes will be marked on their own - for (unsigned i = 0, e = N->getSize(); i < e; i += DS::PointerSize) if (CanReachAliveNodes(N->getLink(i).getNode(), Alive, Visited)) { N->markReachableNodes(Alive); From lattner at cs.uiuc.edu Sat Feb 1 00:55:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Feb 1 00:55:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200302010654.AAA32208@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.82 -> 1.83 --- Log message: Fix a bug where we would delete neccesary calls in bu pass --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.82 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.83 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.82 Sat Feb 1 00:51:17 2003 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Feb 1 00:54:31 2003 @@ -1058,7 +1058,8 @@ std::vector AuxFCallsAlive(AuxFunctionCalls.size()); for (unsigned i = 0, e = AuxFunctionCalls.size(); i != e; ++i) - if (CallSiteUsesAliveArgs(AuxFunctionCalls[i], Alive, Visited)) { + if (!(Flags & DSGraph::RemoveUnreachableGlobals) || + CallSiteUsesAliveArgs(AuxFunctionCalls[i], Alive, Visited)) { AuxFunctionCalls[i].markReachableNodes(Alive); AuxFCallsAlive[i] = true; } From lattner at cs.uiuc.edu Sun Feb 2 10:31:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Feb 2 10:31:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Assembler/2003-02-02-ConstGlobal.ll Message-ID: <200302021630.KAA31216@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Assembler: 2003-02-02-ConstGlobal.ll added (r1.1) --- Log message: New testcase --- Diffs of the changes: From lattner at cs.uiuc.edu Sun Feb 2 10:41:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Feb 2 10:41:01 2003 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y Message-ID: <200302021640.KAA32105@apoc.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.100 -> 1.101 --- Log message: Fix bug: Assembler/2003-02-02-ConstGlobal.ll --- Diffs of the changes: Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.100 llvm/lib/AsmParser/llvmAsmParser.y:1.101 --- llvm/lib/AsmParser/llvmAsmParser.y:1.100 Thu Jan 30 16:24:26 2003 +++ llvm/lib/AsmParser/llvmAsmParser.y Sun Feb 2 10:40:20 2003 @@ -510,16 +510,16 @@ // 1. If at least one of the globals is uninitialized or // 2. If both initializers have the same value. // - // This can only be done if the const'ness of the vars is the same. - // if (GlobalVariable *GV = dyn_cast(V)) { - if (EGV->isConstant() == GV->isConstant() && - (!EGV->hasInitializer() || !GV->hasInitializer() || - EGV->getInitializer() == GV->getInitializer())) { + if (!EGV->hasInitializer() || !GV->hasInitializer() || + EGV->getInitializer() == GV->getInitializer()) { - // Make sure the existing global version gets the initializer! + // Make sure the existing global version gets the initializer! Make + // sure that it also gets marked const if the new version is. if (GV->hasInitializer() && !EGV->hasInitializer()) EGV->setInitializer(GV->getInitializer()); + if (GV->isConstant()) + EGV->setConstant(true); delete GV; // Destroy the duplicate! return true; // They are equivalent! From lattner at cs.uiuc.edu Sun Feb 2 10:41:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Feb 2 10:41:03 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/GlobalVariable.h Message-ID: <200302021640.KAA32118@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: GlobalVariable.h updated: 1.17 -> 1.18 --- Log message: Allow modifying a global variables constness property --- Diffs of the changes: Index: llvm/include/llvm/GlobalVariable.h diff -u llvm/include/llvm/GlobalVariable.h:1.17 llvm/include/llvm/GlobalVariable.h:1.18 --- llvm/include/llvm/GlobalVariable.h:1.17 Wed Oct 9 18:11:33 2002 +++ llvm/include/llvm/GlobalVariable.h Sun Feb 2 10:40:40 2003 @@ -85,8 +85,9 @@ /// runtime execution of the program. Assigning a value into the constant /// leads to undefined behavior. /// - inline bool isConstant() const { return isConstantGlobal; } - + bool isConstant() const { return isConstantGlobal; } + void setConstant(bool Value) { isConstantGlobal = Value; } + virtual void print(std::ostream &OS) const; // Methods for support type inquiry through isa, cast, and dyn_cast: From lattner at cs.uiuc.edu Sun Feb 2 10:43:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Feb 2 10:43:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp Message-ID: <200302021642.KAA32396@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Printer.cpp updated: 1.44 -> 1.45 --- Log message: Be a bit more specific in caption --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.44 llvm/lib/Analysis/DataStructure/Printer.cpp:1.45 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.44 Fri Jan 31 22:51:55 2003 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Sun Feb 2 10:42:01 2003 @@ -64,7 +64,7 @@ if (G->hasFunction()) return "Function " + G->getFunction().getName(); else - return "Non-function graph"; + return "Globals graph"; } static const char *getGraphProperties(const DSGraph *G) { From lattner at cs.uiuc.edu Sun Feb 2 11:03:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Feb 2 11:03:00 2003 Subject: [llvm-commits] CVS: llvm/utils/NightlyTestTemplate.html Message-ID: <200302021702.LAA01269@apoc.cs.uiuc.edu> Changes in directory llvm/utils: NightlyTestTemplate.html updated: 1.4 -> 1.5 --- Log message: Indent for uniformity --- Diffs of the changes: Index: llvm/utils/NightlyTestTemplate.html diff -u llvm/utils/NightlyTestTemplate.html:1.4 llvm/utils/NightlyTestTemplate.html:1.5 --- llvm/utils/NightlyTestTemplate.html:1.4 Wed Jan 22 14:35:59 2003 +++ llvm/utils/NightlyTestTemplate.html Sun Feb 2 11:02:20 2003 @@ -61,7 +61,8 @@

Warnings during the build:

-$WarningsList

+

    $WarningsList +