From lattner at cs.uiuc.edu Mon Nov 4 00:08:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 00:08:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LevelRaise/2002-05-02-MissedRaise.ll Message-ID: <200211040607.AAA04950@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LevelRaise: 2002-05-02-MissedRaise.ll updated: 1.1 -> 1.2 --- Log message: Convert old style gep index from uint to long --- Diffs of the changes: Index: llvm/test/Regression/Transforms/LevelRaise/2002-05-02-MissedRaise.ll diff -u llvm/test/Regression/Transforms/LevelRaise/2002-05-02-MissedRaise.ll:1.1 llvm/test/Regression/Transforms/LevelRaise/2002-05-02-MissedRaise.ll:1.2 --- llvm/test/Regression/Transforms/LevelRaise/2002-05-02-MissedRaise.ll:1.1 Thu May 2 14:53:02 2002 +++ llvm/test/Regression/Transforms/LevelRaise/2002-05-02-MissedRaise.ll Mon Nov 4 00:07:04 2002 @@ -14,7 +14,7 @@ %reg110 = malloc uint, uint 4 store uint %Depth, uint* %reg110 %reg113 = call %List* %createList( uint %Depth ) - %reg217 = getelementptr uint* %reg110, uint 2 + %reg217 = getelementptr uint* %reg110, long 2 %cast221 = cast uint* %reg217 to %List** store %List* %reg113, %List** %cast221 %cast222 = cast uint* %reg110 to %List* From lattner at cs.uiuc.edu Mon Nov 4 00:10:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 00:10:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LevelRaise/2002-02-14-BadAssertion.ll 2002-03-14-ConvertableToGEPHang.ll 2002-03-20-Crash.ll 2002-03-21-MissedRaise2.ll 2002-07-16-RaiseCrash.ll 2002-07-31-AssertionFailure.ll Message-ID: <200211040609.AAA05293@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LevelRaise: 2002-02-14-BadAssertion.ll updated: 1.1 -> 1.2 2002-03-14-ConvertableToGEPHang.ll updated: 1.3 -> 1.4 2002-03-20-Crash.ll updated: 1.4 -> 1.5 2002-03-21-MissedRaise2.ll updated: 1.1 -> 1.2 2002-07-16-RaiseCrash.ll updated: 1.3 -> 1.4 2002-07-31-AssertionFailure.ll updated: 1.2 -> 1.3 --- Log message: Convert uint gep operands to long --- Diffs of the changes: Index: llvm/test/Regression/Transforms/LevelRaise/2002-02-14-BadAssertion.ll diff -u llvm/test/Regression/Transforms/LevelRaise/2002-02-14-BadAssertion.ll:1.1 llvm/test/Regression/Transforms/LevelRaise/2002-02-14-BadAssertion.ll:1.2 --- llvm/test/Regression/Transforms/LevelRaise/2002-02-14-BadAssertion.ll:1.1 Thu Feb 14 16:20:54 2002 +++ llvm/test/Regression/Transforms/LevelRaise/2002-02-14-BadAssertion.ll Mon Nov 4 00:09:46 2002 @@ -10,8 +10,8 @@ begin %reg108 = call int %connect_left( ) %cast1002 = cast ulong 8 to sbyte * - %reg108-idxcast = cast int %reg108 to uint - %reg1000 = getelementptr sbyte * %cast1002, uint %reg108-idxcast + %reg108-idxcast = cast int %reg108 to long + %reg1000 = getelementptr sbyte * %cast1002, long %reg108-idxcast %cast1003 = cast sbyte * %reg1000 to sbyte * * %reg112 = load sbyte * * %cast1003 %cast111 = cast sbyte * %reg112 to int Index: llvm/test/Regression/Transforms/LevelRaise/2002-03-14-ConvertableToGEPHang.ll diff -u llvm/test/Regression/Transforms/LevelRaise/2002-03-14-ConvertableToGEPHang.ll:1.3 llvm/test/Regression/Transforms/LevelRaise/2002-03-14-ConvertableToGEPHang.ll:1.4 --- llvm/test/Regression/Transforms/LevelRaise/2002-03-14-ConvertableToGEPHang.ll:1.3 Tue Sep 10 14:55:40 2002 +++ llvm/test/Regression/Transforms/LevelRaise/2002-03-14-ConvertableToGEPHang.ll Mon Nov 4 00:09:46 2002 @@ -11,9 +11,9 @@ void "build_image_array"() begin bb0: ;[#uses=0] - %reg109 = getelementptr %Disjunct * * * %chosen_disjuncts, uint 7 ; <%Disjunct * * *> [#uses=1] + %reg109 = getelementptr %Disjunct * * * %chosen_disjuncts, long 7 ; <%Disjunct * * *> [#uses=1] %reg108 = load %Disjunct * * * %reg109 ; <%Disjunct * *> [#uses=1] - %reg1000 = getelementptr %Disjunct * * %reg108, uint 3 ; <%Disjunct * *> [#uses=1] + %reg1000 = getelementptr %Disjunct * * %reg108, long 3 ; <%Disjunct * *> [#uses=1] %cast1007 = cast %Disjunct * * %reg1000 to sbyte * * ; [#uses=1] %reg110 = load sbyte * * %cast1007 ; [#uses=1] %cast1008 = cast ulong 4 to sbyte * ; [#uses=1] Index: llvm/test/Regression/Transforms/LevelRaise/2002-03-20-Crash.ll diff -u llvm/test/Regression/Transforms/LevelRaise/2002-03-20-Crash.ll:1.4 llvm/test/Regression/Transforms/LevelRaise/2002-03-20-Crash.ll:1.5 --- llvm/test/Regression/Transforms/LevelRaise/2002-03-20-Crash.ll:1.4 Tue Sep 10 15:04:19 2002 +++ llvm/test/Regression/Transforms/LevelRaise/2002-03-20-Crash.ll Mon Nov 4 00:09:46 2002 @@ -14,7 +14,7 @@ %A = cast %Village* %village to ulong %reg123 = add ulong %A, %cast121 ; <%Village *> [#uses=1] %reg123 = cast ulong %reg123 to %Village* - %idx = getelementptr %Village * %reg123, uint 0, ubyte 0, uint 0 ; <%Village *> [#uses=1] + %idx = getelementptr %Village * %reg123, long 0, ubyte 0, long 0 ; <%Village *> [#uses=1] %reg118 = load %Village** %idx ret %Village *%reg118 end Index: llvm/test/Regression/Transforms/LevelRaise/2002-03-21-MissedRaise2.ll diff -u llvm/test/Regression/Transforms/LevelRaise/2002-03-21-MissedRaise2.ll:1.1 llvm/test/Regression/Transforms/LevelRaise/2002-03-21-MissedRaise2.ll:1.2 --- llvm/test/Regression/Transforms/LevelRaise/2002-03-21-MissedRaise2.ll:1.1 Thu Mar 21 16:39:43 2002 +++ llvm/test/Regression/Transforms/LevelRaise/2002-03-21-MissedRaise2.ll Mon Nov 4 00:09:46 2002 @@ -21,10 +21,10 @@ %reg115 = malloc sbyte *, uint 1 ; [#uses=1] store sbyte * * %reg115, sbyte * * * %reg112 %reg121 = load sbyte * * * %reg112 ; [#uses=1] - %size-idxcast1 = cast int %size to uint ; [#uses=1] - %reg1221 = getelementptr sbyte * * %reg121, uint %size-idxcast1 ; [#uses=1] + %size-idxcast1 = cast int %size to long ; [#uses=1] + %reg1221 = getelementptr sbyte * * %reg121, long %size-idxcast1 ; [#uses=1] store sbyte * null, sbyte * * %reg1221 - %reg232 = getelementptr sbyte * * * %reg112, uint 1 ; [#uses=1] + %reg232 = getelementptr sbyte * * * %reg112, long 1 ; [#uses=1] %cast243 = cast int (uint) * %map to sbyte * * ; [#uses=1] store sbyte * * %cast243, sbyte * * * %reg232 %cast246 = cast sbyte * * * %reg112 to %Hash ; <%Hash> [#uses=1] Index: llvm/test/Regression/Transforms/LevelRaise/2002-07-16-RaiseCrash.ll diff -u llvm/test/Regression/Transforms/LevelRaise/2002-07-16-RaiseCrash.ll:1.3 llvm/test/Regression/Transforms/LevelRaise/2002-07-16-RaiseCrash.ll:1.4 --- llvm/test/Regression/Transforms/LevelRaise/2002-07-16-RaiseCrash.ll:1.3 Thu Aug 22 11:39:14 2002 +++ llvm/test/Regression/Transforms/LevelRaise/2002-07-16-RaiseCrash.ll Mon Nov 4 00:09:46 2002 @@ -12,13 +12,13 @@ br bool %cond220, label %bb5, label %bb2 bb2: ;[#uses=3] - %reg2221 = getelementptr sbyte*** %cast219, uint 6 ; [#uses=1] + %reg2221 = getelementptr sbyte*** %cast219, long 6 ; [#uses=1] %reg108 = load sbyte*** %reg2221 ; [#uses=3] - %reg2251 = getelementptr sbyte** %reg108, uint 5 ; [#uses=1] + %reg2251 = getelementptr sbyte** %reg108, long 5 ; [#uses=1] store sbyte* null, sbyte** %reg2251 - %reg2281 = getelementptr sbyte*** %cast219, uint 6 ; [#uses=1] + %reg2281 = getelementptr sbyte*** %cast219, long 6 ; [#uses=1] store sbyte** null, sbyte*** %reg2281 - %reg2311 = getelementptr sbyte*** %cast219, uint 5 ; [#uses=1] + %reg2311 = getelementptr sbyte*** %cast219, long 5 ; [#uses=1] %reg114 = load sbyte*** %reg2311 ; [#uses=2] %cond234 = seteq sbyte** %reg114, null ; [#uses=1] br bool %cond234, label %bb4, label %bb3 @@ -26,12 +26,12 @@ bb3: ;[#uses=4] %reg115 = phi sbyte*** [ %cast117, %bb3 ], [ %cast219, %bb2 ] ; [#uses=2] %reg116 = phi sbyte** [ %cast118, %bb3 ], [ %reg114, %bb2 ] ; [#uses=4] - %reg236 = getelementptr sbyte** %reg116, uint 5 ; [#uses=1] + %reg236 = getelementptr sbyte** %reg116, long 5 ; [#uses=1] %reg110 = load sbyte** %reg236 ; [#uses=1] - %reg239 = getelementptr sbyte** %reg116, uint 5 ; [#uses=1] + %reg239 = getelementptr sbyte** %reg116, long 5 ; [#uses=1] %cast241 = cast sbyte*** %reg115 to sbyte* ; [#uses=1] store sbyte* %cast241, sbyte** %reg239 - %reg242 = getelementptr sbyte*** %reg115, uint 6 ; [#uses=1] + %reg242 = getelementptr sbyte*** %reg115, long 6 ; [#uses=1] store sbyte** %reg116, sbyte*** %reg242 %cast117 = cast sbyte** %reg116 to sbyte*** ; [#uses=1] %cast118 = cast sbyte* %reg110 to sbyte** ; [#uses=2] @@ -39,9 +39,9 @@ br bool %cond245, label %bb3, label %bb4 bb4: ;[#uses=2] - %reg247 = getelementptr sbyte*** %cast219, uint 5 ; [#uses=1] + %reg247 = getelementptr sbyte*** %cast219, long 5 ; [#uses=1] store sbyte** %reg108, sbyte*** %reg247 - %reg250 = getelementptr sbyte** %reg108, uint 6 ; [#uses=2] + %reg250 = getelementptr sbyte** %reg108, long 6 ; [#uses=2] cast sbyte** %reg250 to sbyte**** ; :0 [#uses=0] %cast252 = cast sbyte*** %cast219 to sbyte* ; [#uses=1] store sbyte* %cast252, sbyte** %reg250 Index: llvm/test/Regression/Transforms/LevelRaise/2002-07-31-AssertionFailure.ll diff -u llvm/test/Regression/Transforms/LevelRaise/2002-07-31-AssertionFailure.ll:1.2 llvm/test/Regression/Transforms/LevelRaise/2002-07-31-AssertionFailure.ll:1.3 --- llvm/test/Regression/Transforms/LevelRaise/2002-07-31-AssertionFailure.ll:1.2 Wed Jul 31 16:10:11 2002 +++ llvm/test/Regression/Transforms/LevelRaise/2002-07-31-AssertionFailure.ll Mon Nov 4 00:09:46 2002 @@ -18,7 +18,7 @@ bb5: ;[#uses=2] %reg125 = phi sbyte* [ %reg126, %bb2], [ null, %0 ] %reg263 = malloc sbyte*, uint 3 ; [#uses=4] - %reg2641 = getelementptr sbyte** %reg263, uint 1 ; [#uses=1] + %reg2641 = getelementptr sbyte** %reg263, long 1 ; [#uses=1] store sbyte* %reg125, sbyte** %reg2641 store sbyte* %reg125, sbyte** %reg263 %cast271 = cast sbyte** %reg263 to %CON_node* ; <%CON_node*> [#uses=1] From lattner at cs.uiuc.edu Mon Nov 4 00:17:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 00:17:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LevelRaise/2002-05-23-MissedRaise.ll Message-ID: <200211040616.AAA05344@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LevelRaise: 2002-05-23-MissedRaise.ll updated: 1.2 -> 1.3 --- Log message: Add information about why this testcase fails --- Diffs of the changes: Index: llvm/test/Regression/Transforms/LevelRaise/2002-05-23-MissedRaise.ll diff -u llvm/test/Regression/Transforms/LevelRaise/2002-05-23-MissedRaise.ll:1.2 llvm/test/Regression/Transforms/LevelRaise/2002-05-23-MissedRaise.ll:1.3 --- llvm/test/Regression/Transforms/LevelRaise/2002-05-23-MissedRaise.ll:1.2 Tue Oct 15 16:39:49 2002 +++ llvm/test/Regression/Transforms/LevelRaise/2002-05-23-MissedRaise.ll Mon Nov 4 00:16:13 2002 @@ -6,9 +6,17 @@ %FILE = type { int, ubyte*, ubyte*, ubyte, ubyte, uint, uint, uint } uint %addfile(%FILE* %f) { - %cast255 = cast %FILE* %f to sbyte* ; [#uses=1] - %reg2421 = getelementptr sbyte* %cast255, long 24 ; [#uses=1] - %reg130 = load sbyte* %reg2421 ; [#uses=1] - %cast250 = cast sbyte %reg130 to uint ; [#uses=1] + %cast255 = cast %FILE* %f to sbyte* + + ; Addreses a ubyte member in memory... + %reg2421 = getelementptr sbyte* %cast255, long 24 + + ; Loads the ubyte + %reg130 = load sbyte* %reg2421 + + ; Error, cast cannot convert the source operand to ubyte because then + ; the sign extension would not be performed. Need to insert a cast. + ; + %cast250 = cast sbyte %reg130 to uint ; This is a sign extension instruction ret uint %cast250 } From lattner at cs.uiuc.edu Mon Nov 4 00:49:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 00:49:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200211040648.AAA06451@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.40 -> 1.41 --- Log message: Change the "Cannot merge two portions of the same node yet" from an assertion into a "oh crap, lets collapse" case --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.40 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.41 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.40 Sun Nov 3 15:27:48 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Mon Nov 4 00:48:26 2002 @@ -347,18 +347,25 @@ if (N == 0 || (N == this && NH.getOffset() == Offset)) return; // Noop - assert(NH.getNode() != this && - "Cannot merge two portions of the same node yet!"); + if (N == this) { + std::cerr << "WARNING: Cannot merge two portions of the same node yet, so we collapse instead!\n"; + N->foldNodeCompletely(); + return; + } // If we are merging a node with a completely folded node, then both nodes are // now completely folded. // if (isNodeCompletelyFolded()) { - N->foldNodeCompletely(); - } else if (NH.getNode()->isNodeCompletelyFolded()) { + if (!N->isNodeCompletelyFolded()) + N->foldNodeCompletely(); + } else if (N->isNodeCompletelyFolded()) { foldNodeCompletely(); Offset = 0; } + N = NH.getNode(); + + if (this == N) return; // If both nodes are not at offset 0, make sure that we are merging the node // at an later offset into the node with the zero offset. @@ -401,7 +408,7 @@ DSNodeHandle &Ref = *N->Referrers.back(); Ref = DSNodeHandle(this, NOffset+Ref.getOffset()); } - + // We must merge fields in this node due to nodes merged in the source node. // In order to handle this we build a map that converts from the source node's // MergeMap values to our MergeMap values. This map is indexed by the @@ -440,7 +447,7 @@ // for (unsigned i = 0, e = NSize; i != e; ++i) if (DSNodeHandle *Link = N->getLink(i)) { - addEdgeTo(i+NOffset, *Link); + addEdgeTo((i+NOffset) % getSize(), *Link); N->MergeMap[i] = -1; // Kill outgoing edge } From vadve at cs.uiuc.edu Mon Nov 4 08:17:01 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Mon Nov 4 08:17:01 2002 Subject: [llvm-commits] CVS: llvm/include/Support/TarjanSCCIterator.h Message-ID: <200211041416.IAA05007@psmith.cs.uiuc.edu> Changes in directory llvm/include/Support: TarjanSCCIterator.h added (r1.1) --- Log message: Generic graph iterator to enumerate the SCCs of a graph in linear time using Tarjan's DFS algorithm. --- Diffs of the changes: From vadve at cs.uiuc.edu Mon Nov 4 08:21:00 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Mon Nov 4 08:21:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/PrintSCC.cpp Message-ID: <200211041420.IAA05399@psmith.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: PrintSCC.cpp added (r1.1) --- Log message: Simple passes that print out SCCs in the CFGs or in the CallGraph of a module. --- Diffs of the changes: From lattner at cs.uiuc.edu Mon Nov 4 10:19:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 10:19:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/malloc.ll Message-ID: <200211041618.KAA09192@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: malloc.ll added (r1.1) --- Log message: New testcase for malloc promotion --- Diffs of the changes: From lattner at cs.uiuc.edu Mon Nov 4 10:20:02 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 10:20:02 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200211041619.KAA09204@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.63 -> 1.64 --- Log message: Add a transformation to turn: malloc Ty, C int malloc [C x Ty], 1 --- Diffs of the changes: Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.63 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.64 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.63 Tue Oct 29 17:03:20 2002 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Nov 4 10:18:53 2002 @@ -23,6 +23,7 @@ #include "llvm/iPHINode.h" #include "llvm/iOperators.h" #include "llvm/Pass.h" +#include "llvm/DerivedTypes.h" #include "llvm/Support/InstIterator.h" #include "llvm/Support/InstVisitor.h" #include "Support/Statistic.h" @@ -76,6 +77,7 @@ Instruction *visitCastInst(CastInst &CI); Instruction *visitPHINode(PHINode &PN); Instruction *visitGetElementPtrInst(GetElementPtrInst &GEP); + Instruction *visitAllocationInst(AllocationInst &AI); // visitInstruction - Specify what to return for unhandled instructions... Instruction *visitInstruction(Instruction &I) { return 0; } @@ -710,6 +712,40 @@ return 0; } + +Instruction *InstCombiner::visitAllocationInst(AllocationInst &AI) { + // Convert: malloc Ty, C - where C is a constant != 1 into: malloc [C x Ty], 1 + if (AI.isArrayAllocation()) // Check C != 1 + if (const ConstantUInt *C = dyn_cast(AI.getArraySize())) { + const Type *NewTy = ArrayType::get(AI.getAllocatedType(), C->getValue()); + AllocationInst *New; + + // Create and insert the replacement instruction... + if (isa(AI)) + New = new MallocInst(NewTy, 0, AI.getName(), &AI); + else if (isa(AI)) + New = new AllocaInst(NewTy, 0, AI.getName(), &AI); + + // Scan to the end of the allocation instructions, to skip over a block of + // allocas if possible... + // + BasicBlock::iterator It = New; + while (isa(*It)) ++It; + + // Now that I is pointing to the first non-allocation-inst in the block, + // insert our getelementptr instruction... + // + std::vector Idx(2, Constant::getNullValue(Type::LongTy)); + Value *V = new GetElementPtrInst(New, Idx, New->getName()+".sub", It); + + // Now make everything use the getelementptr instead of the original + // allocation. + ReplaceInstUsesWith(AI, V); + return &AI; + } + return 0; +} + void InstCombiner::removeFromWorkList(Instruction *I) { From lattner at cs.uiuc.edu Mon Nov 4 10:36:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 10:36:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/getelementptr.ll Message-ID: <200211041635.KAA09388@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: getelementptr.ll updated: 1.6 -> 1.7 --- Log message: Add new getelementptr elimination test --- Diffs of the changes: Index: llvm/test/Regression/Transforms/InstCombine/getelementptr.ll diff -u llvm/test/Regression/Transforms/InstCombine/getelementptr.ll:1.6 llvm/test/Regression/Transforms/InstCombine/getelementptr.ll:1.7 --- llvm/test/Regression/Transforms/InstCombine/getelementptr.ll:1.6 Tue Sep 17 15:47:46 2002 +++ llvm/test/Regression/Transforms/InstCombine/getelementptr.ll Mon Nov 4 10:35:14 2002 @@ -35,3 +35,10 @@ %A = getelementptr [10 x sbyte]* %Global, long 0, long 4 ret sbyte* %A } + +int* %foo6() { + %M = malloc [4 x int] + %A = getelementptr [4 x int]* %M, long 0, long 0 + %B = getelementptr int* %A, long 2 + ret int* %B +} From lattner at cs.uiuc.edu Mon Nov 4 10:44:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 10:44:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200211041643.KAA09868@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.64 -> 1.65 --- Log message: Instcombine this away: %A = getelementptr [4 x int]* %M, long 0, long 0 %B = getelementptr int* %A, long 2 --- Diffs of the changes: Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.64 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.65 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.64 Mon Nov 4 10:18:53 2002 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Nov 4 10:43:32 2002 @@ -681,11 +681,17 @@ *cast(GEP.getOperand(1)); assert(Indices[0] != 0 && "Constant folding of uint's failed!?"); - } else if (*GEP.idx_begin() == ConstantUInt::getNullValue(Type::LongTy) && + } else if (*GEP.idx_begin() == Constant::getNullValue(Type::LongTy) && Src->getNumOperands() != 1) { // Otherwise we can do the fold if the first index of the GEP is a zero Indices.insert(Indices.end(), Src->idx_begin(), Src->idx_end()); Indices.insert(Indices.end(), GEP.idx_begin()+1, GEP.idx_end()); + } else if (Src->getOperand(Src->getNumOperands()-1) == + Constant::getNullValue(Type::LongTy)) { + // If the src gep ends with a constant array index, merge this get into + // it, even if we have a non-zero array index. + Indices.insert(Indices.end(), Src->idx_begin(), Src->idx_end()-1); + Indices.insert(Indices.end(), GEP.idx_begin(), GEP.idx_end()); } if (!Indices.empty()) From lattner at cs.uiuc.edu Mon Nov 4 13:02:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 13:02:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Support/Timer.cpp Message-ID: <200211041901.NAA11159@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Support: Timer.cpp updated: 1.5 -> 1.6 --- Log message: mallinfo is not available on sun apparently :( --- Diffs of the changes: Index: llvm/lib/Support/Timer.cpp diff -u llvm/lib/Support/Timer.cpp:1.5 llvm/lib/Support/Timer.cpp:1.6 --- llvm/lib/Support/Timer.cpp:1.5 Sun Nov 3 19:49:45 2002 +++ llvm/lib/Support/Timer.cpp Mon Nov 4 13:01:41 2002 @@ -71,13 +71,18 @@ perror("getrusage call failed: -time-passes info incorrect!"); } - struct mallinfo MI = mallinfo(); - TimeRecord Result; Result.Elapsed = T.tv_sec + T.tv_usec/1000000.0; Result.UserTime = RU.ru_utime.tv_sec + RU.ru_utime.tv_usec/1000000.0; Result.SystemTime = RU.ru_stime.tv_sec + RU.ru_stime.tv_usec/1000000.0; + +#ifndef __sparc__ + struct mallinfo MI = mallinfo(); Result.MaxRSS = MI.uordblks; +#else + Result.MaxRSS = 0; +#endif + return Result; } From lattner at cs.uiuc.edu Mon Nov 4 13:21:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 13:21:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Support/Timer.cpp Message-ID: <200211041920.NAA13323@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Support: Timer.cpp updated: 1.6 -> 1.7 --- Log message: Allow memory sizes to be negative, remove obsolete TmpRSS field --- Diffs of the changes: Index: llvm/lib/Support/Timer.cpp diff -u llvm/lib/Support/Timer.cpp:1.6 llvm/lib/Support/Timer.cpp:1.7 --- llvm/lib/Support/Timer.cpp:1.6 Mon Nov 4 13:01:41 2002 +++ llvm/lib/Support/Timer.cpp Mon Nov 4 13:19:36 2002 @@ -22,13 +22,13 @@ } Timer::Timer(const std::string &N) - : Elapsed(0), UserTime(0), SystemTime(0), MaxRSS(0), Name(N), + : Elapsed(0), UserTime(0), SystemTime(0), MemUsed(0), Name(N), Started(false), TG(getDefaultTimerGroup()) { TG->addTimer(); } Timer::Timer(const std::string &N, TimerGroup &tg) - : Elapsed(0), UserTime(0), SystemTime(0), MaxRSS(0), Name(N), + : Elapsed(0), UserTime(0), SystemTime(0), MemUsed(0), Name(N), Started(false), TG(&tg) { TG->addTimer(); } @@ -60,7 +60,7 @@ struct TimeRecord { double Elapsed, UserTime, SystemTime; - unsigned long MaxRSS; + long MemUsed; }; static TimeRecord getTimeRecord() { @@ -78,9 +78,9 @@ #ifndef __sparc__ struct mallinfo MI = mallinfo(); - Result.MaxRSS = MI.uordblks; + Result.MemUsed = MI.uordblks; #else - Result.MaxRSS = 0; + Result.MemUsed = 0; #endif return Result; @@ -92,7 +92,7 @@ Elapsed -= TR.Elapsed; UserTime -= TR.UserTime; SystemTime -= TR.SystemTime; - MaxRSS -= TR.MaxRSS; + MemUsed -= TR.MemUsed; } void Timer::stopTimer() { @@ -100,16 +100,14 @@ Elapsed += TR.Elapsed; UserTime += TR.UserTime; SystemTime += TR.SystemTime; - MaxRSS += TR.MaxRSS; - if ((signed long)MaxRSS < 0) - MaxRSS = 0; + MemUsed += TR.MemUsed; } void Timer::sum(const Timer &T) { Elapsed += T.Elapsed; UserTime += T.UserTime; SystemTime += T.SystemTime; - MaxRSS += T.MaxRSS; + MemUsed += T.MemUsed; } //===----------------------------------------------------------------------===// @@ -134,8 +132,8 @@ fprintf(stderr, " "); - if (Total.MaxRSS) - fprintf(stderr, " %8ld ", MaxRSS); + if (Total.MemUsed) + fprintf(stderr, " %8ld ", MemUsed); std::cerr << Name << "\n"; Started = false; // Once printed, don't print again @@ -175,8 +173,7 @@ if (Total.getProcessTime()) std::cerr << " --User+System--"; std::cerr << " ---Wall Time---"; - - if (Total.getMaxRSS()) + if (Total.getMemUsed()) std::cerr << " ---Mem---"; std::cerr << " --- Name ---\n"; From lattner at cs.uiuc.edu Mon Nov 4 13:21:03 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 13:21:03 2002 Subject: [llvm-commits] CVS: llvm/include/Support/Timer.h Message-ID: <200211041920.NAA13330@apoc.cs.uiuc.edu> Changes in directory llvm/include/Support: Timer.h updated: 1.2 -> 1.3 --- Log message: Allow memory sizes to be negative, eliminate TmpRSS --- Diffs of the changes: Index: llvm/include/Support/Timer.h diff -u llvm/include/Support/Timer.h:1.2 llvm/include/Support/Timer.h:1.3 --- llvm/include/Support/Timer.h:1.2 Thu Oct 3 16:08:20 2002 +++ llvm/include/Support/Timer.h Mon Nov 4 13:20:09 2002 @@ -34,8 +34,7 @@ double Elapsed; // Wall clock time elapsed in seconds double UserTime; // User time elapsed double SystemTime; // System time elapsed - unsigned long MaxRSS; // Maximum resident set size (in bytes) - unsigned long RSSTemp; // Temp for calculating maxrss + long MemUsed; // Memory allocated (in bytes) std::string Name; // The name of this time variable bool Started; // Has this time variable ever been started? TimerGroup *TG; // The TimerGroup this Timer is in. @@ -47,15 +46,14 @@ double getProcessTime() const { return UserTime+SystemTime; } double getWallTime() const { return Elapsed; } - unsigned long getMaxRSS() const { return MaxRSS; } + long getMemUsed() const { return MemUsed; } std::string getName() const { return Name; } const Timer &operator=(const Timer &T) { Elapsed = T.Elapsed; UserTime = T.UserTime; SystemTime = T.SystemTime; - MaxRSS = T.MaxRSS; - RSSTemp = T.RSSTemp; + MemUsed = T.MemUsed; Name = T.Name; Started = T.Started; assert (TG == T.TG && "Can only assign timers in the same TimerGroup!"); From hldnbrnd at cs.uiuc.edu Mon Nov 4 13:56:01 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Mon Nov 4 13:56:01 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Ptrdist-anagram/ Message-ID: <200211041955.NAA23882@trinity.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Ptrdist-anagram: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Programs/SingleSource/Ptrdist-anagram added to the repository --- Diffs of the changes: From hldnbrnd at cs.uiuc.edu Mon Nov 4 13:58:01 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Mon Nov 4 13:58:01 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Ptrdist-anagram/Makefile anagram.c input.OUT input.in words Message-ID: <200211041957.NAA23899@trinity.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Ptrdist-anagram: Makefile added (r1.1) anagram.c added (r1.1) input.OUT added (r1.1) input.in added (r1.1) words added (r1.1) --- Log message: Anagram test from the Pointer-Intensive Banchmark Suite --- Diffs of the changes: From hldnbrnd at cs.uiuc.edu Mon Nov 4 13:58:02 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Mon Nov 4 13:58:02 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Makefile Message-ID: <200211041957.NAA23910@trinity.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource: Makefile updated: 1.2 -> 1.3 --- Log message: Added Ptrdist-anagram --- Diffs of the changes: Index: llvm/test/Programs/SingleSource/Makefile diff -u llvm/test/Programs/SingleSource/Makefile:1.2 llvm/test/Programs/SingleSource/Makefile:1.3 --- llvm/test/Programs/SingleSource/Makefile:1.2 Wed Apr 17 12:45:10 2002 +++ llvm/test/Programs/SingleSource/Makefile Mon Nov 4 13:57:36 2002 @@ -1,4 +1,4 @@ LEVEL = ../../.. -DIRS = UnitTests Shootout +DIRS = UnitTests Shootout Ptrdist-anagram include Makefile.singlesrc From lattner at cs.uiuc.edu Mon Nov 4 14:51:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 14:51:01 2002 Subject: [llvm-commits] CVS: llvm/Makefile.common Makefile.Linux Message-ID: <200211042050.OAA14518@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.common updated: 1.67 -> 1.68 Makefile.Linux updated: 1.4 -> 1.5 --- Log message: Generalize ExportSymbols into PLATFORMLINKOPTS --- Diffs of the changes: Index: llvm/Makefile.common diff -u llvm/Makefile.common:1.67 llvm/Makefile.common:1.68 --- llvm/Makefile.common:1.67 Tue Oct 29 09:15:22 2002 +++ llvm/Makefile.common Mon Nov 4 14:50:33 2002 @@ -393,6 +393,7 @@ USED_LIB_PATHS_G := $(addprefix $(LIBDEBUG)/, $(STATICUSEDLIBS)) USED_LIB_PATHS_O := $(addprefix $(LIBRELEASE)/, $(STATICUSEDLIBS)) USED_LIB_PATHS_P := $(addprefix $(LIBPROFILE)/, $(STATICUSEDLIBS)) +LINK_OPTS := $(TOOLLINKOPTS) $(PLATFORMLINKOPTS) all:: $(TOOLEXENAMES) clean:: @@ -400,15 +401,15 @@ $(TOOLEXENAME_G): $(ObjectsG) $(USED_LIB_PATHS_G) $(BUILD_ROOT_TOP)/tools/Debug/.dir @echo ======= Linking $(TOOLNAME) debug executable $(WARN_MSG) ======= - $(VERB) $(LinkG) -o $@ $(ObjectsG) $(USED_LIBS_OPTIONS_G) $(TOOLLINKOPTS) + $(VERB) $(LinkG) -o $@ $(ObjectsG) $(USED_LIBS_OPTIONS_G) $(LINK_OPTS) $(TOOLEXENAME_O): $(ObjectsO) $(USED_LIB_PATHS_O) $(BUILD_ROOT_TOP)/tools/Release/.dir @echo ======= Linking $(TOOLNAME) release executable ======= - $(VERB) $(LinkO) -o $@ $(ObjectsO) $(USED_LIBS_OPTIONS_O) $(TOOLLINKOPTS) + $(VERB) $(LinkO) -o $@ $(ObjectsO) $(USED_LIBS_OPTIONS_O) $(LINK_OPTS) $(TOOLEXENAME_P): $(ObjectsP) $(USED_LIB_PATHS_P) $(BUILD_ROOT_TOP)/tools/Profile/.dir @echo ======= Linking $(TOOLNAME) profile executable ======= - $(VERB) $(LinkP) -o $@ $(ObjectsP) $(USED_LIBS_OPTIONS_P) $(TOOLLINKOPTS) + $(VERB) $(LinkP) -o $@ $(ObjectsP) $(USED_LIBS_OPTIONS_P) $(LINK_OPTS) endif Index: llvm/Makefile.Linux diff -u llvm/Makefile.Linux:1.4 llvm/Makefile.Linux:1.5 --- llvm/Makefile.Linux:1.4 Mon Sep 23 09:24:19 2002 +++ llvm/Makefile.Linux Mon Nov 4 14:50:33 2002 @@ -10,10 +10,10 @@ # MakeSharedObjectOption := -shared -# ExportSymbols - This is used by tools that need to make sure that all of their -# symbols are exported for use at runtime by dlsym. +# PLATFORMLINKOPTS - On Linux, we must specify this linker option so that all +# symbols are exported by tools for runtime use by dlsym. # -ExportSymbols := -Wl,--export-dynamic +PLATFORMLINKOPTS := -Wl,--export-dynamic # 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 Mon Nov 4 14:52:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 14:52:00 2002 Subject: [llvm-commits] CVS: llvm/tools/jello/Makefile Message-ID: <200211042051.OAA14548@apoc.cs.uiuc.edu> Changes in directory llvm/tools/jello: Makefile updated: 1.1 -> 1.2 --- Log message: No need to explicitly inclue ExportSymbols now --- Diffs of the changes: Index: llvm/tools/jello/Makefile diff -u llvm/tools/jello/Makefile:1.1 llvm/tools/jello/Makefile:1.2 --- llvm/tools/jello/Makefile:1.1 Fri Oct 25 17:58:53 2002 +++ llvm/tools/jello/Makefile Mon Nov 4 14:50:53 2002 @@ -5,6 +5,6 @@ # Have gcc tell the linker to export symbols from the program so that # dynamically loaded modules can be linked against them. # -TOOLLINKOPTS = -ldl $(ExportSymbols) +TOOLLINKOPTS = -ldl include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Mon Nov 4 14:52:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 14:52:01 2002 Subject: [llvm-commits] CVS: llvm/tools/analyze/Makefile Message-ID: <200211042051.OAA14541@apoc.cs.uiuc.edu> Changes in directory llvm/tools/analyze: Makefile updated: 1.16 -> 1.17 --- Log message: No need to explicitly inclue ExportSymbols now --- Diffs of the changes: Index: llvm/tools/analyze/Makefile diff -u llvm/tools/analyze/Makefile:1.16 llvm/tools/analyze/Makefile:1.17 --- llvm/tools/analyze/Makefile:1.16 Tue Sep 17 15:40:20 2002 +++ llvm/tools/analyze/Makefile Mon Nov 4 14:50:51 2002 @@ -2,7 +2,7 @@ TOOLNAME = analyze USEDLIBS = asmparser bcreader scalaropts.a transforms.a analysis ipa \ datastructure target.a transformutils.a vmcore support -TOOLLINKOPTS = -ldl $(ExportSymbols) +TOOLLINKOPTS = -ldl include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Mon Nov 4 14:52:02 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 14:52:02 2002 Subject: [llvm-commits] CVS: llvm/tools/llc/Makefile Message-ID: <200211042051.OAA14555@apoc.cs.uiuc.edu> Changes in directory llvm/tools/llc: Makefile updated: 1.30 -> 1.31 --- Log message: No need to explicitly inclue ExportSymbols now --- Diffs of the changes: Index: llvm/tools/llc/Makefile diff -u llvm/tools/llc/Makefile:1.30 llvm/tools/llc/Makefile:1.31 --- llvm/tools/llc/Makefile:1.30 Sun Oct 27 19:13:07 2002 +++ llvm/tools/llc/Makefile Mon Nov 4 14:50:54 2002 @@ -22,8 +22,7 @@ transformutils \ vmcore \ support -TOOLLINKOPTS = -ldl $(ExportSymbols) - +TOOLLINKOPTS = -ldl KEEP_SYMBOLS = 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Mon Nov 4 14:52:03 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 14:52:03 2002 Subject: [llvm-commits] CVS: llvm/tools/lli/Makefile Message-ID: <200211042051.OAA14562@apoc.cs.uiuc.edu> Changes in directory llvm/tools/lli: Makefile updated: 1.17 -> 1.18 --- Log message: No need to explicitly inclue ExportSymbols now --- Diffs of the changes: Index: llvm/tools/lli/Makefile diff -u llvm/tools/lli/Makefile:1.17 llvm/tools/lli/Makefile:1.18 --- llvm/tools/lli/Makefile:1.17 Fri Sep 13 17:20:19 2002 +++ llvm/tools/lli/Makefile Mon Nov 4 14:50:56 2002 @@ -5,6 +5,6 @@ # Have gcc tell the linker to export symbols from the program so that # dynamically loaded modules can be linked against them. # -TOOLLINKOPTS = -ldl $(ExportSymbols) +TOOLLINKOPTS = -ldl include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Mon Nov 4 14:52:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 14:52:04 2002 Subject: [llvm-commits] CVS: llvm/tools/opt/Makefile Message-ID: <200211042051.OAA14569@apoc.cs.uiuc.edu> Changes in directory llvm/tools/opt: Makefile updated: 1.34 -> 1.35 --- Log message: No need to explicitly inclue ExportSymbols now --- Diffs of the changes: Index: llvm/tools/opt/Makefile diff -u llvm/tools/opt/Makefile:1.34 llvm/tools/opt/Makefile:1.35 --- llvm/tools/opt/Makefile:1.34 Sun Oct 27 18:54:59 2002 +++ llvm/tools/opt/Makefile Mon Nov 4 14:50:57 2002 @@ -7,8 +7,8 @@ livevar scalaropts \ ipo ipa.a datastructure transforms target.a analysis \ transformutils vmcore support -TOOLLINKOPTS = -ldl $(ExportSymbols) +TOOLLINKOPTS = -ldl KEEP_SYMBOLS = 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Mon Nov 4 14:54:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 14:54:01 2002 Subject: [llvm-commits] CVS: llvm/Makefile.SunOS Message-ID: <200211042053.OAA14815@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.SunOS updated: 1.3 -> 1.4 --- Log message: Link to -lmalloc --- Diffs of the changes: Index: llvm/Makefile.SunOS diff -u llvm/Makefile.SunOS:1.3 llvm/Makefile.SunOS:1.4 --- llvm/Makefile.SunOS:1.3 Thu Oct 10 14:28:10 2002 +++ llvm/Makefile.SunOS Mon Nov 4 14:53:27 2002 @@ -10,10 +10,9 @@ # MakeSharedObjectOption := -G -# ExportSymbols - This is used by tools that need to make sure that all of their -# symbols are exported for use at runtime by dlsym. -# -ExportSymbols := +# PLATFORMLINKOPTS - On sun we need to link to libmalloc.so to get a definition +# of mallinfo. +ExportSymbols := -lmalloc # 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 hldnbrnd at cs.uiuc.edu Mon Nov 4 15:04:02 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Mon Nov 4 15:04:02 2002 Subject: [llvm-commits] CVS: llvm/Makefile.SunOS Message-ID: <200211042103.PAA24765@trinity.cs.uiuc.edu> Changes in directory llvm: Makefile.SunOS updated: 1.4 -> 1.5 --- Log message: Fix typo. -Chris --- Diffs of the changes: Index: llvm/Makefile.SunOS diff -u llvm/Makefile.SunOS:1.4 llvm/Makefile.SunOS:1.5 --- llvm/Makefile.SunOS:1.4 Mon Nov 4 14:53:27 2002 +++ llvm/Makefile.SunOS Mon Nov 4 15:03:13 2002 @@ -12,7 +12,7 @@ # PLATFORMLINKOPTS - On sun we need to link to libmalloc.so to get a definition # of mallinfo. -ExportSymbols := -lmalloc +PLATFORMLINKOPTS := -lmalloc # 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 Mon Nov 4 15:06:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 15:06:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Support/Timer.cpp Message-ID: <200211042105.PAA14911@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Support: Timer.cpp updated: 1.7 -> 1.8 --- Log message: Sun can now use mallinfo() --- Diffs of the changes: Index: llvm/lib/Support/Timer.cpp diff -u llvm/lib/Support/Timer.cpp:1.7 llvm/lib/Support/Timer.cpp:1.8 --- llvm/lib/Support/Timer.cpp:1.7 Mon Nov 4 13:19:36 2002 +++ llvm/lib/Support/Timer.cpp Mon Nov 4 15:05:21 2002 @@ -76,13 +76,8 @@ Result.UserTime = RU.ru_utime.tv_sec + RU.ru_utime.tv_usec/1000000.0; Result.SystemTime = RU.ru_stime.tv_sec + RU.ru_stime.tv_usec/1000000.0; -#ifndef __sparc__ struct mallinfo MI = mallinfo(); Result.MemUsed = MI.uordblks; -#else - Result.MemUsed = 0; -#endif - return Result; } From lattner at cs.uiuc.edu Mon Nov 4 15:08:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 15:08:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Support/Timer.cpp Message-ID: <200211042107.PAA14924@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Support: Timer.cpp updated: 1.8 -> 1.9 --- Log message: Simplify code --- Diffs of the changes: Index: llvm/lib/Support/Timer.cpp diff -u llvm/lib/Support/Timer.cpp:1.8 llvm/lib/Support/Timer.cpp:1.9 --- llvm/lib/Support/Timer.cpp:1.8 Mon Nov 4 15:05:21 2002 +++ llvm/lib/Support/Timer.cpp Mon Nov 4 15:06:54 2002 @@ -75,9 +75,7 @@ Result.Elapsed = T.tv_sec + T.tv_usec/1000000.0; Result.UserTime = RU.ru_utime.tv_sec + RU.ru_utime.tv_usec/1000000.0; Result.SystemTime = RU.ru_stime.tv_sec + RU.ru_stime.tv_usec/1000000.0; - - struct mallinfo MI = mallinfo(); - Result.MemUsed = MI.uordblks; + Result.MemUsed = mallinfo().uordblks; return Result; } From hldnbrnd at cs.uiuc.edu Mon Nov 4 16:01:01 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Mon Nov 4 16:01:01 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Ptrdist-bc/ Message-ID: <200211042200.QAA27960@trinity.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Ptrdist-bc: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Programs/MultiSource/Ptrdist-bc added to the repository --- Diffs of the changes: From hldnbrnd at cs.uiuc.edu Mon Nov 4 16:01:03 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Mon Nov 4 16:01:03 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Ptrdist-ft/ Message-ID: <200211042200.QAA28107@trinity.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Ptrdist-ft: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Programs/MultiSource/Ptrdist-ft added to the repository --- Diffs of the changes: From hldnbrnd at cs.uiuc.edu Mon Nov 4 16:01:04 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Mon Nov 4 16:01:04 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Ptrdist-ks/ Message-ID: <200211042200.QAA28305@trinity.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Ptrdist-ks: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Programs/MultiSource/Ptrdist-ks added to the repository --- Diffs of the changes: From hldnbrnd at cs.uiuc.edu Mon Nov 4 16:02:01 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Mon Nov 4 16:02:01 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Ptrdist-yacr2/ Message-ID: <200211042201.QAA28371@trinity.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Ptrdist-yacr2: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Programs/MultiSource/Ptrdist-yacr2 added to the repository --- Diffs of the changes: From hldnbrnd at cs.uiuc.edu Mon Nov 4 16:10:03 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Mon Nov 4 16:10:03 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Ptrdist-README Message-ID: <200211042209.QAA28726@trinity.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource: Ptrdist-README added (r1.1) --- Log message: inter-Intensive Benchmark Suite --- Diffs of the changes: From lattner at cs.uiuc.edu Mon Nov 4 18:00:02 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 18:00:02 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSNode.h Message-ID: <200211042359.RAA21457@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSNode.h updated: 1.6 -> 1.7 --- Log message: Add a bunch of assertions --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSNode.h diff -u llvm/include/llvm/Analysis/DSNode.h:1.6 llvm/include/llvm/Analysis/DSNode.h:1.7 --- llvm/include/llvm/Analysis/DSNode.h:1.6 Sun Nov 3 15:23:56 2002 +++ llvm/include/llvm/Analysis/DSNode.h Mon Nov 4 17:59:41 2002 @@ -126,13 +126,19 @@ } DSNodeHandle *getLink(unsigned i) { - if (hasLink(i)) + if (hasLink(i)) { + assert((unsigned)MergeMap[i] < Links.size() && + "MergeMap references Link that doesn't exist!"); return &Links[MergeMap[i]]; + } return 0; } const DSNodeHandle *getLink(unsigned i) const { - if (hasLink(i)) + if (hasLink(i)) { + assert((unsigned)MergeMap[i] < Links.size() && + "MergeMap references Link that doesn't exist!"); return &Links[MergeMap[i]]; + } return 0; } @@ -226,6 +232,8 @@ /// void rewriteMergeMap(signed char From, signed char To) { assert(From != To && "Cannot change something into itself!"); + assert(To < (int)Links.size() && + "Changing MergeMap entry to an illegal entry!"); for (unsigned i = 0, e = MergeMap.size(); i != e; ++i) if (MergeMap[i] == From) MergeMap[i] = To; From lattner at cs.uiuc.edu Mon Nov 4 18:03:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 18:03:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200211050002.SAA21475@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.41 -> 1.42 --- Log message: Attempted fixes to the mergemap to make it work better. Ended up disabling merge map merging completely. It shall be removed. --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.41 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.42 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.41 Mon Nov 4 00:48:26 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Mon Nov 4 18:01:58 2002 @@ -81,7 +81,6 @@ // Fold the MergeMap down to a single byte of space... MergeMap.resize(1); - MergeMap[0] = -1; // If we have links, merge all of our outgoing links together... if (!Links.empty()) { @@ -89,6 +88,8 @@ for (unsigned i = 1, e = Links.size(); i != e; ++i) Links[0].mergeWith(Links[i]); Links.resize(1); + } else { + MergeMap[0] = -1; } } @@ -132,6 +133,7 @@ rewriteMergeMap(OldIdx, NewIdx); assert(MergeMap[i] == NewIdx && "Field not replaced!"); } else { + assert(MergeMap[i] < (int)Links.size() && "MergeMap index out of range!"); Links[MergeMap[i]] = NH; } } @@ -259,6 +261,10 @@ /// void DSNode::mergeMappedValues(signed char V1, signed char V2) { assert(V1 != V2 && "Cannot merge two identical mapped values!"); + assert(V2 < (int)Links.size() && + "Attempting to rewrite to invalid link number!"); + assert(V1 < (int)Links.size() && + "Attempting to rewrite to invalid link number!"); if (V1 < 0) { // If there is no outgoing link from V1, merge it with V2 if (V2 < 0 && V1 > V2) @@ -269,15 +275,15 @@ } else if (V2 < 0) { // Is V2 < 0 && V1 >= 0? rewriteMergeMap(V2, V1); // Merge into the one with the link... } else { // Otherwise, links exist at both locations - // Merge Links[V1] with Links[V2] so they point to the same place now... - Links[V1].mergeWith(Links[V2]); - // Merge the V2 link into V1 so that we reduce the overall value of the - // links are reduced... + // links are reduced... // if (V2 < V1) std::swap(V1, V2); // Ensure V1 < V2 rewriteMergeMap(V2, V1); // After this, V2 is "dead" + // Merge Links[V1] with Links[V2] so they point to the same place now... + Links[V1].mergeWith(Links[V2]); // BROKEN, this can invalidate V2!! + // Change the user of the last link to use V2 instead if ((unsigned)V2 != Links.size()-1) { rewriteMergeMap(Links.size()-1, V2); // Point to V2 instead of last el... @@ -408,7 +414,17 @@ DSNodeHandle &Ref = *N->Referrers.back(); Ref = DSNodeHandle(this, NOffset+Ref.getOffset()); } - + + // Make all of the outgoing links of N now be outgoing links of this. This + // can cause recursive merging! + // + for (unsigned i = 0, e = NSize; i != e; ++i) + if (DSNodeHandle *Link = N->getLink(i)) { + addEdgeTo((i+NOffset) % getSize(), *Link); + N->MergeMap[i] = -1; // Kill outgoing edge + } + +#if 0 // We must merge fields in this node due to nodes merged in the source node. // In order to handle this we build a map that converts from the source node's // MergeMap values to our MergeMap values. This map is indexed by the @@ -427,6 +443,8 @@ // Get what we map this byte to... signed char Element = MergeMap[i+NOffset]; + assert(Element < (int)Links.size() && "Element in merge map out of range!"); + // We use 127 as a sentinal and don't check for it's existence yet... assert(Element != 127 && "MergeMapMap doesn't permit 127 values yet!"); @@ -439,20 +457,15 @@ // mergeMappedValues(CurMappedVal, Element); MergeMapMap[NElement+NSize] = MergeMap[i+NOffset]; + assert(MergeMap[i+NOffset] < (int)Links.size() + && "Element in merge map out of range!"); } } - - // Make all of the outgoing links of N now be outgoing links of this. This - // can cause recursive merging! - // - for (unsigned i = 0, e = NSize; i != e; ++i) - if (DSNodeHandle *Link = N->getLink(i)) { - addEdgeTo((i+NOffset) % getSize(), *Link); - N->MergeMap[i] = -1; // Kill outgoing edge - } +#endif // Now that there are no outgoing edges, all of the Links are dead. N->Links.clear(); + N->MergeMap.clear(); // Merge the node types NodeType |= N->NodeType; From lattner at cs.uiuc.edu Mon Nov 4 18:22:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 18:22:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/LangRef.html Message-ID: <200211050021.SAA23680@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: LangRef.html updated: 1.18 -> 1.19 --- Log message: Add a note about the switch instruction --- Diffs of the changes: Index: llvm/www/docs/LangRef.html diff -u llvm/www/docs/LangRef.html:1.18 llvm/www/docs/LangRef.html:1.19 --- llvm/www/docs/LangRef.html:1.18 Tue Oct 29 17:06:16 2002 +++ llvm/www/docs/LangRef.html Mon Nov 4 18:21:03 2002 @@ -682,13 +682,19 @@ ; Lookup indirect branch switch uint <value>, label <defaultdest>, %switchtype <switchtable> - +
Overview:
+NOTE: The switch instruction may go away in the future. It is not very +well supported in LLVM anyway, so don't go to great lengths to support it. Talk +to Chris for more info if this concerns +you.

+ The 'switch' instruction is used to transfer control flow to one of several different places. It is a generalization of the 'br' instruction, allowing a branch to occur to one of many possible destinations.

@@ -1700,7 +1706,7 @@

Chris Lattner
-Last modified: Tue Oct 29 01:57:05 CST 2002 +Last modified: Mon Nov 4 18:20:38 CST 2002 From lattner at cs.uiuc.edu Mon Nov 4 18:51:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Nov 4 18:51:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp Message-ID: <200211050050.SAA21779@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Reoptimizer/TraceCache: VirtualMem.cpp updated: 1.6 -> 1.7 --- Log message: Fix warning, contrib by Bill Wendling --- Diffs of the changes: Index: llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp diff -u llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp:1.6 llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp:1.7 --- llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp:1.6 Sun Oct 27 13:10:31 2002 +++ llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp Mon Nov 4 18:50:24 2002 @@ -88,6 +88,7 @@ //std::cerr<<(void *) instr<<"\n"; assert(0 && "This branch type is not yet handled!"); + return 0; } //write branch inst, followed by a null inst in delay slot From hldnbrnd at cs.uiuc.edu Tue Nov 5 12:47:00 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Tue Nov 5 12:47:00 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Ptrdist-bc/COPYING Makefile array.b bc.c bc.y.dist bcdefs.h config.h const.h etest.b execute.c fact.b fix_math.h global.c global.h libmath.b load.c main.c math.h number.c number.h primes.OUT primes.b proto.h sbc.cpp sbc.h sbc.output sbc.y scan.c scan.l.dist sqrt.b storage.c util.c version.h y.tab.h Message-ID: <200211051846.MAA05057@trinity.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Ptrdist-bc: COPYING added (r1.1) Makefile added (r1.1) array.b added (r1.1) bc.c added (r1.1) bc.y.dist added (r1.1) bcdefs.h added (r1.1) config.h added (r1.1) const.h added (r1.1) etest.b added (r1.1) execute.c added (r1.1) fact.b added (r1.1) fix_math.h added (r1.1) global.c added (r1.1) global.h added (r1.1) libmath.b added (r1.1) load.c added (r1.1) main.c added (r1.1) math.h added (r1.1) number.c added (r1.1) number.h added (r1.1) primes.OUT added (r1.1) primes.b added (r1.1) proto.h added (r1.1) sbc.cpp added (r1.1) sbc.h added (r1.1) sbc.output added (r1.1) sbc.y added (r1.1) scan.c added (r1.1) scan.l.dist added (r1.1) sqrt.b added (r1.1) storage.c added (r1.1) util.c added (r1.1) version.h added (r1.1) y.tab.h added (r1.1) --- Log message: Added new test --- Diffs of the changes: From hldnbrnd at cs.uiuc.edu Tue Nov 5 12:49:00 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Tue Nov 5 12:49:00 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Ptrdist-ft/Fheap.c Fheap.h Fsanity.c Fsanity.h Fstruct.h Makefile ft-1c1c.OUT ft-1k2k.OUT ft.c graph.c graph.h item.c item.h random.c Message-ID: <200211051848.MAA05079@trinity.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Ptrdist-ft: Fheap.c added (r1.1) Fheap.h added (r1.1) Fsanity.c added (r1.1) Fsanity.h added (r1.1) Fstruct.h added (r1.1) Makefile added (r1.1) ft-1c1c.OUT added (r1.1) ft-1k2k.OUT added (r1.1) ft.c added (r1.1) graph.c added (r1.1) graph.h added (r1.1) item.c added (r1.1) item.h added (r1.1) random.c added (r1.1) --- Log message: Added new test --- Diffs of the changes: From hldnbrnd at cs.uiuc.edu Tue Nov 5 12:51:01 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Tue Nov 5 12:51:01 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Ptrdist-ks/COPYING KL-1.OUT KL-1.in KL-2.OUT KL-2.in KL-3.in KL-4.in KL-5.in KL-6.in KS-1.c KS-2.c KS.h Makefile Message-ID: <200211051850.MAA05091@trinity.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Ptrdist-ks: COPYING added (r1.1) KL-1.OUT added (r1.1) KL-1.in added (r1.1) KL-2.OUT added (r1.1) KL-2.in added (r1.1) KL-3.in added (r1.1) KL-4.in added (r1.1) KL-5.in added (r1.1) KL-6.in added (r1.1) KS-1.c added (r1.1) KS-2.c added (r1.1) KS.h added (r1.1) Makefile added (r1.1) --- Log message: Added new test --- Diffs of the changes: From hldnbrnd at cs.uiuc.edu Tue Nov 5 12:53:00 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Tue Nov 5 12:53:00 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Ptrdist-yacr2/COPYING Makefile assign.c assign.h channel.c channel.h hcg.c hcg.h input1.OUT input1.in input2.OUT input2.in input3.in main.c maze.c maze.h option.c option.h types.h vcg.c vcg.h Message-ID: <200211051852.MAA05105@trinity.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Ptrdist-yacr2: COPYING added (r1.1) Makefile added (r1.1) assign.c added (r1.1) assign.h added (r1.1) channel.c added (r1.1) channel.h added (r1.1) hcg.c added (r1.1) hcg.h added (r1.1) input1.OUT added (r1.1) input1.in added (r1.1) input2.OUT added (r1.1) input2.in added (r1.1) input3.in added (r1.1) main.c added (r1.1) maze.c added (r1.1) maze.h added (r1.1) option.c added (r1.1) option.h added (r1.1) types.h added (r1.1) vcg.c added (r1.1) vcg.h added (r1.1) --- Log message: Added new test --- Diffs of the changes: From lattner at cs.uiuc.edu Tue Nov 5 15:13:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 5 15:13:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/DSAnalysis/simplest-test.ll Message-ID: <200211052112.PAA27694@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/DSAnalysis: simplest-test.ll added (r1.1) --- Log message: New testcase --- Diffs of the changes: From hldnbrnd at cs.uiuc.edu Tue Nov 5 16:56:00 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Tue Nov 5 16:56:00 2002 Subject: [llvm-commits] CVS: llvm/www/docs/TestStatus.html Message-ID: <200211052255.QAA29952@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: TestStatus.html updated: 1.10 -> 1.11 --- Log message: Added new tests --- Diffs of the changes: Index: llvm/www/docs/TestStatus.html diff -u llvm/www/docs/TestStatus.html:1.10 llvm/www/docs/TestStatus.html:1.11 --- llvm/www/docs/TestStatus.html:1.10 Thu Oct 24 15:54:49 2002 +++ llvm/www/docs/TestStatus.html Tue Nov 5 16:55:38 2002 @@ -1,10 +1,10 @@ - +

Test Results

-
last updated: 10/24/2002
-
tests current: 10/24/2002
+
last updated: 11/05/2002
+
tests current: 10/25/2002

SingleSource

@@ -16,6 +16,7 @@ + @@ -48,7 +49,10 @@ + + +
Test NameCBE Compiles?CBE Links?CBE Diff MatchLLI Diff MatchNotes
sumarrayXXX
sumarraymallocXXX
test-indvarsXXX
Ptrdist-anagramXXX

Shootout

08-02-CastTestXXX
CodegenBugXXX
ArrayResolutionXXX
StructureArgsXXX
StructureArgsSimpleXXX
BadLoadXXO

MultiSource

@@ -67,8 +71,13 @@ Olden-tspXXX Olden-voronoiXXOInfinite loop OptimizerEvalXXOIt is a timing test, so not matching is expected. -sgefaXXXBoth native and cbe seg fault +sgefaXXOBoth native and cbe seg fault simXXO +Ptrdist-bcOOOBytecode fails to be generated +Ptrdist-ftOOOBytecode fails to be generated +Ptrdist-ksXXO +Ptrdist-yacr2XXONative seg faults, not 64 friendly + From hldnbrnd at cs.uiuc.edu Tue Nov 5 16:58:00 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Tue Nov 5 16:58:00 2002 Subject: [llvm-commits] CVS: llvm/www/docs/TestStatus.html Message-ID: <200211052257.QAA29984@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: TestStatus.html updated: 1.11 -> 1.12 --- Log message: Typo fixed --- Diffs of the changes: Index: llvm/www/docs/TestStatus.html diff -u llvm/www/docs/TestStatus.html:1.11 llvm/www/docs/TestStatus.html:1.12 --- llvm/www/docs/TestStatus.html:1.11 Tue Nov 5 16:55:38 2002 +++ llvm/www/docs/TestStatus.html Tue Nov 5 16:57:43 2002 @@ -1,4 +1,4 @@ - + From lattner at cs.uiuc.edu Tue Nov 5 17:25:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 5 17:25:01 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/DuffsDevice.c Message-ID: <200211052324.RAA30359@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource: DuffsDevice.c added (r1.1) --- Log message: New testcase --- Diffs of the changes: From vadve at cs.uiuc.edu Tue Nov 5 18:35:01 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Tue Nov 5 18:35:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/EmitAssembly.cpp Message-ID: <200211060034.SAA17130@psmith.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: EmitAssembly.cpp updated: 1.70 -> 1.71 --- Log message: Remove a nasty little semi-colon someone introduced which prevented any machine instrs from being printed! --- Diffs of the changes: Index: llvm/lib/Target/Sparc/EmitAssembly.cpp diff -u llvm/lib/Target/Sparc/EmitAssembly.cpp:1.70 llvm/lib/Target/Sparc/EmitAssembly.cpp:1.71 --- llvm/lib/Target/Sparc/EmitAssembly.cpp:1.70 Wed Oct 30 14:16:38 2002 +++ llvm/lib/Target/Sparc/EmitAssembly.cpp Tue Nov 5 18:34:26 2002 @@ -443,7 +443,7 @@ { unsigned Opcode = MI->getOpCode(); - if (Target.getInstrInfo().isDummyPhiInstr(Opcode)); + if (Target.getInstrInfo().isDummyPhiInstr(Opcode)) return; // IGNORE PHI NODES toAsm << "\t" << Target.getInstrInfo().getName(Opcode) << "\t"; From lattner at cs.uiuc.edu Tue Nov 5 18:53:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Nov 5 18:53:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Verifier/2002-11-05-GetelementptrPointers.ll Message-ID: <200211060052.SAA00444@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Verifier: 2002-11-05-GetelementptrPointers.ll added (r1.1) --- Log message: New testcase to handle eventually --- Diffs of the changes: From lattner at cs.uiuc.edu Wed Nov 6 00:17:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 00:17:01 2002 Subject: [llvm-commits] CVS: llvm/tools/analyze/analyze.cpp Message-ID: <200211060616.AAA06092@apoc.cs.uiuc.edu> Changes in directory llvm/tools/analyze: analyze.cpp updated: 1.46 -> 1.47 --- Log message: Give passnames to the printer classes --- Diffs of the changes: Index: llvm/tools/analyze/analyze.cpp diff -u llvm/tools/analyze/analyze.cpp:1.46 llvm/tools/analyze/analyze.cpp:1.47 --- llvm/tools/analyze/analyze.cpp:1.46 Fri Aug 30 17:54:37 2002 +++ llvm/tools/analyze/analyze.cpp Wed Nov 6 00:16:08 2002 @@ -31,6 +31,8 @@ // Get and print pass... return false; } + + virtual const char *getPassName() const { return "'Pass' Printer"; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequiredID(PassToPrint); @@ -51,6 +53,8 @@ return false; } + virtual const char *getPassName() const { return "FunctionPass Printer"; } + virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequiredID(PassToPrint); AU.setPreservesAll(); @@ -69,6 +73,8 @@ // Get and print pass... return false; } + + virtual const char *getPassName() const { return "BasicBlockPass Printer"; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequiredID(PassToPrint); From lattner at cs.uiuc.edu Wed Nov 6 00:17:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 00:17:04 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp BottomUpClosure.cpp Message-ID: <200211060616.AAA06105@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: TopDownClosure.cpp updated: 1.17 -> 1.18 BottomUpClosure.cpp updated: 1.30 -> 1.31 --- Log message: Delete "StripScalars" argument to cloneInto method --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.17 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.18 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.17 Tue Oct 22 11:01:03 2002 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Wed Nov 6 00:16:30 2002 @@ -176,7 +176,6 @@ // Strip scalars but not allocas since they are alive in callee. // DSNodeHandle RetVal = Graph->cloneInto(CG, OldValMap, OldNodeMap, - /*StripScalars*/ true, /*StripAllocas*/ false); ResolveCallSite(*Graph, DSCallSite(CallSiteInCG, OldNodeMap)); } Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.30 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.31 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.30 Sun Nov 3 20:29:15 2002 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Wed Nov 6 00:16:30 2002 @@ -160,7 +160,6 @@ // The clone call may invalidate any of the vectors in the data // structure graph. Strip locals and don't copy the list of callers DSNodeHandle RetVal = Graph->cloneInto(GI, OldValMap, OldNodeMap, - /*StripScalars*/ true, /*StripAllocas*/ true); // Resolve the arguments in the call to the actual values... From lattner at cs.uiuc.edu Wed Nov 6 00:20:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 00:20:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200211060619.AAA06121@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.25 -> 1.26 --- Log message: Remove stripscalars argument to cloneInto --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.25 llvm/include/llvm/Analysis/DSGraph.h:1.26 --- llvm/include/llvm/Analysis/DSGraph.h:1.25 Sun Nov 3 15:27:46 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Wed Nov 6 00:18:56 2002 @@ -127,7 +127,7 @@ DSNodeHandle cloneInto(const DSGraph &G, std::map &OldValMap, std::map &OldNodeMap, - bool StripScalars = false, bool StripAllocas = false); + bool StripAllocas = false); #if 0 // cloneGlobalInto - Clone the given global node (or the node for the given From lattner at cs.uiuc.edu Wed Nov 6 00:21:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 00:21:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Local.cpp Printer.cpp Message-ID: <200211060620.AAA06141@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.42 -> 1.43 Local.cpp updated: 1.27 -> 1.28 Printer.cpp updated: 1.32 -> 1.33 --- Log message: Dramatically simplify internal DSNode representation, get implementation *FULLY OPERATIONAL* and safe. We are now capable of completely analyzing at LEAST the Olden benchmarks + 181.mcf --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.42 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.43 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.42 Mon Nov 4 18:01:58 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Wed Nov 6 00:20:09 2002 @@ -16,6 +16,15 @@ using std::vector; +namespace { + Statistic<> NumFolds("dsnode", "Number of nodes completely folded"); +}; + +namespace DS { + const unsigned PointerShift = 3; // 64bit ptrs = 3, 32 bit ptrs = 2 + const unsigned PointerSize = 1 << PointerShift; +}; + namespace DataStructureAnalysis { // TODO: FIXME // isPointerType - Return true if this first class type is big enough to hold // a pointer. @@ -29,15 +38,16 @@ // DSNode Implementation //===----------------------------------------------------------------------===// -DSNode::DSNode(enum NodeTy NT, const Type *T) : NodeType(NT) { +DSNode::DSNode(enum NodeTy NT, const Type *T) + : Ty(Type::VoidTy), Size(0), NodeType(NT) { // Add the type entry if it is specified... - if (T) getTypeRec(T, 0); + if (T) mergeTypeInfo(T, 0); } // DSNode copy constructor... do not copy over the referrers list! DSNode::DSNode(const DSNode &N) - : Links(N.Links), MergeMap(N.MergeMap), - TypeEntries(N.TypeEntries), Globals(N.Globals), NodeType(N.NodeType) { + : Links(N.Links), Globals(N.Globals), Ty(N.Ty), Size(N.Size), + NodeType(N.NodeType) { } void DSNode::removeReferrer(DSNodeHandle *H) { @@ -70,229 +80,234 @@ /// single byte with a single TypeEntry of "void". /// void DSNode::foldNodeCompletely() { + if (isNodeCompletelyFolded()) return; + + ++NumFolds; + // We are no longer typed at all... - TypeEntries.clear(); - TypeEntries.push_back(DSTypeRec(Type::VoidTy, 0)); + Ty = DSTypeRec(Type::VoidTy, true); + Size = 1; - // Loop over all of our referrers, making them point to our one byte of space. + // 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) (*I)->setOffset(0); - // Fold the MergeMap down to a single byte of space... - MergeMap.resize(1); - // If we have links, merge all of our outgoing links together... - if (!Links.empty()) { - MergeMap[0] = 0; // We now contain an outgoing edge... - for (unsigned i = 1, e = Links.size(); i != e; ++i) - Links[0].mergeWith(Links[i]); - Links.resize(1); - } else { - MergeMap[0] = -1; - } + for (unsigned i = 1, e = Links.size(); i < e; ++i) + Links[0].mergeWith(Links[i]); + Links.resize(1); } - /// isNodeCompletelyFolded - Return true if this node has been completely /// folded down to something that can never be expanded, effectively losing /// all of the field sensitivity that may be present in the node. /// bool DSNode::isNodeCompletelyFolded() const { - return getSize() == 1 && TypeEntries.size() == 1 && - TypeEntries[0].Ty == Type::VoidTy; + return getSize() == 1 && Ty.Ty == Type::VoidTy && Ty.isArray; } - -/// setLink - Set the link at the specified offset to the specified -/// NodeHandle, replacing what was there. It is uncommon to use this method, -/// instead one of the higher level methods should be used, below. +/// mergeTypeInfo - This method merges the specified type into the current node +/// at the specified offset. This may update the current node's type record if +/// this gives more information to the node, it may do nothing to the node if +/// this information is already known, or it may merge the node completely (and +/// return true) if the information is incompatible with what is already known. /// -void DSNode::setLink(unsigned i, const DSNodeHandle &NH) { - // Create a new entry in the Links vector to hold a new element for offset. - if (!hasLink(i)) { - signed char NewIdx = Links.size(); - // Check to see if we allocate more than 128 distinct links for this node. - // If so, just merge with the last one. This really shouldn't ever happen, - // but it should work regardless of whether it does or not. +/// This method returns true if the node is completely folded, otherwise false. +/// +bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset) { + // Check to make sure the Size member is up-to-date. Size can be one of the + // following: + // Size = 0, Ty = Void: Nothing is known about this node. + // Size = 0, Ty = FnTy: FunctionPtr doesn't have a size, so we use zero + // Size = 1, Ty = Void, Array = 1: The node is collapsed + // Otherwise, sizeof(Ty) = Size + // + assert(((Size == 0 && Ty.Ty == Type::VoidTy && !Ty.isArray) || + (Size == 0 && !Ty.Ty->isSized() && !Ty.isArray) || + (Size == 1 && Ty.Ty == Type::VoidTy && Ty.isArray) || + (Size == 0 && !Ty.Ty->isSized() && !Ty.isArray) || + (TD.getTypeSize(Ty.Ty) == Size)) && + "Size member of DSNode doesn't match the type structure!"); + assert(NewTy != Type::VoidTy && "Cannot merge void type into DSNode!"); + + if (Offset == 0 && NewTy == Ty.Ty) + return false; // This should be a common case, handle it efficiently + + // Return true immediately if the node is completely folded. + if (isNodeCompletelyFolded()) return true; + + // Figure out how big the new type we're merging in is... + unsigned NewTySize = NewTy->isSized() ? TD.getTypeSize(NewTy) : 0; + + // Otherwise check to see if we can fold this type into the current node. If + // we can't, we fold the node completely, if we can, we potentially update our + // internal state. + // + if (Ty.Ty == Type::VoidTy) { + // If this is the first type that this node has seen, just accept it without + // question.... + assert(Offset == 0 && "Cannot have an offset into a void node!"); + assert(Ty.isArray == false && "This shouldn't happen!"); + Ty.Ty = NewTy; + Size = NewTySize; + + // Calculate the number of outgoing links from this node. + Links.resize((Size+DS::PointerSize-1) >> DS::PointerShift); + return false; + } + + // Handle node expansion case here... + if (Offset+NewTySize > Size) { + // It is illegal to grow this node if we have treated it as an array of + // objects... + if (Ty.isArray) { + foldNodeCompletely(); + return true; + } + + if (Offset) { // We could handle this case, but we don't for now... + std::cerr << "UNIMP: Trying to merge a growth type into offset != 0: " + << "Collapsing!\n"; + foldNodeCompletely(); + return true; + } + + // Okay, the situation is nice and simple, we are trying to merge a type in + // at offset 0 that is bigger than our current type. Implement this by + // switching to the new type and then merge in the smaller one, which should + // hit the other code path here. If the other code path decides it's not + // ok, it will collapse the node as appropriate. // - if (NewIdx >= 0) { - Links.push_back(NH); // Allocate space: common case - } else { // Wrap around? Too many links? - NewIdx--; // Merge with whatever happened last - assert(NewIdx > 0 && "Should wrap back around"); - std::cerr << "\n*** DSNode found that requires more than 128 " - << "active links at once!\n\n"; - } - - signed char OldIdx = MergeMap[i]; - assert (OldIdx < 0 && "Shouldn't contain link!"); - - // Make sure that anything aliasing this field gets updated to point to the - // new link field. - rewriteMergeMap(OldIdx, NewIdx); - assert(MergeMap[i] == NewIdx && "Field not replaced!"); - } else { - assert(MergeMap[i] < (int)Links.size() && "MergeMap index out of range!"); - Links[MergeMap[i]] = NH; - } -} + const Type *OldTy = Ty.Ty; + Ty.Ty = NewTy; + Size = NewTySize; -// addEdgeTo - Add an edge from the current node to the specified node. This -// can cause merging of nodes in the graph. -// -void DSNode::addEdgeTo(unsigned Offset, const DSNodeHandle &NH) { - assert(Offset < getSize() && "Offset out of range!"); - if (NH.getNode() == 0) return; // Nothing to do + // Must grow links to be the appropriate size... + Links.resize((Size+DS::PointerSize-1) >> DS::PointerShift); - if (DSNodeHandle *ExistingNH = getLink(Offset)) { - // Merge the two nodes... - ExistingNH->mergeWith(NH); - } else { // No merging to perform... - setLink(Offset, NH); // Just force a link in there... + // Merge in the old type now... which is guaranteed to be smaller than the + // "current" type. + return mergeTypeInfo(OldTy, 0); } -} -/// getTypeRec - This method returns the specified type record if it exists. -/// If it does not yet exist, the method checks to see whether or not the -/// request would result in an untrackable state. If adding it would cause -/// untrackable state, we foldNodeCompletely the node and return the void -/// record, otherwise we add an new TypeEntry and return it. -/// -DSTypeRec &DSNode::getTypeRec(const Type *Ty, unsigned Offset) { - // If the node is already collapsed, we can't do anything... bail out early - if (isNodeCompletelyFolded()) { - assert(TypeEntries.size() == 1 && "Node folded and Entries.size() != 1?"); - return TypeEntries[0]; + assert(Offset < Size && + "Cannot merge something into a part of our type that doesn't exist!"); + + // Find the section of Ty.Ty that NewTy overlaps with... first we find the + // type that starts at offset Offset. + // + unsigned O = 0; + const Type *SubType = Ty.Ty; + while (O < Offset) { + assert(Offset-O < TD.getTypeSize(SubType) && "Offset out of range!"); + + switch (SubType->getPrimitiveID()) { + case Type::StructTyID: { + const StructType *STy = cast(SubType); + const StructLayout &SL = *TD.getStructLayout(STy); + + unsigned i = 0, e = SL.MemberOffsets.size(); + for (; i+1 < e && SL.MemberOffsets[i+1] <= Offset-O; ++i) + /* empty */; + + // The offset we are looking for must be in the i'th element... + SubType = STy->getElementTypes()[i]; + O += SL.MemberOffsets[i]; + break; + } + case Type::ArrayTyID: { + SubType = cast(SubType)->getElementType(); + unsigned ElSize = TD.getTypeSize(SubType); + unsigned Remainder = (Offset-O) % ElSize; + O = Offset-Remainder; + break; + } + default: + assert(0 && "Unknown type!"); + } } - // First search to see if we already have a record for this... - DSTypeRec SearchFor(Ty, Offset); + assert(O == Offset && "Could not achieve the correct offset!"); - std::vector::iterator I; - if (TypeEntries.size() < 5) { // Linear search if we have few entries. - I = TypeEntries.begin(); - while (I != TypeEntries.end() && *I < SearchFor) - ++I; - } else { - I = std::lower_bound(TypeEntries.begin(), TypeEntries.end(), SearchFor); - } - - // At this point, I either points to the right entry or it points to the entry - // we are to insert the new entry in front of... - // - if (I != TypeEntries.end() && *I == SearchFor) - return *I; - - // ASSUME that it's okay to add this type entry. - // FIXME: This should check to make sure it's ok. - - // If the data size is different then our current size, try to resize the node - unsigned ReqSize = Ty->isSized() ? TD.getTypeSize(Ty) : 0; - if (getSize() < ReqSize) { - // If we are trying to make it bigger, and we can grow the node, do so. - if (growNode(ReqSize)) { - assert(isNodeCompletelyFolded() && "Node isn't folded?"); - return TypeEntries[0]; - } + // If we found our type exactly, early exit + if (SubType == NewTy) return false; - } else if (getSize() > ReqSize) { - // If we are trying to make the node smaller, we don't have to do anything. + // Okay, so we found the leader type at the offset requested. Search the list + // of types that starts at this offset. If SubType is currently an array or + // structure, the type desired may actually be the first element of the + // composite type... + // + unsigned SubTypeSize = TD.getTypeSize(SubType); + while (SubType != NewTy) { + const Type *NextSubType = 0; + unsigned NextSubTypeSize; + switch (SubType->getPrimitiveID()) { + case Type::StructTyID: + NextSubType = cast(SubType)->getElementTypes()[0]; + NextSubTypeSize = TD.getTypeSize(SubType); + break; + case Type::ArrayTyID: + NextSubType = cast(SubType)->getElementType(); + NextSubTypeSize = TD.getTypeSize(SubType); + break; + default: ; + // fall out + } - } + if (NextSubType == 0) + break; // In the default case, break out of the loop - return *TypeEntries.insert(I, SearchFor); -} + if (NextSubTypeSize < NewTySize) + break; // Don't allow shrinking to a smaller type than NewTySize + SubType = NextSubType; + SubTypeSize = NextSubTypeSize; + } + + // If we found the type exactly, return it... + if (SubType == NewTy) + return false; + + // Check to see if we have a compatible, but different type... + if (NewTySize == SubTypeSize) { + // Check to see if this type is obviously convertable... int -> uint f.e. + if (NewTy->isLosslesslyConvertableTo(SubType)) + return false; -/// growNode - Attempt to grow the node to the specified size. This may do one -/// of three things: -/// 1. Grow the node, return false -/// 2. Refuse to grow the node, but maintain a trackable situation, return -/// false. -/// 3. Be unable to track if node was that size, so collapse the node and -/// return true. -/// -bool DSNode::growNode(unsigned ReqSize) { - unsigned OldSize = getSize(); + // Check to see if we have a pointer & integer mismatch going on here, + // loading a pointer as a long, for example. + // + if (SubType->isInteger() && isa(NewTy) || + NewTy->isInteger() && isa(SubType)) + return false; - if (0) { - // FIXME: DSNode::growNode() doesn't perform correct safety checks yet! - - foldNodeCompletely(); - return true; } - assert(ReqSize > OldSize && "Not growing node!"); - // Resize the merge map to have enough space... - MergeMap.resize(ReqSize); - // Assign unique values to all of the elements of MergeMap - if (ReqSize < 128) { - // Handle the common case of reasonable size structures... - for (unsigned i = OldSize; i != ReqSize; ++i) - MergeMap[i] = -1-i; // Assign -1, -2, -3, ... - } else { - // It's possible that we have something really big here. In this case, - // divide the object into chunks until it will fit into 128 elements. - unsigned Multiple = ReqSize/128; - - // It's probably an array, and probably some power of two in size. - // Because of this, find the biggest power of two that is bigger than - // multiple to use as our real Multiple. - unsigned RealMultiple = 2; - while (RealMultiple <= Multiple) RealMultiple <<= 1; - - unsigned RealBound = ReqSize/RealMultiple; - assert(RealBound <= 128 && "Math didn't work out right"); - - // Now go through and assign indexes that are between -1 and -128 - // inclusive - // - for (unsigned i = OldSize; i != ReqSize; ++i) - MergeMap[i] = -1-(i % RealBound); // Assign -1, -2, -3... - } - return false; + std::cerr << "MergeTypeInfo Folding OrigTy: " << Ty.Ty + << "\n due to:" << NewTy << " @ " << Offset << "!\n"; + std::cerr << "SubType: " << SubType << "\n\n"; + + foldNodeCompletely(); + return true; } -/// mergeMappedValues - This is the higher level form of rewriteMergeMap. It is -/// fully capable of merging links together if neccesary as well as simply -/// rewriting the map entries. -/// -void DSNode::mergeMappedValues(signed char V1, signed char V2) { - assert(V1 != V2 && "Cannot merge two identical mapped values!"); - assert(V2 < (int)Links.size() && - "Attempting to rewrite to invalid link number!"); - assert(V1 < (int)Links.size() && - "Attempting to rewrite to invalid link number!"); - - if (V1 < 0) { // If there is no outgoing link from V1, merge it with V2 - if (V2 < 0 && V1 > V2) - // If both are not linked, merge to the field closer to 0 - rewriteMergeMap(V2, V1); - else - rewriteMergeMap(V1, V2); - } else if (V2 < 0) { // Is V2 < 0 && V1 >= 0? - rewriteMergeMap(V2, V1); // Merge into the one with the link... - } else { // Otherwise, links exist at both locations - // Merge the V2 link into V1 so that we reduce the overall value of the - // links are reduced... - // - if (V2 < V1) std::swap(V1, V2); // Ensure V1 < V2 - rewriteMergeMap(V2, V1); // After this, V2 is "dead" - // Merge Links[V1] with Links[V2] so they point to the same place now... - Links[V1].mergeWith(Links[V2]); // BROKEN, this can invalidate V2!! - // Change the user of the last link to use V2 instead - if ((unsigned)V2 != Links.size()-1) { - rewriteMergeMap(Links.size()-1, V2); // Point to V2 instead of last el... - // Make sure V2 points the right DSNode - Links[V2] = Links.back(); - } +// addEdgeTo - Add an edge from the current node to the specified node. This +// can cause merging of nodes in the graph. +// +void DSNode::addEdgeTo(unsigned Offset, const DSNodeHandle &NH) { + if (NH.getNode() == 0) return; // Nothing to do - // Reduce the number of distinct outgoing links... - Links.pop_back(); + DSNodeHandle &ExistingEdge = getLink(Offset); + if (ExistingEdge.getNode()) { + // Merge the two nodes... + ExistingEdge.mergeWith(NH); + } else { // No merging to perform... + setLink(Offset, NH); // Just force a link in there... } } @@ -354,11 +369,17 @@ return; // Noop if (N == this) { - std::cerr << "WARNING: Cannot merge two portions of the same node yet, so we collapse instead!\n"; - N->foldNodeCompletely(); + // We cannot merge two pieces of the same node together, collapse the node + // completely. + std::cerr << "Attempting to merge two chunks of the same node together!\n"; + foldNodeCompletely(); return; } + // Merge the type entries of the two nodes together... + if (N->Ty.Ty != Type::VoidTy) + mergeTypeInfo(N->Ty.Ty, Offset); + // If we are merging a node with a completely folded node, then both nodes are // now completely folded. // @@ -396,15 +417,6 @@ // respect to NH.Offset) is now zero. // unsigned NOffset = NH.getOffset()-Offset; - - // If our destination node is too small... try to grow it. - if (N->getSize()+NOffset > getSize() && - growNode(N->getSize()+NOffset)) { - // Catastrophic failure occured and we had to collapse the node. In this - // case, collapse the other node as well. - N->foldNodeCompletely(); - NOffset = 0; - } unsigned NSize = N->getSize(); // Remove all edges pointing at N, causing them to point to 'this' instead. @@ -418,71 +430,29 @@ // Make all of the outgoing links of N now be outgoing links of this. This // can cause recursive merging! // - for (unsigned i = 0, e = NSize; i != e; ++i) - if (DSNodeHandle *Link = N->getLink(i)) { - addEdgeTo((i+NOffset) % getSize(), *Link); - N->MergeMap[i] = -1; // Kill outgoing edge - } - -#if 0 - // We must merge fields in this node due to nodes merged in the source node. - // In order to handle this we build a map that converts from the source node's - // MergeMap values to our MergeMap values. This map is indexed by the - // expression: MergeMap[SMM+SourceNodeSize] so we need to allocate at least - // 2*SourceNodeSize elements of space for the mapping. We can do this because - // we know that there are at most SourceNodeSize outgoing links in the node - // (thus that many positive values) and at most SourceNodeSize distinct fields - // (thus that many negative values). - // - std::vector MergeMapMap(NSize*2, 127); - - // Loop through the structures, merging them together... - for (unsigned i = 0, e = NSize; i != e; ++i) { - // Get what this byte of N maps to... - signed char NElement = N->MergeMap[i]; - - // Get what we map this byte to... - signed char Element = MergeMap[i+NOffset]; - assert(Element < (int)Links.size() && "Element in merge map out of range!"); - - // We use 127 as a sentinal and don't check for it's existence yet... - assert(Element != 127 && "MergeMapMap doesn't permit 127 values yet!"); - - signed char CurMappedVal = MergeMapMap[NElement+NSize]; - if (CurMappedVal == 127) { // Haven't seen this NElement yet? - MergeMapMap[NElement+NSize] = Element; // Map the two together... - } else if (CurMappedVal != Element) { - // If we are mapping two different fields together this means that we need - // to merge fields in the current node due to merging in the source node. + for (unsigned i = 0; i < NSize; i += DS::PointerSize) { + DSNodeHandle &Link = N->getLink(i); + if (Link.getNode()) { + addEdgeTo((i+NOffset) % getSize(), Link); + + // It's possible that after adding the new edge that some recursive + // merging just occured, causing THIS node to get merged into oblivion. + // If that happens, we must not try to merge any more edges into it! // - mergeMappedValues(CurMappedVal, Element); - MergeMapMap[NElement+NSize] = MergeMap[i+NOffset]; - assert(MergeMap[i+NOffset] < (int)Links.size() - && "Element in merge map out of range!"); + if (Size == 0) return; } } -#endif // Now that there are no outgoing edges, all of the Links are dead. N->Links.clear(); - N->MergeMap.clear(); + N->Size = 0; + N->Ty.Ty = Type::VoidTy; + N->Ty.isArray = false; // Merge the node types NodeType |= N->NodeType; N->NodeType = 0; // N is now a dead node. - // Adjust all of the type entries we are merging in by the offset... - // - if (NOffset != 0) { // This case is common enough to optimize for - // Offset all of the TypeEntries in N with their new offset - for (unsigned i = 0, e = N->TypeEntries.size(); i != e; ++i) - N->TypeEntries[i].Offset += NOffset; - } - - // ... now add them to the TypeEntries list. - MergeSortedVectors(TypeEntries, N->TypeEntries); - N->TypeEntries.clear(); // N is dead, no type-entries need exist - // Merge the globals list... if (!N->Globals.empty()) { MergeSortedVectors(Globals, N->Globals); @@ -564,7 +534,6 @@ DSNodeHandle DSGraph::cloneInto(const DSGraph &G, std::map &OldValMap, std::map &OldNodeMap, - bool StripScalars, // FIXME: Kill StripScalars bool StripAllocas) { assert(OldNodeMap.empty() && "Returned OldNodeMap should be empty!"); @@ -655,9 +624,9 @@ N->NodeType |= DSNode::Incomplete; // Recusively process children... - for (unsigned i = 0, e = N->getSize(); i != e; ++i) - if (DSNodeHandle *DSNH = N->getLink(i)) - markIncompleteNode(DSNH->getNode()); + for (unsigned i = 0, e = N->getSize(); i < e; i += DS::PointerSize) + if (DSNode *DSN = N->getLink(i).getNode()) + markIncompleteNode(DSN); } @@ -694,9 +663,9 @@ if (Nodes[i]->NodeType & DSNode::GlobalNode) { DSNode *N = Nodes[i]; // FIXME: Make more efficient by looking over Links directly - for (unsigned i = 0, e = N->getSize(); i != e; ++i) - if (DSNodeHandle *DSNH = N->getLink(i)) - markIncompleteNode(DSNH->getNode()); + for (unsigned i = 0, e = N->getSize(); i < e; i += DS::PointerSize) + if (DSNode *DSN = N->getLink(i).getNode()) + markIncompleteNode(DSN); } } @@ -772,11 +741,10 @@ if (N == 0) return; Alive.insert(N); - // FIXME: Make more efficient by looking over Links directly - for (unsigned i = 0, e = N->getSize(); i != e; ++i) - if (DSNodeHandle *DSNH = N->getLink(i)) - if (!Alive.count(DSNH->getNode())) - markAlive(DSNH->getNode(), Alive); + for (unsigned i = 0, e = N->getSize(); i < e; i += DS::PointerSize) + if (DSNode *DSN = N->getLink(i).getNode()) + if (!Alive.count(DSN)) + markAlive(DSN, Alive); } static bool checkGlobalAlive(DSNode *N, std::set &Alive, @@ -787,17 +755,17 @@ Visiting.insert(N); // If any immediate successor is alive, N is alive - for (unsigned i = 0, e = N->getSize(); i != e; ++i) - if (DSNodeHandle *DSNH = N->getLink(i)) - if (Alive.count(DSNH->getNode())) { + for (unsigned i = 0, e = N->getSize(); i < e; i += DS::PointerSize) + if (DSNode *DSN = N->getLink(i).getNode()) + if (Alive.count(DSN)) { Visiting.erase(N); return true; } // Else if any successor reaches a live node, N is alive - for (unsigned i = 0, e = N->getSize(); i != e; ++i) - if (DSNodeHandle *DSNH = N->getLink(i)) - if (checkGlobalAlive(DSNH->getNode(), Alive, Visiting)) { + for (unsigned i = 0, e = N->getSize(); i < e; i += DS::PointerSize) + if (DSNode *DSN = N->getLink(i).getNode()) + if (checkGlobalAlive(DSN, Alive, Visiting)) { Visiting.erase(N); return true; } Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.27 llvm/lib/Analysis/DataStructure/Local.cpp:1.28 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.27 Sun Nov 3 15:27:48 2002 +++ llvm/lib/Analysis/DataStructure/Local.cpp Wed Nov 6 00:20:09 2002 @@ -184,13 +184,12 @@ /// DSNodeHandle &GraphBuilder::getLink(const DSNodeHandle &node, unsigned LinkNo) { DSNodeHandle &Node = const_cast(node); - DSNodeHandle *Link = Node.getLink(LinkNo); - if (Link) return *Link; - - // If the link hasn't been created yet, make and return a new shadow node - DSNode *N = createNode(DSNode::ShadowNode); - Node.setLink(LinkNo, N); - return *Node.getLink(LinkNo); + DSNodeHandle &Link = Node.getLink(LinkNo); + if (!Link.getNode()) { + // If the link hasn't been created yet, make and return a new shadow node + Link = createNode(DSNode::ShadowNode); + } + return Link; } @@ -236,15 +235,14 @@ unsigned Offset = 0; const PointerType *PTy = cast(GEP.getOperand(0)->getType()); const Type *CurTy = PTy->getElementType(); - DSTypeRec &TopTypeRec = - Value.getNode()->getTypeRec(PTy->getElementType(), Value.getOffset()); - // If the node had to be folded... exit quickly - if (TopTypeRec.Ty == Type::VoidTy) { + if (Value.getNode()->mergeTypeInfo(CurTy, Value.getOffset())) { + // If the node had to be folded... exit quickly setDestTo(GEP, Value); // GEP result points to folded node return; } +#if 0 // Handle the pointer index specially... if (GEP.getNumOperands() > 1 && GEP.getOperand(1) != ConstantSInt::getNullValue(Type::LongTy)) { @@ -269,6 +267,7 @@ } } } +#endif // All of these subscripts are indexing INTO the elements we have... for (unsigned i = 2, e = GEP.getNumOperands(); i < e; ++i) @@ -276,6 +275,7 @@ // Get the type indexing into... const SequentialType *STy = cast(CurTy); CurTy = STy->getElementType(); +#if 0 if (ConstantSInt *CS = dyn_cast(GEP.getOperand(i))) { Offset += CS->getValue()*TD.getTypeSize(CurTy); } else { @@ -298,6 +298,7 @@ N->mergeIndexes(RawOffset+j, RawOffset+i*ElSize+j); } } +#endif } else if (GEP.getOperand(i)->getType() == Type::UByteTy) { unsigned FieldNo = cast(GEP.getOperand(i))->getValue(); const StructType *STy = cast(CurTy); @@ -320,7 +321,7 @@ Ptr.getNode()->NodeType |= DSNode::Read; // Ensure a typerecord exists... - Ptr.getNode()->getTypeRec(LI.getType(), Ptr.getOffset()); + Ptr.getNode()->mergeTypeInfo(LI.getType(), Ptr.getOffset()); if (isPointerType(LI.getType())) setDestTo(LI, getLink(Ptr)); @@ -335,7 +336,7 @@ Dest.getNode()->NodeType |= DSNode::Modified; // Ensure a typerecord exists... - Dest.getNode()->getTypeRec(StoredTy, Dest.getOffset()); + Dest.getNode()->mergeTypeInfo(StoredTy, Dest.getOffset()); // Avoid adding edges from null, or processing non-"pointer" stores if (isPointerType(StoredTy)) Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.32 llvm/lib/Analysis/DataStructure/Printer.cpp:1.33 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.32 Sun Nov 3 15:27:48 2002 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Wed Nov 6 00:20:09 2002 @@ -27,23 +27,25 @@ std::stringstream OS; Module *M = G && &G->getFunction() ? G->getFunction().getParent() : 0; - for (unsigned i = 0, e = N->getTypeEntries().size(); i != e; ++i) { - WriteTypeSymbolic(OS, N->getTypeEntries()[i].Ty, M); - if (N->getTypeEntries()[i].Offset) - OS << "@" << N->getTypeEntries()[i].Offset; - if (N->getTypeEntries()[i].isArray) + if (N->isNodeCompletelyFolded()) + OS << "FOLDED"; + else { + WriteTypeSymbolic(OS, N->getType().Ty, M); + if (N->getType().isArray) OS << " array"; + } + if (N->NodeType) { + OS << ": "; + if (N->NodeType & DSNode::AllocaNode ) OS << "S"; + if (N->NodeType & DSNode::HeapNode ) OS << "H"; + if (N->NodeType & DSNode::GlobalNode ) OS << "G"; + if (N->NodeType & DSNode::UnknownNode) OS << "U"; + if (N->NodeType & DSNode::Incomplete ) OS << "I"; + if (N->NodeType & DSNode::Modified ) OS << "M"; + if (N->NodeType & DSNode::Read ) OS << "R"; OS << "\n"; } - if (N->NodeType & DSNode::AllocaNode ) OS << "S"; - if (N->NodeType & DSNode::HeapNode ) OS << "H"; - if (N->NodeType & DSNode::GlobalNode ) OS << "G"; - if (N->NodeType & DSNode::UnknownNode) OS << "U"; - if (N->NodeType & DSNode::Incomplete ) OS << "I"; - if (N->NodeType & DSNode::Modified ) OS << "M"; - if (N->NodeType & DSNode::Read ) OS << "R"; - for (unsigned i = 0, e = N->getGlobals().size(); i != e; ++i) { WriteAsOperand(OS, N->getGlobals()[i], false, true, M); OS << "\n"; @@ -75,11 +77,6 @@ return "shape=Mrecord";//fontname=Courier"; } - static int getEdgeSourceLabel(const DSNode *Node, DSNode::iterator I) { - assert(Node == I.getNode() && "Iterator not for this node!"); - return Node->getMergeMapLabel(I.getOffset()); - } - /// addCustomGraphFeatures - Use this graph writing hook to emit call nodes /// and the return node. /// @@ -95,7 +92,7 @@ GW.emitSimpleNode(I->first, "plaintext=circle", OS.str()); // Add edge from return node to real destination - int EdgeDest = I->second.getOffset(); + int EdgeDest = I->second.getOffset() >> DS::PointerShift; if (EdgeDest == 0) EdgeDest = -1; GW.emitEdge(I->first, -1, I->second.getNode(), EdgeDest, "arrowtail=tee,color=gray63"); @@ -108,7 +105,7 @@ GW.emitSimpleNode((void*)1, "plaintext=circle", "returning"); // Add edge from return node to real destination - int RetEdgeDest = G->getRetNode().getOffset(); + int RetEdgeDest = G->getRetNode().getOffset() >> DS::PointerShift;; if (RetEdgeDest == 0) RetEdgeDest = -1; GW.emitEdge((void*)1, -1, G->getRetNode().getNode(), RetEdgeDest, "arrowtail=tee,color=gray63"); @@ -121,18 +118,18 @@ GW.emitSimpleNode(&Call, "shape=record", "call", Call.getNumPtrArgs()+2); if (DSNode *N = Call.getRetVal().getNode()) { - int EdgeDest = Call.getRetVal().getOffset(); + int EdgeDest = Call.getRetVal().getOffset() >> DS::PointerShift; if (EdgeDest == 0) EdgeDest = -1; GW.emitEdge(&Call, 0, N, EdgeDest, "color=gray63"); } if (DSNode *N = Call.getCallee().getNode()) { - int EdgeDest = Call.getCallee().getOffset(); + int EdgeDest = Call.getCallee().getOffset() >> DS::PointerShift; if (EdgeDest == 0) EdgeDest = -1; GW.emitEdge(&Call, 1, N, EdgeDest, "color=gray63"); } for (unsigned j = 0, e = Call.getNumPtrArgs(); j != e; ++j) if (DSNode *N = Call.getPtrArg(j).getNode()) { - int EdgeDest = Call.getPtrArg(j).getOffset(); + int EdgeDest = Call.getPtrArg(j).getOffset() >> DS::PointerShift; if (EdgeDest == 0) EdgeDest = -1; GW.emitEdge(&Call, j+2, N, EdgeDest, "color=gray63"); } From lattner at cs.uiuc.edu Wed Nov 6 00:21:03 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 00:21:03 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraphTraits.h DSNode.h DSSupport.h Message-ID: <200211060620.AAA06158@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraphTraits.h updated: 1.9 -> 1.10 DSNode.h updated: 1.7 -> 1.8 DSSupport.h updated: 1.2 -> 1.3 --- Log message: Dramatically simplify internal DSNode representation, get implementation *FULLY OPERATIONAL* and safe. We are now capable of completely analyzing at LEAST the Olden benchmarks + 181.mcf --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraphTraits.h diff -u llvm/include/llvm/Analysis/DSGraphTraits.h:1.9 llvm/include/llvm/Analysis/DSGraphTraits.h:1.10 --- llvm/include/llvm/Analysis/DSGraphTraits.h:1.9 Wed Oct 16 20:01:06 2002 +++ llvm/include/llvm/Analysis/DSGraphTraits.h Wed Nov 6 00:20:27 2002 @@ -23,7 +23,9 @@ DSNodeIterator(const DSNode *N) : Node(N), Offset(0) {} // begin iterator DSNodeIterator(const DSNode *N, bool) // Create end iterator - : Node(N), Offset(N->getSize()) { + : Node(N) { + Offset = (N->getSize()+((1 << DS::PointerShift)-1)) & + ~((1 << DS::PointerShift)-1); } public: DSNodeIterator(const DSNodeHandle &NH) @@ -41,13 +43,12 @@ } pointer operator*() const { - const DSNodeHandle *NH = Node->getLink(Offset); - return NH ? NH->getNode() : 0; + return Node->getLink(Offset).getNode(); } pointer operator->() const { return operator*(); } _Self& operator++() { // Preincrement - ++Offset; + Offset += (1 << DS::PointerShift); return *this; } _Self operator++(int) { // Postincrement Index: llvm/include/llvm/Analysis/DSNode.h diff -u llvm/include/llvm/Analysis/DSNode.h:1.7 llvm/include/llvm/Analysis/DSNode.h:1.8 --- llvm/include/llvm/Analysis/DSNode.h:1.7 Mon Nov 4 17:59:41 2002 +++ llvm/include/llvm/Analysis/DSNode.h Wed Nov 6 00:20:27 2002 @@ -17,47 +17,34 @@ /// different types represented in this object. /// class DSNode { - /// Links - Contains one entry for every _distinct_ pointer field in the - /// memory block. These are demand allocated and indexed by the MergeMap - /// vector. - /// - std::vector Links; - - /// MergeMap - Maps from every byte in the object to a signed byte number. - /// This map is neccesary due to the merging that is possible as part of the - /// unification algorithm. To merge two distinct bytes of the object together - /// into a single logical byte, the indexes for the two bytes are set to the - /// same value. This fully general merging is capable of representing all - /// manners of array merging if neccesary. - /// - /// This map is also used to map outgoing pointers to various byte offsets in - /// this data structure node. If this value is >= 0, then it indicates that - /// the numbered entry in the Links vector contains the outgoing edge for this - /// byte offset. In this way, the Links vector can be demand allocated and - /// byte elements of the node may be merged without needing a Link allocated - /// for it. - /// - /// Initially, each each element of the MergeMap is assigned a unique negative - /// number, which are then merged as the unification occurs. - /// - std::vector MergeMap; - /// Referrers - Keep track of all of the node handles that point to this /// DSNode. These pointers may need to be updated to point to a different /// node if this node gets merged with it. /// std::vector Referrers; - /// TypeEntries - As part of the merging process of this algorithm, nodes of - /// different types can be represented by this single DSNode. This vector is - /// kept sorted. + /// Links - Contains one entry for every sizeof(void*) bytes in this memory + /// object. Note that if the node is not a multiple of size(void*) bytes + /// large, that there is an extra entry for the "remainder" of the node as + /// well. For this reason, nodes of 1 byte in size do have one link. /// - std::vector TypeEntries; + std::vector Links; /// Globals - The list of global values that are merged into this node. /// std::vector Globals; + /// Type - Keep track of the current outer most type of this object, in + /// addition to whether or not it has been indexed like an array or not. If + /// the isArray bit is set, the node cannot grow. + /// + DSTypeRec Ty; + + /// Size - The current size of the node. This should be equal to the size of + /// the current type record. + /// + unsigned Size; + void operator=(const DSNode &); // DO NOT IMPLEMENT public: enum NodeTy { @@ -99,10 +86,10 @@ /// getSize - Return the maximum number of bytes occupied by this object... /// - unsigned getSize() const { return MergeMap.size(); } + unsigned getSize() const { return Size; } - // getTypeEntries - Return the possible types and their offsets in this object - const std::vector &getTypeEntries() const { return TypeEntries; } + // getType - Return the node type of this object... + const DSTypeRec &getType() const { return Ty; } /// getReferrers - Return a list of the pointers to this node... /// @@ -117,51 +104,46 @@ bool isRead() const { return (NodeType & Read) != 0; } - /// hasLink - Return true if this memory object has a link at the specified - /// location. + /// hasLink - Return true if this memory object has a link in slot #LinkNo /// - bool hasLink(unsigned i) const { - assert(i < getSize() && "Field Link index is out of range!"); - return MergeMap[i] >= 0; - } - - DSNodeHandle *getLink(unsigned i) { - if (hasLink(i)) { - assert((unsigned)MergeMap[i] < Links.size() && - "MergeMap references Link that doesn't exist!"); - return &Links[MergeMap[i]]; - } - return 0; - } - const DSNodeHandle *getLink(unsigned i) const { - if (hasLink(i)) { - assert((unsigned)MergeMap[i] < Links.size() && - "MergeMap references Link that doesn't exist!"); - return &Links[MergeMap[i]]; - } - return 0; - } - - /// getMergeMapLabel - Return the merge map entry specified, to allow printing - /// out of DSNodes nicely for DOT graphs. + bool hasLink(unsigned Offset) const { + assert((Offset & ((1 << DS::PointerShift)-1)) == 0 && + "Pointer offset not aligned correctly!"); + unsigned Index = Offset >> DS::PointerShift; + assert(Index < Links.size() && "Link index is out of range!"); + return Links[Index].getNode(); + } + DSNodeHandle &getLink(unsigned Offset) { + assert((Offset & ((1 << DS::PointerShift)-1)) == 0 && + "Pointer offset not aligned correctly!"); + unsigned Index = Offset >> DS::PointerShift; + assert(Index < Links.size() && "Link index is out of range!"); + return Links[Index]; + } + const DSNodeHandle &getLink(unsigned Offset) const { + assert((Offset & ((1 << DS::PointerShift)-1)) == 0 && + "Pointer offset not aligned correctly!"); + unsigned Index = Offset >> DS::PointerShift; + assert(Index < Links.size() && "Link index is out of range!"); + return Links[Index]; + } + + /// mergeTypeInfo - This method merges the specified type into the current + /// node at the specified offset. This may update the current node's type + /// record if this gives more information to the node, it may do nothing to + /// the node if this information is already known, or it may merge the node + /// completely (and return true) if the information is incompatible with what + /// is already known. /// - int getMergeMapLabel(unsigned i) const { - assert(i < MergeMap.size() && "MergeMap index out of range!"); - return MergeMap[i]; - } - - /// getTypeRec - This method returns the specified type record if it exists. - /// If it does not yet exist, the method checks to see whether or not the - /// request would result in an untrackable state. If adding it would cause - /// untrackable state, we foldNodeCompletely the node and return the void - /// record, otherwise we add an new TypeEntry and return it. + /// This method returns true if the node is completely folded, otherwise + /// false. /// - DSTypeRec &getTypeRec(const Type *Ty, unsigned Offset); + bool mergeTypeInfo(const Type *Ty, unsigned Offset); /// foldNodeCompletely - If we determine that this node has some funny /// behavior happening to it that we cannot represent, we fold it down to a /// single, completely pessimistic, node. This node is represented as a - /// single byte with a single TypeEntry of "void". + /// single byte with a single TypeEntry of "void" with isArray = true. /// void foldNodeCompletely(); @@ -175,7 +157,13 @@ /// NodeHandle, replacing what was there. It is uncommon to use this method, /// instead one of the higher level methods should be used, below. /// - void setLink(unsigned i, const DSNodeHandle &NH); + void setLink(unsigned Offset, const DSNodeHandle &NH) { + assert((Offset & ((1 << DS::PointerShift)-1)) == 0 && + "Pointer offset not aligned correctly!"); + unsigned Index = Offset >> DS::PointerShift; + assert(Index < Links.size() && "Link index is out of range!"); + Links[Index] = NH; + } /// addEdgeTo - Add an edge from the current node to the specified node. This /// can cause merging of nodes in the graph. @@ -191,18 +179,6 @@ /// void mergeWith(const DSNodeHandle &NH, unsigned Offset); - /// mergeIndexes - If we discover that two indexes are equivalent and must be - /// merged, this function is used to do the dirty work. - /// - void mergeIndexes(unsigned idx1, unsigned idx2) { - assert(idx1 < getSize() && idx2 < getSize() && "Indexes out of range!"); - signed char MV1 = MergeMap[idx1]; - signed char MV2 = MergeMap[idx2]; - if (MV1 != MV2) - mergeMappedValues(MV1, MV2); - } - - /// addGlobal - Add an entry for a global value to the Globals list. This /// also marks the node with the 'G' flag if it does not already have it. /// @@ -226,34 +202,6 @@ // addReferrer - Keep the referrer set up to date... void addReferrer(DSNodeHandle *H) { Referrers.push_back(H); } void removeReferrer(DSNodeHandle *H); - - /// rewriteMergeMap - Loop over the mergemap, replacing any references to the - /// index From to be references to the index To. - /// - void rewriteMergeMap(signed char From, signed char To) { - assert(From != To && "Cannot change something into itself!"); - assert(To < (int)Links.size() && - "Changing MergeMap entry to an illegal entry!"); - for (unsigned i = 0, e = MergeMap.size(); i != e; ++i) - if (MergeMap[i] == From) - MergeMap[i] = To; - } - - /// mergeMappedValues - This is the higher level form of rewriteMergeMap. It - /// is fully capable of merging links together if neccesary as well as simply - /// rewriting the map entries. - /// - void mergeMappedValues(signed char V1, signed char V2); - - /// growNode - Attempt to grow the node to the specified size. This may do - /// one of three things: - /// 1. Grow the node, return false - /// 2. Refuse to grow the node, but maintain a trackable situation, return - /// false. - /// 3. Be unable to track if node was that size, so collapse the node and - /// return true. - /// - bool growNode(unsigned RequestedSize); }; @@ -276,26 +224,26 @@ /// getLink - Treat this current node pointer as a pointer to a structure of /// some sort. This method will return the pointer a mem[this+Num] /// -inline const DSNodeHandle *DSNodeHandle::getLink(unsigned Num) const { +inline const DSNodeHandle &DSNodeHandle::getLink(unsigned Off) const { assert(N && "DSNodeHandle does not point to a node yet!"); - return N->getLink(Num+Offset); + return N->getLink(Offset+Off); } -inline DSNodeHandle *DSNodeHandle::getLink(unsigned Num) { +inline DSNodeHandle &DSNodeHandle::getLink(unsigned Off) { assert(N && "DSNodeHandle does not point to a node yet!"); - return N->getLink(Num+Offset); + return N->getLink(Off+Offset); } -inline void DSNodeHandle::setLink(unsigned Num, const DSNodeHandle &NH) { +inline void DSNodeHandle::setLink(unsigned Off, const DSNodeHandle &NH) { assert(N && "DSNodeHandle does not point to a node yet!"); - N->setLink(Num+Offset, NH); + N->setLink(Off+Offset, NH); } /// addEdgeTo - Add an edge from the current node to the specified node. This /// can cause merging of nodes in the graph. /// -inline void DSNodeHandle::addEdgeTo(unsigned LinkNo, const DSNodeHandle &Node) { +inline void DSNodeHandle::addEdgeTo(unsigned Off, const DSNodeHandle &Node) { assert(N && "DSNodeHandle does not point to a node yet!"); - N->addEdgeTo(LinkNo+Offset, Node); + N->addEdgeTo(Off+Offset, Node); } /// mergeWith - Merge the logical node pointed to by 'this' with the node @@ -304,9 +252,8 @@ inline void DSNodeHandle::mergeWith(const DSNodeHandle &Node) { if (N != 0) N->mergeWith(Node, Offset); - else { // No node to merge with, so just point to Node + else // No node to merge with, so just point to Node *this = Node; - } } #endif Index: llvm/include/llvm/Analysis/DSSupport.h diff -u llvm/include/llvm/Analysis/DSSupport.h:1.2 llvm/include/llvm/Analysis/DSSupport.h:1.3 --- llvm/include/llvm/Analysis/DSSupport.h:1.2 Sat Nov 2 15:18:53 2002 +++ llvm/include/llvm/Analysis/DSSupport.h Wed Nov 6 00:20:27 2002 @@ -22,6 +22,10 @@ class DSGraph; // A graph for a function class DSNodeIterator; // Data structure graph traversal iterator +namespace DS { + extern const unsigned PointerShift; // 64bit ptrs = 3, 32 bit ptrs = 2 +}; + //===----------------------------------------------------------------------===// /// DSNodeHandle - Implement a "handle" to a data structure node that takes care /// of all of the add/un'refing of the node to prevent the backpointers in the @@ -32,6 +36,7 @@ /// defined in DSNode.h because they need knowledge of DSNode operation. Putting /// them in a CPP file wouldn't help making them inlined and keeping DSNode and /// DSNodeHandle (and friends) in one file complicates things. +/// class DSNodeHandle { DSNode *N; unsigned Offset; @@ -77,8 +82,8 @@ /// getLink - Treat this current node pointer as a pointer to a structure of /// some sort. This method will return the pointer a mem[this+Num] /// - inline const DSNodeHandle *getLink(unsigned Num) const; - inline DSNodeHandle *getLink(unsigned Num); + inline const DSNodeHandle &getLink(unsigned Num) const; + inline DSNodeHandle &getLink(unsigned Num); inline void setLink(unsigned Num, const DSNodeHandle &NH); }; @@ -90,23 +95,11 @@ /// struct DSTypeRec { const Type *Ty; // The type itself... - unsigned Offset; // The offset in the node bool isArray; // Have we accessed an array of elements? - DSTypeRec() : Ty(0), Offset(0), isArray(false) {} - DSTypeRec(const Type *T, unsigned O) : Ty(T), Offset(O), isArray(false) {} - - bool operator<(const DSTypeRec &TR) const { - // Sort first by offset! - return Offset < TR.Offset || (Offset == TR.Offset && Ty < TR.Ty); - } - bool operator==(const DSTypeRec &TR) const { - return Ty == TR.Ty && Offset == TR.Offset; - } - bool operator!=(const DSTypeRec &TR) const { return !operator==(TR); } + DSTypeRec(const Type *T = 0, bool A = false) + : Ty(T), isArray(A) {} }; - - From lattner at cs.uiuc.edu Wed Nov 6 00:22:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 00:22:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/DSAnalysis/badcases.ll goodcases.ll Message-ID: <200211060621.AAA06173@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/DSAnalysis: badcases.ll added (r1.1) goodcases.ll added (r1.1) --- Log message: New testcases --- Diffs of the changes: From lattner at cs.uiuc.edu Wed Nov 6 01:17:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 01:17:01 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Olden-health/list.c Message-ID: <200211060716.BAA12298@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Olden-health: list.c updated: 1.3 -> 1.4 --- Log message: Add a hack to make levelraise DTRT on addList --- Diffs of the changes: Index: llvm/test/Programs/MultiSource/Olden-health/list.c diff -u llvm/test/Programs/MultiSource/Olden-health/list.c:1.3 llvm/test/Programs/MultiSource/Olden-health/list.c:1.4 --- llvm/test/Programs/MultiSource/Olden-health/list.c:1.3 Thu Nov 8 14:21:25 2001 +++ llvm/test/Programs/MultiSource/Olden-health/list.c Wed Nov 6 01:16:04 2002 @@ -9,6 +9,11 @@ #include #include "health.h" +/* LevelRaiseHack - Level raise is having issues with addList. This is a gross + hack to get health working better. + */ +static void LevelRaiseHack(struct List *L) {} + void addList(struct List *list, struct Patient *patient) { struct List *b; @@ -17,7 +22,7 @@ list = list->forward; } list = (struct List *)malloc(sizeof(struct List)); - + LevelRaiseHack(list); list->patient = patient; list->forward = NULL; list->back = b; From vadve at cs.uiuc.edu Wed Nov 6 10:12:01 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Wed Nov 6 10:12:01 2002 Subject: [llvm-commits] CVS: llvm/tools/llc/Makefile Message-ID: <200211061611.KAA18950@psmith.cs.uiuc.edu> Changes in directory llvm/tools/llc: Makefile updated: 1.31 -> 1.32 --- Log message: Don't build llc symbols by default. --- Diffs of the changes: Index: llvm/tools/llc/Makefile diff -u llvm/tools/llc/Makefile:1.31 llvm/tools/llc/Makefile:1.32 --- llvm/tools/llc/Makefile:1.31 Mon Nov 4 14:50:54 2002 +++ llvm/tools/llc/Makefile Wed Nov 6 10:10:57 2002 @@ -23,7 +23,6 @@ vmcore \ support TOOLLINKOPTS = -ldl -KEEP_SYMBOLS = 1 include $(LEVEL)/Makefile.common From vadve at cs.uiuc.edu Wed Nov 6 11:01:01 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Wed Nov 6 11:01:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200211061700.LAA19103@psmith.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.26 -> 1.27 --- Log message: Add const version of function getNodeForValue: const DSNodeHandle &getNodeForValue(Value *V) const. --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.26 llvm/include/llvm/Analysis/DSGraph.h:1.27 --- llvm/include/llvm/Analysis/DSGraph.h:1.26 Wed Nov 6 00:18:56 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Wed Nov 6 11:00:41 2002 @@ -76,6 +76,13 @@ /// DSNodeHandle &getNodeForValue(Value *V) { return ScalarMap[V]; } + const DSNodeHandle &getNodeForValue(Value *V) const { + std::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; + } + const DSNodeHandle &getRetNode() const { return RetNode; } DSNodeHandle &getRetNode() { return RetNode; } From vadve at cs.uiuc.edu Wed Nov 6 11:02:00 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Wed Nov 6 11:02:00 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/IPModRef.h Message-ID: <200211061701.LAA19117@psmith.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: IPModRef.h added (r1.1) --- Log message: An interprocedural analysis pass that computes flow-insensitive IP Mod and Ref information for every function and every call site. --- Diffs of the changes: From vadve at cs.uiuc.edu Wed Nov 6 11:03:01 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Wed Nov 6 11:03:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/IPModRef.cpp Message-ID: <200211061702.LAA19126@psmith.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: IPModRef.cpp added (r1.1) --- Log message: An interprocedural analysis pass that computes flow-insensitive IP Mod and Ref information for every function and every call site. --- Diffs of the changes: From vadve at cs.uiuc.edu Wed Nov 6 11:15:01 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Wed Nov 6 11:15:01 2002 Subject: [llvm-commits] CVS: llvm/include/Support/BitSetVector.h Message-ID: <200211061714.LAA19148@psmith.cs.uiuc.edu> Changes in directory llvm/include/Support: BitSetVector.h added (r1.1) --- Log message: An implementation of the bit-vector representation of sets. --- Diffs of the changes: From vadve at cs.uiuc.edu Wed Nov 6 11:18:01 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Wed Nov 6 11:18:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/AliasAnalysis.cpp Message-ID: <200211061717.LAA19219@psmith.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: AliasAnalysis.cpp updated: 1.5 -> 1.6 --- Log message: Make query operations non-const to allow demand-driven analyses. --- Diffs of the changes: Index: llvm/lib/Analysis/AliasAnalysis.cpp diff -u llvm/lib/Analysis/AliasAnalysis.cpp:1.5 llvm/lib/Analysis/AliasAnalysis.cpp:1.6 --- llvm/lib/Analysis/AliasAnalysis.cpp:1.5 Sun Sep 8 13:45:18 2002 +++ llvm/lib/Analysis/AliasAnalysis.cpp Wed Nov 6 11:17:29 2002 @@ -34,10 +34,10 @@ // namespace { struct CanModify : public InstVisitor { - const AliasAnalysis &AA; + AliasAnalysis &AA; const Value *Ptr; - CanModify(const AliasAnalysis *aa, const Value *ptr) + CanModify(AliasAnalysis *aa, const Value *ptr) : AA(*aa), Ptr(ptr) {} bool visitInvokeInst(InvokeInst &II) { @@ -66,7 +66,7 @@ /// specified basic block to modify the value pointed to by Ptr. /// bool AliasAnalysis::canBasicBlockModify(const BasicBlock &bb, - const Value *Ptr) const { + const Value *Ptr) { CanModify CM(this, Ptr); BasicBlock &BB = const_cast(bb); @@ -84,7 +84,7 @@ /// bool AliasAnalysis::canInstructionRangeModify(const Instruction &I1, const Instruction &I2, - const Value *Ptr) const { + const Value *Ptr) { assert(I1.getParent() == I2.getParent() && "Instructions not in same basic block!"); CanModify CM(this, Ptr); @@ -144,7 +144,7 @@ // Hopefully we have a smart C++ compiler. :) // AliasAnalysis::Result BasicAliasAnalysis::alias(const Value *V1, - const Value *V2) const { + const Value *V2) { // Strip off constant pointer refs if they exist if (const ConstantPointerRef *CPR = dyn_cast(V1)) V1 = CPR->getValue(); From vadve at cs.uiuc.edu Wed Nov 6 11:19:01 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Wed Nov 6 11:19:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/AliasAnalysis.h BasicAliasAnalysis.h Message-ID: <200211061718.LAA19265@psmith.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: AliasAnalysis.h updated: 1.2 -> 1.3 BasicAliasAnalysis.h updated: 1.5 -> 1.6 --- Log message: Make query operations non-const to allow demand-driven analyses. --- Diffs of the changes: Index: llvm/include/llvm/Analysis/AliasAnalysis.h diff -u llvm/include/llvm/Analysis/AliasAnalysis.h:1.2 llvm/include/llvm/Analysis/AliasAnalysis.h:1.3 --- llvm/include/llvm/Analysis/AliasAnalysis.h:1.2 Thu Aug 22 16:22:25 2002 +++ llvm/include/llvm/Analysis/AliasAnalysis.h Wed Nov 6 11:17:55 2002 @@ -34,22 +34,22 @@ /// other. This is the interface that must be implemented by specific alias /// analysis implementations. /// - virtual Result alias(const Value *V1, const Value *V2) const = 0; + virtual Result alias(const Value *V1, const Value *V2) = 0; /// canCallModify - Return a Result that indicates whether the specified /// function call can modify the memory location pointed to by Ptr. /// - virtual Result canCallModify(const CallInst &CI, const Value *Ptr) const = 0; + virtual Result canCallModify(const CallInst &CI, const Value *Ptr) = 0; /// canInvokeModify - Return a Result that indicates whether the specified /// function invoke can modify the memory location pointed to by Ptr. /// - virtual Result canInvokeModify(const InvokeInst &I, const Value *Ptr) const=0; + virtual Result canInvokeModify(const InvokeInst &I, const Value *Ptr) = 0; /// canBasicBlockModify - Return true if it is possible for execution of the /// specified basic block to modify the value pointed to by Ptr. /// - bool canBasicBlockModify(const BasicBlock &BB, const Value *Ptr) const; + bool canBasicBlockModify(const BasicBlock &BB, const Value *Ptr); /// canInstructionRangeModify - Return true if it is possible for the /// execution of the specified instructions to modify the value pointed to by @@ -57,7 +57,7 @@ /// range of [I1,I2] INCLUSIVE. I1 and I2 must be in the same basic block. /// bool canInstructionRangeModify(const Instruction &I1, const Instruction &I2, - const Value *Ptr) const; + const Value *Ptr); virtual ~AliasAnalysis(); // We want to be subclassed }; Index: llvm/include/llvm/Analysis/BasicAliasAnalysis.h diff -u llvm/include/llvm/Analysis/BasicAliasAnalysis.h:1.5 llvm/include/llvm/Analysis/BasicAliasAnalysis.h:1.6 --- llvm/include/llvm/Analysis/BasicAliasAnalysis.h:1.5 Wed Sep 25 17:27:54 2002 +++ llvm/include/llvm/Analysis/BasicAliasAnalysis.h Wed Nov 6 11:17:55 2002 @@ -16,17 +16,17 @@ // alias - This is the only method here that does anything interesting... // - Result alias(const Value *V1, const Value *V2) const; + Result alias(const Value *V1, const Value *V2); /// canCallModify - We are not interprocedural, so we do nothing exciting. /// - Result canCallModify(const CallInst &CI, const Value *Ptr) const { + Result canCallModify(const CallInst &CI, const Value *Ptr) { return MayAlias; } /// canInvokeModify - We are not interprocedural, so we do nothing exciting. /// - Result canInvokeModify(const InvokeInst &I, const Value *Ptr) const { + Result canInvokeModify(const InvokeInst &I, const Value *Ptr) { return MayAlias; // We are not interprocedural } }; From lattner at cs.uiuc.edu Wed Nov 6 12:02:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 12:02:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200211061801.MAA15605@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.43 -> 1.44 --- Log message: Make PointerSize & Shift be enums Fix problem with recursive merging --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.43 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.44 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.43 Wed Nov 6 00:20:09 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Wed Nov 6 12:01:39 2002 @@ -20,11 +20,6 @@ Statistic<> NumFolds("dsnode", "Number of nodes completely folded"); }; -namespace DS { - const unsigned PointerShift = 3; // 64bit ptrs = 3, 32 bit ptrs = 2 - const unsigned PointerSize = 1 << PointerShift; -}; - namespace DataStructureAnalysis { // TODO: FIXME // isPointerType - Return true if this first class type is big enough to hold // a pointer. @@ -392,7 +387,7 @@ } N = NH.getNode(); - if (this == N) return; + if (this == N || N == 0) return; // If both nodes are not at offset 0, make sure that we are merging the node // at an later offset into the node with the zero offset. From lattner at cs.uiuc.edu Wed Nov 6 12:03:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 12:03:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSSupport.h Message-ID: <200211061802.MAA15692@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSSupport.h updated: 1.3 -> 1.4 --- Log message: Make PointerShift/Size be enums so they are constants instead of globals --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSSupport.h diff -u llvm/include/llvm/Analysis/DSSupport.h:1.3 llvm/include/llvm/Analysis/DSSupport.h:1.4 --- llvm/include/llvm/Analysis/DSSupport.h:1.3 Wed Nov 6 00:20:27 2002 +++ llvm/include/llvm/Analysis/DSSupport.h Wed Nov 6 12:02:26 2002 @@ -22,8 +22,10 @@ class DSGraph; // A graph for a function class DSNodeIterator; // Data structure graph traversal iterator -namespace DS { - extern const unsigned PointerShift; // 64bit ptrs = 3, 32 bit ptrs = 2 +namespace DS { // FIXME: After the paper, this should get cleaned up + enum { PointerShift = 3, // 64bit ptrs = 3, 32 bit ptrs = 2 + PointerSize = 1 << PointerShift + }; }; //===----------------------------------------------------------------------===// From lattner at cs.uiuc.edu Wed Nov 6 12:09:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 12:09:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Steensgaard.cpp Message-ID: <200211061808.MAA16518@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Steensgaard.cpp updated: 1.7 -> 1.8 --- Log message: Change Steens class to build with Vikram's changes --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/Steensgaard.cpp diff -u llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.7 llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.8 --- llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.7 Sun Nov 3 15:27:48 2002 +++ llvm/lib/Analysis/DataStructure/Steensgaard.cpp Wed Nov 6 12:08:32 2002 @@ -48,17 +48,17 @@ // // alias - This is the only method here that does anything interesting... - Result alias(const Value *V1, const Value *V2) const; + Result alias(const Value *V1, const Value *V2); /// canCallModify - Not implemented yet: FIXME /// - Result canCallModify(const CallInst &CI, const Value *Ptr) const { + Result canCallModify(const CallInst &CI, const Value *Ptr) { return MayAlias; } /// canInvokeModify - Not implemented yet: FIXME /// - Result canInvokeModify(const InvokeInst &I, const Value *Ptr) const { + Result canInvokeModify(const InvokeInst &I, const Value *Ptr) { return MayAlias; } @@ -196,7 +196,7 @@ } // alias - This is the only method here that does anything interesting... -AliasAnalysis::Result Steens::alias(const Value *V1, const Value *V2) const { +AliasAnalysis::Result Steens::alias(const Value *V1, const Value *V2) { assert(ResultGraph && "Result grcaph has not yet been computed!"); std::map &GVM = ResultGraph->getScalarMap(); From lattner at cs.uiuc.edu Wed Nov 6 12:35:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 12:35:01 2002 Subject: [llvm-commits] CVS: llvm/include/Support/BitSetVector.h Message-ID: <200211061834.MAA18629@apoc.cs.uiuc.edu> Changes in directory llvm/include/Support: BitSetVector.h updated: 1.1 -> 1.2 --- Log message: Make maxSize a private variable, add a size() accessor --- Diffs of the changes: Index: llvm/include/Support/BitSetVector.h diff -u llvm/include/Support/BitSetVector.h:1.1 llvm/include/Support/BitSetVector.h:1.2 --- llvm/include/Support/BitSetVector.h:1.1 Wed Nov 6 11:14:14 2002 +++ llvm/include/Support/BitSetVector.h Wed Nov 6 12:34:40 2002 @@ -41,6 +41,7 @@ class iterator; std::vector bitsetVec; + unsigned maxSize; static unsigned NumWords(unsigned Size) { return (Size+WORDSIZE-1)/WORDSIZE;} @@ -53,14 +54,15 @@ BitSetVector(); // do not implement! public: - unsigned maxSize; - /// /// Constructor: create a set of the maximum size maxSetSize. /// The set is initialized to empty. /// BitSetVector(unsigned maxSetSize) - : bitsetVec(BitSetVector::NumWords(maxSetSize)), maxSize(maxSetSize) { } + : bitsetVec(NumWords(maxSetSize)), maxSize(maxSetSize) { } + + /// size - Return the number of bits tracked by this bit vector... + unsigned size() const { return maxSize; } /// /// Modifier methods: reset, set for entire set, operator[] for one element. @@ -229,7 +231,7 @@ inline bool Disjoint(const BitSetVector& set1, const BitSetVector& set2) { - assert(set1.maxSize == set2.maxSize && "Illegal intersection"); + assert(set1.size() == set2.size() && "Illegal intersection"); for (unsigned i = 0; i < set1.bitsetVec.size(); ++i) if ((set1.getWord(i) & set2.getWord(i)).any()) return false; From lattner at cs.uiuc.edu Wed Nov 6 12:39:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 12:39:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/IPModRef.h Message-ID: <200211061838.MAA18870@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: IPModRef.h updated: 1.1 -> 1.2 --- Log message: Remove a couple of #includes, move some code to .cpp file --- Diffs of the changes: Index: llvm/include/llvm/Analysis/IPModRef.h diff -u llvm/include/llvm/Analysis/IPModRef.h:1.1 llvm/include/llvm/Analysis/IPModRef.h:1.2 --- llvm/include/llvm/Analysis/IPModRef.h:1.1 Wed Nov 6 11:01:46 2002 +++ llvm/include/llvm/Analysis/IPModRef.h Wed Nov 6 12:38:10 2002 @@ -33,15 +33,12 @@ // class IPModRef is primarily meant for other analysis passes that need to // use Mod/Ref information efficiently for more complicated purposes; // the bit-vector representations make propagation very efficient. +// //===----------------------------------------------------------------------===// - #ifndef LLVM_ANALYSIS_IPMODREF_H #define LLVM_ANALYSIS_IPMODREF_H - -#include "llvm/Analysis/DataStructure.h" -#include "llvm/Analysis/DSGraph.h" #include "llvm/Pass.h" #include "Support/BitSetVector.h" #include "Support/NonCopyable.h" @@ -49,12 +46,12 @@ class Module; class Function; class CallInst; +class DSNode; class DSGraph; class ModRefInfo; // Result of IP Mod/Ref for one entity class FunctionModRefInfo; // ModRefInfo for a func and all calls in it class IPModRef; // Pass that computes IP Mod/Ref info - //--------------------------------------------------------------------------- // class ModRefInfo // @@ -67,7 +64,7 @@ class ModRefInfo { BitSetVector modNodeSet; // set of modified nodes BitSetVector refNodeSet; // set of referenced nodes - + public: // // Methods to construct ModRefInfo objects. @@ -76,6 +73,12 @@ : modNodeSet(numNodes), refNodeSet(numNodes) { } + unsigned getSize() const { + assert(modNodeSet.size() == refNodeSet.size() && + "Mod & Ref different size?"); + return modNodeSet.size(); + } + void setNodeIsMod (unsigned nodeId) { modNodeSet[nodeId] = true; } void setNodeIsRef (unsigned nodeId) { refNodeSet[nodeId] = true; } @@ -148,14 +151,12 @@ // unsigned getNodeId (const DSNode* node) const { std::map::const_iterator iter = NodeIds.find(node); - assert(iter == NodeIds.end() || iter->second < funcTDGraph.getGraphSize()); - return (iter == NodeIds.end())? funcTDGraph.getGraphSize() : iter->second; - } - unsigned getNodeId (const Value* value) const { - return getNodeId(funcTDGraph.getNodeForValue(const_cast(value)) - .getNode()); + assert(iter == NodeIds.end() || iter->second < funcModRefInfo.getSize()); + return (iter == NodeIds.end())? funcModRefInfo.getSize() : iter->second; } + unsigned getNodeId (const Value* value) const; + // Debugging support methods void print(std::ostream &O) const; void dump() const; @@ -181,20 +182,7 @@ Module* M; FunctionModRefInfo& getFuncInfo(const Function& func, - bool computeIfMissing = false) - { - FunctionModRefInfo*& funcInfo = funcToModRefInfoMap[&func]; - assert (funcInfo != NULL || computeIfMissing); - if (funcInfo == NULL && computeIfMissing) - { // Create a new FunctionModRefInfo object - funcInfo = new FunctionModRefInfo(func, // inserts into map - getAnalysis().getDSGraph(func), - getAnalysis().getDSGraph(func)); - funcInfo->computeModRef(func); // computes the mod/ref info - } - return *funcInfo; - } - + bool computeIfMissing = false); public: IPModRef() : M(NULL) { } ~IPModRef() { } @@ -223,11 +211,7 @@ // getAnalysisUsage - This pass requires top-down data structure graphs. // It modifies nothing. // - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesAll(); - AU.addRequired(); - AU.addRequired(); - } + virtual void getAnalysisUsage(AnalysisUsage &AU) const; }; //===----------------------------------------------------------------------===// From lattner at cs.uiuc.edu Wed Nov 6 12:39:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 12:39:04 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/IPModRef.cpp Message-ID: <200211061838.MAA18877@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: IPModRef.cpp updated: 1.1 -> 1.2 --- Log message: Remove a couple of #includes, move some code from .h file --- Diffs of the changes: Index: llvm/lib/Analysis/IPA/IPModRef.cpp diff -u llvm/lib/Analysis/IPA/IPModRef.cpp:1.1 llvm/lib/Analysis/IPA/IPModRef.cpp:1.2 --- llvm/lib/Analysis/IPA/IPModRef.cpp:1.1 Wed Nov 6 11:02:03 2002 +++ llvm/lib/Analysis/IPA/IPModRef.cpp Wed Nov 6 12:38:18 2002 @@ -4,22 +4,15 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Analysis/IPModRef.h" #include "llvm/Analysis/DataStructure.h" #include "llvm/Analysis/DSGraph.h" -#include "llvm/Analysis/IPModRef.h" #include "llvm/Module.h" -#include "llvm/Function.h" #include "llvm/iOther.h" -#include "llvm/Pass.h" #include "Support/Statistic.h" #include "Support/STLExtras.h" #include "Support/StringExtras.h" -#include -#include -#include - - //---------------------------------------------------------------------------- // Private constants and data //---------------------------------------------------------------------------- @@ -73,6 +66,12 @@ callSiteModRefInfo.clear(); } +unsigned FunctionModRefInfo::getNodeId(const Value* value) const { + return getNodeId(funcTDGraph.getNodeForValue(const_cast(value)) + .getNode()); +} + + // Dummy function that will be replaced with one that inlines // the callee's BU graph into the caller's TD graph. @@ -196,6 +195,31 @@ if (! FI->isExternal()) getFuncInfo(*FI, /*computeIfMissing*/ true); return true; +} + + +FunctionModRefInfo& IPModRef::getFuncInfo(const Function& func, + bool computeIfMissing) +{ + FunctionModRefInfo*& funcInfo = funcToModRefInfoMap[&func]; + assert (funcInfo != NULL || computeIfMissing); + if (funcInfo == NULL && computeIfMissing) + { // Create a new FunctionModRefInfo object + funcInfo = new FunctionModRefInfo(func, // inserts into map + getAnalysis().getDSGraph(func), + getAnalysis().getDSGraph(func)); + funcInfo->computeModRef(func); // computes the mod/ref info + } + return *funcInfo; +} + +// getAnalysisUsage - This pass requires top-down data structure graphs. +// It modifies nothing. +// +void IPModRef::getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + AU.addRequired(); + AU.addRequired(); } From lattner at cs.uiuc.edu Wed Nov 6 13:08:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 13:08:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/IPModRef.h Message-ID: <200211061907.NAA19091@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: IPModRef.h updated: 1.2 -> 1.3 --- Log message: Give a back pointer to the IPModRef object to the FunctionModRefInfo object --- Diffs of the changes: Index: llvm/include/llvm/Analysis/IPModRef.h diff -u llvm/include/llvm/Analysis/IPModRef.h:1.2 llvm/include/llvm/Analysis/IPModRef.h:1.3 --- llvm/include/llvm/Analysis/IPModRef.h:1.2 Wed Nov 6 12:38:10 2002 +++ llvm/include/llvm/Analysis/IPModRef.h Wed Nov 6 13:07:11 2002 @@ -113,6 +113,7 @@ class FunctionModRefInfo { const Function& F; // The function + IPModRef& IPModRefObj; // The IPModRef Object owning this const DSGraph& funcTDGraph; // Top-down DS graph for function const DSGraph& funcLocalGraph; // Local DS graph for function ModRefInfo funcModRefInfo; // ModRefInfo for the function body @@ -127,6 +128,7 @@ public: /* ctor */ FunctionModRefInfo (const Function& func, + IPModRef& IPModRefObj, const DSGraph& tdg, const DSGraph& ldg); /* dtor */ ~FunctionModRefInfo (); From lattner at cs.uiuc.edu Wed Nov 6 13:08:07 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 13:08:07 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/IPModRef.cpp Message-ID: <200211061907.NAA19098@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: IPModRef.cpp updated: 1.2 -> 1.3 --- Log message: Give a back pointer to the IPModRef object to the FunctionModRefInfo object --- Diffs of the changes: Index: llvm/lib/Analysis/IPA/IPModRef.cpp diff -u llvm/lib/Analysis/IPA/IPModRef.cpp:1.2 llvm/lib/Analysis/IPA/IPModRef.cpp:1.3 --- llvm/lib/Analysis/IPA/IPModRef.cpp:1.2 Wed Nov 6 12:38:18 2002 +++ llvm/lib/Analysis/IPA/IPModRef.cpp Wed Nov 6 13:07:13 2002 @@ -44,9 +44,10 @@ // This constructor computes a node numbering for the TD graph. // FunctionModRefInfo::FunctionModRefInfo(const Function& func, + IPModRef& ipmro, const DSGraph& tdg, const DSGraph& ldg) - : F(func), + : F(func), IPModRefObj(ipmro), funcTDGraph(tdg), funcLocalGraph(ldg), funcModRefInfo(tdg.getGraphSize()) @@ -76,7 +77,7 @@ // Dummy function that will be replaced with one that inlines // the callee's BU graph into the caller's TD graph. // -const DSGraph* ResolveGraphForCallSite(const DSGraph& funcTDGraph, +static const DSGraph* ResolveGraphForCallSite(const DSGraph& funcTDGraph, const CallInst& callInst) { return &funcTDGraph; // TEMPORARY @@ -203,9 +204,9 @@ { FunctionModRefInfo*& funcInfo = funcToModRefInfoMap[&func]; assert (funcInfo != NULL || computeIfMissing); - if (funcInfo == NULL && computeIfMissing) + if (funcInfo == NULL) { // Create a new FunctionModRefInfo object - funcInfo = new FunctionModRefInfo(func, // inserts into map + funcInfo = new FunctionModRefInfo(func, *this, // inserts into map getAnalysis().getDSGraph(func), getAnalysis().getDSGraph(func)); funcInfo->computeModRef(func); // computes the mod/ref info @@ -219,6 +220,7 @@ void IPModRef::getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); AU.addRequired(); + AU.addRequired(); AU.addRequired(); } From lattner at cs.uiuc.edu Wed Nov 6 13:39:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 13:39:00 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/IPModRef.h Message-ID: <200211061938.NAA20299@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: IPModRef.h updated: 1.3 -> 1.4 --- Log message: Add a stub to implement the context sensitive mod/ref info for call sites --- Diffs of the changes: Index: llvm/include/llvm/Analysis/IPModRef.h diff -u llvm/include/llvm/Analysis/IPModRef.h:1.3 llvm/include/llvm/Analysis/IPModRef.h:1.4 --- llvm/include/llvm/Analysis/IPModRef.h:1.3 Wed Nov 6 13:07:11 2002 +++ llvm/include/llvm/Analysis/IPModRef.h Wed Nov 6 13:38:41 2002 @@ -125,6 +125,7 @@ void computeModRef (const Function &func); void computeModRef (const CallInst& callInst); + DSGraph *ResolveCallSiteModRefInfo(const CallInst &CI); public: /* ctor */ FunctionModRefInfo (const Function& func, From lattner at cs.uiuc.edu Wed Nov 6 13:39:03 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 13:39:03 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/IPModRef.cpp Message-ID: <200211061938.NAA20306@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: IPModRef.cpp updated: 1.3 -> 1.4 --- Log message: Add a stub to implement the context sensitive mod/ref info for call sites --- Diffs of the changes: Index: llvm/lib/Analysis/IPA/IPModRef.cpp diff -u llvm/lib/Analysis/IPA/IPModRef.cpp:1.3 llvm/lib/Analysis/IPA/IPModRef.cpp:1.4 --- llvm/lib/Analysis/IPA/IPModRef.cpp:1.3 Wed Nov 6 13:07:13 2002 +++ llvm/lib/Analysis/IPA/IPModRef.cpp Wed Nov 6 13:38:43 2002 @@ -74,16 +74,6 @@ -// Dummy function that will be replaced with one that inlines -// the callee's BU graph into the caller's TD graph. -// -static const DSGraph* ResolveGraphForCallSite(const DSGraph& funcTDGraph, - const CallInst& callInst) -{ - return &funcTDGraph; // TEMPORARY -} - - // Compute Mod/Ref bit vectors for the entire function. // These are simply copies of the Read/Write flags from the nodes of // the top-down DS graph. @@ -108,6 +98,27 @@ computeModRef(callSites[i].getCallInst()); } +// ResolveCallSiteModRefInfo - This method performs the following actions: +// +// 1. It clones the top-down graph for the current function +// 2. It clears all of the mod/ref bits in the cloned graph +// 3. It then merges the bottom-up graph(s) for the specified call-site into +// the clone (bringing new mod/ref bits). +// 4. It returns the clone. +// +// NOTE: Because this clones a dsgraph and returns it, the caller is responsible +// for deleting the returned graph! +// +DSGraph *FunctionModRefInfo::ResolveCallSiteModRefInfo(const CallInst &CI) { + // Step #1: Clone the top-down graph... + DSGraph *Result = new DSGraph(funcTDGraph); + + //const Function &F = *CI.getParent()->getParent(); + //DSGraph &TDGraph = IPModRefObj.getAnalysis().getDSGraph(F); + + + return Result; +} // Compute Mod/Ref bit vectors for a single call site. // These are copies of the Read/Write flags from the nodes of @@ -122,8 +133,7 @@ callSiteModRefInfo[&callInst] = callModRefInfo; // Get a copy of the graph for the callee with the callee inlined - const DSGraph* csgp = ResolveGraphForCallSite(funcTDGraph, callInst); - assert(csgp && "Unable to compute callee mod/ref information"); + DSGraph* csgp = ResolveCallSiteModRefInfo(callInst); // For all nodes in the graph, extract the mod/ref information const std::vector& csgNodes = csgp->getNodes(); @@ -136,6 +146,7 @@ if (csgNodes[i]->isRead()) callModRefInfo->setNodeIsRef(getNodeId(origNodes[i])); } + delete csgp; } From lattner at cs.uiuc.edu Wed Nov 6 14:00:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 14:00:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/IPModRef.h Message-ID: <200211061959.NAA20796@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: IPModRef.h updated: 1.4 -> 1.5 --- Log message: Allow the ResolveCallSiteModRefInfo method to return a mapping of nodes, implement the mod/ref bit masking --- Diffs of the changes: Index: llvm/include/llvm/Analysis/IPModRef.h diff -u llvm/include/llvm/Analysis/IPModRef.h:1.4 llvm/include/llvm/Analysis/IPModRef.h:1.5 --- llvm/include/llvm/Analysis/IPModRef.h:1.4 Wed Nov 6 13:38:41 2002 +++ llvm/include/llvm/Analysis/IPModRef.h Wed Nov 6 13:59:31 2002 @@ -41,13 +41,13 @@ #include "llvm/Pass.h" #include "Support/BitSetVector.h" -#include "Support/NonCopyable.h" class Module; class Function; class CallInst; class DSNode; class DSGraph; +class DSNodeHandle; class ModRefInfo; // Result of IP Mod/Ref for one entity class FunctionModRefInfo; // ModRefInfo for a func and all calls in it class IPModRef; // Pass that computes IP Mod/Ref info @@ -125,7 +125,8 @@ void computeModRef (const Function &func); void computeModRef (const CallInst& callInst); - DSGraph *ResolveCallSiteModRefInfo(const CallInst &CI); + DSGraph *ResolveCallSiteModRefInfo(const CallInst &CI, + std::map &NodeMap); public: /* ctor */ FunctionModRefInfo (const Function& func, From lattner at cs.uiuc.edu Wed Nov 6 14:00:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 14:00:04 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/IPModRef.cpp Message-ID: <200211061959.NAA20803@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: IPModRef.cpp updated: 1.4 -> 1.5 --- Log message: Allow the ResolveCallSiteModRefInfo method to return a mapping of nodes, implement the mod/ref bit masking --- Diffs of the changes: Index: llvm/lib/Analysis/IPA/IPModRef.cpp diff -u llvm/lib/Analysis/IPA/IPModRef.cpp:1.4 llvm/lib/Analysis/IPA/IPModRef.cpp:1.5 --- llvm/lib/Analysis/IPA/IPModRef.cpp:1.4 Wed Nov 6 13:38:43 2002 +++ llvm/lib/Analysis/IPA/IPModRef.cpp Wed Nov 6 13:59:33 2002 @@ -104,17 +104,28 @@ // 2. It clears all of the mod/ref bits in the cloned graph // 3. It then merges the bottom-up graph(s) for the specified call-site into // the clone (bringing new mod/ref bits). -// 4. It returns the clone. +// 4. It returns the clone, and a mapping of nodes from the original TDGraph to +// the cloned graph with Mod/Ref info for the callsite. // // NOTE: Because this clones a dsgraph and returns it, the caller is responsible // for deleting the returned graph! // -DSGraph *FunctionModRefInfo::ResolveCallSiteModRefInfo(const CallInst &CI) { +DSGraph *FunctionModRefInfo::ResolveCallSiteModRefInfo(const CallInst &CI, + std::map &NodeMap) { + // Step #1: Clone the top-down graph... - DSGraph *Result = new DSGraph(funcTDGraph); + std::map RawNodeMap; + DSGraph *Result = new DSGraph(funcTDGraph, RawNodeMap); + + // Convert the NodeMap from a map to DSNode* to be a map to DSNodeHandle's + NodeMap.insert(RawNodeMap.begin(), RawNodeMap.end()); + + // We are now done with the old map... so free it's memory... + RawNodeMap.clear(); + + // Step #2: Clear Mod/Ref information... + Result->maskNodeTypes(~(DSNode::Modified | DSNode::Read)); - //const Function &F = *CI.getParent()->getParent(); - //DSGraph &TDGraph = IPModRefObj.getAnalysis().getDSGraph(F); return Result; @@ -133,7 +144,8 @@ callSiteModRefInfo[&callInst] = callModRefInfo; // Get a copy of the graph for the callee with the callee inlined - DSGraph* csgp = ResolveCallSiteModRefInfo(callInst); + std::map NodeMap; + DSGraph* csgp = ResolveCallSiteModRefInfo(callInst, NodeMap); // For all nodes in the graph, extract the mod/ref information const std::vector& csgNodes = csgp->getNodes(); From hldnbrnd at cs.uiuc.edu Wed Nov 6 14:09:01 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Wed Nov 6 14:09:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp Message-ID: <200211062008.OAA21326@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CWriter: Writer.cpp updated: 1.69 -> 1.70 --- Log message: Loads and stores can't be inlined. This fixes test/Singlesource/matrixTranspose --- Diffs of the changes: Index: llvm/lib/CWriter/Writer.cpp diff -u llvm/lib/CWriter/Writer.cpp:1.69 llvm/lib/CWriter/Writer.cpp:1.70 --- llvm/lib/CWriter/Writer.cpp:1.69 Fri Nov 1 11:37:09 2002 +++ llvm/lib/CWriter/Writer.cpp Wed Nov 6 14:07:54 2002 @@ -94,7 +94,8 @@ // Must be an expression, must be used exactly once. If it is dead, we // emit it inline where it would go. if (I.getType() == Type::VoidTy || I.use_size() != 1 || - isa(I) || isa(I) || isa(I)) + isa(I) || isa(I) || isa(I) || + isa(I)) // Don't inline a load across a store! return false; // Only inline instruction it it's use is in the same BB as the inst. From lattner at cs.uiuc.edu Wed Nov 6 14:38:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 14:38:01 2002 Subject: [llvm-commits] CVS: llvm/test/Makefile Message-ID: <200211062037.OAA21584@apoc.cs.uiuc.edu> Changes in directory llvm/test: Makefile updated: 1.33 -> 1.34 --- Log message: libraries is used for internal stuff, not as a real testcase --- Diffs of the changes: Index: llvm/test/Makefile diff -u llvm/test/Makefile:1.33 llvm/test/Makefile:1.34 --- llvm/test/Makefile:1.33 Sun Mar 17 22:05:26 2002 +++ llvm/test/Makefile Wed Nov 6 14:36:52 2002 @@ -1,5 +1,5 @@ LEVEL = .. -DIRS = Feature Libraries Regression Programs +DIRS = Feature Regression Programs include ../Makefile.common include Makefile.tests From lattner at cs.uiuc.edu Wed Nov 6 14:59:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 14:59:01 2002 Subject: [llvm-commits] CVS: llvm/test/Libraries/README.txt Message-ID: <200211062058.OAA22131@apoc.cs.uiuc.edu> Changes in directory llvm/test/Libraries: README.txt added (r1.1) --- Log message: Add note about what this is --- Diffs of the changes: From hldnbrnd at cs.uiuc.edu Wed Nov 6 15:39:00 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Wed Nov 6 15:39:00 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/CBackend/2002-11-06-PrintEscaped.ll Message-ID: <200211062138.PAA23577@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CBackend: 2002-11-06-PrintEscaped.ll added (r1.1) --- Log message: Certain characters not getting escaped properly --- Diffs of the changes: From hldnbrnd at cs.uiuc.edu Wed Nov 6 15:41:01 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Wed Nov 6 15:41:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp Message-ID: <200211062140.PAA23593@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CWriter: Writer.cpp updated: 1.70 -> 1.71 --- Log message: Fixes escapeing bug in strings. Fixes test case test/Regression/CBackend/2002-11-06-PrintEscaped.c --- Diffs of the changes: Index: llvm/lib/CWriter/Writer.cpp diff -u llvm/lib/CWriter/Writer.cpp:1.70 llvm/lib/CWriter/Writer.cpp:1.71 --- llvm/lib/CWriter/Writer.cpp:1.70 Wed Nov 6 14:07:54 2002 +++ llvm/lib/CWriter/Writer.cpp Wed Nov 6 15:40:23 2002 @@ -297,8 +297,8 @@ (unsigned char)cast(CPA->getOperand(i))->getValue(); if (isprint(C)) { - if (C == '"') - Out << "\\\""; + if (C == '"' || C == '\\') + Out << "\\" << C; else Out << C; } else { From lattner at cs.uiuc.edu Wed Nov 6 17:00:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 17:00:01 2002 Subject: [llvm-commits] CVS: llvm/tools/lli/ExternalFunctions.cpp Message-ID: <200211062259.QAA24437@apoc.cs.uiuc.edu> Changes in directory llvm/tools/lli: ExternalFunctions.cpp updated: 1.34 -> 1.35 --- Log message: Implement fputc and ungetc to allow burg to run in lli --- Diffs of the changes: Index: llvm/tools/lli/ExternalFunctions.cpp diff -u llvm/tools/lli/ExternalFunctions.cpp:1.34 llvm/tools/lli/ExternalFunctions.cpp:1.35 --- llvm/tools/lli/ExternalFunctions.cpp:1.34 Wed Oct 2 16:12:13 2002 +++ llvm/tools/lli/ExternalFunctions.cpp Wed Nov 6 16:59:28 2002 @@ -549,6 +549,22 @@ return GV; } +// int fputc(int C, FILE *stream); +GenericValue lle_X_fputc(FunctionType *M, const vector &Args) { + assert(Args.size() == 2); + GenericValue GV; + GV.IntVal = fputc(Args[0].IntVal, getFILE(Args[1].PointerVal)); + return GV; +} + +// int ungetc(int C, FILE *stream); +GenericValue lle_X_ungetc(FunctionType *M, const vector &Args) { + assert(Args.size() == 2); + GenericValue GV; + GV.IntVal = ungetc(Args[0].IntVal, getFILE(Args[1].PointerVal)); + return GV; +} + } // End extern "C" @@ -596,5 +612,8 @@ FuncNames["lle_X_fwrite"] = lle_X_fwrite; FuncNames["lle_X_fgets"] = lle_X_fgets; FuncNames["lle_X_fflush"] = lle_X_fflush; + FuncNames["lle_X_fgetc"] = lle_X_getc; FuncNames["lle_X_getc"] = lle_X_getc; + FuncNames["lle_X_fputc"] = lle_X_fputc; + FuncNames["lle_X_ungetc"] = lle_X_ungetc; } From lattner at cs.uiuc.edu Wed Nov 6 17:06:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 17:06:01 2002 Subject: [llvm-commits] CVS: llvm/tools/lli/ExternalFunctions.cpp Message-ID: <200211062305.RAA24533@apoc.cs.uiuc.edu> Changes in directory llvm/tools/lli: ExternalFunctions.cpp updated: 1.35 -> 1.36 --- Log message: Implement fprintf --- Diffs of the changes: Index: llvm/tools/lli/ExternalFunctions.cpp diff -u llvm/tools/lli/ExternalFunctions.cpp:1.35 llvm/tools/lli/ExternalFunctions.cpp:1.36 --- llvm/tools/lli/ExternalFunctions.cpp:1.35 Wed Nov 6 16:59:28 2002 +++ llvm/tools/lli/ExternalFunctions.cpp Wed Nov 6 17:05:03 2002 @@ -565,6 +565,21 @@ return GV; } +// int fprintf(FILE *,sbyte *, ...) - a very rough implementation to make output +// useful. +GenericValue lle_X_fprintf(FunctionType *M, const vector &Args) { + assert(Args.size() > 2); + char Buffer[10000]; + vector NewArgs; + GenericValue GV; GV.PointerVal = (PointerTy)Buffer; + NewArgs.push_back(GV); + NewArgs.insert(NewArgs.end(), Args.begin()+1, Args.end()); + GV = lle_X_sprintf(M, NewArgs); + + fputs(Buffer, getFILE(Args[0].PointerVal)); + return GV; +} + } // End extern "C" @@ -616,4 +631,5 @@ FuncNames["lle_X_getc"] = lle_X_getc; FuncNames["lle_X_fputc"] = lle_X_fputc; FuncNames["lle_X_ungetc"] = lle_X_ungetc; + FuncNames["lle_X_fprintf"] = lle_X_fprintf; } From lattner at cs.uiuc.edu Wed Nov 6 17:27:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 17:27:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure.h Message-ID: <200211062326.RAA24824@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DataStructure.h updated: 1.48 -> 1.49 --- Log message: Add a comment --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure.h:1.48 llvm/include/llvm/Analysis/DataStructure.h:1.49 --- llvm/include/llvm/Analysis/DataStructure.h:1.48 Tue Oct 29 16:55:11 2002 +++ llvm/include/llvm/Analysis/DataStructure.h Wed Nov 6 17:26:21 2002 @@ -80,6 +80,8 @@ return *I->second; } + /// getCallSites - Return all of the call sites for the specified function + /// const std::vector *getCallSites(const Function &F) const { std::map >::const_iterator I = CallSites.find(&F); From lattner at cs.uiuc.edu Wed Nov 6 17:35:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 17:35:01 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/Makefile.DSGraphs Message-ID: <200211062334.RAA26687@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: Makefile.DSGraphs updated: 1.4 -> 1.5 --- Log message: Add >>>, add -stats, remove tail --- Diffs of the changes: Index: llvm/test/DSGraphs/Makefile.DSGraphs diff -u llvm/test/DSGraphs/Makefile.DSGraphs:1.4 llvm/test/DSGraphs/Makefile.DSGraphs:1.5 --- llvm/test/DSGraphs/Makefile.DSGraphs:1.4 Sun Nov 3 10:32:31 2002 +++ llvm/test/DSGraphs/Makefile.DSGraphs Wed Nov 6 17:34:09 2002 @@ -1,4 +1,4 @@ -## $Id: Makefile.DSGraphs,v 1.4 2002/11/03 16:32:31 vadve Exp $ +## $Id: Makefile.DSGraphs,v 1.5 2002/11/06 23:34:09 lattner Exp $ ##---------------------------------------------------------------------------- ## Common makefile rules for testing DSGraph analysis. ## @@ -29,10 +29,9 @@ %.ps: %.lib.bc @echo "---------------------------------------------------------------" - @echo "========= " $< + @echo ">>> ========= " $< @echo "---------------------------------------------------------------" - analyze -$(PASS)datastructure -time-passes $< > $<.analyze$(PASS).out 2>&1 - tail -12 $<.analyze$(PASS).out + analyze -$(PASS)datastructure -stats -time-passes $< | tee $<.analyze$(PASS).out 2>&1 dot -Tps < $(PASS).main.dot > $@ clean:: From lattner at cs.uiuc.edu Wed Nov 6 17:41:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 17:41:01 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/test_indvars/Makefile Message-ID: <200211062340.RAA28159@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs/test_indvars: Makefile updated: 1.1 -> 1.2 --- Log message: Fix broken makefile --- Diffs of the changes: Index: llvm/test/DSGraphs/test_indvars/Makefile diff -u llvm/test/DSGraphs/test_indvars/Makefile:1.1 llvm/test/DSGraphs/test_indvars/Makefile:1.2 --- llvm/test/DSGraphs/test_indvars/Makefile:1.1 Sun Nov 3 06:38:20 2002 +++ llvm/test/DSGraphs/test_indvars/Makefile Wed Nov 6 17:40:45 2002 @@ -4,8 +4,7 @@ LEVEL = ../../.. PROG = test_indvars.llvm.bc - -PROGPATH = $(LEVEL)/test_indvars.llvm.bc +PROGPATH = $(LEVEL)/test/Programs/SingleSource/Output/$(PROG) include ../Makefile.DSGraphs From lattner at cs.uiuc.edu Wed Nov 6 17:42:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 17:42:00 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/Makefile.DSGraphs Message-ID: <200211062341.RAA28171@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: Makefile.DSGraphs updated: 1.5 -> 1.6 --- Log message: Allow execution to continue even if stuff aborts out --- Diffs of the changes: Index: llvm/test/DSGraphs/Makefile.DSGraphs diff -u llvm/test/DSGraphs/Makefile.DSGraphs:1.5 llvm/test/DSGraphs/Makefile.DSGraphs:1.6 --- llvm/test/DSGraphs/Makefile.DSGraphs:1.5 Wed Nov 6 17:34:09 2002 +++ llvm/test/DSGraphs/Makefile.DSGraphs Wed Nov 6 17:41:11 2002 @@ -1,4 +1,4 @@ -## $Id: Makefile.DSGraphs,v 1.5 2002/11/06 23:34:09 lattner Exp $ +## $Id: Makefile.DSGraphs,v 1.6 2002/11/06 23:41:11 lattner Exp $ ##---------------------------------------------------------------------------- ## Common makefile rules for testing DSGraph analysis. ## @@ -31,8 +31,8 @@ @echo "---------------------------------------------------------------" @echo ">>> ========= " $< @echo "---------------------------------------------------------------" - analyze -$(PASS)datastructure -stats -time-passes $< | tee $<.analyze$(PASS).out 2>&1 - dot -Tps < $(PASS).main.dot > $@ + -analyze -$(PASS)datastructure -stats -time-passes $< | tee $<.analyze$(PASS).out 2>&1 + -dot -Tps < $(PASS).main.dot > $@ clean:: /bin/rm -f core* *.dot *.ps *.lib.bc *.analyze*.out $(PROG) From lattner at cs.uiuc.edu Wed Nov 6 17:45:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 17:45:01 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/SPEC/Makefile.spec Message-ID: <200211062344.RAA28461@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/SPEC: Makefile.spec updated: 1.2 -> 1.3 --- Log message: Make sure that the bytecode gets "built" even if nothing else is. --- Diffs of the changes: Index: llvm/test/Programs/MultiSource/SPEC/Makefile.spec diff -u llvm/test/Programs/MultiSource/SPEC/Makefile.spec:1.2 llvm/test/Programs/MultiSource/SPEC/Makefile.spec:1.3 --- llvm/test/Programs/MultiSource/SPEC/Makefile.spec:1.2 Wed Oct 9 16:16:40 2002 +++ llvm/test/Programs/MultiSource/SPEC/Makefile.spec Wed Nov 6 17:44:37 2002 @@ -23,6 +23,8 @@ data: @test -L data || ln -s $(BENCHDATADIR) +all:: $(BENCHBC) + ifndef DISABLE_LLC all :: Output/$(BENCH).diff-llc endif From lattner at cs.uiuc.edu Wed Nov 6 19:52:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 19:52:01 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/generate_report.pl Makefile Makefile.DSGraphs Message-ID: <200211070151.TAA05431@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: generate_report.pl added (r1.1) Makefile updated: 1.3 -> 1.4 Makefile.DSGraphs updated: 1.6 -> 1.7 --- Log message: Changes neccesary to run an automated summary script to gather DS analysis numbers from all benchmarks --- Diffs of the changes: Index: llvm/test/DSGraphs/Makefile diff -u llvm/test/DSGraphs/Makefile:1.3 llvm/test/DSGraphs/Makefile:1.4 --- llvm/test/DSGraphs/Makefile:1.3 Sun Nov 3 12:42:28 2002 +++ llvm/test/DSGraphs/Makefile Wed Nov 6 19:51:16 2002 @@ -47,5 +47,15 @@ include ../Makefile.tests +clean:: + rm -f report.raw.out + dummylib.o: dummylib.c $(LCC1) $(LCC) $< -c + +report.raw.out: $(LANALYZE) + $(MAKE) clean + gmake all 2>&1 | tee report.raw.out + +report: report.raw.out + ./generate_report.pl report.raw.out 2>&1 | tee report.txt Index: llvm/test/DSGraphs/Makefile.DSGraphs diff -u llvm/test/DSGraphs/Makefile.DSGraphs:1.6 llvm/test/DSGraphs/Makefile.DSGraphs:1.7 --- llvm/test/DSGraphs/Makefile.DSGraphs:1.6 Wed Nov 6 17:41:11 2002 +++ llvm/test/DSGraphs/Makefile.DSGraphs Wed Nov 6 19:51:16 2002 @@ -1,4 +1,4 @@ -## $Id: Makefile.DSGraphs,v 1.6 2002/11/06 23:41:11 lattner Exp $ +## $Id: Makefile.DSGraphs,v 1.7 2002/11/07 01:51:16 lattner Exp $ ##---------------------------------------------------------------------------- ## Common makefile rules for testing DSGraph analysis. ## @@ -24,14 +24,18 @@ .PRECIOUS: %.lib.bc -%.lib.bc: %.bc ../dummylib.o +%.lib.bc: %.bc ../dummylib.o $(LANALYZE) link $< ../dummylib.o | opt -internalize -funcresolve -globaldce > $@ + +ANALYZE_OPTS = -stats -time-passes -only-print-main-ds + %.ps: %.lib.bc @echo "---------------------------------------------------------------" @echo ">>> ========= " $< @echo "---------------------------------------------------------------" - -analyze -$(PASS)datastructure -stats -time-passes $< | tee $<.analyze$(PASS).out 2>&1 + -time analyze -$(PASS)datastructure $(ANALYZE_OPTS) $< | \ + tee $<.analyze$(PASS).out 2>&1 -dot -Tps < $(PASS).main.dot > $@ clean:: From lattner at cs.uiuc.edu Wed Nov 6 19:54:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 19:54:00 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/README.txt Message-ID: <200211070153.TAA06165@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: README.txt added (r1.1) --- Log message: Add note about directory contents --- Diffs of the changes: From lattner at cs.uiuc.edu Wed Nov 6 19:56:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 19:56:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200211070155.TAA06247@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.44 -> 1.45 --- Log message: Move printouts to be wrapped in DEBUG() macros --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.44 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.45 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.44 Wed Nov 6 12:01:39 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Wed Nov 6 19:54:56 2002 @@ -163,8 +163,8 @@ } if (Offset) { // We could handle this case, but we don't for now... - std::cerr << "UNIMP: Trying to merge a growth type into offset != 0: " - << "Collapsing!\n"; + DEBUG(std::cerr << "UNIMP: Trying to merge a growth type into " + << "offset != 0: Collapsing!\n"); foldNodeCompletely(); return true; } @@ -280,10 +280,9 @@ } - - std::cerr << "MergeTypeInfo Folding OrigTy: " << Ty.Ty - << "\n due to:" << NewTy << " @ " << Offset << "!\n"; - std::cerr << "SubType: " << SubType << "\n\n"; + DEBUG(std::cerr << "MergeTypeInfo Folding OrigTy: " << Ty.Ty + << "\n due to:" << NewTy << " @ " << Offset << "!\n" + << "SubType: " << SubType << "\n\n"); foldNodeCompletely(); return true; @@ -366,7 +365,8 @@ if (N == this) { // We cannot merge two pieces of the same node together, collapse the node // completely. - std::cerr << "Attempting to merge two chunks of the same node together!\n"; + DEBUG(std::cerr << "Attempting to merge two chunks of" + << " the same node together!\n"); foldNodeCompletely(); return; } From lattner at cs.uiuc.edu Wed Nov 6 19:56:03 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 19:56:03 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp Message-ID: <200211070155.TAA06257@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Printer.cpp updated: 1.33 -> 1.34 --- Log message: When the -only-print-main-ds option is specified, still print out graph size statistics for skipped functions --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.33 llvm/lib/Analysis/DataStructure/Printer.cpp:1.34 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.33 Wed Nov 6 00:20:09 2002 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Wed Nov 6 19:54:44 2002 @@ -168,8 +168,15 @@ } for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) - if (!I->isExternal() && (I->getName() == "main" || !OnlyPrintMain)) - C.getDSGraph((Function&)*I).writeGraphToFile(O, Prefix+I->getName()); + if (!I->isExternal()) { + DSGraph &Gr = C.getDSGraph((Function&)*I); + if (I->getName() == "main" || !OnlyPrintMain) + Gr.writeGraphToFile(O, Prefix+I->getName()); + else { + O << "Skipped Writing '" << Prefix+I->getName() << ".dot'... [" + << Gr.getGraphSize() << "+" << Gr.getFunctionCalls().size() << "]\n"; + } + } } From lattner at cs.uiuc.edu Wed Nov 6 19:58:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 19:58:00 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/Makefile Message-ID: <200211070157.TAA06281@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: Makefile updated: 1.4 -> 1.5 --- Log message: Automatically backup the last report generated. --- Diffs of the changes: Index: llvm/test/DSGraphs/Makefile diff -u llvm/test/DSGraphs/Makefile:1.4 llvm/test/DSGraphs/Makefile:1.5 --- llvm/test/DSGraphs/Makefile:1.4 Wed Nov 6 19:51:16 2002 +++ llvm/test/DSGraphs/Makefile Wed Nov 6 19:56:50 2002 @@ -58,4 +58,5 @@ gmake all 2>&1 | tee report.raw.out report: report.raw.out + -mv -f report.txt report.old.txt ./generate_report.pl report.raw.out 2>&1 | tee report.txt From lattner at cs.uiuc.edu Wed Nov 6 19:58:03 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 19:58:03 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/generate_report.pl Message-ID: <200211070157.TAA06286@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: generate_report.pl updated: 1.1 -> 1.2 --- Log message: Don't print input filename --- Diffs of the changes: Index: llvm/test/DSGraphs/generate_report.pl diff -u llvm/test/DSGraphs/generate_report.pl:1.1 llvm/test/DSGraphs/generate_report.pl:1.2 --- llvm/test/DSGraphs/generate_report.pl:1.1 Wed Nov 6 19:51:16 2002 +++ llvm/test/DSGraphs/generate_report.pl Wed Nov 6 19:56:35 2002 @@ -2,7 +2,7 @@ my $InputFN = $ARGV[0]; -print "Reading input from $InputFN\n"; +#print "Reading input from $InputFN\n"; open(INPUT, $InputFN) or die "Couldn't open '$InputFN'!"; From lattner at cs.uiuc.edu Wed Nov 6 20:04:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 20:04:00 2002 Subject: [llvm-commits] CVS: llvm/www/docs/DSGraphStatus.html Message-ID: <200211070203.UAA08841@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: DSGraphStatus.html added (r1.1) --- Log message: New web page to track the progress of the DSGraph implementation --- Diffs of the changes: From lattner at cs.uiuc.edu Wed Nov 6 20:09:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 20:09:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/DSGraphStatus.html Message-ID: <200211070208.UAA09015@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: DSGraphStatus.html updated: 1.1 -> 1.2 --- Log message: Add note --- Diffs of the changes: Index: llvm/www/docs/DSGraphStatus.html diff -u llvm/www/docs/DSGraphStatus.html:1.1 llvm/www/docs/DSGraphStatus.html:1.2 --- llvm/www/docs/DSGraphStatus.html:1.1 Wed Nov 6 20:03:18 2002 +++ llvm/www/docs/DSGraphStatus.html Wed Nov 6 20:07:57 2002 @@ -1,11 +1,11 @@ - - - Data Structure Graph Analysis Status Page - +Data Structure Graph Analysis Status Page - -

Data Structure Graph Analysis Status Page

+

Data Structure Graph Analysis Status Page

+ +This page records information and the progress the data structure analysis +passes have been making. Times are in seconds, sizes are #bytes allocated for a +particular pass.


Nov 6, 2002:

@@ -61,7 +61,7 @@
Chris Lattner
-Last modified: Wed Nov 6 20:01:51 CST 2002 +Last modified: Wed Nov 6 20:05:44 CST 2002 From lattner at cs.uiuc.edu Wed Nov 6 20:09:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 20:09:04 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/generate_report.pl Message-ID: <200211070208.UAA06415@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: generate_report.pl updated: 1.2 -> 1.3 --- Log message: Minor cleanups for script --- Diffs of the changes: Index: llvm/test/DSGraphs/generate_report.pl diff -u llvm/test/DSGraphs/generate_report.pl:1.2 llvm/test/DSGraphs/generate_report.pl:1.3 --- llvm/test/DSGraphs/generate_report.pl:1.2 Wed Nov 6 19:56:35 2002 +++ llvm/test/DSGraphs/generate_report.pl Wed Nov 6 20:08:18 2002 @@ -42,14 +42,14 @@ printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ TOTAL', $Record, 10); printField('real\s+([ms0-9.]+)', $Record, 10); - print "- "; + print "| "; # Print Sizes printField("([0-9]+) Local", $Record, 10); printField("([0-9]+) Bottom-up", $Record, 10); printField("([0-9]+) Top-down", $Record, 10); printField("([0-9]+) TOTAL", $Record, 10); - print "- "; + print "| "; printField("([0-9]+).*completely folded", $Record, 5); printField("\.main\.dot.... \\[([+0-9]+)\\]", $Record, 8); printField("\.__main\.dot.... \\[([0-9+]+)\\]", $Record, 8); @@ -67,5 +67,5 @@ printf("%-${FieldWidth}s", "*"); } else { printf("%-${FieldWidth}s", $1); -} + } } From lattner at cs.uiuc.edu Wed Nov 6 20:19:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 20:19:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/DSGraphStatus.html Message-ID: <200211070218.UAA09065@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: DSGraphStatus.html updated: 1.2 -> 1.3 --- Log message: Add new NumNodes column --- Diffs of the changes: Index: llvm/www/docs/DSGraphStatus.html diff -u llvm/www/docs/DSGraphStatus.html:1.2 llvm/www/docs/DSGraphStatus.html:1.3 --- llvm/www/docs/DSGraphStatus.html:1.2 Wed Nov 6 20:07:57 2002 +++ llvm/www/docs/DSGraphStatus.html Wed Nov 6 20:18:30 2002 @@ -13,47 +13,47 @@ Notes: Debug build, no globals graph, no array collapsing.

-Name:                         LocTime:  BUTime:   TDTime:   TotTime:  AnlzTime:      LocSize:  BUSize:   TDSize:   TotSize:    NumFold main    __main  
-ackermann.llvm.lib            0.0004    0.0005    0.0004    0.0048    0m0.035s  |    6976      992       840       18736     |    *    0+0     0+0     
-ary3.llvm.lib                 0.0008    0.0011    0.0010    0.0073    0m0.067s  |    7992      7808      2416      34264     |    6    0+0     0+0     
-fib2.llvm.lib                 0.0005    0.0007    0.0004    0.0070    0m0.055s  |    1776      5312      1080      23992     |    *    0+0     0+0     
-hash.llvm.lib                 0.0020    0.0031    0.0063    0.0227    0m0.062s  |    17488     23928     12584     67400     |    *    2+0     2+0     
-heapsort.llvm.lib             0.0006    0.0008    0.0007    0.0078    0m0.026s  |    2264      13720     2216      33016     |    *    2+0     2+0     
-hello.llvm.lib                0.0002    0.0002    0.0002    0.0016    0m0.017s  |    504       2816      336       3656      |    *    0+0     0+0     
-lists.llvm.lib                0.0028    0.0098    0.0042    0.0226    0m0.074s  |    22272     14264     12128     60688     |    57   0+0     0+0     
-llubenchmark.llvm.lib         0.0012    0.0011    0.0017    0.0112    0m0.046s  |    9680      2144      9944      32776     |    *    4+1     4+1     
-matrix.llvm.lib               0.0008    0.0013    0.0014    0.0078    0m0.039s  |    7848      10416     2200      36176     |    *    0+0     0+0     
-matrixTranspose.llvm.lib      0.0004    0.0015    0.0019    0.0058    0m0.034s  |    9136      14520     25336     48992     |    *    1+0     1+0     
+Name:                         LocTime:  BUTime:   TDTime:   TotTime:  AnlzTime:      LocSize:  BUSize:   TDSize:   TotSize:    NumFold NumNodes  main    __main  
+ackermann.llvm.lib            0.0004    0.0005    0.0004    0.0045    0m0.040s  |    6976      992       840       18736     |    *    10+0      0+0     0+0     
+ary3.llvm.lib                 0.0008    0.0012    0.0012    0.0074    0m0.034s  |    7992      7808      2416      34264     |    6    37+0      0+0     0+0     
+fib2.llvm.lib                 0.0005    0.0006    0.0004    0.0047    0m0.019s  |    1776      5312      1080      23992     |    *    14+0      0+0     0+0     
+hash.llvm.lib                 0.0020    0.0031    0.0036    0.0157    0m0.046s  |    17488     23928     12584     67400     |    *    131+0     2+0     2+0     
+heapsort.llvm.lib             0.0006    0.0008    0.0007    0.0061    0m0.023s  |    2264      13720     2216      33016     |    *    33+0      2+0     2+0     
+hello.llvm.lib                0.0002    0.0002    0.0002    0.0015    0m0.014s  |    504       2816      336       3656      |    *    2+0       0+0     0+0     
+lists.llvm.lib                0.0029    0.0057    0.0057    0.0203    0m0.077s  |    22272     14264     12128     60688     |    57   38+0      0+0     0+0     
+llubenchmark.llvm.lib         0.0012    0.0011    0.0017    0.0111    0m0.036s  |    9680      2144      9944      32776     |    *    49+8      4+1     4+1     
+matrix.llvm.lib               0.0008    0.0013    0.0014    0.0079    0m0.038s  |    7848      10416     2200      36176     |    *    32+0      0+0     0+0     
+matrixTranspose.llvm.lib      0.0004    0.0015    0.0019    0.0054    0m0.031s  |    9136      14520     25336     48992     |    *    10+0      1+0     1+0     
 methcall.llvm.lib             analyze: DataStructure.cpp:191: bool DSNode::mergeTypeInfo(const Type*, unsigned int): Assertion `Offset < Size && "Cannot merge something into a part of our type that doesn't exist!"' failed.
 objinst.llvm.lib              analyze: DataStructure.cpp:191: bool DSNode::mergeTypeInfo(const Type*, unsigned int): Assertion `Offset < Size && "Cannot merge something into a part of our type that doesn't exist!"' failed.
-pi.llvm.lib                   0.0004    0.0004    0.0005    0.0035    0m0.016s  |    4744      1248      4368      10360     |    *    0+0     0+0     
-printargs.llvm.lib            0.0004    0.0003    0.0003    0.0022    0m0.031s  |    888       504       512       1904      |    *    0+0     0+0     
-random.llvm.lib               0.0005    0.0005    0.0005    0.0062    0m0.021s  |    1584      4704      5752      25264     |    *    2+0     2+0     
-sumarray.llvm.lib             0.0002    0.0003    0.0002    0.0020    0m0.029s  |    976       3424      464       6976      |    3    0+0     0+0     
-sumarray2d.llvm.lib           0.0010    0.0073    0.0090    0.0193    0m0.038s  |    41416     47080     80696     171512    |    *    0+0     0+0     
-sumarraymalloc.llvm.lib       0.0006    0.0007    0.0005    0.0052    0m0.027s  |    2032      5984      1368      23472     |    *    0+0     0+0     
-indvars.llvm.lib              0.0018    0.0207    0.0270    0.0514    0m0.066s  |    82040     87944     160872    333400    |    *    0+0     0+0     
-bh.llvm.lib                   0.0081    0.0129    0.0162    0.0577    0m0.185s  |    55112     75768     42928     240056    |    74   11+0    11+0    
-bisort.llvm.lib               0.0018    0.0024    0.0025    0.0149    0m0.054s  |    12776     18296     6808      48952     |    *    4+0     4+0     
-em3d.llvm.lib                 0.0035    0.0098    0.0179    0.0401    0m0.083s  |    33816     49744     54144     146112    |    10   14+1    14+1    
-health.llvm.lib               0.0034    0.0062    0.0058    0.0244    0m0.088s  |    28432     27992     12640     83992     |    72   6+0     6+0     
-mst.llvm.lib                  0.0024    0.0038    0.0051    0.0191    0m0.077s  |    16520     25840     14016     71048     |    10   9+0     9+0     
-perimeter.llvm.lib            0.0020    0.0033    0.0025    0.0156    0m0.046s  |    13968     12720     3928      43272     |    *    1+0     1+0     
-power.llvm.lib                0.0028    0.0039    0.0063    0.0208    0m0.064s  |    20960     30136     23504     82696     |    *    4+0     4+0     
-treeadd.llvm.lib              0.0008    0.0010    0.0008    0.0065    0m0.023s  |    7928      6424      2088      28432     |    *    1+0     1+0     
-tsp.llvm.lib                  0.0034    0.0037    0.0033    0.0184    0m0.055s  |    17304     13808     17968     63704     |    18   4+0     4+0     
-voronoi.llvm.lib              0.0135    0.0197    0.0526    0.1006    0m0.212s  |    78560     83336     116312    292200    |    19   16+0    16+0    
-optimizer-eval.llvm.lib       0.0096    0.1005    0.3984    0.5400    0m0.667s  |    76736     140000    409448    644528    |    58   7+0     7+0     
-sgefa.llvm.lib                0.0060    0.0263    0.0336    0.0824    0m0.144s  |    82280     96016     67728     270712    |    *    2+0     2+0     
-sieve.llvm.lib                0.0006    0.0023    0.0068    0.0137    0m0.050s  |    9872      13808     38872     76312     |    *    1+0     1+0     
-sim.llvm.lib                  0.0133    0.2114    1.0950    1.3635    0m1.521s  |    62864     98984     200600    457536    |    *    71+7    71+7    
-164.gzip.llvm.lib             0.0221    0.0817    0.2879    0.4718    0m1.014s  |    235048    421864    1439120   2192624   |    17   114+1   114+1   
-181.mcf.lib                   0.0119    0.0349    0.1130    0.1824    0m0.306s  |    120504    192920    545720    876032    |    195  14+0    14+0    
+pi.llvm.lib                   0.0005    0.0004    0.0005    0.0032    0m0.027s  |    4744      1248      4368      10360     |    *    14+0      0+0     0+0     
+printargs.llvm.lib            0.0003    0.0005    0.0003    0.0023    0m0.042s  |    888       504       512       1904      |    *    5+0       0+0     0+0     
+random.llvm.lib               0.0005    0.0005    0.0005    0.0056    0m0.032s  |    1584      4704      5752      25264     |    *    21+0      2+0     2+0     
+sumarray.llvm.lib             0.0002    0.0003    0.0002    0.0020    0m0.034s  |    976       3424      464       6976      |    3    5+0       0+0     0+0     
+sumarray2d.llvm.lib           0.0010    0.0077    0.0111    0.0216    0m0.047s  |    41416     47080     80696     171512    |    *    9+0       0+0     0+0     
+sumarraymalloc.llvm.lib       0.0007    0.0007    0.0005    0.0054    0m0.032s  |    2032      5984      1368      23472     |    *    17+0      0+0     0+0     
+indvars.llvm.lib              0.0018    0.0189    0.0264    0.0490    0m0.065s  |    82040     87944     160872    333400    |    *    12+0      0+0     0+0     
+bh.llvm.lib                   0.0113    0.0128    0.0163    0.0597    0m0.148s  |    55112     75768     42928     240056    |    74   400+5     11+0    11+0    
+bisort.llvm.lib               0.0018    0.0024    0.0024    0.0123    0m0.051s  |    12776     18296     6808      48952     |    *    89+0      4+0     4+0     
+em3d.llvm.lib                 0.0035    0.0098    0.0196    0.0490    0m0.103s  |    33816     49744     54144     146112    |    10   518+33    14+1    14+1    
+health.llvm.lib               0.0033    0.0061    0.0057    0.0226    0m0.088s  |    28432     27992     12640     83992     |    72   151+1     6+0     6+0     
+mst.llvm.lib                  0.0025    0.0039    0.0050    0.0192    0m0.074s  |    16520     25840     14016     71048     |    10   217+1     9+0     9+0     
+perimeter.llvm.lib            0.0020    0.0032    0.0025    0.0154    0m0.045s  |    13968     12720     3928      43272     |    *    35+0      1+0     1+0     
+power.llvm.lib                0.0027    0.0039    0.0060    0.0232    0m0.062s  |    20960     30136     23504     82696     |    *    146+0     4+0     4+0     
+treeadd.llvm.lib              0.0009    0.0010    0.0008    0.0070    0m0.054s  |    7928      6424      2088      28432     |    *    27+0      1+0     1+0     
+tsp.llvm.lib                  0.0035    0.0034    0.0032    0.0187    0m0.064s  |    17304     13808     17968     63704     |    18   95+1      4+0     4+0     
+voronoi.llvm.lib              0.0093    0.0193    0.0567    0.1033    0m0.199s  |    78560     83336     116312    292200    |    19   1006+0    16+0    16+0    
+optimizer-eval.llvm.lib       0.0099    0.1017    0.4073    0.5492    0m0.674s  |    76736     140000    409448    644528    |    58   1259+23   7+0     7+0     
+sgefa.llvm.lib                0.0057    0.0283    0.0357    0.0863    0m0.153s  |    82280     96016     67728     270712    |    *    121+2     2+0     2+0     
+sieve.llvm.lib                0.0006    0.0020    0.0030    0.0096    0m0.033s  |    9872      13808     38872     76312     |    *    22+0      1+0     1+0     
+sim.llvm.lib                  0.0134    0.2127    1.1230    1.3938    0m1.559s  |    62864     98984     200600    457536    |    *    1807+206  71+7    71+7    
+164.gzip.llvm.lib             0.0225    0.0727    0.2910    0.4651    0m1.003s  |    235048    421864    1439120   2192624   |    17   9181+106  114+1   114+1   
+181.mcf.lib                   0.0121    0.0354    0.1096    0.1780    0m0.292s  |    120504    192920    545720    876032    |    195  753+0     14+0    14+0    
 197.parser.lib                analyze: ../../../include/llvm/Analysis/DSNode.h:74: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed.
 254.gap.lib                   analyze: ../../../include/llvm/Analysis/DSNode.h:74: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed.
 255.vortex.lib                analyze: DataStructure.cpp:191: bool DSNode::mergeTypeInfo(const Type*, unsigned int): Assertion `Offset < Size && "Cannot merge something into a part of our type that doesn't exist!"' failed.
-256.bzip2.lib                 0.0151    0.0609    0.6638    0.7968    0m1.050s  |    210880    387776    3371632   4041800   |    18   65+1    65+1    
-300.twolf.lib                 0.1784    0.5300    42.3220   43.6094   0m45.547s |    522056    653816    10076992  11252864  |    1269 410+12  410+12  
+256.bzip2.lib                 0.0149    0.0604    0.6503    0.7810    0m1.027s  |    210880    387776    3371632   4041800   |    18   5005+76   65+1    65+1    
+300.twolf.lib                 0.1806    0.5248    42.5463   43.8329   0m45.785s |    522056    653816    10076992  11252864  |    1269 *         410+12  410+12  
 burg.llvm.lib                 analyze: ../../../include/llvm/Analysis/DSNode.h:74: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed.
 
@@ -61,7 +61,7 @@
Chris Lattner
-Last modified: Wed Nov 6 20:05:44 CST 2002 +Last modified: Wed Nov 6 20:18:06 CST 2002 From lattner at cs.uiuc.edu Wed Nov 6 20:19:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 20:19:04 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp Message-ID: <200211070218.UAA08050@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Printer.cpp updated: 1.34 -> 1.35 --- Log message: Compute total number of nodes and # call nodes --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.34 llvm/lib/Analysis/DataStructure/Printer.cpp:1.35 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.34 Wed Nov 6 19:54:44 2002 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Wed Nov 6 20:18:46 2002 @@ -167,9 +167,12 @@ return; } + unsigned TotalNumNodes = 0, TotalCallNodes = 0; for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) if (!I->isExternal()) { DSGraph &Gr = C.getDSGraph((Function&)*I); + TotalNumNodes += Gr.getGraphSize(); + TotalCallNodes += Gr.getFunctionCalls().size(); if (I->getName() == "main" || !OnlyPrintMain) Gr.writeGraphToFile(O, Prefix+I->getName()); else { @@ -177,6 +180,9 @@ << Gr.getGraphSize() << "+" << Gr.getFunctionCalls().size() << "]\n"; } } + + O << "\nGraphs contain [" << TotalNumNodes << "+" << TotalCallNodes + << "] nodes total\n"; } From lattner at cs.uiuc.edu Wed Nov 6 20:20:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 20:20:01 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/generate_report.pl Message-ID: <200211070219.UAA08069@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: generate_report.pl updated: 1.3 -> 1.4 --- Log message: Add information about total # nodes in graph --- Diffs of the changes: Index: llvm/test/DSGraphs/generate_report.pl diff -u llvm/test/DSGraphs/generate_report.pl:1.3 llvm/test/DSGraphs/generate_report.pl:1.4 --- llvm/test/DSGraphs/generate_report.pl:1.3 Wed Nov 6 20:08:18 2002 +++ llvm/test/DSGraphs/generate_report.pl Wed Nov 6 20:19:04 2002 @@ -21,11 +21,13 @@ # first test. shift @Records; -printf("%-30s%-10s%-10s%-10s%-10s%-10s %-10s%-10s%-10s%-10s %-8s%-8s%-8s\n", +printf("%-30s%-10s%-10s%-10s%-10s%-10s " . + "%-10s%-10s%-10s%-10s " . + "%-8s%-10s%-8s%-8s\n", "Name:", "LocTime:", "BUTime:", "TDTime:", "TotTime:", "AnlzTime:", "LocSize:", "BUSize:", "TDSize:", "TotSize:", - "NumFold", "main", "__main"); + "NumFold", "NumNodes", "main", "__main"); foreach $Record (@Records) { # Print BM name @@ -51,7 +53,8 @@ print "| "; printField("([0-9]+).*completely folded", $Record, 5); - printField("\.main\.dot.... \\[([+0-9]+)\\]", $Record, 8); + printField("Graphs contain \\[([0-9+]+)\\] nodes total", $Record, 10); + printField("\.main\.dot.... \\[([0-9+]+)\\]", $Record, 8); printField("\.__main\.dot.... \\[([0-9+]+)\\]", $Record, 8); } print "\n"; From lattner at cs.uiuc.edu Wed Nov 6 21:54:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 21:54:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/DSGraphStatus.html Message-ID: <200211070353.VAA10086@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: DSGraphStatus.html updated: 1.3 -> 1.4 --- Log message: Update info now that bugfixes have been applied --- Diffs of the changes: Index: llvm/www/docs/DSGraphStatus.html diff -u llvm/www/docs/DSGraphStatus.html:1.3 llvm/www/docs/DSGraphStatus.html:1.4 --- llvm/www/docs/DSGraphStatus.html:1.3 Wed Nov 6 20:18:30 2002 +++ llvm/www/docs/DSGraphStatus.html Wed Nov 6 21:53:27 2002 @@ -24,8 +24,8 @@ llubenchmark.llvm.lib 0.0012 0.0011 0.0017 0.0111 0m0.036s | 9680 2144 9944 32776 | * 49+8 4+1 4+1 matrix.llvm.lib 0.0008 0.0013 0.0014 0.0079 0m0.038s | 7848 10416 2200 36176 | * 32+0 0+0 0+0 matrixTranspose.llvm.lib 0.0004 0.0015 0.0019 0.0054 0m0.031s | 9136 14520 25336 48992 | * 10+0 1+0 1+0 -methcall.llvm.lib analyze: DataStructure.cpp:191: bool DSNode::mergeTypeInfo(const Type*, unsigned int): Assertion `Offset < Size && "Cannot merge something into a part of our type that doesn't exist!"' failed. -objinst.llvm.lib analyze: DataStructure.cpp:191: bool DSNode::mergeTypeInfo(const Type*, unsigned int): Assertion `Offset < Size && "Cannot merge something into a part of our type that doesn't exist!"' failed. +methcall.llvm.lib 0.0010 0.0018 0.0030 0.0108 0m0.080s | 3952 17528 9024 44160 | 30 112+52 7+4 7+4 +objinst.llvm.lib 0.0011 0.0018 0.0058 0.0149 0m0.061s | 9480 19064 13192 55392 | 37 163+80 7+4 7+4 pi.llvm.lib 0.0005 0.0004 0.0005 0.0032 0m0.027s | 4744 1248 4368 10360 | * 14+0 0+0 0+0 printargs.llvm.lib 0.0003 0.0005 0.0003 0.0023 0m0.042s | 888 504 512 1904 | * 5+0 0+0 0+0 random.llvm.lib 0.0005 0.0005 0.0005 0.0056 0m0.032s | 1584 4704 5752 25264 | * 21+0 2+0 2+0 @@ -51,7 +51,7 @@ 181.mcf.lib 0.0121 0.0354 0.1096 0.1780 0m0.292s | 120504 192920 545720 876032 | 195 753+0 14+0 14+0 197.parser.lib analyze: ../../../include/llvm/Analysis/DSNode.h:74: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed. 254.gap.lib analyze: ../../../include/llvm/Analysis/DSNode.h:74: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed. -255.vortex.lib analyze: DataStructure.cpp:191: bool DSNode::mergeTypeInfo(const Type*, unsigned int): Assertion `Offset < Size && "Cannot merge something into a part of our type that doesn't exist!"' failed. +255.vortex.lib analyze: ../../../include/llvm/Analysis/DSNode.h:74: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed. 256.bzip2.lib 0.0149 0.0604 0.6503 0.7810 0m1.027s | 210880 387776 3371632 4041800 | 18 5005+76 65+1 65+1 300.twolf.lib 0.1806 0.5248 42.5463 43.8329 0m45.785s | 522056 653816 10076992 11252864 | 1269 * 410+12 410+12 burg.llvm.lib analyze: ../../../include/llvm/Analysis/DSNode.h:74: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed. @@ -61,7 +61,7 @@
Chris Lattner
-Last modified: Wed Nov 6 20:18:06 CST 2002 +Last modified: Wed Nov 6 21:50:19 CST 2002 From lattner at cs.uiuc.edu Wed Nov 6 23:00:02 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 23:00:02 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200211070459.WAA09600@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.45 -> 1.46 --- Log message: Minor bugfix to enable generation of methcall.llvm.lib, objinst.llvm.lib, and The problem was merging two unsized types like function's, ie int (int*) with int (uint *) --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.45 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.46 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.45 Wed Nov 6 19:54:56 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Wed Nov 6 22:59:28 2002 @@ -187,7 +187,7 @@ return mergeTypeInfo(OldTy, 0); } - assert(Offset < Size && + assert(Offset <= Size && "Cannot merge something into a part of our type that doesn't exist!"); // Find the section of Ty.Ty that NewTy overlaps with... first we find the @@ -234,7 +234,7 @@ // structure, the type desired may actually be the first element of the // composite type... // - unsigned SubTypeSize = TD.getTypeSize(SubType); + unsigned SubTypeSize = SubType->isSized() ? TD.getTypeSize(SubType) : 0; while (SubType != NewTy) { const Type *NextSubType = 0; unsigned NextSubTypeSize; From lattner at cs.uiuc.edu Wed Nov 6 23:01:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 23:01:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/IPModRef.cpp Message-ID: <200211070500.XAA09618@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: IPModRef.cpp updated: 1.5 -> 1.6 --- Log message: Fix problem with dangling referrers --- Diffs of the changes: Index: llvm/lib/Analysis/IPA/IPModRef.cpp diff -u llvm/lib/Analysis/IPA/IPModRef.cpp:1.5 llvm/lib/Analysis/IPA/IPModRef.cpp:1.6 --- llvm/lib/Analysis/IPA/IPModRef.cpp:1.5 Wed Nov 6 13:59:33 2002 +++ llvm/lib/Analysis/IPA/IPModRef.cpp Wed Nov 6 23:00:35 2002 @@ -158,6 +158,9 @@ if (csgNodes[i]->isRead()) callModRefInfo->setNodeIsRef(getNodeId(origNodes[i])); } + + // Drop nodemap before we delete the graph... + NodeMap.clear(); delete csgp; } @@ -194,7 +197,6 @@ // class IPModRef: An interprocedural pass that computes IP Mod/Ref info. //---------------------------------------------------------------------------- - // Free the FunctionModRefInfo objects cached in funcToModRefInfoMap. // void IPModRef::releaseMemory() @@ -215,6 +217,7 @@ bool IPModRef::run(Module &theModule) { M = &theModule; + for (Module::const_iterator FI = M->begin(), FE = M->end(); FI != FE; ++FI) if (! FI->isExternal()) getFuncInfo(*FI, /*computeIfMissing*/ true); From lattner at cs.uiuc.edu Wed Nov 6 23:22:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 23:22:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp DataStructure.cpp Local.cpp TopDownClosure.cpp Message-ID: <200211070521.XAA09859@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.31 -> 1.32 DataStructure.cpp updated: 1.46 -> 1.47 Local.cpp updated: 1.28 -> 1.29 TopDownClosure.cpp updated: 1.18 -> 1.19 --- Log message: Rename DataStructureAnalysis namespace to DS --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.31 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.32 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.31 Wed Nov 6 00:16:30 2002 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Wed Nov 6 23:20:53 2002 @@ -16,13 +16,7 @@ static RegisterAnalysis X("budatastructure", "Bottom-up Data Structure Analysis Closure"); -namespace DataStructureAnalysis { // TODO: FIXME: Eliminate - // isPointerType - Return true if this first class type is big enough to hold - // a pointer. - // - bool isPointerType(const Type *Ty); -} -using namespace DataStructureAnalysis; +using namespace DS; // releaseMemory - If the pass pipeline is done with this pass, we can release Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.46 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.47 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.46 Wed Nov 6 22:59:28 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Wed Nov 6 23:20:53 2002 @@ -20,14 +20,10 @@ Statistic<> NumFolds("dsnode", "Number of nodes completely folded"); }; -namespace DataStructureAnalysis { // TODO: FIXME - // isPointerType - Return true if this first class type is big enough to hold - // a pointer. - // - bool isPointerType(const Type *Ty); +namespace DS { // TODO: FIXME extern TargetData TD; } -using namespace DataStructureAnalysis; +using namespace DS; //===----------------------------------------------------------------------===// // DSNode Implementation Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.28 llvm/lib/Analysis/DataStructure/Local.cpp:1.29 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.28 Wed Nov 6 00:20:09 2002 +++ llvm/lib/Analysis/DataStructure/Local.cpp Wed Nov 6 23:20:53 2002 @@ -30,12 +30,9 @@ static RegisterAnalysis X("datastructure", "Local Data Structure Analysis"); -using namespace DataStructureAnalysis; - -namespace DataStructureAnalysis { +namespace DS { // FIXME: Do something smarter with target data! TargetData TD("temp-td"); - unsigned PointerSize(TD.getPointerSize()); // isPointerType - Return true if this type is big enough to hold a pointer. bool isPointerType(const Type *Ty) { @@ -46,6 +43,7 @@ return false; } } +using namespace DS; namespace { Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.18 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.19 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.18 Wed Nov 6 00:16:30 2002 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Wed Nov 6 23:20:53 2002 @@ -68,7 +68,7 @@ for (unsigned i = 0, e = CallSite.getNumPtrArgs(); i != e; ++i, ++AI) { // Advance the argument iterator to the first pointer argument... - while (!DataStructureAnalysis::isPointerType(AI->getType())) ++AI; + while (!DS::isPointerType(AI->getType())) ++AI; // TD ...Merge the formal arg scalar with the actual arg node DSNodeHandle &NodeForFormal = Graph.getNodeForValue(AI); From lattner at cs.uiuc.edu Wed Nov 6 23:22:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Nov 6 23:22:04 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSSupport.h Message-ID: <200211070521.XAA09870@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSSupport.h updated: 1.4 -> 1.5 --- Log message: Expose isPointerType to clients of dsanalysis --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSSupport.h diff -u llvm/include/llvm/Analysis/DSSupport.h:1.4 llvm/include/llvm/Analysis/DSSupport.h:1.5 --- llvm/include/llvm/Analysis/DSSupport.h:1.4 Wed Nov 6 12:02:26 2002 +++ llvm/include/llvm/Analysis/DSSupport.h Wed Nov 6 23:21:15 2002 @@ -26,6 +26,11 @@ enum { PointerShift = 3, // 64bit ptrs = 3, 32 bit ptrs = 2 PointerSize = 1 << PointerShift }; + + // isPointerType - Return true if this first class type is big enough to hold + // a pointer. + // + bool isPointerType(const Type *Ty); }; //===----------------------------------------------------------------------===// From lattner at cs.uiuc.edu Thu Nov 7 00:31:02 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 00:31:02 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200211070630.AAA13007@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.27 -> 1.28 --- Log message: Add new method --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.27 llvm/include/llvm/Analysis/DSGraph.h:1.28 --- llvm/include/llvm/Analysis/DSGraph.h:1.27 Wed Nov 6 11:00:41 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Thu Nov 7 00:30:17 2002 @@ -136,6 +136,15 @@ std::map &OldNodeMap, bool StripAllocas = false); + /// mergeInGraph - The method is used for merging graphs together. If the + /// argument graph is not *this, it makes a clone of the specified graph, then + /// merges the nodes specified in the call site with the formal arguments in + /// the graph. If the StripAlloca's argument is true then Alloca markers are + /// removed from nodes. + /// + void mergeInGraph(DSCallSite &CS, const DSGraph &Graph, bool StripAllocas); + + #if 0 // cloneGlobalInto - Clone the given global node (or the node for the given // GlobalValue) from the GlobalsGraph and all its target links (recursively). From lattner at cs.uiuc.edu Thu Nov 7 00:33:02 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 00:33:02 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp DataStructure.cpp TopDownClosure.cpp Message-ID: <200211070632.AAA13022@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.32 -> 1.33 DataStructure.cpp updated: 1.47 -> 1.48 TopDownClosure.cpp updated: 1.19 -> 1.20 --- Log message: Implement a new mergeInGraph method, which basically factors code out of the BU class. This will be used by the IPModRef class to do stuff, eventually perhaps the TD pass will use it also. Speaking of the TD pass, this also eliminates the self recursive case, which was broken, and couldn't occur anyway. --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.32 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.33 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.32 Wed Nov 6 23:20:53 2002 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Thu Nov 7 00:31:54 2002 @@ -46,29 +46,6 @@ return false; } -// ResolveArguments - Resolve the formal and actual arguments for a function -// call. -// -static void ResolveArguments(DSCallSite &Call, Function &F, - map &ScalarMap) { - // Resolve all of the function arguments... - Function::aiterator AI = F.abegin(); - for (unsigned i = 0, e = Call.getNumPtrArgs(); i != e; ++i, ++AI) { - // Advance the argument iterator to the first pointer argument... - while (!isPointerType(AI->getType())) { - ++AI; -#ifndef NDEBUG - if (AI == F.aend()) - std::cerr << "Bad call to Function: " << F.getName() << "\n"; -#endif - assert(AI != F.aend() && "# Args provided is not # Args required!"); - } - - // Add the link from the argument scalar to the provided value - ScalarMap[AI].mergeWith(Call.getPtrArg(i)); - } -} - DSGraph &BUDataStructures::calculateGraph(Function &F) { // Make sure this graph has not already been calculated, or that we don't get // into an infinite loop with mutually recursive functions. @@ -115,11 +92,8 @@ // actual arguments... DEBUG(std::cerr << "\t[BU] Self Inlining: " << F.getName() << "\n"); - // Handle the return value if present... - Graph->getRetNode().mergeWith(Call.getRetVal()); - - // Resolve the arguments in the call to the actual values... - ResolveArguments(Call, F, Graph->getScalarMap()); + // Handle self recursion by resolving the arguments and return value + Graph->mergeInGraph(Call, *Graph, true); // Erase the entry in the callees vector Callees.erase(Callees.begin()+c--); @@ -145,22 +119,8 @@ CallSitesForFunc.back().setResolvingCaller(&F); CallSitesForFunc.back().setCallee(0); - // 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. - map OldValMap; - 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 - DSNodeHandle RetVal = Graph->cloneInto(GI, OldValMap, OldNodeMap, - /*StripAllocas*/ true); - - // Resolve the arguments in the call to the actual values... - ResolveArguments(Call, FI, OldValMap); - - // Handle the return value if present... - RetVal.mergeWith(Call.getRetVal()); + // Handle self recursion by resolving the arguments and return value + Graph->mergeInGraph(Call, GI, true); // Erase the entry in the Callees vector Callees.erase(Callees.begin()+c--); Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.47 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.48 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.47 Wed Nov 6 23:20:53 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Thu Nov 7 00:31:54 2002 @@ -90,6 +90,7 @@ Links[0].mergeWith(Links[i]); Links.resize(1); } + /// isNodeCompletelyFolded - Return true if this node has been completely /// folded down to something that can never be expanded, effectively losing /// all of the field sensitivity that may be present in the node. @@ -571,6 +572,57 @@ // Return the returned node pointer... return DSNodeHandle(OldNodeMap[G.RetNode.getNode()], G.RetNode.getOffset()); +} + +/// mergeInGraph - The method is used for merging graphs together. If the +/// argument graph is not *this, it makes a clone of the specified graph, then +/// merges the nodes specified in the call site with the formal arguments in the +/// graph. +/// +void DSGraph::mergeInGraph(DSCallSite &CS, const DSGraph &Graph, + bool StripAllocas) { + std::map OldValMap; + DSNodeHandle RetVal; + std::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; + + // The clone call may invalidate any of the vectors in the data + // structure graph. Strip locals and don't copy the list of callers + RetVal = cloneInto(Graph, OldValMap, OldNodeMap, StripAllocas); + ScalarMap = &OldValMap; + } else { + RetVal = getRetNode(); + ScalarMap = &getScalarMap(); + } + + // Merge the return value with the return value of the context... + RetVal.mergeWith(CS.getRetVal()); + + // Resolve all of the function arguments... + Function &F = Graph.getFunction(); + Function::aiterator AI = F.abegin(); + for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i, ++AI) { + // Advance the argument iterator to the first pointer argument... + while (!isPointerType(AI->getType())) { + ++AI; +#ifndef NDEBUG + if (AI == F.aend()) + std::cerr << "Bad call to Function: " << F.getName() << "\n"; +#endif + assert(AI != F.aend() && "# Args provided is not # Args required!"); + } + + // Add the link from the argument scalar to the provided value + DSNodeHandle &NH = (*ScalarMap)[AI]; + assert(NH.getNode() && "Pointer argument without scalarmap entry?"); + NH.mergeWith(CS.getPtrArg(i)); + } } #if 0 Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.19 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.20 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.19 Wed Nov 6 23:20:53 2002 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Thu Nov 7 00:31:54 2002 @@ -149,36 +149,36 @@ DEBUG(std::cerr << "\t [TD] Inlining caller #" << c << " '" << Caller.getName() << "' into callee: " << F.getName() << "\n"); - if (&Caller == &F) { - // Self-recursive call: this can happen after a cycle of calls is inlined. - ResolveCallSite(*Graph, CallSite); - } else { + // Self recursion is not tracked in BU pass... + assert(&Caller != &F && "This cannot happen!\n"); - // Recursively compute the graph for the Caller. It should be fully - // resolved except if there is mutual recursion... - // - DSGraph &CG = calculateGraph(Caller); // Graph to inline - - DEBUG(std::cerr << "\t\t[TD] Got graph for " << Caller.getName() - << " in: " << F.getName() << "\n"); + // Recursively compute the graph for the Caller. It should be fully + // resolved except if there is mutual recursion... + // + DSGraph &CG = calculateGraph(Caller); // Graph to inline + + DEBUG(std::cerr << "\t\t[TD] Got graph for " << Caller.getName() + << " in: " << F.getName() << "\n"); + + // Translate call site from having links into the BU graph + DSCallSite CallSiteInCG(CallSite, BUMaps[&Caller]); - // These two maps keep track of where scalars in the old graph _used_ - // to point to, and of new nodes matching nodes of the old graph. - std::map OldValMap; - std::map OldNodeMap; + // These two maps keep track of where scalars in the old graph _used_ + // to point to, and of new nodes matching nodes of the old graph. + std::map OldValMap; + std::map OldNodeMap; - // Translate call site from having links into the BU graph - DSCallSite CallSiteInCG(CallSite, BUMaps[&Caller]); - - // Clone the Caller's graph into the current graph, keeping - // track of where scalars in the old graph _used_ to point... - // Do this here because it only needs to happens once for each Caller! - // Strip scalars but not allocas since they are alive in callee. - // - DSNodeHandle RetVal = Graph->cloneInto(CG, OldValMap, OldNodeMap, - /*StripAllocas*/ false); - ResolveCallSite(*Graph, DSCallSite(CallSiteInCG, OldNodeMap)); - } + // FIXME: Eventually use DSGraph::mergeInGraph here... + // Graph->mergeInGraph(CallSiteInCG, CG, false); + + // Clone the Caller's graph into the current graph, keeping + // track of where scalars in the old graph _used_ to point... + // Do this here because it only needs to happens once for each Caller! + // Strip scalars but not allocas since they are alive in callee. + // + DSNodeHandle RetVal = Graph->cloneInto(CG, OldValMap, OldNodeMap, + /*StripAllocas*/ false); + ResolveCallSite(*Graph, DSCallSite(CallSiteInCG, OldNodeMap)); } // Recompute the Incomplete markers and eliminate unreachable nodes. From lattner at cs.uiuc.edu Thu Nov 7 01:07:02 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 01:07:02 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200211070706.BAA14455@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.28 -> 1.29 --- Log message: Instead of using a bool that constant has to be explained, use a self explanitory enum instead. --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.28 llvm/include/llvm/Analysis/DSGraph.h:1.29 --- llvm/include/llvm/Analysis/DSGraph.h:1.28 Thu Nov 7 00:30:17 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Thu Nov 7 01:05:56 2002 @@ -125,25 +125,30 @@ // void removeDeadNodes(bool KeepAllGlobals = false, bool KeepCalls = true); + enum AllocaBit { + StripAllocaBit, + KeepAllocaBit + }; + // cloneInto - Clone the specified DSGraph into the current graph, returning // the Return node of the graph. The translated ScalarMap for the old - // function is filled into the OldValMap member. If StripScalars - // (StripAllocas) is set to true, Scalar (Alloca) markers are removed from the - // graph as the graph is being cloned. + // function is filled into the OldValMap member. If StripAllocas is set to + // 'StripAllocaBit', Alloca markers are removed from the graph as the graph is + // being cloned. // DSNodeHandle cloneInto(const DSGraph &G, std::map &OldValMap, std::map &OldNodeMap, - bool StripAllocas = false); + AllocaBit StripAllocas = KeepAllocaBit); /// mergeInGraph - The method is used for merging graphs together. If the /// argument graph is not *this, it makes a clone of the specified graph, then /// merges the nodes specified in the call site with the formal arguments in - /// the graph. If the StripAlloca's argument is true then Alloca markers are - /// removed from nodes. + /// the graph. If the StripAlloca's argument is 'StripAllocaBit' then Alloca + /// markers are removed from nodes. /// - void mergeInGraph(DSCallSite &CS, const DSGraph &Graph, bool StripAllocas); - + void mergeInGraph(DSCallSite &CS, const DSGraph &Graph, + AllocaBit StripAllocas); #if 0 // cloneGlobalInto - Clone the given global node (or the node for the given From lattner at cs.uiuc.edu Thu Nov 7 01:07:07 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 01:07:07 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp DataStructure.cpp TopDownClosure.cpp Message-ID: <200211070706.BAA14495@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.33 -> 1.34 DataStructure.cpp updated: 1.48 -> 1.49 TopDownClosure.cpp updated: 1.20 -> 1.21 --- Log message: Instead of using a bool that constant has to be explained, use a self explanitory enum instead. --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.33 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.34 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.33 Thu Nov 7 00:31:54 2002 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Thu Nov 7 01:06:20 2002 @@ -93,7 +93,7 @@ DEBUG(std::cerr << "\t[BU] Self Inlining: " << F.getName() << "\n"); // Handle self recursion by resolving the arguments and return value - Graph->mergeInGraph(Call, *Graph, true); + Graph->mergeInGraph(Call, *Graph, DSGraph::StripAllocaBit); // Erase the entry in the callees vector Callees.erase(Callees.begin()+c--); @@ -120,7 +120,7 @@ CallSitesForFunc.back().setCallee(0); // Handle self recursion by resolving the arguments and return value - Graph->mergeInGraph(Call, GI, true); + Graph->mergeInGraph(Call, GI, DSGraph::StripAllocaBit); // Erase the entry in the Callees vector Callees.erase(Callees.begin()+c--); Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.48 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.49 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.48 Thu Nov 7 00:31:54 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Thu Nov 7 01:06:20 2002 @@ -526,7 +526,7 @@ DSNodeHandle DSGraph::cloneInto(const DSGraph &G, std::map &OldValMap, std::map &OldNodeMap, - bool StripAllocas) { + AllocaBit StripAllocas) { assert(OldNodeMap.empty() && "Returned OldNodeMap should be empty!"); unsigned FN = Nodes.size(); // First new node... @@ -544,11 +544,10 @@ for (unsigned i = FN, e = Nodes.size(); i != e; ++i) Nodes[i]->remapLinks(OldNodeMap); - // Remove local markers as specified - unsigned char StripBits = StripAllocas ? DSNode::AllocaNode : 0; - if (StripBits) + // Remove alloca markers as specified + if (StripAllocas == StripAllocaBit) for (unsigned i = FN, e = Nodes.size(); i != e; ++i) - Nodes[i]->NodeType &= ~StripBits; + Nodes[i]->NodeType &= ~DSNode::AllocaNode; // Copy the value map... and merge all of the global nodes... for (std::map::const_iterator I = G.ScalarMap.begin(), @@ -580,7 +579,7 @@ /// graph. /// void DSGraph::mergeInGraph(DSCallSite &CS, const DSGraph &Graph, - bool StripAllocas) { + AllocaBit StripAllocas) { std::map OldValMap; DSNodeHandle RetVal; std::map *ScalarMap = &OldValMap; Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.20 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.21 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.20 Thu Nov 7 00:31:54 2002 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Thu Nov 7 01:06:20 2002 @@ -177,7 +177,7 @@ // Strip scalars but not allocas since they are alive in callee. // DSNodeHandle RetVal = Graph->cloneInto(CG, OldValMap, OldNodeMap, - /*StripAllocas*/ false); + DSGraph::KeepAllocaBit); ResolveCallSite(*Graph, DSCallSite(CallSiteInCG, OldNodeMap)); } From lattner at cs.uiuc.edu Thu Nov 7 01:12:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 01:12:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/IPModRef.h Message-ID: <200211070711.BAA14542@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: IPModRef.h updated: 1.5 -> 1.6 --- Log message: Add interfaces for ResolveCallSiteModRefInfo --- Diffs of the changes: Index: llvm/include/llvm/Analysis/IPModRef.h diff -u llvm/include/llvm/Analysis/IPModRef.h:1.5 llvm/include/llvm/Analysis/IPModRef.h:1.6 --- llvm/include/llvm/Analysis/IPModRef.h:1.5 Wed Nov 6 13:59:31 2002 +++ llvm/include/llvm/Analysis/IPModRef.h Thu Nov 7 01:11:49 2002 @@ -125,7 +125,7 @@ void computeModRef (const Function &func); void computeModRef (const CallInst& callInst); - DSGraph *ResolveCallSiteModRefInfo(const CallInst &CI, + DSGraph *ResolveCallSiteModRefInfo(CallInst &CI, std::map &NodeMap); public: @@ -202,6 +202,11 @@ const FunctionModRefInfo& getFunctionModRefInfo(const Function& func) { return getFuncInfo(func); } + + /// getBUDSGraph - This method returns the BU data structure graph for F + /// through the use of the BUDataStructures object. + /// + const DSGraph &getBUDSGraph(const Function &F); // Debugging support methods // From lattner at cs.uiuc.edu Thu Nov 7 01:13:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 01:13:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/IPModRef.cpp Message-ID: <200211070712.BAA14551@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: IPModRef.cpp updated: 1.6 -> 1.7 --- Log message: Implement ResolveCallSiteModRefInfo for IPModRef. computeModRef is not yet done though! --- Diffs of the changes: Index: llvm/lib/Analysis/IPA/IPModRef.cpp diff -u llvm/lib/Analysis/IPA/IPModRef.cpp:1.6 llvm/lib/Analysis/IPA/IPModRef.cpp:1.7 --- llvm/lib/Analysis/IPA/IPModRef.cpp:1.6 Wed Nov 6 23:00:35 2002 +++ llvm/lib/Analysis/IPA/IPModRef.cpp Thu Nov 7 01:12:23 2002 @@ -109,8 +109,11 @@ // // NOTE: Because this clones a dsgraph and returns it, the caller is responsible // for deleting the returned graph! +// NOTE: This method may return a null pointer if it is unable to determine the +// requested information (because the call site calls an external +// function or we cannot determine the complete set of functions invoked). // -DSGraph *FunctionModRefInfo::ResolveCallSiteModRefInfo(const CallInst &CI, +DSGraph *FunctionModRefInfo::ResolveCallSiteModRefInfo(CallInst &CI, std::map &NodeMap) { // Step #1: Clone the top-down graph... @@ -126,8 +129,46 @@ // Step #2: Clear Mod/Ref information... Result->maskNodeTypes(~(DSNode::Modified | DSNode::Read)); + // Step #3: clone the bottom up graphs for the callees into the caller graph + if (const Function *F = CI.getCalledFunction()) { + if (F->isExternal()) { + delete Result; + return 0; // We cannot compute Mod/Ref info for this callsite... + } + + // Build up a DSCallSite for our invocation point here... - + // If the call returns a value, make sure to merge the nodes... + DSNodeHandle RetVal; + if (DS::isPointerType(CI.getType())) + RetVal = Result->getNodeForValue(&CI); + + // Populate the arguments list... + std::vector Args; + for (unsigned i = 1, e = CI.getNumOperands(); i != e; ++i) + if (DS::isPointerType(CI.getOperand(i)->getType())) + Args.push_back(Result->getNodeForValue(CI.getOperand(i))); + + // Build the call site... + DSCallSite CS(CI, RetVal, 0, Args); + + // Perform the merging now of the graph for the callee, which will come with + // mod/ref bits set... + Result->mergeInGraph(CS, IPModRefObj.getBUDSGraph(*F), + DSGraph::StripAllocaBit); + + } else { + std::cerr << "IP Mod/Ref indirect call not implemented yet: " + << "Being conservative\n"; + delete Result; + return 0; + } + + // Remove trivial dead nodes... don't aggressively prune graph though... the + // graph is short lived anyway. + Result->removeTriviallyDeadNodes(false); + + // Step #4: Return the clone + the mapping (by ref) return Result; } @@ -145,7 +186,11 @@ // Get a copy of the graph for the callee with the callee inlined std::map NodeMap; - DSGraph* csgp = ResolveCallSiteModRefInfo(callInst, NodeMap); + DSGraph* csgp = + ResolveCallSiteModRefInfo(const_cast(callInst), NodeMap); + + assert(csgp && "FIXME: Cannot handle case where call site mod/ref info" + " is not available yet!"); // For all nodes in the graph, extract the mod/ref information const std::vector& csgNodes = csgp->getNodes(); @@ -209,7 +254,6 @@ funcToModRefInfoMap.clear(); } - // Run the "interprocedural" pass on each function. This needs to do // NO real interprocedural work because all that has been done the // data structure analysis. @@ -239,6 +283,14 @@ } return *funcInfo; } + +/// getBUDSGraph - This method returns the BU data structure graph for F through +/// the use of the BUDataStructures object. +/// +const DSGraph &IPModRef::getBUDSGraph(const Function &F) { + return getAnalysis().getDSGraph(F); +} + // getAnalysisUsage - This pass requires top-down data structure graphs. // It modifies nothing. From lattner at cs.uiuc.edu Thu Nov 7 01:17:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 01:17:00 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/Makefile generate_report.pl Message-ID: <200211070716.BAA14582@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: Makefile updated: 1.5 -> 1.6 generate_report.pl updated: 1.4 -> 1.5 --- Log message: Add option to make files without timing information in them so that I can diff the output of two different runs to see if anything changes due to a change of mine. --- Diffs of the changes: Index: llvm/test/DSGraphs/Makefile diff -u llvm/test/DSGraphs/Makefile:1.5 llvm/test/DSGraphs/Makefile:1.6 --- llvm/test/DSGraphs/Makefile:1.5 Wed Nov 6 19:56:50 2002 +++ llvm/test/DSGraphs/Makefile Thu Nov 7 01:16:05 2002 @@ -58,5 +58,7 @@ gmake all 2>&1 | tee report.raw.out report: report.raw.out + -mv -f report.no-times.txt report.no-times.old.txt -mv -f report.txt report.old.txt + ./generate_report.pl -no-times report.raw.out > report.no-times.txt ./generate_report.pl report.raw.out 2>&1 | tee report.txt Index: llvm/test/DSGraphs/generate_report.pl diff -u llvm/test/DSGraphs/generate_report.pl:1.4 llvm/test/DSGraphs/generate_report.pl:1.5 --- llvm/test/DSGraphs/generate_report.pl:1.4 Wed Nov 6 20:19:04 2002 +++ llvm/test/DSGraphs/generate_report.pl Thu Nov 7 01:16:05 2002 @@ -1,7 +1,20 @@ #!/usr/dcs/software/supported/bin/perl -w -my $InputFN = $ARGV[0]; +# Default values for arguments +$SHOW_TIMES = 1; + +# Parse arguments... +while ($_ = $ARGV[0], /^[-+]/) { + shift; + last if /^--$/; # Stop processing arguments on -- + + # List command line options here... + if (/^-no-times$/) { $SHOW_TIMES = 0; next; } + + print "Unknown option: $_ : ignoring!\n"; +} +my $InputFN = $ARGV[0]; #print "Reading input from $InputFN\n"; open(INPUT, $InputFN) or die "Couldn't open '$InputFN'!"; @@ -21,11 +34,13 @@ # first test. shift @Records; -printf("%-30s%-10s%-10s%-10s%-10s%-10s " . - "%-10s%-10s%-10s%-10s " . - "%-8s%-10s%-8s%-8s\n", - "Name:", - "LocTime:", "BUTime:", "TDTime:", "TotTime:", "AnlzTime:", +printf("%-30s", "Name:"); +if ($SHOW_TIMES) { + printf("%-10s%-10s%-10s%-10s%-10s ", + "LocTime:", "BUTime:", "TDTime:", "TotTime:", "AnlzTime:"); +} + +printf("%-10s%-10s%-10s%-10s " . "%-8s%-10s%-8s%-8s\n", "LocSize:", "BUSize:", "TDSize:", "TotSize:", "NumFold", "NumNodes", "main", "__main"); @@ -37,14 +52,17 @@ # If an assertion failure occured, print it out. print (grep /Assertion/, (split "\n", $Record)); } else { - # Print Times - printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ Local', $Record, 10); - printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ Bottom-up', $Record, 10); - printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ Top-down', $Record, 10); - printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ TOTAL', $Record, 10); - printField('real\s+([ms0-9.]+)', $Record, 10); + if ($SHOW_TIMES) { + # Print Times + printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ Local', $Record, 10); + printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ Bottom-up', $Record, 10); + printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ Top-down', $Record, 10); + printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ TOTAL', $Record, 10); + printField('real\s+([ms0-9.]+)', $Record, 10); + + print "| "; + } - print "| "; # Print Sizes printField("([0-9]+) Local", $Record, 10); printField("([0-9]+) Bottom-up", $Record, 10); From lattner at cs.uiuc.edu Thu Nov 7 12:00:02 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 12:00:02 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp X86InstrInfo.def Message-ID: <200211071759.LAA31858@psmith.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: InstSelectSimple.cpp updated: 1.21 -> 1.22 X86InstrInfo.def updated: 1.12 -> 1.13 --- Log message: Add instruction selection code and tests for setcc instructions --- Diffs of the changes: Index: llvm/lib/Target/X86/InstSelectSimple.cpp diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.21 llvm/lib/Target/X86/InstSelectSimple.cpp:1.22 --- llvm/lib/Target/X86/InstSelectSimple.cpp:1.21 Sat Nov 2 14:54:46 2002 +++ llvm/lib/Target/X86/InstSelectSimple.cpp Thu Nov 7 11:59:21 2002 @@ -8,6 +8,7 @@ #include "X86InstrInfo.h" #include "llvm/Function.h" #include "llvm/iTerminators.h" +#include "llvm/iOperators.h" #include "llvm/iOther.h" #include "llvm/iPHINode.h" #include "llvm/Type.h" @@ -77,6 +78,7 @@ // Other operators void visitShiftInst(ShiftInst &I); + void visitSetCondInst(SetCondInst &I); void visitPHINode(PHINode &I); void visitInstruction(Instruction &I) { @@ -160,6 +162,157 @@ } } +/// SetCC instructions - Here we just emit boilerplate code to set a byte-sized +/// register, then move it to wherever the result should be. +/// We handle FP setcc instructions by pushing them, doing a +/// compare-and-pop-twice, and then copying the concodes to the main +/// processor's concodes (I didn't make this up, it's in the Intel manual) +/// +void +ISel::visitSetCondInst (SetCondInst & I) +{ + // The arguments are already supposed to be of the same type. + Value *var1 = I.getOperand (0); + Value *var2 = I.getOperand (1); + unsigned reg1 = getReg (var1); + unsigned reg2 = getReg (var2); + unsigned resultReg = getReg (I); + unsigned comparisonWidth = var1->getType ()->getPrimitiveSize (); + unsigned unsignedComparison = var1->getType ()->isUnsigned (); + unsigned resultWidth = I.getType ()->getPrimitiveSize (); + bool fpComparison = var1->getType ()->isFloatingPoint (); + if (fpComparison) + { + // Push the variables on the stack with fldl opcodes. + // FIXME: assuming var1, var2 are in memory, if not, spill to + // stack first + switch (comparisonWidth) + { + case 4: + BuildMI (BB, X86::FLDr4, 1, X86::NoReg).addReg (reg1); + break; + case 8: + BuildMI (BB, X86::FLDr8, 1, X86::NoReg).addReg (reg1); + break; + default: + visitInstruction (I); + break; + } + switch (comparisonWidth) + { + case 4: + BuildMI (BB, X86::FLDr4, 1, X86::NoReg).addReg (reg2); + break; + case 8: + BuildMI (BB, X86::FLDr8, 1, X86::NoReg).addReg (reg2); + break; + default: + visitInstruction (I); + break; + } + // (Non-trapping) compare and pop twice. + // FIXME: Result of comparison -> condition codes, not a register. + BuildMI (BB, X86::FUCOMPP, 0); + // Move fp status word (concodes) to ax. + BuildMI (BB, X86::FNSTSWr8, 1, X86::AX); + // Load real concodes from ax. + // FIXME: Once again, flags are not modeled. + BuildMI (BB, X86::SAHF, 0); + } + else + { // integer comparison + // Emit: cmp , (do the comparison). We can + // compare 8-bit with 8-bit, 16-bit with 16-bit, 32-bit with + // 32-bit. + // FIXME: Result of comparison -> condition codes, not a register. + switch (comparisonWidth) + { + case 1: + BuildMI (BB, X86::CMPrr8, 2, + X86::NoReg).addReg (reg1).addReg (reg2); + break; + case 2: + BuildMI (BB, X86::CMPrr16, 2, + X86::NoReg).addReg (reg1).addReg (reg2); + break; + case 4: + BuildMI (BB, X86::CMPrr32, 2, + X86::NoReg).addReg (reg1).addReg (reg2); + break; + case 8: + default: + visitInstruction (I); + break; + } + } + // Emit setOp instruction (extract concode; clobbers ax), + // using the following mapping: + // LLVM -> X86 signed X86 unsigned + // ----- ----- ----- + // seteq -> sete sete + // setne -> setne setne + // setlt -> setl setb + // setgt -> setg seta + // setle -> setle setbe + // setge -> setge setae + switch (I.getOpcode ()) + { + case Instruction::SetEQ: + BuildMI (BB, X86::SETE, 0, X86::AL); + break; + case Instruction::SetGE: + if (unsignedComparison) + BuildMI (BB, X86::SETAE, 0, X86::AL); + else + BuildMI (BB, X86::SETGE, 0, X86::AL); + break; + case Instruction::SetGT: + if (unsignedComparison) + BuildMI (BB, X86::SETA, 0, X86::AL); + else + BuildMI (BB, X86::SETG, 0, X86::AL); + break; + case Instruction::SetLE: + if (unsignedComparison) + BuildMI (BB, X86::SETBE, 0, X86::AL); + else + BuildMI (BB, X86::SETLE, 0, X86::AL); + break; + case Instruction::SetLT: + if (unsignedComparison) + BuildMI (BB, X86::SETB, 0, X86::AL); + else + BuildMI (BB, X86::SETL, 0, X86::AL); + break; + case Instruction::SetNE: + BuildMI (BB, X86::SETNE, 0, X86::AL); + break; + default: + visitInstruction (I); + break; + } + // Put it in the result using a move. + switch (resultWidth) + { + case 1: + BuildMI (BB, X86::MOVrr8, 1, resultReg).addReg (X86::AL); + break; + // FIXME: What to do about implicit destination registers? + // E.g., you don't specify it, but CBW is more like AX = CBW(AL). + case 2: + BuildMI (BB, X86::CBW, 0, X86::AX); + BuildMI (BB, X86::MOVrr16, 1, resultReg).addReg (X86::AX); + break; + case 4: + BuildMI (BB, X86::CWDE, 0, X86::EAX); + BuildMI (BB, X86::MOVrr32, 1, resultReg).addReg (X86::EAX); + break; + case 8: + default: + visitInstruction (I); + break; + } +} /// 'ret' instruction - Here we are interested in meeting the x86 ABI. As such, Index: llvm/lib/Target/X86/X86InstrInfo.def diff -u llvm/lib/Target/X86/X86InstrInfo.def:1.12 llvm/lib/Target/X86/X86InstrInfo.def:1.13 --- llvm/lib/Target/X86/X86InstrInfo.def:1.12 Sat Nov 2 14:54:46 2002 +++ llvm/lib/Target/X86/X86InstrInfo.def Thu Nov 7 11:59:21 2002 @@ -66,7 +66,6 @@ I(IDIVrr16 , "idivw", 0, 0) // DA/r16=AX&DX F7/6 I(IDIVrr32 , "idivl", 0, 0) // DA/r32=EAX&DX F7/6 - // Logical operators I(ANDrr8 , "andb", 0, 0) // R8 &= R8 20/r I(ANDrr16 , "andw", 0, 0) // R16 &= R16 21/r @@ -98,11 +97,39 @@ I(SARrr32 , "sarl", 0, 0) // R32 >>= cl D3/7 I(SARir32 , "sarl", 0, 0) // R32 >>= imm8 C1/7 ib +// Floating point loads +I(FLDr4 , "flds", 0, 0) // push float D9/0 +I(FLDr8 , "fldl ", 0, 0) // push double DD/0 + +// Floating point compares +I(FUCOMPP , "fucompp", 0, 0) // compare+pop2x DA E9 + +// Floating point flag ops +I(FNSTSWr8 , "fnstsw", 0, 0) // AX = fp flags DF E0 + +// Condition code ops, incl. set if equal/not equal/... +I(SAHF , "sahf", 0, 0) // flags = AH 9E +I(SETA , "seta", 0, 0) // R8 = > unsign 0F 97 +I(SETAE , "setae", 0, 0) // R8 = >=unsign 0F 93 +I(SETB , "setb", 0, 0) // R8 = < unsign 0F 92 +I(SETBE , "setbe", 0, 0) // R8 = <=unsign 0F 96 +I(SETE , "sete", 0, 0) // R8 = == 0F 94 +I(SETG , "setg", 0, 0) // R8 = > signed 0F 9F +I(SETGE , "setge", 0, 0) // R8 = >=signed 0F 9D +I(SETL , "setl", 0, 0) // R8 = < signed 0F 9C +I(SETLE , "setle", 0, 0) // R8 = <=signed 0F 9E +I(SETNE , "setne", 0, 0) // R8 = != 0F 95 + +// Integer comparisons +I(CMPrr8 , "cmpb", 0, 0) // compare R8,R8 38/r +I(CMPrr16 , "cmpw", 0, 0) // compare R16,R16 39/r +I(CMPrr32 , "cmpl", 0, 0) // compare R32,R32 39/r -// Miscellaneous instructions... +// Sign extenders I(CBW , "cbw", 0, 0) // AH = signext(AL) 98 I(CWD , "cwd", 0, 0) // DX = signext(AX) 99 I(CWQ , "cwq", 0, 0) // EDX= signext(EAX) 99 +I(CWDE , "cwde", 0, 0) // EAX = extend AX 98 // At this point, I is dead, so undefine the macro #undef I From lattner at cs.uiuc.edu Thu Nov 7 12:00:07 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 12:00:07 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Jello/test-setcond-fp.ll test-setcond-int.ll Message-ID: <200211071759.LAA31857@psmith.cs.uiuc.edu> Changes in directory llvm/test/Regression/Jello: test-setcond-fp.ll added (r1.1) test-setcond-int.ll added (r1.1) --- Log message: Add instruction selection code and tests for setcc instructions --- Diffs of the changes: From lattner at cs.uiuc.edu Thu Nov 7 12:10:02 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 12:10:02 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Jello/test-setcond-int.ll Message-ID: <200211071809.MAA31883@psmith.cs.uiuc.edu> Changes in directory llvm/test/Regression/Jello: test-setcond-int.ll updated: 1.1 -> 1.2 --- Log message: comment out the 64-bit cases for now. --- Diffs of the changes: Index: llvm/test/Regression/Jello/test-setcond-int.ll diff -u llvm/test/Regression/Jello/test-setcond-int.ll:1.1 llvm/test/Regression/Jello/test-setcond-int.ll:1.2 --- llvm/test/Regression/Jello/test-setcond-int.ll:1.1 Thu Nov 7 11:59:21 2002 +++ llvm/test/Regression/Jello/test-setcond-int.ll Thu Nov 7 12:09:02 2002 @@ -2,8 +2,8 @@ void %main() { %int1 = add int 0, 0 %int2 = add int 0, 0 - %long1 = add long 0, 0 - %long2 = add long 0, 0 + ;%long1 = add long 0, 0 + ;%long2 = add long 0, 0 %sbyte1 = add sbyte 0, 0 %sbyte2 = add sbyte 0, 0 %short1 = add short 0, 0 @@ -12,8 +12,8 @@ %ubyte2 = add ubyte 0, 0 %uint1 = add uint 0, 0 %uint2 = add uint 0, 0 - %ulong1 = add ulong 0, 0 - %ulong2 = add ulong 0, 0 + ;%ulong1 = add ulong 0, 0 + ;%ulong2 = add ulong 0, 0 %ushort1 = add ushort 0, 0 %ushort2 = add ushort 0, 0 %test1 = seteq ubyte %ubyte1, %ubyte2 @@ -34,12 +34,12 @@ %test16 = setle uint %uint1, %uint2 %test17 = setlt uint %uint1, %uint2 %test18 = setne uint %uint1, %uint2 - %test19 = seteq ulong %ulong1, %ulong2 - %test20 = setge ulong %ulong1, %ulong2 - %test21 = setgt ulong %ulong1, %ulong2 - %test22 = setle ulong %ulong1, %ulong2 - %test23 = setlt ulong %ulong1, %ulong2 - %test24 = setne ulong %ulong1, %ulong2 + ;%test19 = seteq ulong %ulong1, %ulong2 + ;%test20 = setge ulong %ulong1, %ulong2 + ;%test21 = setgt ulong %ulong1, %ulong2 + ;%test22 = setle ulong %ulong1, %ulong2 + ;%test23 = setlt ulong %ulong1, %ulong2 + ;%test24 = setne ulong %ulong1, %ulong2 %test25 = seteq sbyte %sbyte1, %sbyte2 %test26 = setge sbyte %sbyte1, %sbyte2 %test27 = setgt sbyte %sbyte1, %sbyte2 @@ -58,11 +58,11 @@ %test40 = setle int %int1, %int2 %test41 = setlt int %int1, %int2 %test42 = setne int %int1, %int2 - %test43 = seteq long %long1, %long2 - %test44 = setge long %long1, %long2 - %test45 = setgt long %long1, %long2 - %test46 = setle long %long1, %long2 - %test47 = setlt long %long1, %long2 - %test48 = setne long %long1, %long2 + ;%test43 = seteq long %long1, %long2 + ;%test44 = setge long %long1, %long2 + ;%test45 = setgt long %long1, %long2 + ;%test46 = setle long %long1, %long2 + ;%test47 = setlt long %long1, %long2 + ;%test48 = setne long %long1, %long2 ret void } From lattner at cs.uiuc.edu Thu Nov 7 13:30:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 13:30:01 2002 Subject: [llvm-commits] CVS: llvm/tools/lli/Execution.cpp Interpreter.h UserInput.cpp Message-ID: <200211071929.NAA21537@apoc.cs.uiuc.edu> Changes in directory llvm/tools/lli: Execution.cpp updated: 1.70 -> 1.71 Interpreter.h updated: 1.23 -> 1.24 UserInput.cpp updated: 1.22 -> 1.23 --- Log message: Make command line arguments setup be endian correct!! --- Diffs of the changes: Index: llvm/tools/lli/Execution.cpp diff -u llvm/tools/lli/Execution.cpp:1.70 llvm/tools/lli/Execution.cpp:1.71 --- llvm/tools/lli/Execution.cpp:1.70 Wed Oct 30 15:47:57 2002 +++ llvm/tools/lli/Execution.cpp Thu Nov 7 13:29:31 2002 @@ -980,6 +980,28 @@ } +GenericValue Interpreter::CreateArgv(const std::vector &InputArgv){ + // Pointers are 64 bits... + PointerTy *Result = new PointerTy[InputArgv.size()+1]; // 64 bit assumption + + for (unsigned i = 0; i < InputArgv.size(); ++i) { + unsigned Size = InputArgv[i].size()+1; + char *Dest = new char[Size]; + copy(InputArgv[i].begin(), InputArgv[i].end(), Dest); + Dest[Size-1] = 0; + + GenericValue GV; GV.PointerVal = (PointerTy)Dest; + // Endian safe: Result[i] = (PointerTy)Dest; + StoreValueToMemory(GV, (GenericValue*)(Result+i), + Type::LongTy); // 64 bit assumption + } + + Result[InputArgv.size()] = 0; + GenericValue GV; GV.PointerVal = (PointerTy)Result; + return GV; +} + + //===----------------------------------------------------------------------===// // Miscellaneous Instruction Implementations //===----------------------------------------------------------------------===// Index: llvm/tools/lli/Interpreter.h diff -u llvm/tools/lli/Interpreter.h:1.23 llvm/tools/lli/Interpreter.h:1.24 --- llvm/tools/lli/Interpreter.h:1.23 Tue Oct 15 15:34:05 2002 +++ llvm/tools/lli/Interpreter.h Thu Nov 7 13:29:31 2002 @@ -126,9 +126,9 @@ static void print(const Type *Ty, GenericValue V); static void printValue(const Type *Ty, GenericValue V); - // Hack until we can parse command line args... bool callMainMethod(const std::string &MainName, const std::vector &InputFilename); + GenericValue CreateArgv(const std::vector &InputArgv); void list(); // Do the 'list' command void printStackTrace(); // Do the 'backtrace' command Index: llvm/tools/lli/UserInput.cpp diff -u llvm/tools/lli/UserInput.cpp:1.22 llvm/tools/lli/UserInput.cpp:1.23 --- llvm/tools/lli/UserInput.cpp:1.22 Mon Sep 2 20:08:28 2002 +++ llvm/tools/lli/UserInput.cpp Thu Nov 7 13:29:31 2002 @@ -238,23 +238,6 @@ return false; } -static void *CreateArgv(const std::vector &InputArgv) { - // Pointers are 64 bits... - uint64_t *Result = new PointerTy[InputArgv.size()+1]; - - for (unsigned i = 0; i < InputArgv.size(); ++i) { - unsigned Size = InputArgv[i].size()+1; - char *Dest = new char[Size]; - copy(InputArgv[i].begin(), InputArgv[i].end(), Dest); - Dest[Size-1] = 0; - Result[i] = (PointerTy)Dest; - } - - Result[InputArgv.size()] = 0; - return Result; -} - - // callMainMethod - This is a nasty gross hack that will dissapear when // callMethod can parse command line options and stuff for us. // @@ -289,8 +272,7 @@ return true; } - GenericValue GV; GV.PointerVal = (uint64_t)CreateArgv(InputArgv); - Args.push_back(GV); + Args.push_back(CreateArgv(InputArgv)); } // fallthrough case 1: From lattner at cs.uiuc.edu Thu Nov 7 13:35:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 13:35:00 2002 Subject: [llvm-commits] CVS: llvm/tools/lli/ExternalFunctions.cpp Message-ID: <200211071934.NAA22009@apoc.cs.uiuc.edu> Changes in directory llvm/tools/lli: ExternalFunctions.cpp updated: 1.36 -> 1.37 --- Log message: Implement freopen for burg --- Diffs of the changes: Index: llvm/tools/lli/ExternalFunctions.cpp diff -u llvm/tools/lli/ExternalFunctions.cpp:1.36 llvm/tools/lli/ExternalFunctions.cpp:1.37 --- llvm/tools/lli/ExternalFunctions.cpp:1.36 Wed Nov 6 17:05:03 2002 +++ llvm/tools/lli/ExternalFunctions.cpp Thu Nov 7 13:33:50 2002 @@ -531,11 +531,20 @@ return GV; } +// FILE *freopen(const char *path, const char *mode, FILE *stream); +GenericValue lle_X_freopen(FunctionType *M, const vector &Args) { + assert(Args.size() == 3); + GenericValue GV; + GV.PointerVal = (PointerTy)freopen((char*)Args[0].PointerVal, + (char*)Args[1].PointerVal, + getFILE(Args[2].PointerVal)); + return GV; +} + // int fflush(FILE *stream); GenericValue lle_X_fflush(FunctionType *M, const vector &Args) { assert(Args.size() == 1); GenericValue GV; - GV.IntVal = fflush(getFILE(Args[0].PointerVal)); return GV; } @@ -544,7 +553,6 @@ GenericValue lle_X_getc(FunctionType *M, const vector &Args) { assert(Args.size() == 1); GenericValue GV; - GV.IntVal = getc(getFILE(Args[0].PointerVal)); return GV; } @@ -632,4 +640,5 @@ FuncNames["lle_X_fputc"] = lle_X_fputc; FuncNames["lle_X_ungetc"] = lle_X_ungetc; FuncNames["lle_X_fprintf"] = lle_X_fprintf; + FuncNames["lle_X_freopen"] = lle_X_freopen; } From lattner at cs.uiuc.edu Thu Nov 7 13:45:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 13:45:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp Message-ID: <200211071944.NAA22537@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CWriter: Writer.cpp updated: 1.71 -> 1.72 --- Log message: Print out 'float' constants correctly --- Diffs of the changes: Index: llvm/lib/CWriter/Writer.cpp diff -u llvm/lib/CWriter/Writer.cpp:1.71 llvm/lib/CWriter/Writer.cpp:1.72 --- llvm/lib/CWriter/Writer.cpp:1.71 Wed Nov 6 15:40:23 2002 +++ llvm/lib/CWriter/Writer.cpp Thu Nov 7 13:43:59 2002 @@ -535,6 +535,7 @@ << "\n\n/* Support for floating point constants */\n" << "typedef unsigned long long ConstantDoubleTy;\n" + << "typedef unsigned int ConstantFloatTy;\n" << "\n\n/* Global Declarations */\n"; @@ -772,9 +773,17 @@ double Val = FPC->getValue(); FPConstantMap[FPC] = FPCounter; // Number the FP constants - Out << " const ConstantDoubleTy FloatConstant" << FPCounter++ - << " = 0x" << std::hex << *(unsigned long long*)&Val << std::dec - << "; /* " << Val << " */\n"; + + if (FPC->getType() == Type::DoubleTy) + Out << " const ConstantDoubleTy FloatConstant" << FPCounter++ + << " = 0x" << std::hex << *(unsigned long long*)&Val << std::dec + << "; /* " << Val << " */\n"; + else if (FPC->getType() == Type::FloatTy) + Out << " const ConstantFloatTy FloatConstant" << FPCounter++ + << " = 0x" << std::hex << *(unsigned*)&Val << std::dec + << "; /* " << Val << " */\n"; + else + assert(0 && "Unknown float type!"); } Out << "\n"; From hldnbrnd at cs.uiuc.edu Thu Nov 7 15:38:01 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Thu Nov 7 15:38:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/TestStatus.html Message-ID: <200211072137.PAA18040@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: TestStatus.html updated: 1.12 -> 1.13 --- Log message: Updated test results. --- Diffs of the changes: Index: llvm/www/docs/TestStatus.html diff -u llvm/www/docs/TestStatus.html:1.12 llvm/www/docs/TestStatus.html:1.13 --- llvm/www/docs/TestStatus.html:1.12 Tue Nov 5 16:57:43 2002 +++ llvm/www/docs/TestStatus.html Thu Nov 7 15:37:32 2002 @@ -3,14 +3,14 @@

Test Results

-
last updated: 11/05/2002
-
tests current: 10/25/2002
+
last updated: 11/07/2002
+
tests current: 11/07/2002

SingleSource

- - + + @@ -23,7 +23,7 @@ - + @@ -51,27 +51,27 @@ - +
Test NameCBE Compiles?CBE Links?CBE Diff MatchLLI Diff MatchNotes
llubenchmarkXXOX
matrixTransposeXXO
piXXOX
matrixTransposeXXX
piXXOXFloat error
printargsXXX
sumarray2dXXX
sumarrayXXX
ackermanXXX
ary3XXX
fib2XXX
hashXXO
hashXXX
heapsortXXX
helloXXX
listsXXX
ArrayResolutionXXX
StructureArgsXXX
StructureArgsSimpleXXX
BadLoadXXO
BadLoadXXX

MultiSource

- - + + - + - + - + - + From lattner at cs.uiuc.edu Thu Nov 7 16:14:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 16:14:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp Message-ID: <200211072213.QAA30308@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CWriter: Writer.cpp updated: 1.72 -> 1.73 --- Log message: _REALLY_ fix the float constant problem --- Diffs of the changes: Index: llvm/lib/CWriter/Writer.cpp diff -u llvm/lib/CWriter/Writer.cpp:1.72 llvm/lib/CWriter/Writer.cpp:1.73 --- llvm/lib/CWriter/Writer.cpp:1.72 Thu Nov 7 13:43:59 2002 +++ llvm/lib/CWriter/Writer.cpp Thu Nov 7 16:12:53 2002 @@ -778,11 +778,12 @@ Out << " const ConstantDoubleTy FloatConstant" << FPCounter++ << " = 0x" << std::hex << *(unsigned long long*)&Val << std::dec << "; /* " << Val << " */\n"; - else if (FPC->getType() == Type::FloatTy) + else if (FPC->getType() == Type::FloatTy) { + float fVal = Val; Out << " const ConstantFloatTy FloatConstant" << FPCounter++ - << " = 0x" << std::hex << *(unsigned*)&Val << std::dec + << " = 0x" << std::hex << *(unsigned*)&fVal << std::dec << "; /* " << Val << " */\n"; - else + } else assert(0 && "Unknown float type!"); } From hldnbrnd at cs.uiuc.edu Thu Nov 7 16:42:01 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Thu Nov 7 16:42:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/TestStatus.html Message-ID: <200211072241.QAA18600@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: TestStatus.html updated: 1.13 -> 1.14 --- Log message: More updates, more test work --- Diffs of the changes: Index: llvm/www/docs/TestStatus.html diff -u llvm/www/docs/TestStatus.html:1.13 llvm/www/docs/TestStatus.html:1.14 --- llvm/www/docs/TestStatus.html:1.13 Thu Nov 7 15:37:32 2002 +++ llvm/www/docs/TestStatus.html Thu Nov 7 16:40:56 2002 @@ -8,9 +8,9 @@

SingleSource

Test NameCBE Compiles?CBE Links?CBE Diff MatchLLI Diff MatchNotes
BurgXXOBytecode problem
FhourstonesXXOSeg Fault
BurgXXOBytecode problem, CBE works great though
FhourstonesXXOBoth native and CBE seg fault
Olden-bhXXX
Olden-bisortXXX
Olden-em3dXXXX
Olden-healthXXOO
Olden-healthXXOX
Olden-mstXXX
Olden-perimeterXXX
Olden-powerXXOpercision error
Olden-powerXXOfloat error
Olden-treaddXXX
Olden-tspXXX
Olden-voronoiXXOInfinite loop
Olden-voronoiXXO
OptimizerEvalXXOIt is a timing test, so not matching is expected.
sgefaXXOBoth native and cbe seg fault
sgefaXXOBoth native and CBE seg fault
simXXO
Ptrdist-bcOOOBytecode fails to be generated
Ptrdist-ftOOOBytecode fails to be generated
- + - + @@ -37,12 +37,12 @@ - + - + @@ -63,7 +63,7 @@ - + @@ -75,7 +75,7 @@ - +
Test NameCBE Compiles?CBE Links?CBE Diff MatchLLI Diff MatchNotes
llubenchmarkXXOX
llubenchmarkXXXX
matrixTransposeXXX
piXXOXFloat error
piXXXX
printargsXXX
sumarray2dXXX
sumarrayXXX

UnitTests

PrintfCharXXX
ArgumentTestXXOX
ArgumentTestXXXX
CastTest1XXX
05-02-CastTest2XXX
CastTest3XXX
05-02-CastTestXXX
ManyArgumentsXXOX
ManyArgumentsXXXX
NotTestXXX
DivTestXXX
08-02-CastTest2XXX
Olden-bhXXX
Olden-bisortXXX
Olden-em3dXXXX
Olden-healthXXOX
Olden-healthXXXX
Olden-mstXXX
Olden-perimeterXXX
Olden-powerXXOfloat error
simXXO
Ptrdist-bcOOOBytecode fails to be generated
Ptrdist-ftOOOBytecode fails to be generated
Ptrdist-ksXXO
Ptrdist-ksXXX
Ptrdist-yacr2XXONative seg faults, not 64 friendly
From hldnbrnd at cs.uiuc.edu Thu Nov 7 16:58:01 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Thu Nov 7 16:58:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/TestStatus.html Message-ID: <200211072257.QAA19010@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: TestStatus.html updated: 1.14 -> 1.15 --- Log message: UpdateCVS: ---------------------------------------------------------------------- --- Diffs of the changes: Index: llvm/www/docs/TestStatus.html diff -u llvm/www/docs/TestStatus.html:1.14 llvm/www/docs/TestStatus.html:1.15 --- llvm/www/docs/TestStatus.html:1.14 Thu Nov 7 16:40:56 2002 +++ llvm/www/docs/TestStatus.html Thu Nov 7 16:57:41 2002 @@ -16,7 +16,7 @@ sumarrayXXX sumarraymallocXXX test-indvarsXXX -Ptrdist-anagramXXX +Ptrdist-anagramXXOseg faults

Shootout

From lattner at cs.uiuc.edu Thu Nov 7 17:38:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 17:38:01 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Burg/zalloc.c Message-ID: <200211072337.RAA30885@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Burg: zalloc.c updated: 1.1 -> 1.2 --- Log message: Make sure to get the right proto for malloc --- Diffs of the changes: Index: llvm/test/Programs/MultiSource/Burg/zalloc.c diff -u llvm/test/Programs/MultiSource/Burg/zalloc.c:1.1 llvm/test/Programs/MultiSource/Burg/zalloc.c:1.2 --- llvm/test/Programs/MultiSource/Burg/zalloc.c:1.1 Mon Oct 14 11:39:24 2002 +++ llvm/test/Programs/MultiSource/Burg/zalloc.c Thu Nov 7 17:36:59 2002 @@ -1,12 +1,12 @@ -char rcsid_zalloc[] = "$Id: zalloc.c,v 1.1 2002/10/14 16:39:24 vadve Exp $"; +char rcsid_zalloc[] = "$Id: zalloc.c,v 1.2 2002/11/07 23:36:59 lattner Exp $"; #include #include +#include #include "b.h" extern void exit ARGS((int)); extern void free ARGS((void *)); -extern void *malloc ARGS((unsigned)); int fatal(name, line) char *name; int line; From lattner at cs.uiuc.edu Thu Nov 7 17:38:05 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 17:38:05 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Burg/burs.c Message-ID: <200211072337.RAA30897@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Burg: burs.c updated: 1.1 -> 1.2 --- Log message: Add a hack to get some typeness --- Diffs of the changes: Index: llvm/test/Programs/MultiSource/Burg/burs.c diff -u llvm/test/Programs/MultiSource/Burg/burs.c:1.1 llvm/test/Programs/MultiSource/Burg/burs.c:1.2 --- llvm/test/Programs/MultiSource/Burg/burs.c:1.1 Mon Oct 14 11:39:22 2002 +++ llvm/test/Programs/MultiSource/Burg/burs.c Thu Nov 7 17:37:19 2002 @@ -1,4 +1,4 @@ -char rcsid_burs[] = "$Id: burs.c,v 1.1 2002/10/14 16:39:22 vadve Exp $"; +char rcsid_burs[] = "$Id: burs.c,v 1.2 2002/11/07 23:37:19 lattner Exp $"; #include "b.h" @@ -41,6 +41,8 @@ } } +static Operator addTypeInfo(Operator op) { return op; } + void build() { @@ -65,6 +67,7 @@ for (ts = popQ(globalQ); ts; ts = popQ(globalQ)) { for (ol = operators; ol; ol = ol->next) { Operator op = (Operator) ol->x; +op = addTypeInfo(op); /*TMP HACK!*/ addToTable(op->table, ts); } } From lattner at cs.uiuc.edu Thu Nov 7 17:40:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 17:40:01 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Burg/b.h fe.h Message-ID: <200211072339.RAA31066@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Burg: b.h updated: 1.1 -> 1.2 fe.h updated: 1.1 -> 1.2 --- Log message: Add #includes --- Diffs of the changes: Index: llvm/test/Programs/MultiSource/Burg/b.h diff -u llvm/test/Programs/MultiSource/Burg/b.h:1.1 llvm/test/Programs/MultiSource/Burg/b.h:1.2 --- llvm/test/Programs/MultiSource/Burg/b.h:1.1 Mon Oct 14 11:39:22 2002 +++ llvm/test/Programs/MultiSource/Burg/b.h Thu Nov 7 17:39:27 2002 @@ -1,6 +1,8 @@ -/* $Id: b.h,v 1.1 2002/10/14 16:39:22 vadve Exp $ */ +/* $Id: b.h,v 1.2 2002/11/07 23:39:27 lattner Exp $ */ #define MAX_ARITY 2 + +#include typedef int ItemSetNum; typedef int OperatorNum; Index: llvm/test/Programs/MultiSource/Burg/fe.h diff -u llvm/test/Programs/MultiSource/Burg/fe.h:1.1 llvm/test/Programs/MultiSource/Burg/fe.h:1.2 --- llvm/test/Programs/MultiSource/Burg/fe.h:1.1 Mon Oct 14 11:39:22 2002 +++ llvm/test/Programs/MultiSource/Burg/fe.h Thu Nov 7 17:39:27 2002 @@ -1,4 +1,6 @@ -/* $Id: fe.h,v 1.1 2002/10/14 16:39:22 vadve Exp $ */ +/* $Id: fe.h,v 1.2 2002/11/07 23:39:27 lattner Exp $ */ + +#include struct binding { char *name; From lattner at cs.uiuc.edu Thu Nov 7 18:23:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 18:23:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/FunctionResolve/2002-11-07-RetMismatch.ll Message-ID: <200211080022.SAA01243@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/FunctionResolve: 2002-11-07-RetMismatch.ll added (r1.1) --- Log message: Add testcase that is fscking twolf --- Diffs of the changes: From vadve at cs.uiuc.edu Thu Nov 7 18:24:01 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Thu Nov 7 18:24:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure.h Message-ID: <200211080023.SAA01269@psmith.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DataStructure.h updated: 1.49 -> 1.50 --- Log message: Restore a #include because this header file needs the definitions of DSCallSite::~DSCallSite and DSNodeHandle::~DSNodeHandle. --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure.h:1.49 llvm/include/llvm/Analysis/DataStructure.h:1.50 --- llvm/include/llvm/Analysis/DataStructure.h:1.49 Wed Nov 6 17:26:21 2002 +++ llvm/include/llvm/Analysis/DataStructure.h Thu Nov 7 18:23:23 2002 @@ -7,13 +7,12 @@ #ifndef LLVM_ANALYSIS_DATA_STRUCTURE_H #define LLVM_ANALYSIS_DATA_STRUCTURE_H +#include "llvm/Analysis/DSSupport.h" #include "llvm/Pass.h" class Type; class DSGraph; class DSNode; -class DSNodeHandle; -class DSCallSite; class LocalDataStructures; // A collection of local graphs for a program class BUDataStructures; // A collection of bu graphs for a program class TDDataStructures; // A collection of td graphs for a program From lattner at cs.uiuc.edu Thu Nov 7 18:32:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 18:32:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/FunctionResolve/2002-11-07-RetMismatch.ll Message-ID: <200211080031.SAA02976@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/FunctionResolve: 2002-11-07-RetMismatch.ll updated: 1.1 -> 1.2 --- Log message: Fix predicate --- Diffs of the changes: Index: llvm/test/Regression/Transforms/FunctionResolve/2002-11-07-RetMismatch.ll diff -u llvm/test/Regression/Transforms/FunctionResolve/2002-11-07-RetMismatch.ll:1.1 llvm/test/Regression/Transforms/FunctionResolve/2002-11-07-RetMismatch.ll:1.2 --- llvm/test/Regression/Transforms/FunctionResolve/2002-11-07-RetMismatch.ll:1.1 Thu Nov 7 18:22:07 2002 +++ llvm/test/Regression/Transforms/FunctionResolve/2002-11-07-RetMismatch.ll Thu Nov 7 18:31:27 2002 @@ -1,4 +1,4 @@ -; RUN: if as < %s | opt -funcresolve -globaldce | dis | grep declare +; RUN: if as < %s | opt -funcresolve -funcresolve | dis | grep declare ; RUN: then exit 1 ; RUN: else exit 0 ; RUN: fi From lattner at cs.uiuc.edu Thu Nov 7 18:39:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 18:39:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp Message-ID: <200211080038.SAA04272@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: FunctionResolution.cpp updated: 1.14 -> 1.15 --- Log message: Fix bug: FunctionResolve/2002-11-07-RetMismatch.ll --- Diffs of the changes: Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.14 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.15 --- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.14 Sun Oct 13 12:30:30 2002 +++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Thu Nov 7 18:38:20 2002 @@ -251,8 +251,7 @@ // to 'int (int)' or 'int ()' or whatever else is not completely generic. // Function *F = cast(Globals[i]); - if (!F->getFunctionType()->isVarArg() || - F->getFunctionType()->getNumParams()) { + if (!F->isExternal()) { if (Concrete) return false; // Found two different functions types. Can't choose! From lattner at cs.uiuc.edu Thu Nov 7 19:22:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 19:22:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Printer.cpp TopDownClosure.cpp Message-ID: <200211080121.TAA07457@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.49 -> 1.50 Printer.cpp updated: 1.35 -> 1.36 TopDownClosure.cpp updated: 1.21 -> 1.22 --- Log message: Add flush --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.49 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.50 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.49 Thu Nov 7 01:06:20 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Thu Nov 7 19:21:07 2002 @@ -17,7 +17,8 @@ using std::vector; namespace { - Statistic<> NumFolds("dsnode", "Number of nodes completely folded"); + Statistic<> NumFolds ("dsnode", "Number of nodes completely folded"); + Statistic<> NumCallNodesMerged("dsnode", "Number of call nodes merged"); }; namespace DS { // TODO: FIXME @@ -443,7 +444,7 @@ // Merge the node types NodeType |= N->NodeType; - N->NodeType = 0; // N is now a dead node. + N->NodeType = DEAD; // N is now a dead node. // Merge the globals list... if (!N->Globals.empty()) { @@ -497,17 +498,6 @@ void DSGraph::dump() const { print(std::cerr); } -// Helper function used to clone a function list. -// -static void CopyFunctionCallsList(const vector& fromCalls, - vector &toCalls, - std::map &NodeMap) { - unsigned FC = toCalls.size(); // FirstCall - toCalls.reserve(FC+fromCalls.size()); - for (unsigned i = 0, ei = fromCalls.size(); i != ei; ++i) - toCalls.push_back(DSCallSite(fromCalls[i], NodeMap)); -} - /// remapLinks - Change all of the Links in the current node according to the /// specified mapping. /// @@ -528,6 +518,7 @@ std::map &OldNodeMap, AllocaBit StripAllocas) { assert(OldNodeMap.empty() && "Returned OldNodeMap should be empty!"); + assert(&G != this && "Cannot clone graph into itself!"); unsigned FN = Nodes.size(); // First new node... @@ -560,14 +551,18 @@ std::map::iterator GVI = ScalarMap.find(I->first); if (GVI != ScalarMap.end()) { // Is the global value in this fn already? GVI->second.mergeWith(H); + OldNodeMap[I->second.getNode()] = H.getNode(); } else { ScalarMap[I->first] = H; // Add global pointer to this graph } } } - // Copy the function calls list... - CopyFunctionCallsList(G.FunctionCalls, FunctionCalls, OldNodeMap); + // Copy the function calls list... + unsigned FC = FunctionCalls.size(); // FirstCall + FunctionCalls.reserve(FC+G.FunctionCalls.size()); + for (unsigned i = 0, ei = G.FunctionCalls.size(); i != ei; ++i) + FunctionCalls.push_back(DSCallSite(G.FunctionCalls[i], OldNodeMap)); // Return the returned node pointer... return DSNodeHandle(OldNodeMap[G.RetNode.getNode()], G.RetNode.getOffset()); @@ -729,7 +724,8 @@ // bool DSGraph::isNodeDead(DSNode *N) { // Is it a trivially dead shadow node... - if (N->getReferrers().empty() && N->NodeType == 0) + if (N->getReferrers().empty() && + (N->NodeType == 0 || N->NodeType == DSNode::DEAD)) return true; // Is it a function node or some other trivially unused global? @@ -754,6 +750,9 @@ Calls.erase(std::unique(Calls.begin(), Calls.end()), Calls.end()); + // Track the number of call nodes merged away... + NumCallNodesMerged += NumFns-Calls.size(); + DEBUG(if (NumFns != Calls.size()) std::cerr << "Merged " << (NumFns-Calls.size()) << " call nodes in " << where << "\n";); @@ -936,7 +935,7 @@ // inlining graphs. // void DSGraph::removeDeadNodes(bool KeepAllGlobals, bool KeepCalls) { - assert((!KeepAllGlobals || KeepCalls) && + assert((!KeepAllGlobals || KeepCalls) && // FIXME: This should be an enum! "KeepAllGlobals without KeepCalls is meaningless"); // Reduce the amount of work we have to do... @@ -961,22 +960,13 @@ E = ScalarMap.end(); I != E; ++I) markAlive(I->second.getNode(), Alive); -#if 0 - // Marge all nodes reachable by global nodes, as alive. Isn't this covered by - // the ScalarMap? - // - if (KeepAllGlobals) - for (unsigned i = 0, e = Nodes.size(); i != e; ++i) - if (Nodes[i]->NodeType & DSNode::GlobalNode) - markAlive(Nodes[i], Alive); -#endif - // The return value is alive as well... markAlive(RetNode.getNode(), Alive); // Mark all globals or cast nodes that can reach a live node as alive. // This also marks all nodes reachable from such nodes as alive. // Of course, if KeepAllGlobals is specified, they would be live already. + if (!KeepAllGlobals) markGlobalsAlive(*this, Alive, !KeepCalls); Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.35 llvm/lib/Analysis/DataStructure/Printer.cpp:1.36 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.35 Wed Nov 6 20:18:46 2002 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Thu Nov 7 19:21:07 2002 @@ -182,7 +182,7 @@ } O << "\nGraphs contain [" << TotalNumNodes << "+" << TotalCallNodes - << "] nodes total\n"; + << "] nodes total" << std::endl; } Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.21 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.22 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.21 Thu Nov 7 01:06:20 2002 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Thu Nov 7 19:21:07 2002 @@ -138,7 +138,8 @@ // Loop over all call sites of this function, merging each one into this // graph. // - DEBUG(std::cerr << " [TD] Inlining callers for: " << F.getName() << "\n"); + DEBUG(std::cerr << " [TD] Inlining " << CallSitesP->size() + << " callers for: " << F.getName() << "\n"); const std::vector &CallSites = *CallSitesP; for (unsigned c = 0, ce = CallSites.size(); c != ce; ++c) { const DSCallSite &CallSite = CallSites[c]; From lattner at cs.uiuc.edu Thu Nov 7 19:23:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 19:23:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSNode.h Message-ID: <200211080122.TAA07470@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSNode.h updated: 1.8 -> 1.9 --- Log message: Add flag that may be used to determine if dead nodes are used. It's temporary --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSNode.h diff -u llvm/include/llvm/Analysis/DSNode.h:1.8 llvm/include/llvm/Analysis/DSNode.h:1.9 --- llvm/include/llvm/Analysis/DSNode.h:1.8 Wed Nov 6 00:20:27 2002 +++ llvm/include/llvm/Analysis/DSNode.h Thu Nov 7 19:22:26 2002 @@ -56,6 +56,9 @@ Incomplete = 1 << 4, // This node may not be complete Modified = 1 << 5, // This node is modified in this context Read = 1 << 6, // This node is read in this context +#if 1 + DEAD = 1 << 7, // This node is dead and should not be pointed to +#endif }; /// NodeType - A union of the above bits. "Shadow" nodes do not add any flags @@ -208,11 +211,11 @@ //===----------------------------------------------------------------------===// // Define inline DSNodeHandle functions that depend on the definition of DSNode // - inline void DSNodeHandle::setNode(DSNode *n) { if (N) N->removeReferrer(this); N = n; if (N) N->addReferrer(this); + assert(!N || ((N->NodeType & DSNode::DEAD) == 0)); } inline bool DSNodeHandle::hasLink(unsigned Num) const { From lattner at cs.uiuc.edu Thu Nov 7 23:01:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 23:01:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp Message-ID: <200211080500.XAA10386@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Local.cpp updated: 1.29 -> 1.30 --- Log message: * actually handle constants (especially constantexprs) correctly. - This seems to dramatically improve many benchmarks, only slowing down gzip significantly. --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.29 llvm/lib/Analysis/DataStructure/Local.cpp:1.30 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.29 Wed Nov 6 23:20:53 2002 +++ llvm/lib/Analysis/DataStructure/Local.cpp Thu Nov 7 23:00:44 2002 @@ -88,7 +88,7 @@ void visitPHINode(PHINode &PN); - void visitGetElementPtrInst(GetElementPtrInst &GEP); + void visitGetElementPtrInst(User &GEP); void visitReturnInst(ReturnInst &RI); void visitLoadInst(LoadInst &LI); void visitStoreInst(StoreInst &SI); @@ -145,21 +145,38 @@ /// getValueDest - Return the DSNode that the actual value points to. /// -DSNodeHandle GraphBuilder::getValueDest(Value &V) { - if (Constant *C = dyn_cast(&V)) { - // FIXME: Return null NH for constants like 10 or null - // FIXME: Handle constant exprs here. +DSNodeHandle GraphBuilder::getValueDest(Value &Val) { + Value *V = &Val; + if (V == Constant::getNullValue(V->getType())) + return 0; // Null doesn't point to anything, don't add to ScalarMap! - return 0; // Constant doesn't point to anything. - } - - DSNodeHandle &NH = ScalarMap[&V]; + DSNodeHandle &NH = ScalarMap[V]; if (NH.getNode()) return NH; // Already have a node? Just return it... + if (Constant *C = dyn_cast(V)) + if (ConstantPointerRef *CPR = dyn_cast(C)) { + return NH = getValueDest(*CPR->getValue()); + } else if (ConstantExpr *CE = dyn_cast(C)) { + if (CE->getOpcode() == Instruction::Cast) + return NH = getValueDest(*CE->getOperand(0)); + if (CE->getOpcode() == Instruction::GetElementPtr) { + visitGetElementPtrInst(*CE); + return ScalarMap[CE]; + } + + // This returns a conservative unknown node for any unhandled ConstExpr + return NH = createNode(DSNode::UnknownNode); + } else if (ConstantIntegral *CI = dyn_cast(C)) { + // Random constants are unknown mem + return NH = createNode(DSNode::UnknownNode); + } else { + assert(0 && "Unknown constant type!"); + } + // Otherwise we need to create a new node to point to... DSNode *N; - if (GlobalValue *GV = dyn_cast(&V)) { + if (GlobalValue *GV = dyn_cast(V)) { // Create a new global node for this global variable... N = createNode(DSNode::GlobalNode, GV->getType()->getElementType()); N->addGlobal(GV); @@ -226,7 +243,7 @@ PNDest.mergeWith(getValueDest(*PN.getIncomingValue(i))); } -void GraphBuilder::visitGetElementPtrInst(GetElementPtrInst &GEP) { +void GraphBuilder::visitGetElementPtrInst(User &GEP) { DSNodeHandle Value = getValueDest(*GEP.getOperand(0)); if (Value.getNode() == 0) return; From lattner at cs.uiuc.edu Thu Nov 7 23:02:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 23:02:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Steensgaard.cpp TopDownClosure.cpp Message-ID: <200211080501.XAA10403@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.50 -> 1.51 Steensgaard.cpp updated: 1.8 -> 1.9 TopDownClosure.cpp updated: 1.22 -> 1.23 --- Log message: Use DSNodeHandleMap instead to be safe --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.50 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.51 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.50 Thu Nov 7 19:21:07 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Thu Nov 7 23:01:14 2002 @@ -470,11 +470,12 @@ //===----------------------------------------------------------------------===// DSGraph::DSGraph(const DSGraph &G) : Func(G.Func) { - std::map NodeMap; + std::map NodeMap; RetNode = cloneInto(G, ScalarMap, NodeMap); } -DSGraph::DSGraph(const DSGraph &G, std::map &NodeMap) +DSGraph::DSGraph(const DSGraph &G, + std::map &NodeMap) : Func(G.Func) { RetNode = cloneInto(G, ScalarMap, NodeMap); } @@ -501,9 +502,12 @@ /// remapLinks - Change all of the Links in the current node according to the /// specified mapping. /// -void DSNode::remapLinks(std::map &OldNodeMap) { - for (unsigned i = 0, e = Links.size(); i != e; ++i) - Links[i].setNode(OldNodeMap[Links[i].getNode()]); +void DSNode::remapLinks(std::map &OldNodeMap) { + for (unsigned i = 0, e = Links.size(); i != e; ++i) { + DSNodeHandle &H = OldNodeMap[Links[i].getNode()]; + Links[i].setNode(H.getNode()); + Links[i].setOffset(Links[i].getOffset()+H.getOffset()); + } } @@ -515,7 +519,7 @@ // DSNodeHandle DSGraph::cloneInto(const DSGraph &G, std::map &OldValMap, - std::map &OldNodeMap, + std::map &OldNodeMap, AllocaBit StripAllocas) { assert(OldNodeMap.empty() && "Returned OldNodeMap should be empty!"); assert(&G != this && "Cannot clone graph into itself!"); @@ -544,14 +548,14 @@ for (std::map::const_iterator I = G.ScalarMap.begin(), E = G.ScalarMap.end(); I != E; ++I) { DSNodeHandle &H = OldValMap[I->first]; - H.setNode(OldNodeMap[I->second.getNode()]); - H.setOffset(I->second.getOffset()); + DSNodeHandle &MappedNode = OldNodeMap[I->second.getNode()]; + H.setNode(MappedNode.getNode()); + H.setOffset(I->second.getOffset()+MappedNode.getOffset()); if (isa(I->first)) { // Is this a global? std::map::iterator GVI = ScalarMap.find(I->first); if (GVI != ScalarMap.end()) { // Is the global value in this fn already? GVI->second.mergeWith(H); - OldNodeMap[I->second.getNode()] = H.getNode(); } else { ScalarMap[I->first] = H; // Add global pointer to this graph } @@ -565,7 +569,9 @@ FunctionCalls.push_back(DSCallSite(G.FunctionCalls[i], OldNodeMap)); // Return the returned node pointer... - return DSNodeHandle(OldNodeMap[G.RetNode.getNode()], G.RetNode.getOffset()); + DSNodeHandle &MappedRet = OldNodeMap[G.RetNode.getNode()]; + return DSNodeHandle(MappedRet.getNode(), + MappedRet.getOffset()+G.RetNode.getOffset()); } /// mergeInGraph - The method is used for merging graphs together. If the @@ -584,7 +590,7 @@ // 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; + std::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 Index: llvm/lib/Analysis/DataStructure/Steensgaard.cpp diff -u llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.8 llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.9 --- llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.8 Wed Nov 6 12:08:32 2002 +++ llvm/lib/Analysis/DataStructure/Steensgaard.cpp Thu Nov 7 23:01:14 2002 @@ -124,7 +124,7 @@ if (!I->isExternal()) { std::map ValMap; { // Scope to free NodeMap memory ASAP - std::map NodeMap; + std::map NodeMap; const DSGraph &FDSG = LDS.getDSGraph(*I); DSNodeHandle RetNode = ResultGraph->cloneInto(FDSG, ValMap, NodeMap); Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.22 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.23 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.22 Thu Nov 7 19:21:07 2002 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Thu Nov 7 23:01:14 2002 @@ -93,7 +93,7 @@ DSGraph &BUGraph = BU.getDSGraph(F); // Copy the BU graph, keeping a mapping from the BUGraph to the current Graph - std::map BUNodeMap; + std::map BUNodeMap; Graph = new DSGraph(BUGraph, BUNodeMap); // We only need the BUMap entries for the nodes that are used in call sites. @@ -113,12 +113,12 @@ } // Loop through te BUNodeMap, keeping only the nodes that are "Needed" - for (std::map::iterator I = BUNodeMap.begin(); + for (std::map::iterator I = BUNodeMap.begin(); I != BUNodeMap.end(); ) if (NeededNodes.count(I->first) && I->first) // Keep needed nodes... ++I; else { - std::map::iterator J = I++; + std::map::iterator J = I++; BUNodeMap.erase(J); } @@ -167,7 +167,7 @@ // These two maps keep track of where scalars in the old graph _used_ // to point to, and of new nodes matching nodes of the old graph. std::map OldValMap; - std::map OldNodeMap; + std::map OldNodeMap; // FIXME: Eventually use DSGraph::mergeInGraph here... // Graph->mergeInGraph(CallSiteInCG, CG, false); From lattner at cs.uiuc.edu Thu Nov 7 23:04:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Nov 7 23:04:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h DSNode.h Message-ID: <200211080503.XAA10588@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.29 -> 1.30 DSNode.h updated: 1.9 -> 1.10 --- Log message: Use DSNodeHandle for persistent maps --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.29 llvm/include/llvm/Analysis/DSGraph.h:1.30 --- llvm/include/llvm/Analysis/DSGraph.h:1.29 Thu Nov 7 01:05:56 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Thu Nov 7 23:03:37 2002 @@ -43,7 +43,7 @@ // destination graph, you may optionally do this by specifying a map to record // this into. DSGraph(const DSGraph &DSG); - DSGraph(const DSGraph &DSG, std::map &BUNodeMap); + DSGraph(const DSGraph &DSG, std::map &NodeMap); ~DSGraph(); bool hasFunction() const { return Func != 0; } @@ -138,7 +138,7 @@ // DSNodeHandle cloneInto(const DSGraph &G, std::map &OldValMap, - std::map &OldNodeMap, + std::map &OldNodeMap, AllocaBit StripAllocas = KeepAllocaBit); /// 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.9 llvm/include/llvm/Analysis/DSNode.h:1.10 --- llvm/include/llvm/Analysis/DSNode.h:1.9 Thu Nov 7 19:22:26 2002 +++ llvm/include/llvm/Analysis/DSNode.h Thu Nov 7 23:03:37 2002 @@ -198,7 +198,7 @@ /// remapLinks - Change all of the Links in the current node according to the /// specified mapping. - void remapLinks(std::map &OldNodeMap); + void remapLinks(std::map &OldNodeMap); private: friend class DSNodeHandle; From lattner at cs.uiuc.edu Fri Nov 8 00:51:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 00:51:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/ProgrammersManual.html Message-ID: <200211080650.AAA24958@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: ProgrammersManual.html updated: 1.35 -> 1.36 --- Log message: Add some notes about DEBUG flag --- Diffs of the changes: Index: llvm/www/docs/ProgrammersManual.html diff -u llvm/www/docs/ProgrammersManual.html:1.35 llvm/www/docs/ProgrammersManual.html:1.36 --- llvm/www/docs/ProgrammersManual.html:1.35 Sun Oct 20 21:38:02 2002 +++ llvm/www/docs/ProgrammersManual.html Fri Nov 8 00:50:02 2002 @@ -349,8 +349,15 @@ Using the DEBUG() macro instead of a home brewed solution allows you to now have to create "yet another" command line option for the debug output for -your pass. Note that DEBUG() macros are disabled for optimized -builds, so they do not cause a performance impact at all.

+your pass. Note that DEBUG() macros are disabled for optimized builds, +so they do not cause a performance impact at all (for the same reason, they +should also not contain side-effects!).

+ +One additional nice thing about the DEBUG() macro is that you can +enable or disable it directly in gdb. Just use "set DebugFlag=0" or +"set DebugFlag=1" from the gdb if the program is running. If the +program hasn't been started yet, you can always just run it with +-debug.

@@ -1769,6 +1776,6 @@ Chris Lattner -Last modified: Sun Oct 20 21:37:06 CDT 2002 +Last modified: Fri Nov 8 00:48:37 CST 2002 From lattner at cs.uiuc.edu Fri Nov 8 00:51:09 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 00:51:09 2002 Subject: [llvm-commits] CVS: llvm/www/docs/DSGraphStatus.html Message-ID: <200211080650.AAA24982@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: DSGraphStatus.html updated: 1.4 -> 1.5 --- Log message: Add some numbers --- Diffs of the changes: Index: llvm/www/docs/DSGraphStatus.html diff -u llvm/www/docs/DSGraphStatus.html:1.4 llvm/www/docs/DSGraphStatus.html:1.5 --- llvm/www/docs/DSGraphStatus.html:1.4 Wed Nov 6 21:53:27 2002 +++ llvm/www/docs/DSGraphStatus.html Fri Nov 8 00:50:22 2002 @@ -5,10 +5,120 @@ This page records information and the progress the data structure analysis passes have been making. Times are in seconds, sizes are #bytes allocated for a -particular pass.

+particular pass. Runs that are all '*'d out were not completed because they +were taking too long.


-

Nov 6, 2002:

+

Nov 7, 2002 #2:

+ +Same as the
previous run, but now we actually handle +constants (especially constantexprs) correctly in the local and all subsequent +passes. This seems to dramatically improve many benchmarks, only slowing down +gzip significantly.

+ +

+Name:                     Anlyz: LocTime: BUTime:  TDTime:  TotTime:      LocSize: BUSize:  TDSize:    TotSize:     NumFold  NumNodes   main   __main
+254.gap.lib                 6.07 analyze: ../../../include/llvm/Analysis/DSNode.h:77: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed.
+164.gzip.llvm.lib           5.32 0.1157   1.0296   3.4025   4.6326   |    2054352  2631576  7804656    12588904   |    398   13372+217  174+3  174+3  
+300.twolf.lib              30.88 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
+256.bzip2.lib               2.36 0.0250   0.1913   1.8190   2.0966   |    371928   1045320  7533440    9023600    |    407   11415+149  151+2  151+2  
+sim.llvm.lib                1.97 0.0174   0.2155   1.4731   1.7539   |    104584   120112   449736     747416     |    46    2745+52    101+2  101+2  
+255.vortex.lib             15.71 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
+197.parser.lib              1.27 analyze: ../../../include/llvm/Analysis/DSNode.h:77: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed.
+optimizer-eval.llvm.lib     1.09 0.0132   0.0926   0.8104   0.9528   |    109416   186592   1827184    2141376    |    1709  8189+43    63+0   63+0   
+burg.llvm.lib               0.81 analyze: ../../../include/llvm/Analysis/DSNode.h:77: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed.
+181.mcf.lib                 0.38 0.0163   0.0470   0.1847   0.2714   |    156304   219896   808112     1201160    |    226   1859+0     44+0   44+0   
+voronoi.llvm.lib            0.22 0.0118   0.0241   0.0776   0.1293   |    82728    87872    214584     399128     |    31    1650+0     30+0   30+0   
+sgefa.llvm.lib              0.19 0.0074   0.0324   0.0716   0.1303   |    104560   104744   200024     434096     |    89    610+1      32+0   32+0   
+bh.llvm.lib                 0.17 0.0106   0.0158   0.0344   0.0813   |    80112    86984    210008     425144     |    66    678+3      16+0   16+0   
+em3d.llvm.lib               0.16 0.0067   0.0111   0.0619   0.0899   |    37600    55936    217632     327872     |    90    1584+522   38+3   38+3   
+health.llvm.lib             0.10 0.0044   0.0071   0.0117   0.0322   |    31120    38712    35248      120048     |    81    328+0      14+0   14+0   
+lists.llvm.lib              0.09 0.0037   0.0075   0.0296   0.0477   |    27792    32968    83288      162264     |    61    222+0      10+0   10+0   
+llubenchmark.llvm.lib       0.09 0.0018   0.0021   0.0060   0.0178   |    11104    12176    32552      66840      |    35    152+22     17+1   17+1   
+power.llvm.lib              0.08 0.0036   0.0045   0.0139   0.0308   |    21672    31000    40512      109008     |    5     246+0      9+0    9+0    
+mst.llvm.lib                0.07 0.0033   0.0051   0.0125   0.0296   |    28368    27552    49088      119680     |    54    435+1      21+0   21+0   
+indvars.llvm.lib            0.07 0.0020   0.0199   0.0281   0.0521   |    85496    84840    164280     334616     |    *     15+0       1+0    1+0    
+perimeter.llvm.lib          0.06 0.0027   0.0035   0.0037   0.0180   |    15312    12112    14536      54800      |    *     83+0       4+0    4+0    
+tsp.llvm.lib                0.05 0.0045   0.0041   0.0063   0.0254   |    27736    15016    25296      82352      |    28    228+1      11+0   11+0   
+hash.llvm.lib               0.04 0.0025   0.0038   0.0054   0.0202   |    18288    24528    26104      82320      |    2     220+0      7+0    7+0    
+bisort.llvm.lib             0.04 0.0025   0.0030   0.0050   0.0178   |    14296    19056    28384      72808      |    5     186+0      10+0   10+0   
+sumarray2d.llvm.lib         0.04 0.0011   0.0077   0.0102   0.0210   |    42032    46264    83960      174576     |    *     12+0       1+0    1+0    
+treeadd.llvm.lib            0.04 0.0011   0.0013   0.0017   0.0086   |    9008     7360     10264      42432      |    2     64+0       5+0    5+0    
+objinst.llvm.lib            0.03 0.0021   0.0019   0.0049   0.0147   |    10928    15344    24592      64520      |    31    151+72     9+4    9+4    
+methcall.llvm.lib           0.03 0.0014   0.0016   0.0030   0.0111   |    15520    8928     8032       45736      |    27    99+44      8+4    8+4    
+matrix.llvm.lib             0.03 0.0010   0.0015   0.0017   0.0086   |    8680     8424     8200       41304      |    *     39+0       1+0    1+0    
+sieve.llvm.lib              0.03 0.0007   0.0021   0.0032   0.0101   |    10320    13864    34512      72456      |    *     26+0       2+0    2+0    
+sumarraymalloc.llvm.lib     0.03 0.0007   0.0008   0.0008   0.0060   |    2656     6144     6848       30024      |    *     31+0       2+0    2+0    
+matrixTranspose.llvm.lib    0.03 0.0006   0.0027   0.0034   0.0087   |    14064    9080     28600      51744      |    *     14+0       3+0    3+0    
+ary3.llvm.lib               0.02 0.0011   0.0013   0.0012   0.0081   |    8720     6968     8256       39992      |    6     44+0       1+0    1+0    
+heapsort.llvm.lib           0.02 0.0008   0.0008   0.0008   0.0077   |    2896     13464    2552       33728      |    *     39+0       3+0    3+0    
+random.llvm.lib             0.02 0.0007   0.0006   0.0006   0.0056   |    6296     4848     6112       29856      |    *     26+0       3+0    3+0    
+fib2.llvm.lib               0.01 0.0007   0.0007   0.0006   0.0052   |    5488     5408     1344       24888      |    *     19+0       1+0    1+0    
+pi.llvm.lib                 0.01 0.0006   0.0006   0.0009   0.0043   |    5656     4768     5416       15840      |    *     29+0       3+0    3+0    
+printargs.llvm.lib          0.01 0.0003   0.0003   0.0003   0.0023   |    1336     560      728        2624       |    *     9+0        1+0    1+0    
+sumarray.llvm.lib           0.01 0.0003   0.0003   0.0002   0.0022   |    1256     2456     456        6280       |    3     5+0        0+0    0+0    
+hello.llvm.lib              0.01 0.0003   0.0003   0.0002   0.0019   |    840      2872     3136       6848       |    *     5+0        1+0    1+0    
+ackermann.llvm.lib          0.01 *        *        *        *        |    *        *        *          *          |    *     0+0        *      *      
+

+ + +


+

Nov 7, 2002:

+ +Notes: Debug build, no globals graph, no array collapsing.

+ +Things are a big slower than before due to corrected handling of global +variables. + +

+Name:                     Anlyz: LocTime: BUTime:  TDTime:  TotTime:      LocSize: BUSize:  TDSize:    TotSize:     NumFold  NumNodes   main   __main
+254.gap.lib                 6.23 analyze: ../../../include/llvm/Analysis/DSNode.h:77: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed.
+sim.llvm.lib                3.77 0.0156   0.3313   1.6634   2.0787   |    63080    98008    192424     426656     |    *     1825+84    63+2   63+2   
+300.twolf.lib             374.15 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
+255.vortex.lib            185.26 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
+256.bzip2.lib               1.10 0.0158   0.0679   0.7397   0.8794   |    213592   385312   3368648    4040464    |    18    5238+257   64+1   64+1   
+164.gzip.llvm.lib           1.08 0.0260   0.0797   0.3326   0.5279   |    235048   421744   1484408    2237792    |    21    9628+634   113+1  113+1  
+197.parser.lib              1.06 analyze: ../../../include/llvm/Analysis/DSNode.h:77: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed.
+burg.llvm.lib               0.71 analyze: ../../../include/llvm/Analysis/DSNode.h:77: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed.
+optimizer-eval.llvm.lib     0.67 0.0115   0.0793   0.4125   0.5422   |    78080    141896   372592     610760     |    58    666+27     2+0    2+0    
+181.mcf.lib                 0.32 0.0125   0.0418   0.1271   0.2052   |    120504   192920   545696     876008     |    186   753+0      14+0   14+0   
+voronoi.llvm.lib            0.18 0.0098   0.0204   0.0661   0.1116   |    78560    83344    116304     292200     |    19    1006+0     16+0   16+0   
+sgefa.llvm.lib              0.16 0.0064   0.0340   0.0413   0.0999   |    82280    96016    67960      270944     |    *     125+2      2+0    2+0    
+sieve.llvm.lib              0.16 0.0007   0.0028   0.0209   0.0295   |    9872     13808    38872      76312      |    *     22+0       1+0    1+0    
+lists.llvm.lib              0.15 0.0027   0.0061   0.0042   0.0217   |    22256    14256    3208       51720      |    52    38+0       0+0    0+0    
+bh.llvm.lib                 0.14 0.0082   0.0140   0.0171   0.0630   |    73320    75448    42920      255160     |    74    402+4      10+0   10+0   
+em3d.llvm.lib               0.14 0.0037   0.0091   0.0303   0.0522   |    33816    50768    109200     202192     |    10    925+410    19+3   19+3   
+hash.llvm.lib               0.14 0.0020   0.0033   0.0036   0.0154   |    17488    23928    12584      67400      |    *     131+0      2+0    2+0    
+llubenchmark.llvm.lib       0.13 0.0013   0.0011   0.0019   0.0128   |    9680     2144     10072      32904      |    *     51+10      4+1    4+1    
+indvars.llvm.lib            0.12 0.0022   0.0248   0.0422   0.0713   |    82040    87944    160872     333400     |    *     12+0       0+0    0+0    
+ary3.llvm.lib               0.12 0.0008   0.0011   0.0009   0.0072   |    7992     7808     2416       34264      |    6     37+0       0+0    0+0    
+health.llvm.lib             0.10 0.0035   0.0067   0.0067   0.0280   |    28432    27984    12640      83984      |    72    151+1      6+0    6+0    
+hello.llvm.lib              0.10 0.0002   0.0002   0.0002   0.0016   |    504      2816     336        3656       |    *     2+0        0+0    0+0    
+ackermann.llvm.lib          0.09 0.0004   0.0005   0.0004   0.0045   |    6976     992      840        18736      |    *     10+0       0+0    0+0    
+objinst.llvm.lib            0.08 0.0014   0.0019   0.0052   0.0137   |    9480     19064    12216      54416      |    25    148+80     7+4    7+4    
+sumarray2d.llvm.lib         0.08 0.0012   0.0096   0.0109   0.0235   |    41416    47080    80696      171512     |    *     9+0        0+0    0+0    
+methcall.llvm.lib           0.08 0.0011   0.0016   0.0032   0.0108   |    3952     17528    8584       43720      |    23    104+52     7+4    7+4    
+heapsort.llvm.lib           0.08 0.0006   0.0008   0.0007   0.0063   |    2264     13720    2216       33016      |    *     33+0       2+0    2+0    
+fib2.llvm.lib               0.08 0.0005   0.0006   0.0004   0.0048   |    1776     5312     1080       23992      |    *     14+0       0+0    0+0    
+tsp.llvm.lib                0.07 0.0036   0.0035   0.0041   0.0197   |    17304    13808    17968      63704      |    18    95+1       4+0    4+0    
+random.llvm.lib             0.07 0.0005   0.0006   0.0005   0.0066   |    1584     4704     5752       25264      |    *     21+0       2+0    2+0    
+pi.llvm.lib                 0.07 0.0004   0.0004   0.0005   0.0031   |    4744     1248     4368       10360      |    *     14+0       0+0    0+0    
+power.llvm.lib              0.06 0.0031   0.0063   0.0070   0.0251   |    19440    28024    23544      86832      |    *     146+0      4+0    4+0    
+bisort.llvm.lib             0.06 0.0019   0.0036   0.0026   0.0168   |    12776    18296    6808       48952      |    *     89+0       4+0    4+0    
+matrixTranspose.llvm.lib    0.06 0.0005   0.0019   0.0025   0.0065   |    9136     14520    25336      48992      |    *     10+0       1+0    1+0    
+printargs.llvm.lib          0.06 0.0003   0.0003   0.0003   0.0021   |    888      504      512        1904       |    *     5+0        0+0    0+0    
+perimeter.llvm.lib          0.05 0.0026   0.0042   0.0044   0.0220   |    13968    12464    3928       43016      |    *     35+0       1+0    1+0    
+mst.llvm.lib                0.05 0.0026   0.0040   0.0052   0.0227   |    16520    25840    14016      71048      |    10    217+1      9+0    9+0    
+sumarray.llvm.lib           0.05 0.0002   0.0003   0.0002   0.0020   |    976      3424     464        6976       |    3     5+0        0+0    0+0    
+treeadd.llvm.lib            0.03 0.0010   0.0011   0.0009   0.0085   |    7928     6424     2088       28432      |    *     27+0       1+0    1+0    
+matrix.llvm.lib             0.02 0.0020   0.0013   0.0014   0.0090   |    7856     10416    2200       36232      |    *     32+0       0+0    0+0    
+sumarraymalloc.llvm.lib     0.02 0.0006   0.0007   0.0005   0.0056   |    2032     5984     1368       23472      |    *     17+0       0+0    0+0    
+

+ + + +


+

Nov 6, 2002:

Notes: Debug build, no globals graph, no array collapsing.

@@ -53,7 +163,7 @@ 254.gap.lib analyze: ../../../include/llvm/Analysis/DSNode.h:74: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed. 255.vortex.lib analyze: ../../../include/llvm/Analysis/DSNode.h:74: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed. 256.bzip2.lib 0.0149 0.0604 0.6503 0.7810 0m1.027s | 210880 387776 3371632 4041800 | 18 5005+76 65+1 65+1 -300.twolf.lib 0.1806 0.5248 42.5463 43.8329 0m45.785s | 522056 653816 10076992 11252864 | 1269 * 410+12 410+12 +300.twolf.lib 0.1806 0.5248 42.5463 43.8329 0m45.785s | 522056 653816 10076992 11252864 | 1269 78066+4900 410+12 410+12 burg.llvm.lib analyze: ../../../include/llvm/Analysis/DSNode.h:74: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed. @@ -61,7 +171,7 @@

Chris Lattner
-Last modified: Wed Nov 6 21:50:19 CST 2002 +Last modified: Thu Nov 7 23:00:33 CST 2002 From vadve at cs.uiuc.edu Fri Nov 8 08:08:01 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Fri Nov 8 08:08:01 2002 Subject: [llvm-commits] CVS: llvm/include/Support/hash_set hash_map Message-ID: <200211081407.IAA02220@psmith.cs.uiuc.edu> Changes in directory llvm/include/Support: hash_set updated: 1.5 -> 1.6 hash_map updated: 1.4 -> 1.5 --- Log message: Include HashExtras.h since it is almost always needed anyway. --- Diffs of the changes: Index: llvm/include/Support/hash_set diff -u llvm/include/Support/hash_set:1.5 llvm/include/Support/hash_set:1.6 --- llvm/include/Support/hash_set:1.5 Thu Jul 25 10:23:20 2002 +++ llvm/include/Support/hash_set Fri Nov 8 08:07:33 2002 @@ -39,5 +39,7 @@ using HASH_NAMESPACE::hash_set; using HASH_NAMESPACE::hash; +#include + #endif Index: llvm/include/Support/hash_map diff -u llvm/include/Support/hash_map:1.4 llvm/include/Support/hash_map:1.5 --- llvm/include/Support/hash_map:1.4 Thu Jul 25 10:23:20 2002 +++ llvm/include/Support/hash_map Fri Nov 8 08:07:33 2002 @@ -39,4 +39,6 @@ using HASH_NAMESPACE::hash_map; using HASH_NAMESPACE::hash; +#include + #endif From lattner at cs.uiuc.edu Fri Nov 8 13:11:02 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 13:11:02 2002 Subject: [llvm-commits] CVS: llvm/tools/lli/ExternalFunctions.cpp Message-ID: <200211081910.NAA19091@apoc.cs.uiuc.edu> Changes in directory llvm/tools/lli: ExternalFunctions.cpp updated: 1.37 -> 1.38 --- Log message: Implement feof --- Diffs of the changes: Index: llvm/tools/lli/ExternalFunctions.cpp diff -u llvm/tools/lli/ExternalFunctions.cpp:1.37 llvm/tools/lli/ExternalFunctions.cpp:1.38 --- llvm/tools/lli/ExternalFunctions.cpp:1.37 Thu Nov 7 13:33:50 2002 +++ llvm/tools/lli/ExternalFunctions.cpp Fri Nov 8 13:10:26 2002 @@ -501,6 +501,15 @@ return GV; } +// int feof(FILE *stream); +GenericValue lle_X_feof(FunctionType *M, const vector &Args) { + assert(Args.size() == 1); + GenericValue GV; + + GV.IntVal = feof(getFILE(Args[0].PointerVal)); + return GV; +} + // size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream); GenericValue lle_X_fread(FunctionType *M, const vector &Args) { assert(Args.size() == 4); @@ -631,6 +640,7 @@ FuncNames["lle_i_clock"] = lle_i_clock; FuncNames["lle_X_fopen"] = lle_X_fopen; FuncNames["lle_X_fclose"] = lle_X_fclose; + FuncNames["lle_X_feof"] = lle_X_feof; FuncNames["lle_X_fread"] = lle_X_fread; FuncNames["lle_X_fwrite"] = lle_X_fwrite; FuncNames["lle_X_fgets"] = lle_X_fgets; From lattner at cs.uiuc.edu Fri Nov 8 13:14:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 13:14:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/IPModRef.cpp Message-ID: <200211081913.NAA19323@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: IPModRef.cpp updated: 1.7 -> 1.8 --- Log message: Fix IPModRef to use new DS interface --- Diffs of the changes: Index: llvm/lib/Analysis/IPA/IPModRef.cpp diff -u llvm/lib/Analysis/IPA/IPModRef.cpp:1.7 llvm/lib/Analysis/IPA/IPModRef.cpp:1.8 --- llvm/lib/Analysis/IPA/IPModRef.cpp:1.7 Thu Nov 7 01:12:23 2002 +++ llvm/lib/Analysis/IPA/IPModRef.cpp Fri Nov 8 13:13:14 2002 @@ -117,14 +117,7 @@ std::map &NodeMap) { // Step #1: Clone the top-down graph... - std::map RawNodeMap; - DSGraph *Result = new DSGraph(funcTDGraph, RawNodeMap); - - // Convert the NodeMap from a map to DSNode* to be a map to DSNodeHandle's - NodeMap.insert(RawNodeMap.begin(), RawNodeMap.end()); - - // We are now done with the old map... so free it's memory... - RawNodeMap.clear(); + DSGraph *Result = new DSGraph(funcTDGraph, NodeMap); // Step #2: Clear Mod/Ref information... Result->maskNodeTypes(~(DSNode::Modified | DSNode::Read)); From lattner at cs.uiuc.edu Fri Nov 8 14:35:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 14:35:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Module.h Message-ID: <200211082034.OAA23994@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Module.h updated: 1.27 -> 1.28 --- Log message: Add a method "getMainFunction()" that efficiently locates 'main' in a module --- Diffs of the changes: Index: llvm/include/llvm/Module.h diff -u llvm/include/llvm/Module.h:1.27 llvm/include/llvm/Module.h:1.28 --- llvm/include/llvm/Module.h:1.27 Sun Oct 13 22:30:13 2002 +++ llvm/include/llvm/Module.h Fri Nov 8 14:34:00 2002 @@ -80,6 +80,12 @@ /// Function *getFunction(const std::string &Name, const FunctionType *Ty); + /// getMainFunction - This function looks up main efficiently. This is such a + /// common case, that it is a method in Module. If main cannot be found, a + /// null pointer is returned. + /// + Function *getMainFunction(); + /// addTypeName - Insert an entry in the symbol table mapping Str to Type. If /// there is already an entry for this name, true is returned and the symbol /// table is not modified. From lattner at cs.uiuc.edu Fri Nov 8 14:35:06 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 14:35:06 2002 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Module.cpp Message-ID: <200211082034.OAA24003@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Module.cpp updated: 1.30 -> 1.31 --- Log message: Add a method "getMainFunction()" that efficiently locates 'main' in a module --- Diffs of the changes: Index: llvm/lib/VMCore/Module.cpp diff -u llvm/lib/VMCore/Module.cpp:1.30 llvm/lib/VMCore/Module.cpp:1.31 --- llvm/lib/VMCore/Module.cpp:1.30 Tue Oct 15 16:26:29 2002 +++ llvm/lib/VMCore/Module.cpp Fri Nov 8 14:34:02 2002 @@ -139,6 +139,58 @@ return false; } +/// getMainFunction - This function looks up main efficiently. This is such a +/// common case, that it is a method in Module. If main cannot be found, a +/// null pointer is returned. +/// +Function *Module::getMainFunction() { + std::vector Params; + + // int main(void)... + if (Function *F = getFunction("main", FunctionType::get(Type::IntTy, + Params, false))) + return F; + + // void main(void)... + if (Function *F = getFunction("main", FunctionType::get(Type::VoidTy, + Params, false))) + return F; + + Params.push_back(Type::IntTy); + + // int main(int argc)... + if (Function *F = getFunction("main", FunctionType::get(Type::IntTy, + Params, false))) + return F; + + // void main(int argc)... + if (Function *F = getFunction("main", FunctionType::get(Type::VoidTy, + Params, false))) + return F; + + for (unsigned i = 0; i != 2; ++i) { // Check argv and envp + Params.push_back(PointerType::get(PointerType::get(Type::SByteTy))); + + // int main(int argc, char **argv)... + if (Function *F = getFunction("main", FunctionType::get(Type::IntTy, + Params, false))) + return F; + + // void main(int argc, char **argv)... + if (Function *F = getFunction("main", FunctionType::get(Type::VoidTy, + Params, false))) + return F; + } + + // Loop over all of the methods, trying to find main the hard way... + for (iterator I = begin(), E = end(); I != E; ++I) + if (I->getName() == "main") + return I; + return 0; // Main not found... +} + + + // getTypeName - If there is at least one entry in the symbol table for the // specified type, return it. // From lattner at cs.uiuc.edu Fri Nov 8 14:35:10 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 14:35:10 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/Internalize.cpp Message-ID: <200211082034.OAA24022@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: Internalize.cpp updated: 1.11 -> 1.12 --- Log message: Use the new getMainFunction() method to efficiently locate main --- Diffs of the changes: Index: llvm/lib/Transforms/IPO/Internalize.cpp diff -u llvm/lib/Transforms/IPO/Internalize.cpp:1.11 llvm/lib/Transforms/IPO/Internalize.cpp:1.12 --- llvm/lib/Transforms/IPO/Internalize.cpp:1.11 Mon Oct 7 13:34:32 2002 +++ llvm/lib/Transforms/IPO/Internalize.cpp Fri Nov 8 14:34:21 2002 @@ -17,21 +17,16 @@ class InternalizePass : public Pass { virtual bool run(Module &M) { - bool FoundMain = false; // Look for a function named main... - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (I->getName() == "main" && !I->isExternal() && - I->hasExternalLinkage()) { - FoundMain = true; - break; - } - - if (!FoundMain) return false; // No main found, must be a library... + Function *MainFunc = M.getMainFunction(); + + if (MainFunc == 0 || MainFunc->isExternal()) + return false; // No main found, must be a library... bool Changed = false; // Found a main function, mark all functions not named main as internal. for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (I->getName() != "main" && // Leave the main function external + if (&*I != MainFunc && // Leave the main function external !I->isExternal() && // Function must be defined here !I->hasInternalLinkage()) { // Can't already have internal linkage I->setInternalLinkage(true); From lattner at cs.uiuc.edu Fri Nov 8 14:48:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 14:48:00 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/Makefile Message-ID: <200211082047.OAA24764@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: Makefile updated: 1.6 -> 1.7 --- Log message: Sort graphs by total time, don't perform make clean --- Diffs of the changes: Index: llvm/test/DSGraphs/Makefile diff -u llvm/test/DSGraphs/Makefile:1.6 llvm/test/DSGraphs/Makefile:1.7 --- llvm/test/DSGraphs/Makefile:1.6 Thu Nov 7 01:16:05 2002 +++ llvm/test/DSGraphs/Makefile Fri Nov 8 14:47:06 2002 @@ -54,11 +54,11 @@ $(LCC) $< -c report.raw.out: $(LANALYZE) - $(MAKE) clean gmake all 2>&1 | tee report.raw.out report: report.raw.out -mv -f report.no-times.txt report.no-times.old.txt -mv -f report.txt report.old.txt - ./generate_report.pl -no-times report.raw.out > report.no-times.txt - ./generate_report.pl report.raw.out 2>&1 | tee report.txt + ./generate_report.pl -no-times report.raw.out | sort --key=2 -r > report.no-times.txt + ./generate_report.pl report.raw.out | sort --key=2 -r | tee report.txt + From lattner at cs.uiuc.edu Fri Nov 8 14:49:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 14:49:01 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/generate_report.pl Message-ID: <200211082048.OAA24790@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: generate_report.pl updated: 1.5 -> 1.6 --- Log message: Lots of minor tweaks --- Diffs of the changes: Index: llvm/test/DSGraphs/generate_report.pl diff -u llvm/test/DSGraphs/generate_report.pl:1.5 llvm/test/DSGraphs/generate_report.pl:1.6 --- llvm/test/DSGraphs/generate_report.pl:1.5 Thu Nov 7 01:16:05 2002 +++ llvm/test/DSGraphs/generate_report.pl Fri Nov 8 14:48:05 2002 @@ -34,19 +34,25 @@ # first test. shift @Records; -printf("%-30s", "Name:"); + +# Output the headers for the report.... +printf("%-25s ", "Name:"); if ($SHOW_TIMES) { - printf("%-10s%-10s%-10s%-10s%-10s ", - "LocTime:", "BUTime:", "TDTime:", "TotTime:", "AnlzTime:"); + printf("%6s %-8s %-8s %-8s %-8s ", + "Anlyz:", "LocTime:", "BUTime:", "TDTime:", "TotTime:"); } -printf("%-10s%-10s%-10s%-10s " . "%-8s%-10s%-8s%-8s\n", +printf("%-8s %-8s %-10s %-10s " . "%-8s %-10s %-6s %-6s\n", "LocSize:", "BUSize:", "TDSize:", "TotSize:", "NumFold", "NumNodes", "main", "__main"); foreach $Record (@Records) { # Print BM name - printField('([-a-zA-Z0-9.]+)\.bc', $Record, 30); + printField('([-a-zA-Z0-9.]+)\.bc', $Record, -25); + + if ($SHOW_TIMES) { # Print total elapsed time... + printField('real\s+([ms0-9.]+)', $Record, 6); + } if ($Record =~ m/Assertion/) { # If an assertion failure occured, print it out. @@ -54,26 +60,24 @@ } else { if ($SHOW_TIMES) { # Print Times - printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ Local', $Record, 10); - printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ Bottom-up', $Record, 10); - printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ Top-down', $Record, 10); - printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ TOTAL', $Record, 10); - printField('real\s+([ms0-9.]+)', $Record, 10); - + printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ Local', $Record, -8); + printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ Bottom-up', $Record, -8); + printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ Top-down', $Record, -8); + printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ TOTAL', $Record, -8); print "| "; } # Print Sizes - printField("([0-9]+) Local", $Record, 10); - printField("([0-9]+) Bottom-up", $Record, 10); - printField("([0-9]+) Top-down", $Record, 10); - printField("([0-9]+) TOTAL", $Record, 10); + printField("([0-9]+) Local", $Record, -8); + printField("([0-9]+) Bottom-up", $Record, -8); + printField("([0-9]+) Top-down", $Record, -10); + printField("([0-9]+) TOTAL", $Record, -10); print "| "; - printField("([0-9]+).*completely folded", $Record, 5); - printField("Graphs contain \\[([0-9+]+)\\] nodes total", $Record, 10); - printField("\.main\.dot.... \\[([0-9+]+)\\]", $Record, 8); - printField("\.__main\.dot.... \\[([0-9+]+)\\]", $Record, 8); + printField("([0-9]+).*completely folded", $Record, -5); + printField("Graphs contain \\[([0-9+]+)\\] nodes total", $Record, -10); + printField("\.main\.dot.... \\[([0-9+]+)\\]", $Record, -6); + printField("\.__main\.dot.... \\[([0-9+]+)\\]", $Record, -6); } print "\n"; #print "#####\n"; @@ -85,8 +89,8 @@ #print "Args: '$Regex' '$Record'\n"; $Record =~ m/$Regex/; if (!defined($1)) { - printf("%-${FieldWidth}s", "*"); + printf("%${FieldWidth}s ", "*"); } else { - printf("%-${FieldWidth}s", $1); + printf("%${FieldWidth}s ", $1); } } From lattner at cs.uiuc.edu Fri Nov 8 14:49:05 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 14:49:05 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/Makefile.DSGraphs Message-ID: <200211082048.OAA24795@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: Makefile.DSGraphs updated: 1.7 -> 1.8 --- Log message: Minor tweaks. --- Diffs of the changes: Index: llvm/test/DSGraphs/Makefile.DSGraphs diff -u llvm/test/DSGraphs/Makefile.DSGraphs:1.7 llvm/test/DSGraphs/Makefile.DSGraphs:1.8 --- llvm/test/DSGraphs/Makefile.DSGraphs:1.7 Wed Nov 6 19:51:16 2002 +++ llvm/test/DSGraphs/Makefile.DSGraphs Fri Nov 8 14:47:40 2002 @@ -1,4 +1,4 @@ -## $Id: Makefile.DSGraphs,v 1.7 2002/11/07 01:51:16 lattner Exp $ +## $Id: Makefile.DSGraphs,v 1.8 2002/11/08 20:47:40 lattner Exp $ ##---------------------------------------------------------------------------- ## Common makefile rules for testing DSGraph analysis. ## @@ -8,7 +8,9 @@ ## PROGPATH = location from where to copy the *.bc file. ##---------------------------------------------------------------------------- -all: $(PROG:.bc=.ps) +include $(LEVEL)/test/Makefile.tests + +all:: $(PROG:.bc=.ps) PASS = td @@ -24,17 +26,17 @@ .PRECIOUS: %.lib.bc -%.lib.bc: %.bc ../dummylib.o $(LANALYZE) +%.lib.bc: %.bc ../dummylib.o link $< ../dummylib.o | opt -internalize -funcresolve -globaldce > $@ ANALYZE_OPTS = -stats -time-passes -only-print-main-ds -%.ps: %.lib.bc +%.ps: %.lib.bc $(LANALYZE) @echo "---------------------------------------------------------------" @echo ">>> ========= " $< @echo "---------------------------------------------------------------" - -time analyze -$(PASS)datastructure $(ANALYZE_OPTS) $< | \ + -time -p $(LANALYZE) -$(PASS)datastructure $(ANALYZE_OPTS) $< | \ tee $<.analyze$(PASS).out 2>&1 -dot -Tps < $(PASS).main.dot > $@ From lattner at cs.uiuc.edu Fri Nov 8 14:49:10 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 14:49:10 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/dummylib.c Message-ID: <200211082048.OAA24800@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: dummylib.c updated: 1.1 -> 1.2 --- Log message: Add a bunch more stubs --- Diffs of the changes: Index: llvm/test/DSGraphs/dummylib.c diff -u llvm/test/DSGraphs/dummylib.c:1.1 llvm/test/DSGraphs/dummylib.c:1.2 --- llvm/test/DSGraphs/dummylib.c:1.1 Sun Nov 3 06:39:43 2002 +++ llvm/test/DSGraphs/dummylib.c Fri Nov 8 14:47:52 2002 @@ -1,6 +1,8 @@ #include #include +#include +void srand(unsigned x) {} double exp(double x) { return 0; } double log(double x) { return 0; } double sqrt(double x) { return 0; } @@ -17,6 +19,15 @@ char *strcpy(char*Str1, const char *Str) { return Str1; } #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; } +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; } +void rewind(FILE*F) { } + void *calloc(size_t A, size_t B) { return malloc(A*B); } void *realloc(void *ptr, size_t N) { return ptr; } @@ -27,10 +38,24 @@ int memcmp(const char *A, const char *B, size_t N) { return 0; } ssize_t read(int fildes, void *buf, size_t nbyte) { return nbyte; } int close(int FD) { return 0; } +int rename(const char *oldpath, const char *newpath) { return 0; } + -const *strchr(const char *S, int N) { return S; } + +char *strchr(const char *s, int c) { return (char*)s; } int strcmp(const char *s1, const char *s2) { return 0; } int strncmp(const char *s1, const char *s2, size_t n) { return 0; } char *strncpy(char *s1, const char *s2, size_t n) { return s1; } +char *strpbrk(const char *s, const char *accept) { return (char*)s; } + +long clock() { return 0; } +char *ctime(const time_t *timep) { return 0; } +time_t time(time_t *t) { return *t = 0; } +double sin(double x) { return x; } +double cos(double x) { return x; } +double atan(double x) { 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 Nov 8 15:26:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 15:26:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h DSNode.h DataStructure.h Message-ID: <200211082125.PAA25959@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.30 -> 1.31 DSNode.h updated: 1.10 -> 1.11 DataStructure.h updated: 1.50 -> 1.51 --- Log message: - Add support for an "auxillary" call site list - Original call sites are now never modified after construction by the local pass. - DSGraph::cloneInto can now optionally not clone the call sites - BUDataStructures no longer has a ton of book-keeping info for a broken implementation of the TD data structures --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.30 llvm/include/llvm/Analysis/DSGraph.h:1.31 --- llvm/include/llvm/Analysis/DSGraph.h:1.30 Thu Nov 7 23:03:37 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Fri Nov 8 15:24:51 2002 @@ -26,14 +26,19 @@ #endif // FunctionCalls - This vector maintains a single entry for each call - // instruction in the current graph. Each call entry contains DSNodeHandles - // that refer to the arguments that are passed into the function call. The - // first entry in the vector is the scalar that holds the return value for the - // call, the second is the function scalar being invoked, and the rest are - // pointer arguments to the function. + // instruction in the current graph. The first entry in the vector is the + // scalar that holds the return value for the call, the second is the function + // scalar being invoked, and the rest are pointer arguments to the function. + // This vector is built by the Local graph and is never modified after that. // std::vector FunctionCalls; + // AuxFunctionCalls - This vector contains call sites that have been processed + // by some mechanism. In pratice, the BU Analysis uses this vector to hold + // the _unresolved_ call sites, because it cannot modify FunctionCalls. + // + std::vector AuxFunctionCalls; + void operator=(const DSGraph &); // DO NOT IMPLEMENT public: DSGraph() : Func(0) {} // Create a new, empty, DSGraph. @@ -64,13 +69,20 @@ std::map &getScalarMap() { return ScalarMap; } const std::map &getScalarMap() const {return ScalarMap;} - std::vector &getFunctionCalls() { - return FunctionCalls; - } + /// getFunctionCalls - Return the list of call sites in the original local + /// graph... + /// const std::vector &getFunctionCalls() const { return FunctionCalls; } + /// getAuxFunctionCalls - Get the call sites as modified by whatever passes + /// have been run. + /// + std::vector &getAuxFunctionCalls() { + return AuxFunctionCalls; + } + /// getNodeForValue - Given a value that is used or defined in the body of the /// current function, return the DSNode that it points to. /// @@ -125,9 +137,11 @@ // void removeDeadNodes(bool KeepAllGlobals = false, bool KeepCalls = true); - enum AllocaBit { - StripAllocaBit, - KeepAllocaBit + // CloneFlags enum - Bits that may be passed into the cloneInto method to + // specify how to clone the function graph. + enum CloneFlags { + StripAllocaBit = 1 << 0, KeepAllocaBit = 0 << 0, + DontCloneCallNodes = 2 << 0, CloneCallNodes = 0 << 0, }; // cloneInto - Clone the specified DSGraph into the current graph, returning @@ -139,7 +153,7 @@ DSNodeHandle cloneInto(const DSGraph &G, std::map &OldValMap, std::map &OldNodeMap, - AllocaBit StripAllocas = KeepAllocaBit); + unsigned CloneFlags = 0); /// mergeInGraph - The method is used for merging graphs together. If the /// argument graph is not *this, it makes a clone of the specified graph, then @@ -147,8 +161,7 @@ /// the graph. If the StripAlloca's argument is 'StripAllocaBit' then Alloca /// markers are removed from nodes. /// - void mergeInGraph(DSCallSite &CS, const DSGraph &Graph, - AllocaBit StripAllocas); + void mergeInGraph(DSCallSite &CS, const DSGraph &Graph, unsigned CloneFlags); #if 0 // cloneGlobalInto - Clone the given global node (or the node for the given Index: llvm/include/llvm/Analysis/DSNode.h diff -u llvm/include/llvm/Analysis/DSNode.h:1.10 llvm/include/llvm/Analysis/DSNode.h:1.11 --- llvm/include/llvm/Analysis/DSNode.h:1.10 Thu Nov 7 23:03:37 2002 +++ llvm/include/llvm/Analysis/DSNode.h Fri Nov 8 15:24:51 2002 @@ -98,6 +98,10 @@ /// const std::vector &getReferrers() const { return Referrers; } + /// hasNoReferrers - Return true if nothing is pointing to this node at all. + /// + bool hasNoReferrers() const { return Referrers.empty(); } + /// isModified - Return true if this node may be modified in this context /// bool isModified() const { return (NodeType & Modified) != 0; } Index: llvm/include/llvm/Analysis/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure.h:1.50 llvm/include/llvm/Analysis/DataStructure.h:1.51 --- llvm/include/llvm/Analysis/DataStructure.h:1.50 Thu Nov 7 18:23:23 2002 +++ llvm/include/llvm/Analysis/DataStructure.h Fri Nov 8 15:24:51 2002 @@ -9,6 +9,7 @@ #include "llvm/Analysis/DSSupport.h" #include "llvm/Pass.h" +#include class Type; class DSGraph; @@ -66,7 +67,6 @@ class BUDataStructures : public Pass { // DSInfo, one graph for each function std::map DSInfo; - std::map > CallSites; public: ~BUDataStructures() { releaseMemory(); } @@ -79,21 +79,12 @@ return *I->second; } - /// getCallSites - Return all of the call sites for the specified function - /// - const std::vector *getCallSites(const Function &F) const { - std::map >::const_iterator I - = CallSites.find(&F); - return I != CallSites.end() ? &I->second : 0; - } - - // print - Print out the analysis results... + // print - Print out the analysis results... void print(std::ostream &O, const Module *M) const; // If the pass pipeline is done with this pass, we can release our memory... virtual void releaseMemory(); - // getAnalysisUsage - This obviously provides a data structure graph. virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); AU.addRequired(); @@ -109,24 +100,7 @@ class TDDataStructures : public Pass { // DSInfo, one graph for each function std::map DSInfo; - - // Each graph in DSInfo is based on a graph in the BUDS object. The BUMaps - // member keeps the mappings from the BU graphs to the TD graphs as they are - // calculated by calculateGraph. This information is used to properly - // implement resolving of call sites, where the call sites in the BUGraph are - // in terms of the caller function's graph in the BUGraph. - // - typedef std::map BUNodeMapTy; - std::map BUMaps; - - // CallSitesForFunction - This is a temporary map that is only kept around - // when building the top-down closures for a program. It traverses all of the - // call sites in the BU graph and holds all of the call sites that each - // function is the "resolving caller" for. - // - std::map > CallSitesForFunction; - + std::set GraphDone; public: ~TDDataStructures() { releaseMemory(); } @@ -151,7 +125,8 @@ AU.addRequired(); } private: - DSGraph &calculateGraph(Function &F); + void calculateGraph(Function &F); + DSGraph &getOrCreateDSGraph(Function &F); void ResolveCallSite(DSGraph &Graph, const DSCallSite &CallSite); }; From lattner at cs.uiuc.edu Fri Nov 8 15:28:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 15:28:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Steensgaard.cpp Message-ID: <200211082127.PAA25983@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Steensgaard.cpp updated: 1.9 -> 1.10 --- Log message: Cannot modify original call sites vector --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/Steensgaard.cpp diff -u llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.9 llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.10 --- llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.9 Thu Nov 7 23:01:14 2002 +++ llvm/lib/Analysis/DataStructure/Steensgaard.cpp Fri Nov 8 15:27:37 2002 @@ -156,7 +156,12 @@ // call nodes... // std::vector &Calls = - ResultGraph->getFunctionCalls(); + ResultGraph->getAuxFunctionCalls(); + assert(Calls.empty() && "Aux call list is already in use??"); + + // Start with a copy of the original call sites... + Calls = ResultGraph->getFunctionCalls(); + for (unsigned i = 0; i != Calls.size(); ) { DSCallSite &CurCall = Calls[i]; From lattner at cs.uiuc.edu Fri Nov 8 15:28:06 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 15:28:06 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200211082127.PAA25988@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.51 -> 1.52 --- Log message: - Add a bunch of checking to make sure that dead nodes are not used after they are marked DEAD. This helped track down some bugs - Fix a bunch of bugs where we were doing work on nodes after they became dead - Add support for aux function call sites - Add support for not cloning call sites --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.51 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.52 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.51 Thu Nov 7 23:01:14 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Fri Nov 8 15:27:12 2002 @@ -360,6 +360,10 @@ if (N == 0 || (N == this && NH.getOffset() == Offset)) return; // Noop + assert((N->NodeType & DSNode::DEAD) == 0); + assert((NodeType & DSNode::DEAD) == 0); + assert(!hasNoReferrers() && "Should not try to fold a useless node!"); + if (N == this) { // We cannot merge two pieces of the same node together, collapse the node // completely. @@ -370,22 +374,33 @@ } // Merge the type entries of the two nodes together... - if (N->Ty.Ty != Type::VoidTy) + if (N->Ty.Ty != Type::VoidTy) { mergeTypeInfo(N->Ty.Ty, Offset); + // mergeTypeInfo can cause collapsing, which can cause this node to become + // dead. + if (hasNoReferrers()) return; + } + assert((NodeType & DSNode::DEAD) == 0); + // If we are merging a node with a completely folded node, then both nodes are // now completely folded. // if (isNodeCompletelyFolded()) { - if (!N->isNodeCompletelyFolded()) + if (!N->isNodeCompletelyFolded()) { N->foldNodeCompletely(); + if (hasNoReferrers()) return; + } } else if (N->isNodeCompletelyFolded()) { foldNodeCompletely(); Offset = 0; + if (hasNoReferrers()) return; } N = NH.getNode(); + assert((NodeType & DSNode::DEAD) == 0); if (this == N || N == 0) return; + assert((NodeType & DSNode::DEAD) == 0); // If both nodes are not at offset 0, make sure that we are merging the node // at an later offset into the node with the zero offset. @@ -412,6 +427,8 @@ unsigned NOffset = NH.getOffset()-Offset; unsigned NSize = N->getSize(); + assert((NodeType & DSNode::DEAD) == 0); + // Remove all edges pointing at N, causing them to point to 'this' instead. // Make sure to adjust their offset, not just the node pointer. // @@ -419,6 +436,7 @@ DSNodeHandle &Ref = *N->Referrers.back(); Ref = DSNodeHandle(this, NOffset+Ref.getOffset()); } + assert((NodeType & DSNode::DEAD) == 0); // Make all of the outgoing links of N now be outgoing links of this. This // can cause recursive merging! @@ -482,6 +500,7 @@ DSGraph::~DSGraph() { FunctionCalls.clear(); + AuxFunctionCalls.clear(); ScalarMap.clear(); RetNode.setNode(0); @@ -520,7 +539,7 @@ DSNodeHandle DSGraph::cloneInto(const DSGraph &G, std::map &OldValMap, std::map &OldNodeMap, - AllocaBit StripAllocas) { + unsigned CloneFlags) { assert(OldNodeMap.empty() && "Returned OldNodeMap should be empty!"); assert(&G != this && "Cannot clone graph into itself!"); @@ -531,6 +550,7 @@ for (unsigned i = 0, e = G.Nodes.size(); i != e; ++i) { DSNode *Old = G.Nodes[i]; DSNode *New = new DSNode(*Old); + New->NodeType &= ~DSNode::DEAD; // Clear dead flag... Nodes.push_back(New); OldNodeMap[Old] = New; } @@ -540,7 +560,7 @@ Nodes[i]->remapLinks(OldNodeMap); // Remove alloca markers as specified - if (StripAllocas == StripAllocaBit) + if (CloneFlags & StripAllocaBit) for (unsigned i = FN, e = Nodes.size(); i != e; ++i) Nodes[i]->NodeType &= ~DSNode::AllocaNode; @@ -562,11 +582,19 @@ } } - // Copy the function calls list... - unsigned FC = FunctionCalls.size(); // FirstCall - FunctionCalls.reserve(FC+G.FunctionCalls.size()); - for (unsigned i = 0, ei = G.FunctionCalls.size(); i != ei; ++i) - FunctionCalls.push_back(DSCallSite(G.FunctionCalls[i], OldNodeMap)); + if (!(CloneFlags & DontCloneCallNodes)) { + // Copy the function calls list... + unsigned FC = FunctionCalls.size(); // FirstCall + FunctionCalls.reserve(FC+G.FunctionCalls.size()); + for (unsigned i = 0, ei = G.FunctionCalls.size(); i != ei; ++i) + FunctionCalls.push_back(DSCallSite(G.FunctionCalls[i], OldNodeMap)); + + // Copy the auxillary function calls list... + FC = AuxFunctionCalls.size(); // FirstCall + AuxFunctionCalls.reserve(FC+G.AuxFunctionCalls.size()); + for (unsigned i = 0, ei = G.AuxFunctionCalls.size(); i != ei; ++i) + AuxFunctionCalls.push_back(DSCallSite(G.AuxFunctionCalls[i], OldNodeMap)); + } // Return the returned node pointer... DSNodeHandle &MappedRet = OldNodeMap[G.RetNode.getNode()]; @@ -580,7 +608,7 @@ /// graph. /// void DSGraph::mergeInGraph(DSCallSite &CS, const DSGraph &Graph, - AllocaBit StripAllocas) { + unsigned CloneFlags) { std::map OldValMap; DSNodeHandle RetVal; std::map *ScalarMap = &OldValMap; @@ -594,7 +622,7 @@ // The clone call may invalidate any of the vectors in the data // structure graph. Strip locals and don't copy the list of callers - RetVal = cloneInto(Graph, OldValMap, OldNodeMap, StripAllocas); + RetVal = cloneInto(Graph, OldValMap, OldNodeMap, CloneFlags); ScalarMap = &OldValMap; } else { RetVal = getRetNode(); @@ -899,7 +927,7 @@ GlobalNodes.insert(G.getNodes()[i]); // Add all call nodes to the same set - vector &Calls = G.getFunctionCalls(); + vector &Calls = G.getAuxFunctionCalls(); if (FilterCalls) { for (unsigned i = 0, e = Calls.size(); i != e; ++i) { for (unsigned j = 0, e = Calls[i].getNumPtrArgs(); j != e; ++j) From lattner at cs.uiuc.edu Fri Nov 8 15:29:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 15:29:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Message-ID: <200211082128.PAA26005@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: TopDownClosure.cpp updated: 1.23 -> 1.24 --- Log message: Reimplement TD pass completely it now works --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.23 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.24 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.23 Thu Nov 7 23:01:14 2002 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Fri Nov 8 15:28:37 2002 @@ -12,7 +12,6 @@ #include "llvm/Module.h" #include "llvm/DerivedTypes.h" #include "Support/Statistic.h" -#include static RegisterAnalysis Y("tddatastructure", "Top-down Data Structure Analysis Closure"); @@ -21,7 +20,6 @@ // our memory... here... // void TDDataStructures::releaseMemory() { - BUMaps.clear(); for (std::map::iterator I = DSInfo.begin(), E = DSInfo.end(); I != E; ++I) delete I->second; @@ -37,21 +35,14 @@ bool TDDataStructures::run(Module &M) { BUDataStructures &BU = getAnalysis(); - // Calculate the CallSitesForFunction mapping from the BU info... - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal()) - if (const std::vector *CS = BU.getCallSites(*I)) - for (unsigned i = 0, e = CS->size(); i != e; ++i) - if (Function *F = (*CS)[i].getResolvingCaller()) - CallSitesForFunction[F].push_back(&(*CS)[i]); + // Calculate top-down from main... + if (Function *F = M.getMainFunction()) + calculateGraph(*F); - // Next calculate the graphs for each function... + // Next calculate the graphs for each function unreachable function... for (Module::reverse_iterator I = M.rbegin(), E = M.rend(); I != E; ++I) if (!I->isExternal()) calculateGraph(*I); - - // Destroy the temporary mapping... - CallSitesForFunction.clear(); return false; } @@ -81,116 +72,131 @@ Graph.getRetNode().mergeWith(CallSite.getRetVal()); } +DSGraph &TDDataStructures::getOrCreateDSGraph(Function &F) { + DSGraph *&G = DSInfo[&F]; + if (G == 0) { // Not created yet? Clone BU graph... + G = new DSGraph(getAnalysis().getDSGraph(F)); + G->getAuxFunctionCalls().clear(); + } + return *G; +} -DSGraph &TDDataStructures::calculateGraph(Function &F) { - // Make sure this graph has not already been calculated, or that we don't get +void TDDataStructures::calculateGraph(Function &F) { + // Make sure this graph has not already been calculated, and that we don't get // into an infinite loop with mutually recursive functions. // - DSGraph *&Graph = DSInfo[&F]; - if (Graph) return *Graph; - - BUDataStructures &BU = getAnalysis(); - DSGraph &BUGraph = BU.getDSGraph(F); - - // Copy the BU graph, keeping a mapping from the BUGraph to the current Graph - std::map BUNodeMap; - Graph = new DSGraph(BUGraph, BUNodeMap); - - // We only need the BUMap entries for the nodes that are used in call sites. - // Calculate which nodes are needed. - std::set NeededNodes; - std::map >::iterator CSFFI - = CallSitesForFunction.find(&F); - if (CSFFI == CallSitesForFunction.end()) { - BUNodeMap.clear(); // No nodes are neccesary - } else { - std::vector &CSV = CSFFI->second; - for (unsigned i = 0, e = CSV.size(); i != e; ++i) { - NeededNodes.insert(CSV[i]->getRetVal().getNode()); - for (unsigned j = 0, je = CSV[i]->getNumPtrArgs(); j != je; ++j) - NeededNodes.insert(CSV[i]->getPtrArg(j).getNode()); - } - } + if (GraphDone.count(&F)) return; + GraphDone.insert(&F); - // Loop through te BUNodeMap, keeping only the nodes that are "Needed" - for (std::map::iterator I = BUNodeMap.begin(); - I != BUNodeMap.end(); ) - if (NeededNodes.count(I->first) && I->first) // Keep needed nodes... - ++I; - else { - std::map::iterator J = I++; - BUNodeMap.erase(J); - } + // Get the current functions graph... + DSGraph &Graph = getOrCreateDSGraph(F); - NeededNodes.clear(); // We are done with this temporary data structure - - // Convert the mapping from a node-to-node map into a node-to-nodehandle map - BUNodeMapTy &BUMap = BUMaps[&F]; - BUMap.insert(BUNodeMap.begin(), BUNodeMap.end()); - BUNodeMap.clear(); // We are done with the temporary map. - - const std::vector *CallSitesP = BU.getCallSites(F); - if (CallSitesP == 0) { - DEBUG(std::cerr << " [TD] No callers for: " << F.getName() << "\n"); - return *Graph; // If no call sites, the graph is the same as the BU graph! + const std::vector &CallSites = Graph.getFunctionCalls(); +#if 0 + if (CallSites.empty()) { + DEBUG(std::cerr << " [TD] No callees for: " << F.getName() << "\n"); + return; // If no call sites, the graph is the same as the BU graph! } - - // Loop over all call sites of this function, merging each one into this - // graph. +#endif + // Loop over all of the call sites, building a multi-map from Callees to + // DSCallSite*'s. With this map we can then loop over each callee, cloning + // this graph once into it, then resolving arguments. // - DEBUG(std::cerr << " [TD] Inlining " << CallSitesP->size() - << " callers for: " << F.getName() << "\n"); - const std::vector &CallSites = *CallSitesP; - for (unsigned c = 0, ce = CallSites.size(); c != ce; ++c) { - const DSCallSite &CallSite = CallSites[c]; - Function &Caller = *CallSite.getResolvingCaller(); - assert(&Caller && !Caller.isExternal() && - "Externals function cannot 'call'!"); - - DEBUG(std::cerr << "\t [TD] Inlining caller #" << c << " '" - << Caller.getName() << "' into callee: " << F.getName() << "\n"); - - // Self recursion is not tracked in BU pass... - assert(&Caller != &F && "This cannot happen!\n"); - - // Recursively compute the graph for the Caller. It should be fully - // resolved except if there is mutual recursion... - // - DSGraph &CG = calculateGraph(Caller); // Graph to inline - - DEBUG(std::cerr << "\t\t[TD] Got graph for " << Caller.getName() - << " in: " << F.getName() << "\n"); - - // Translate call site from having links into the BU graph - DSCallSite CallSiteInCG(CallSite, BUMaps[&Caller]); - - // These two maps keep track of where scalars in the old graph _used_ - // to point to, and of new nodes matching nodes of the old graph. - std::map OldValMap; - std::map OldNodeMap; - - // FIXME: Eventually use DSGraph::mergeInGraph here... - // Graph->mergeInGraph(CallSiteInCG, CG, false); - - // Clone the Caller's graph into the current graph, keeping - // track of where scalars in the old graph _used_ to point... - // Do this here because it only needs to happens once for each Caller! - // Strip scalars but not allocas since they are alive in callee. - // - DSNodeHandle RetVal = Graph->cloneInto(CG, OldValMap, OldNodeMap, - DSGraph::KeepAllocaBit); - ResolveCallSite(*Graph, DSCallSite(CallSiteInCG, OldNodeMap)); + std::multimap CalleeSites; + for (unsigned i = 0, e = CallSites.size(); i != e; ++i) { + const DSCallSite &CS = CallSites[i]; + const std::vector Callees = + CS.getCallee().getNode()->getGlobals(); + + // Loop over all of the functions that this call may invoke... + for (unsigned c = 0, e = Callees.size(); c != e; ++c) + if (Function *F = dyn_cast(Callees[c])) // If this is a fn... + if (!F->isExternal()) // If it's not external + CalleeSites.insert(std::make_pair(F, &CS)); // Keep track of it! } - // Recompute the Incomplete markers and eliminate unreachable nodes. - Graph->maskIncompleteMarkers(); - Graph->markIncompleteNodes(/*markFormals*/ !F.hasInternalLinkage() + // Now that we have information about all of the callees, propogate the + // current graph into the callees. + // + DEBUG(std::cerr << " [TD] Inlining '" << F.getName() << "' into " + << CalleeSites.size() << " callees.\n"); + + // Loop over all the callees... + for (std::multimap::iterator + I = CalleeSites.begin(), E = CalleeSites.end(); I != E; ) + if (I->first == &F) { // Bottom-up pass takes care of self loops! + ++I; + } else { + // For each callee... + Function *Callee = I->first; + DSGraph &CG = getOrCreateDSGraph(*Callee); // Get the callee's graph... + + DEBUG(std::cerr << "\t [TD] Inlining into callee '" << Callee->getName() + << "'\n"); + + // Clone our current graph into the callee... + std::map OldValMap; + std::map OldNodeMap; + CG.cloneInto(Graph, OldValMap, OldNodeMap, + DSGraph::KeepAllocaBit | DSGraph::DontCloneCallNodes); + OldValMap.clear(); // We don't care about the ValMap + + // Loop over all of the invocation sites of the callee, resolving + // arguments to our graph. This loop may iterate multiple times if the + // current function calls this callee multiple times with different + // signatures. + // + for (; I != E && I->first == Callee; ++I) { + // Map call site into callee graph + DSCallSite NewCS(*I->second, OldNodeMap); + + // Resolve the return values... + NewCS.getRetVal().mergeWith(CG.getRetNode()); + + // Resolve all of the arguments... + Function::aiterator AI = Callee->abegin(); + for (unsigned i = 0, e = NewCS.getNumPtrArgs(); i != e; ++i, ++AI) { + // Advance the argument iterator to the first pointer argument... + while (!DS::isPointerType(AI->getType())) { + ++AI; +#ifndef NDEBUG + if (AI == Callee->aend()) + std::cerr << "Bad call to Function: " << Callee->getName()<< "\n"; +#endif + assert(AI != Callee->aend() && + "# Args provided is not # Args required!"); + } + + // Add the link from the argument scalar to the provided value + DSNodeHandle &NH = CG.getNodeForValue(AI); + assert(NH.getNode() && "Pointer argument without scalarmap entry?"); + NH.mergeWith(NewCS.getPtrArg(i)); + } + } + + // Done with the nodemap... + OldNodeMap.clear(); + + // Recompute the Incomplete markers and eliminate unreachable nodes. + CG.maskIncompleteMarkers(); + CG.markIncompleteNodes(/*markFormals*/ !F.hasInternalLinkage() /*&& FIXME: NEED TO CHECK IF ALL CALLERS FOUND!*/); - Graph->removeDeadNodes(/*KeepAllGlobals*/ false, /*KeepCalls*/ false); + CG.removeTriviallyDeadNodes(false); + CG.removeDeadNodes(false, true) ;///*KeepAllGlobals*/ false, true); + ///*KeepCalls*/ false); + } - DEBUG(std::cerr << " [TD] Done inlining callers for: " << F.getName() << " [" - << Graph->getGraphSize() << "+" << Graph->getFunctionCalls().size() - << "]\n"); + DEBUG(std::cerr << " [TD] Done inlining into callees for: " << F.getName() + << " [" << Graph.getGraphSize() << "+" + << Graph.getFunctionCalls().size() << "]\n"); - return *Graph; + + // Loop over all the callees... making sure they are all resolved now... + Function *LastFunc = 0; + for (std::multimap::iterator + I = CalleeSites.begin(), E = CalleeSites.end(); I != E; ++I) + if (I->first != LastFunc) { // Only visit each callee once... + LastFunc = I->first; + calculateGraph(*I->first); + } } From lattner at cs.uiuc.edu Fri Nov 8 15:29:06 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 15:29:06 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Message-ID: <200211082128.PAA25993@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.34 -> 1.35 --- Log message: Remove gunk used by broken TD pass --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.34 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.35 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.34 Thu Nov 7 01:06:20 2002 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Fri Nov 8 15:25:24 2002 @@ -23,9 +23,6 @@ // our memory... here... // void BUDataStructures::releaseMemory() { - // Delete all call site information - CallSites.clear(); - for (map::iterator I = DSInfo.begin(), E = DSInfo.end(); I != E; ++I) delete I->second; @@ -62,7 +59,10 @@ #endif // Start resolving calls... - std::vector &FCs = Graph->getFunctionCalls(); + std::vector &FCs = Graph->getAuxFunctionCalls(); + + // Start with a copy of the original call sites... + FCs = Graph->getFunctionCalls(); DEBUG(std::cerr << " [BU] Inlining: " << F.getName() << "\n"); @@ -110,14 +110,6 @@ DEBUG(std::cerr << "\t\t[BU] Got graph for " << FI.getName() << " in: " << F.getName() << "\n"); - - // Record that the original DSCallSite was a call site of FI. - // This may or may not have been known when the DSCallSite was - // originally created. - std::vector &CallSitesForFunc = CallSites[&FI]; - CallSitesForFunc.push_back(Call); - CallSitesForFunc.back().setResolvingCaller(&F); - CallSitesForFunc.back().setCallee(0); // Handle self recursion by resolving the arguments and return value Graph->mergeInGraph(Call, GI, DSGraph::StripAllocaBit); From lattner at cs.uiuc.edu Fri Nov 8 15:30:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 15:30:01 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/Makefile Makefile.DSGraphs Message-ID: <200211082129.PAA26018@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: Makefile updated: 1.7 -> 1.8 Makefile.DSGraphs updated: 1.8 -> 1.9 --- Log message: Fix result printing --- Diffs of the changes: Index: llvm/test/DSGraphs/Makefile diff -u llvm/test/DSGraphs/Makefile:1.7 llvm/test/DSGraphs/Makefile:1.8 --- llvm/test/DSGraphs/Makefile:1.7 Fri Nov 8 14:47:06 2002 +++ llvm/test/DSGraphs/Makefile Fri Nov 8 15:29:01 2002 @@ -53,12 +53,19 @@ dummylib.o: dummylib.c $(LCC1) $(LCC) $< -c -report.raw.out: $(LANALYZE) - gmake all 2>&1 | tee report.raw.out +recursive_reports : + $(VERB) for dir in ${PARALLEL_DIRS}; do \ + (cd $$dir; $(MAKE) $@) || exit 1; \ + done + +report.raw.out: dummylib.o $(LANALYZE) + gmake recursive_reports 2>&1 | tee report.raw.out report: report.raw.out -mv -f report.no-times.txt report.no-times.old.txt -mv -f report.txt report.old.txt - ./generate_report.pl -no-times report.raw.out | sort --key=2 -r > report.no-times.txt - ./generate_report.pl report.raw.out | sort --key=2 -r | tee report.txt + ./generate_report.pl -no-times report.raw.out > report.no-times.txt + ./generate_report.pl report.raw.out > report.txt + @head -n1 report.txt + @sed '/^Name:/d' < report.txt | sort --key=2 -r -g Index: llvm/test/DSGraphs/Makefile.DSGraphs diff -u llvm/test/DSGraphs/Makefile.DSGraphs:1.8 llvm/test/DSGraphs/Makefile.DSGraphs:1.9 --- llvm/test/DSGraphs/Makefile.DSGraphs:1.8 Fri Nov 8 14:47:40 2002 +++ llvm/test/DSGraphs/Makefile.DSGraphs Fri Nov 8 15:29:01 2002 @@ -1,4 +1,4 @@ -## $Id: Makefile.DSGraphs,v 1.8 2002/11/08 20:47:40 lattner Exp $ +## $Id: Makefile.DSGraphs,v 1.9 2002/11/08 21:29:01 lattner Exp $ ##---------------------------------------------------------------------------- ## Common makefile rules for testing DSGraph analysis. ## @@ -10,6 +10,8 @@ include $(LEVEL)/test/Makefile.tests +LIB_LINKED = $(PROG:.bc=.lib.bc) + all:: $(PROG:.bc=.ps) PASS = td @@ -30,15 +32,23 @@ link $< ../dummylib.o | opt -internalize -funcresolve -globaldce > $@ -ANALYZE_OPTS = -stats -time-passes -only-print-main-ds - %.ps: %.lib.bc $(LANALYZE) @echo "---------------------------------------------------------------" @echo ">>> ========= " $< @echo "---------------------------------------------------------------" - -time -p $(LANALYZE) -$(PASS)datastructure $(ANALYZE_OPTS) $< | \ + -$(LANALYZE) -$(PASS)datastructure -stats -time-passes $< | \ tee $<.analyze$(PASS).out 2>&1 -dot -Tps < $(PASS).main.dot > $@ clean:: /bin/rm -f core* *.dot *.ps *.lib.bc *.analyze*.out $(PROG) + +ANALYZE_OPTS = -stats -time-passes -only-print-main-ds +report.out.txt: $(LIB_LINKED) $(LANALYZE) + @echo "---------------------------------------------------------------" + @echo ">>> ========= " $< + @echo "---------------------------------------------------------------" + -time -p $(LANALYZE) -$(PASS)datastructure $(ANALYZE_OPTS) $< > $@ 2>&1 + +recursive_reports: report.out.txt + cat report.out.txt \ No newline at end of file From lattner at cs.uiuc.edu Fri Nov 8 15:30:06 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 15:30:06 2002 Subject: [llvm-commits] CVS: llvm/test/Libraries/Makefile.libs Message-ID: <200211082129.PAA26030@apoc.cs.uiuc.edu> Changes in directory llvm/test/Libraries: Makefile.libs updated: 1.3 -> 1.4 --- Log message: fix path --- Diffs of the changes: Index: llvm/test/Libraries/Makefile.libs diff -u llvm/test/Libraries/Makefile.libs:1.3 llvm/test/Libraries/Makefile.libs:1.4 --- llvm/test/Libraries/Makefile.libs:1.3 Mon Jul 29 19:53:26 2002 +++ llvm/test/Libraries/Makefile.libs Fri Nov 8 15:29:22 2002 @@ -30,7 +30,7 @@ # Install target for libraries: Copy into the gcc install directory in chris's # tree... # -INSTALL_DIR := /home/vadve/lattner/cvs/gcc_install/lib/gcc-lib/llvm/3.1/ +INSTALL_DIR := /home/vadve/lattner/cvs/gcc_install_x86/llvm/lib/ install:: $(DESTLIBNAME) cp $(DESTLIBNAME) $(INSTALL_DIR) From lattner at cs.uiuc.edu Fri Nov 8 16:18:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 16:18:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/IPModRef.cpp Message-ID: <200211082217.QAA27349@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: IPModRef.cpp updated: 1.8 -> 1.9 --- Log message: Reduce amount of work needed to compute ip/modref --- Diffs of the changes: Index: llvm/lib/Analysis/IPA/IPModRef.cpp diff -u llvm/lib/Analysis/IPA/IPModRef.cpp:1.8 llvm/lib/Analysis/IPA/IPModRef.cpp:1.9 --- llvm/lib/Analysis/IPA/IPModRef.cpp:1.8 Fri Nov 8 13:13:14 2002 +++ llvm/lib/Analysis/IPA/IPModRef.cpp Fri Nov 8 16:17:01 2002 @@ -148,7 +148,8 @@ // Perform the merging now of the graph for the callee, which will come with // mod/ref bits set... Result->mergeInGraph(CS, IPModRefObj.getBUDSGraph(*F), - DSGraph::StripAllocaBit); + DSGraph::StripAllocaBit | DSGraph::DontCloneCallNodes | + DSGraph::DontCloneAuxCallNodes); } else { std::cerr << "IP Mod/Ref indirect call not implemented yet: " From lattner at cs.uiuc.edu Fri Nov 8 16:27:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 16:27:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Message-ID: <200211082226.QAA27945@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: TopDownClosure.cpp updated: 1.24 -> 1.25 --- Log message: Reenable 'quick exit' case --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.24 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.25 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.24 Fri Nov 8 15:28:37 2002 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Fri Nov 8 16:26:43 2002 @@ -92,12 +92,11 @@ DSGraph &Graph = getOrCreateDSGraph(F); const std::vector &CallSites = Graph.getFunctionCalls(); -#if 0 if (CallSites.empty()) { DEBUG(std::cerr << " [TD] No callees for: " << F.getName() << "\n"); return; // If no call sites, the graph is the same as the BU graph! } -#endif + // Loop over all of the call sites, building a multi-map from Callees to // DSCallSite*'s. With this map we can then loop over each callee, cloning // this graph once into it, then resolving arguments. From lattner at cs.uiuc.edu Fri Nov 8 16:28:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 16:28:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Message-ID: <200211082227.QAA27965@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.35 -> 1.36 --- Log message: ONLY merge in the aux call sites, this causes a HUGE speedup --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.35 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.36 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.35 Fri Nov 8 15:25:24 2002 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Fri Nov 8 16:27:25 2002 @@ -112,7 +112,8 @@ << " in: " << F.getName() << "\n"); // Handle self recursion by resolving the arguments and return value - Graph->mergeInGraph(Call, GI, DSGraph::StripAllocaBit); + Graph->mergeInGraph(Call, GI, DSGraph::StripAllocaBit | + DSGraph::DontCloneCallNodes); // Erase the entry in the Callees vector Callees.erase(Callees.begin()+c--); From lattner at cs.uiuc.edu Fri Nov 8 16:28:05 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 16:28:05 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200211082227.QAA27970@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.52 -> 1.53 --- Log message: Allow specification of whether the call sites should be copied, AND whether the aux call sites should be copied --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.52 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.53 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.52 Fri Nov 8 15:27:12 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Fri Nov 8 16:27:09 2002 @@ -588,9 +588,11 @@ FunctionCalls.reserve(FC+G.FunctionCalls.size()); for (unsigned i = 0, ei = G.FunctionCalls.size(); i != ei; ++i) FunctionCalls.push_back(DSCallSite(G.FunctionCalls[i], OldNodeMap)); + } + if (!(CloneFlags & DontCloneAuxCallNodes)) { // Copy the auxillary function calls list... - FC = AuxFunctionCalls.size(); // FirstCall + unsigned FC = AuxFunctionCalls.size(); // FirstCall AuxFunctionCalls.reserve(FC+G.AuxFunctionCalls.size()); for (unsigned i = 0, ei = G.AuxFunctionCalls.size(); i != ei; ++i) AuxFunctionCalls.push_back(DSCallSite(G.AuxFunctionCalls[i], OldNodeMap)); @@ -981,13 +983,20 @@ std::set Alive; // If KeepCalls, mark all nodes reachable by call nodes as alive... - if (KeepCalls) + if (KeepCalls) { for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) { for (unsigned j = 0, e = FunctionCalls[i].getNumPtrArgs(); j != e; ++j) markAlive(FunctionCalls[i].getPtrArg(j).getNode(), Alive); markAlive(FunctionCalls[i].getRetVal().getNode(), Alive); markAlive(FunctionCalls[i].getCallee().getNode(), Alive); } + for (unsigned i = 0, e = AuxFunctionCalls.size(); i != e; ++i) { + for (unsigned j = 0, e = AuxFunctionCalls[i].getNumPtrArgs(); j != e; ++j) + markAlive(AuxFunctionCalls[i].getPtrArg(j).getNode(), Alive); + markAlive(AuxFunctionCalls[i].getRetVal().getNode(), Alive); + markAlive(AuxFunctionCalls[i].getCallee().getNode(), Alive); + } + } // Mark all nodes reachable by scalar nodes as alive... for (std::map::iterator I = ScalarMap.begin(), From lattner at cs.uiuc.edu Fri Nov 8 16:30:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 16:30:00 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200211082229.QAA28005@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.31 -> 1.32 --- Log message: Add another option to cloneGraph --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.31 llvm/include/llvm/Analysis/DSGraph.h:1.32 --- llvm/include/llvm/Analysis/DSGraph.h:1.31 Fri Nov 8 15:24:51 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Fri Nov 8 16:28:55 2002 @@ -140,8 +140,9 @@ // CloneFlags enum - Bits that may be passed into the cloneInto method to // specify how to clone the function graph. enum CloneFlags { - StripAllocaBit = 1 << 0, KeepAllocaBit = 0 << 0, - DontCloneCallNodes = 2 << 0, CloneCallNodes = 0 << 0, + StripAllocaBit = 1 << 0, KeepAllocaBit = 0 << 0, + DontCloneCallNodes = 1 << 1, CloneCallNodes = 0 << 0, + DontCloneAuxCallNodes = 1 << 2, CloneAuxCallNodes = 0 << 0, }; // cloneInto - Clone the specified DSGraph into the current graph, returning From lattner at cs.uiuc.edu Fri Nov 8 16:30:06 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 16:30:06 2002 Subject: [llvm-commits] CVS: llvm/www/docs/DSGraphStatus.html Message-ID: <200211082229.QAA02162@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: DSGraphStatus.html updated: 1.5 -> 1.6 --- Log message: Add a bunch more numbers --- Diffs of the changes: Index: llvm/www/docs/DSGraphStatus.html diff -u llvm/www/docs/DSGraphStatus.html:1.5 llvm/www/docs/DSGraphStatus.html:1.6 --- llvm/www/docs/DSGraphStatus.html:1.5 Fri Nov 8 00:50:22 2002 +++ llvm/www/docs/DSGraphStatus.html Fri Nov 8 16:29:30 2002 @@ -6,7 +6,125 @@ This page records information and the progress the data structure analysis passes have been making. Times are in seconds, sizes are #bytes allocated for a particular pass. Runs that are all '*'d out were not completed because they -were taking too long.

+were taking too long (time listed show how long I waited).

+


+

Nov 8, 2002 #2:

+ +Same as the
previous run, but with a huge bug fix: +before, all of the call nodes (from the local pass) were being passed up in the +BU pass, causing graph exposions. Now these call sites are not propogated. The +times and sized of graphs are all much smaller now.

+ +

+Name:                     Anlyz: LocTime: BUTime:  TDTime:  TotTime:      LocSize: BUSize:  TDSize:    TotSize:     NumFold  NumNodes   main   __main
+254.gap.lib               130.47 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
+255.vortex.lib             86.17 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
+197.parser.lib             26.50 0.1601   1.4931   22.7485  24.7647  |    2187656  4037056  57704672   64165544   |    4550  196932+1184 601+0  601+0  
+300.twolf.lib              14.33 0.2311   1.0000   10.1733  12.1591  |    629008   1085616  15564712   17279336   |    4655  161528+1101 854+0  854+0  
+burg.llvm.lib               6.71 0.0904   0.3799   5.1871   5.8809   |    745152   1254280  6822216    8821648    |    3253  72533+902  436+0  436+0  
+164.gzip.llvm.lib           6.07 0.1158   0.9992   4.1925   5.3966   |    2113120  2772872  9043760    14026344   |    233   16632+232  171+0  171+0  
+256.bzip2.lib               2.16 0.0239   0.1987   1.6047   1.8899   |    372776   1059888  7503640    9009560    |    132   11456+201  148+0  148+0  
+sim.llvm.lib                1.54 0.0163   0.2356   1.0723   1.3738   |    106096   124280   400760     726152     |    41    2739+67    99+0   99+0   
+optimizer-eval.llvm.lib     0.58 0.0126   0.0890   0.3282   0.4696   |    110464   188584   1055832    1373072    |    287   3693+101   63+0   63+0   
+181.mcf.lib                 0.33 0.0155   0.0465   0.1437   0.2308   |    156864   225184   805584     1204520    |    209   1914+72    44+0   44+0   
+voronoi.llvm.lib            0.19 0.0111   0.0253   0.0644   0.1178   |    83248    93616    238648     429504     |    31    1733+106   30+0   30+0   
+sgefa.llvm.lib              0.18 0.0069   0.0398   0.0492   0.1156   |    104712   108472   178920     416872     |    67    634+55     31+0   31+0   
+bh.llvm.lib                 0.16 0.0100   0.0177   0.0355   0.0838   |    81376    93656    190104     428952     |    66    715+64     13+0   13+0   
+health.llvm.lib             0.10 0.0230   0.0084   0.0138   0.0551   |    31232    31552    56984      134736     |    75    361+40     14+0   14+0   
+em3d.llvm.lib               0.09 0.0045   0.0117   0.0255   0.0519   |    37336    67808    126960     248728     |    50    1031+59    28+0   28+0   
+power.llvm.lib              0.07 0.0035   0.0053   0.0105   0.0287   |    23432    31680    42680      113616     |    3     277+35     9+0    9+0    
+mst.llvm.lib                0.07 0.0033   0.0060   0.0145   0.0333   |    29080    31400    56720      131872     |    35    470+36     21+0   21+0   
+lists.llvm.lib              0.07 0.0079   0.0129   0.0170   0.0453   |    27616    39648    75280      154864     |    54    246+34     10+0   10+0   
+indvars.llvm.lib            0.07 0.0020   0.0257   0.0269   0.0569   |    85496    87560    161216     334272     |    *     18+3       1+0    1+0    
+tsp.llvm.lib                0.06 0.0041   0.0049   0.0065   0.0250   |    19360    26216    26712      86912      |    23    247+31     10+0   10+0   
+perimeter.llvm.lib          0.05 0.0024   0.0045   0.0039   0.0194   |    15336    22904    16288      67184      |    *     105+24     4+0    4+0    
+hash.llvm.lib               0.05 0.0029   0.0043   0.0066   0.0211   |    25880    18176    28168      85624      |    2     241+23     7+0    7+0    
+bisort.llvm.lib             0.05 0.0022   0.0036   0.0064   0.0192   |    14376    28616    22416      76480      |    3     210+27     10+0   10+0   
+llubenchmark.llvm.lib       0.04 0.0017   0.0026   0.0045   0.0169   |    11824    24304    18168      65304      |    8     144+20     15+0   15+0   
+treeadd.llvm.lib            0.03 0.0013   0.0016   0.0023   0.0101   |    9080     8408     11224      40704      |    2     76+14      5+0    5+0    
+sumarray2d.llvm.lib         0.03 0.0014   0.0097   0.0106   0.0238   |    42056    46440    83192      174008     |    *     15+3       1+0    1+0    
+sieve.llvm.lib              0.03 0.0008   0.0021   0.0032   0.0103   |    16064    14264    35312      76008      |    *     30+4       2+0    2+0    
+objinst.llvm.lib            0.03 0.0015   0.0024   0.0037   0.0134   |    11032    15488    11440      51616      |    39    73+17      3+0    3+0    
+methcall.llvm.lib           0.03 0.0014   0.0018   0.0030   0.0115   |    10824    9704     11128      45312      |    31    58+14      2+0    2+0    
+matrix.llvm.lib             0.03 0.0011   0.0017   0.0018   0.0109   |    8584     17680    4208       46232      |    *     46+11      1+0    1+0    
+ary3.llvm.lib               0.03 0.0010   0.0014   0.0014   0.0085   |    8752     17136    4168       45720      |    6     50+7       1+0    1+0    
+sumarraymalloc.llvm.lib     0.02 0.0007   0.0009   0.0013   0.0070   |    2720     12824    3376       33352      |    *     38+8       2+0    2+0    
+random.llvm.lib             0.02 0.0006   0.0009   0.0009   0.0060   |    6184     1808     2752       23600      |    *     31+5       3+0    3+0    
+pi.llvm.lib                 0.02 0.0006   0.0007   0.0011   0.0049   |    5696     5272     6544       17512      |    *     34+6       3+0    3+0    
+matrixTranspose.llvm.lib    0.02 0.0007   0.0033   0.0034   0.0095   |    14088    9424     29480      52992      |    *     17+4       3+0    3+0    
+heapsort.llvm.lib           0.02 0.0008   0.0009   0.0013   0.0076   |    2936     7224     3912       29240      |    *     45+6       3+0    3+0    
+fib2.llvm.lib               0.02 0.0014   0.0008   0.0009   0.0067   |    6176     1808     2400       23008      |    *     25+6       1+0    1+0    
+sumarray.llvm.lib           0.01 0.0003   0.0003   0.0003   0.0022   |    1280     3552     584        7528       |    3     7+2        0+0    0+0    
+printargs.llvm.lib          0.01 0.0005   0.0004   0.0006   0.0030   |    1360     816      4760       6936       |    *     13+4       1+0    1+0    
+hello.llvm.lib              0.01 0.0003   0.0003   0.0003   0.0022   |    880      592      2944       6672       |    *     8+3        1+0    1+0    
+ackermann.llvm.lib          0.01 0.0000   0.0000   0.0001   0.0004   |    0        0        832        832        |    *     0+0        *      *      
+

+ +


+

Nov 8, 2002:

+ +Same as the
previous run, but now the Top-Down pass +has been rewritten to:

+ +

    +
  • Actually work on all of the benchmarks +
  • Require less book-keeping +
  • Only clone a caller graph into a particular callee graph once +
  • Not prune nodes as aggressively, this is probably the reason for many + slowdowns below. +

+ +Looking deeper into the results, gzip got slower by a factor of 4, optimizer +eval got slower by a factor of 3, sim slowed down just a little bit.

+ +Note that without the globals graph, some benchmarks are still VERY slow (those +with heavy use of globals).

+ +

+Name:                     Anlyz: LocTime: BUTime:  TDTime:  TotTime:      LocSize: BUSize:  TDSize:    TotSize:     NumFold  NumNodes   main   __main
+254.gap.lib               330.50 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
+255.vortex.lib                 * *        *        *        *        |    *        *        *          *          |    *     *          *      *      
+197.parser.lib            120.10 0.1649   11.8198  105.3900 118.0119 |    2188536  4525320  60972272   67921544   |    22575 202604+8604 601+0  601+0  
+300.twolf.lib              72.38 0.2431   1.8500   30.5671  72.3845  |    629008   1375352  16515832   18520192   |    18090 163168+3906 854+0  854+0  
+burg.llvm.lib              34.18 0.0871   1.0919   15.8467  34.1754  |    749304   1755232  7209416    9779360    |    21707 78464+4387 393+0  393+0  
+164.gzip.llvm.lib          21.81 0.1149   1.2083   19.6981  21.1201  |    2055024  3145544  8929008    14227896   |    2387  18236+1588 171+0  171+0  
+256.bzip2.lib               7.44 0.0250   0.3032   6.2987   7.4430   |    372776   1205520  7660752    9312304    |    1765  11947+1011 148+0  148+0  
+optimizer-eval.llvm.lib     3.24 0.0131   1.0648   1.9117   3.0792   |    110456   343032   1971952    2443624    |    5293  4186+1033  63+0   63+0   
+sim.llvm.lib                2.27 0.0170   0.2274   1.7720   2.0708   |    104728   130376   451320     759088     |    62    2755+122   99+0   99+0   
+181.mcf.lib                 0.61 0.0162   0.0556   0.3631   0.4646   |    156648   234864   866704     1275064    |    243   2023+163   44+0   44+0   
+voronoi.llvm.lib            0.45 0.0117   0.0447   0.2557   0.3385   |    83088    150936   337552     585520     |    157   2063+390   30+0   30+0   
+bh.llvm.lib                 0.38 0.0101   0.0253   0.1778   0.2394   |    79736    129328   245408     502512     |    66    858+198    13+0   13+0   
+sgefa.llvm.lib              0.27 0.0071   0.0396   0.0780   0.1465   |    104712   112576   204600     446656     |    130   640+103    31+0   31+0   
+power.llvm.lib              0.14 0.0035   0.0080   0.0451   0.0675   |    31272    49768    66968      155680     |    6     359+96     9+0    9+0    
+em3d.llvm.lib               0.13 0.0046   0.0140   0.0524   0.0825   |    37096    65320    122624     241744     |    141   920+127    21+0   21+0   
+mst.llvm.lib                0.13 0.0033   0.0084   0.0381   0.0605   |    29104    36104    70496      150376     |    100   506+91     21+0   21+0   
+lists.llvm.lib              0.12 0.0036   0.0118   0.0328   0.0664   |    27880    33064    98728      177520     |    58    270+63     10+0   10+0   
+bisort.llvm.lib             0.11 0.0023   0.0047   0.0125   0.0270   |    14376    29520    33808      88776      |    6     226+42     10+0   10+0   
+indvars.llvm.lib            0.11 0.0020   0.0254   0.0310   0.0606   |    85520    88232    161216     334968     |    *     18+3       1+0    1+0    
+health.llvm.lib             0.10 0.0044   0.0113   0.0255   0.0519   |    31232    44592    53456      144248     |    79    385+69     14+0   14+0   
+tsp.llvm.lib                0.10 0.0042   0.0062   0.0176   0.0382   |    27840    19008    51376      112528     |    27    271+55     10+0   10+0   
+hash.llvm.lib               0.10 0.0026   0.0056   0.0168   0.0336   |    25880    29936    35312      104528     |    6     271+44     7+0    7+0    
+heapsort.llvm.lib           0.09 0.0007   0.0009   0.0015   0.0429   |    2936     7384     4064       29552      |    *     47+7       3+0    3+0    
+perimeter.llvm.lib          0.08 0.0025   0.0064   0.0090   0.0271   |    15432    25616    18552      72440      |    *     121+39     4+0    4+0    
+objinst.llvm.lib            0.08 0.0015   0.0027   0.0076   0.0180   |    11032    16088    19848      60624      |    39    78+25      3+0    3+0    
+sumarray2d.llvm.lib         0.06 0.0011   0.0098   0.0111   0.0241   |    42056    46440    83192      174008     |    *     15+3       1+0    1+0    
+ary3.llvm.lib               0.06 0.0010   0.0016   0.0021   0.0096   |    8752     17528    4696       46640      |    6     55+10      1+0    1+0    
+llubenchmark.llvm.lib       0.05 0.0018   0.0034   0.0063   0.0199   |    11824    20384    28056      71272      |    32    141+31     15+0   15+0   
+treeadd.llvm.lib            0.05 0.0012   0.0023   0.0036   0.0121   |    9120     17640    10960      53880      |    4     82+18      5+0    5+0    
+sumarray.llvm.lib           0.04 0.0003   0.0003   0.0003   0.0022   |    1280     3552     584        7528       |    3     7+2        0+0    0+0    
+methcall.llvm.lib           0.03 0.0014   0.0021   0.0045   0.0147   |    10680    16000    11784      51720      |    31    63+19      2+0    2+0    
+sieve.llvm.lib              0.03 0.0008   0.0022   0.0047   0.0120   |    16064    14528    39672      80632      |    *     32+5       2+0    2+0    
+fib2.llvm.lib               0.03 0.0007   0.0009   0.0011   0.0063   |    5512     6088     2544       26432      |    *     27+7       1+0    1+0    
+matrix.llvm.lib             0.02 0.0010   0.0017   0.0021   0.0100   |    8760     8104     8976       42184      |    *     48+12      1+0    1+0    
+matrixTranspose.llvm.lib    0.02 0.0007   0.0034   0.0037   0.0098   |    14088    9424     29480      52992      |    *     17+4       3+0    3+0    
+sumarraymalloc.llvm.lib     0.02 0.0007   0.0010   0.0016   0.0075   |    2720     12928    3536       33544      |    *     40+9       2+0    2+0    
+pi.llvm.lib                 0.02 0.0006   0.0007   0.0014   0.0052   |    5696     5368     5680       16744      |    *     35+7       3+0    3+0    
+random.llvm.lib             0.02 0.0006   0.0007   0.0012   0.0061   |    2136     6040     7248       31176      |    *     33+6       3+0    3+0    
+printargs.llvm.lib          0.02 0.0003   0.0004   0.0007   0.0030   |    1360     1024     1728       4112       |    *     14+5       1+0    1+0    
+hello.llvm.lib              0.02 0.0003   0.0003   0.0005   0.0023   |    880      648      768        4552       |    *     9+4        1+0    1+0    
+ackermann.llvm.lib          0.02 0.0000   0.0000   0.0002   0.0004   |    0        0        832        832        |    *     0+0        *      *      
+

+


Nov 7, 2002 #2:

@@ -18,12 +136,12 @@
 Name:                     Anlyz: LocTime: BUTime:  TDTime:  TotTime:      LocSize: BUSize:  TDSize:    TotSize:     NumFold  NumNodes   main   __main
+300.twolf.lib              30.88 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
+255.vortex.lib             15.71 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
 254.gap.lib                 6.07 analyze: ../../../include/llvm/Analysis/DSNode.h:77: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed.
 164.gzip.llvm.lib           5.32 0.1157   1.0296   3.4025   4.6326   |    2054352  2631576  7804656    12588904   |    398   13372+217  174+3  174+3  
-300.twolf.lib              30.88 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
 256.bzip2.lib               2.36 0.0250   0.1913   1.8190   2.0966   |    371928   1045320  7533440    9023600    |    407   11415+149  151+2  151+2  
 sim.llvm.lib                1.97 0.0174   0.2155   1.4731   1.7539   |    104584   120112   449736     747416     |    46    2745+52    101+2  101+2  
-255.vortex.lib             15.71 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
 197.parser.lib              1.27 analyze: ../../../include/llvm/Analysis/DSNode.h:77: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed.
 optimizer-eval.llvm.lib     1.09 0.0132   0.0926   0.8104   0.9528   |    109416   186592   1827184    2141376    |    1709  8189+43    63+0   63+0   
 burg.llvm.lib               0.81 analyze: ../../../include/llvm/Analysis/DSNode.h:77: DSNode::~DSNode(): Assertion `Referrers.empty() && "Referrers to dead node exist!"' failed.
@@ -171,7 +289,7 @@
     
Chris Lattner
-Last modified: Thu Nov 7 23:00:33 CST 2002 +Last modified: Fri Nov 8 16:26:15 CST 2002 From lattner at cs.uiuc.edu Fri Nov 8 16:51:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 16:51:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200211082250.QAA28640@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.53 -> 1.54 --- Log message: Fold arrays down to a single element. This causes huge wins on some benchmarks for example: 197.parser (64M->14M), 164.gzip (14M->2.7M). The actual graphs represented should not change at all. --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.53 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.54 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.53 Fri Nov 8 16:27:09 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Fri Nov 8 16:49:57 2002 @@ -131,6 +131,16 @@ // Return true immediately if the node is completely folded. if (isNodeCompletelyFolded()) return true; + // If this is an array type, eliminate the outside arrays because they won't + // be used anyway. This greatly reduces the size of large static arrays used + // as global variables, for example. + // + while (const ArrayType *AT = dyn_cast(NewTy)) { + // FIXME: we might want to keep small arrays, but must be careful about + // things like: [2 x [10000 x int*]] + NewTy = AT->getElementType(); + } + // Figure out how big the new type we're merging in is... unsigned NewTySize = NewTy->isSized() ? TD.getTypeSize(NewTy) : 0; From lattner at cs.uiuc.edu Fri Nov 8 16:52:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 16:52:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/DSGraphStatus.html Message-ID: <200211082251.QAA02318@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: DSGraphStatus.html updated: 1.6 -> 1.7 --- Log message: Add numbers for array folding --- Diffs of the changes: Index: llvm/www/docs/DSGraphStatus.html diff -u llvm/www/docs/DSGraphStatus.html:1.6 llvm/www/docs/DSGraphStatus.html:1.7 --- llvm/www/docs/DSGraphStatus.html:1.6 Fri Nov 8 16:29:30 2002 +++ llvm/www/docs/DSGraphStatus.html Fri Nov 8 16:51:10 2002 @@ -7,6 +7,66 @@ passes have been making. Times are in seconds, sizes are #bytes allocated for a particular pass. Runs that are all '*'d out were not completed because they were taking too long (time listed show how long I waited).

+ +


+

Nov 8, 2002 #3:

+ +Same as the
previous run, but now we automatically +collapse arrays down to a single element in the representation. The graphs +produced should be exactly the same, it's just memory consumption that goes +dramatically down, for example: 197.parser (64M->14M), 164.gzip +(14M->2.7M), 256.bzip (9M -> 1.9M), etc.

+ +With reduced memory consumption comes higher performance of course (better cache +behavior n stuff).

+ +

+Name:                     Anlyz: LocTime: BUTime:  TDTime:  TotTime:      LocSize: BUSize:  TDSize:    TotSize:     NumFold  NumNodes   main   __main
+254.gap.lib                71.65 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
+255.vortex.lib              4.62 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
+300.twolf.lib              12.22 0.2369   0.8840   8.0785   9.9177   |    573880   770752   10364040   11708672   |    3514  161528+1101 854+0  854+0  
+197.parser.lib             11.73 0.1216   0.5217   9.3368   10.3099  |    461720   619960   12948496   14266336   |    2641  196932+1184 601+0  601+0  
+burg.llvm.lib               5.35 0.0857   0.2873   3.9878   4.5484   |    650608   906016   4691952    6248576    |    1555  72533+902  436+0  436+0  
+164.gzip.llvm.lib           1.33 0.0309   0.1085   0.5445   0.7708   |    284312   521048   1877416    2779368    |    67    16632+232  171+0  171+0  
+256.bzip2.lib               0.73 0.0191   0.0588   0.3611   0.4995   |    156760   336272   1390240    1956528    |    20    11456+201  148+0  148+0  
+optimizer-eval.llvm.lib     0.56 0.0129   0.0957   0.2881   0.4359   |    85720    178016   750424     1032352    |    *     3693+101   63+0   63+0   
+sim.llvm.lib                0.29 0.0126   0.0237   0.0731   0.1630   |    93240    106144   331688     626088     |    *     2739+67    99+0   99+0   
+181.mcf.lib                 0.28 0.0153   0.0379   0.0649   0.1457   |    136744   155416   202496     511544     |    178   1914+72    44+0   44+0   
+voronoi.llvm.lib            0.22 0.0122   0.0296   0.0728   0.1324   |    83568    94008    212560     404128     |    17    1733+106   30+0   30+0   
+sgefa.llvm.lib              0.19 0.0072   0.0375   0.0491   0.1131   |    102144   109744   117064     353720     |    *     634+55     31+0   31+0   
+bh.llvm.lib                 0.17 0.0098   0.0164   0.0260   0.0728   |    78048    82616    86688      311168     |    66    715+64     13+0   13+0   
+em3d.llvm.lib               0.11 0.0046   0.0114   0.0327   0.0590   |    36344    64760    125360     243088     |    9     1031+59    28+0   28+0   
+power.llvm.lib              0.09 0.0043   0.0053   0.0100   0.0296   |    22840    33912    30440      103016     |    *     277+35     9+0    9+0    
+tsp.llvm.lib                0.08 0.0043   0.0057   0.0066   0.0276   |    20640    25416    25784      86464      |    19    247+31     10+0   10+0   
+mst.llvm.lib                0.08 0.0033   0.0060   0.0123   0.0308   |    29088    31400    51632      126792     |    10    470+36     21+0   21+0   
+lists.llvm.lib              0.08 0.0035   0.0080   0.0111   0.0294   |    25048    33872    25520      96760      |    50    246+34     10+0   10+0   
+health.llvm.lib             0.08 0.0043   0.0083   0.0120   0.0344   |    31232    31256    45008      122464     |    71    361+40     14+0   14+0   
+perimeter.llvm.lib          0.07 0.0036   0.0047   0.0049   0.0251   |    15336    22904    15968      66864      |    *     105+24     4+0    4+0    
+objinst.llvm.lib            0.06 0.0016   0.0024   0.0090   0.0191   |    11032    15560    12416      52664      |    33    73+17      3+0    3+0    
+bisort.llvm.lib             0.06 0.0023   0.0036   0.0065   0.0202   |    14376    20968    22152      68568      |    *     210+27     10+0   10+0   
+llubenchmark.llvm.lib       0.05 0.0018   0.0024   0.0042   0.0166   |    11824    15464    23480      61776      |    *     144+20     15+0   15+0   
+hash.llvm.lib               0.05 0.0026   0.0044   0.0062   0.0206   |    18192    24928    23976      80496      |    *     241+23     7+0    7+0    
+methcall.llvm.lib           0.04 0.0014   0.0019   0.0031   0.0120   |    10824    9704     11128      45312      |    26    58+14      2+0    2+0    
+ary3.llvm.lib               0.04 0.0010   0.0015   0.0014   0.0102   |    8752     17136    4168       45720      |    6     50+7       1+0    1+0    
+treeadd.llvm.lib            0.03 0.0011   0.0016   0.0023   0.0098   |    9080     8408     9944       39424      |    *     76+14      5+0    5+0    
+sieve.llvm.lib              0.03 0.0006   0.0006   0.0009   0.0063   |    7856     6056     2480       26760      |    *     30+4       2+0    2+0    
+pi.llvm.lib                 0.03 0.0006   0.0007   0.0012   0.0050   |    5696     5272     5584       16552      |    *     34+6       3+0    3+0    
+matrix.llvm.lib             0.03 0.0010   0.0017   0.0018   0.0096   |    8584     17680    4208       46232      |    *     46+11      1+0    1+0    
+heapsort.llvm.lib           0.03 0.0010   0.0009   0.0013   0.0076   |    2936     7224     3912       29240      |    *     45+6       3+0    3+0    
+sumarraymalloc.llvm.lib     0.02 0.0007   0.0009   0.0015   0.0072   |    2720     6872     7128       31152      |    *     38+8       2+0    2+0    
+sumarray.llvm.lib           0.02 0.0003   0.0002   0.0003   0.0025   |    864      3144     592        6712       |    *     7+2        0+0    0+0    
+random.llvm.lib             0.02 0.0006   0.0006   0.0009   0.0057   |    6184     1808     2752       23600      |    *     31+5       3+0    3+0    
+printargs.llvm.lib          0.02 0.0003   0.0004   0.0006   0.0028   |    1360     816      3480       5656       |    *     13+4       1+0    1+0    
+matrixTranspose.llvm.lib    0.02 0.0004   0.0004   0.0006   0.0034   |    5888     1224     4864       11976      |    *     17+4       3+0    3+0    
+indvars.llvm.lib            0.02 0.0005   0.0005   0.0005   0.0037   |    4680     3552     1200       9432       |    *     18+3       1+0    1+0    
+fib2.llvm.lib               0.02 0.0007   0.0008   0.0009   0.0059   |    6176     1808     2400       23008      |    *     25+6       1+0    1+0    
+sumarray2d.llvm.lib         0.01 0.0004   0.0004   0.0004   0.0030   |    1648     6024     4144       14136      |    *     15+3       1+0    1+0    
+hello.llvm.lib              0.01 0.0003   0.0003   0.0003   0.0022   |    880      592      2944       6672       |    *     8+3        1+0    1+0    
+ackermann.llvm.lib          0.00 0.0000   0.0000   0.0002   0.0004   |    0        0        832        832        |    *     0+0        *      *      
+

+ + +


Nov 8, 2002 #2:

@@ -289,7 +349,7 @@
Chris Lattner
-Last modified: Fri Nov 8 16:26:15 CST 2002 +Last modified: Fri Nov 8 16:49:01 CST 2002 From lattner at cs.uiuc.edu Fri Nov 8 17:19:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 17:19:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp Message-ID: <200211082318.RAA28852@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: CorrelatedExprs.cpp updated: 1.7 -> 1.8 --- Log message: Fix spelling error --- Diffs of the changes: Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.7 llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.8 --- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.7 Tue Oct 29 17:03:20 2002 +++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp Fri Nov 8 17:18:37 2002 @@ -542,7 +542,7 @@ // Create and insert the PHI node into the top of Dest. PHINode *NewPN = new PHINode(I->getType(), I->getName()+".fw_merge", Dest->begin()); - // There is definately an edge from OldSucc... add the edge now + // There is definitely an edge from OldSucc... add the edge now NewPN->addIncoming(I, OldSucc); // There is also an edge from BB now, add the edge with the calculated From lattner at cs.uiuc.edu Fri Nov 8 17:23:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 17:23:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSNode.h Message-ID: <200211082322.RAA28871@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSNode.h updated: 1.11 -> 1.12 --- Log message: Add new methods --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSNode.h diff -u llvm/include/llvm/Analysis/DSNode.h:1.11 llvm/include/llvm/Analysis/DSNode.h:1.12 --- llvm/include/llvm/Analysis/DSNode.h:1.11 Fri Nov 8 15:24:51 2002 +++ llvm/include/llvm/Analysis/DSNode.h Fri Nov 8 17:22:48 2002 @@ -120,6 +120,8 @@ assert(Index < Links.size() && "Link index is out of range!"); return Links[Index].getNode(); } + + /// getLink - Return the link at the specified offset. DSNodeHandle &getLink(unsigned Offset) { assert((Offset & ((1 << DS::PointerShift)-1)) == 0 && "Pointer offset not aligned correctly!"); @@ -135,6 +137,10 @@ return Links[Index]; } + /// getNumLinks - Return the number of links in a node... + /// + unsigned getNumLinks() const { return Links.size(); } + /// mergeTypeInfo - This method merges the specified type into the current /// node at the specified offset. This may update the current node's type /// record if this gives more information to the node, it may do nothing to @@ -171,6 +177,10 @@ assert(Index < Links.size() && "Link index is out of range!"); Links[Index] = NH; } + + /// getPointerSize - Return the size of a pointer for the current target. + /// + unsigned getPointerSize() const { return DS::PointerSize; } /// addEdgeTo - Add an edge from the current node to the specified node. This /// can cause merging of nodes in the graph. From lattner at cs.uiuc.edu Fri Nov 8 18:49:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 18:49:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/InductionVariable.cpp Message-ID: <200211090048.SAA00898@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: InductionVariable.cpp updated: 1.20 -> 1.21 --- Log message: Fix warning --- Diffs of the changes: Index: llvm/lib/Analysis/InductionVariable.cpp diff -u llvm/lib/Analysis/InductionVariable.cpp:1.20 llvm/lib/Analysis/InductionVariable.cpp:1.21 --- llvm/lib/Analysis/InductionVariable.cpp:1.20 Fri Oct 11 00:34:27 2002 +++ llvm/lib/Analysis/InductionVariable.cpp Fri Nov 8 18:48:39 2002 @@ -180,7 +180,7 @@ } // Find final node: predecesor of the loop header that's also an exit - BasicBlock *terminator; + BasicBlock *terminator = 0; BasicBlock *header = L->getHeader(); for (pred_iterator PI = pred_begin(header), PE = pred_end(header); PI != PE; ++PI) { From lattner at cs.uiuc.edu Fri Nov 8 18:50:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 18:50:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200211090049.SAA00925@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.54 -> 1.55 --- Log message: Fix warning & release build --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.54 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.55 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.54 Fri Nov 8 16:49:57 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Fri Nov 8 18:49:05 2002 @@ -245,7 +245,7 @@ unsigned SubTypeSize = SubType->isSized() ? TD.getTypeSize(SubType) : 0; while (SubType != NewTy) { const Type *NextSubType = 0; - unsigned NextSubTypeSize; + unsigned NextSubTypeSize = 0; switch (SubType->getPrimitiveID()) { case Type::StructTyID: NextSubType = cast(SubType)->getElementTypes()[0]; @@ -514,11 +514,9 @@ ScalarMap.clear(); RetNode.setNode(0); -#ifndef NDEBUG // Drop all intra-node references, so that assertions don't fail... std::for_each(Nodes.begin(), Nodes.end(), std::mem_fun(&DSNode::dropAllReferences)); -#endif // Delete all of the nodes themselves... std::for_each(Nodes.begin(), Nodes.end(), deleter); From lattner at cs.uiuc.edu Fri Nov 8 18:50:05 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 18:50:05 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSNode.h Message-ID: <200211090049.SAA00913@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSNode.h updated: 1.12 -> 1.13 --- Log message: Fix release build --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSNode.h diff -u llvm/include/llvm/Analysis/DSNode.h:1.12 llvm/include/llvm/Analysis/DSNode.h:1.13 --- llvm/include/llvm/Analysis/DSNode.h:1.12 Fri Nov 8 17:22:48 2002 +++ llvm/include/llvm/Analysis/DSNode.h Fri Nov 8 18:48:52 2002 @@ -72,10 +72,8 @@ DSNode(const DSNode &); ~DSNode() { -#ifndef NDEBUG - dropAllReferences(); // Only needed to satisfy assertion checks... + dropAllReferences(); assert(Referrers.empty() && "Referrers to dead node exist!"); -#endif } // Iterator for graph interface... From lattner at cs.uiuc.edu Fri Nov 8 18:50:10 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 18:50:10 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp Message-ID: <200211090049.SAA00934@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSelection: InstrSelection.cpp updated: 1.53 -> 1.54 --- Log message: Fix warning --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp diff -u llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.53 llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.54 --- llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.53 Mon Oct 28 13:01:16 2002 +++ llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp Fri Nov 8 18:49:16 2002 @@ -220,7 +220,7 @@ void InstructionSelection::InsertPhiElimInstructions(BasicBlock *BB, - const vector& CpVec) + const vector& CpVec) { Instruction *TermInst = (Instruction*)BB->getTerminator(); MachineCodeForInstruction &MC4Term = MachineCodeForInstruction::get(TermInst); @@ -228,10 +228,10 @@ assert (FirstMIOfTerm && "No Machine Instrs for terminator"); MachineFunction &MF = MachineFunction::get(BB->getParent()); - MachineBasicBlock *MBB; // FIXME: if PHI instructions existed in the machine code, this would be // unnecesary. + MachineBasicBlock *MBB = 0; for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) if (I->getBasicBlock() == BB) { MBB = I; From lattner at cs.uiuc.edu Fri Nov 8 18:50:15 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 18:50:15 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp Message-ID: <200211090049.SAA00946@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths: ProfilePaths.cpp updated: 1.22 -> 1.23 --- Log message: Fix warning --- Diffs of the changes: Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.22 llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.23 --- llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.22 Sat Oct 12 15:33:47 2002 +++ llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp Fri Nov 8 18:49:30 2002 @@ -87,7 +87,7 @@ std::vector edges; Node *tmp; - Node *exitNode, *startNode; + Node *exitNode = 0, *startNode = 0; // The nodes must be uniquesly identified: // That is, no two nodes must hav same BB* From lattner at cs.uiuc.edu Fri Nov 8 18:50:20 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 18:50:20 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200211090049.SAA00959@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.65 -> 1.66 --- Log message: Fix warning --- Diffs of the changes: Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.65 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.66 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.65 Mon Nov 4 10:43:32 2002 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri Nov 8 18:49:43 2002 @@ -724,13 +724,15 @@ if (AI.isArrayAllocation()) // Check C != 1 if (const ConstantUInt *C = dyn_cast(AI.getArraySize())) { const Type *NewTy = ArrayType::get(AI.getAllocatedType(), C->getValue()); - AllocationInst *New; + AllocationInst *New = 0; // Create and insert the replacement instruction... if (isa(AI)) New = new MallocInst(NewTy, 0, AI.getName(), &AI); - else if (isa(AI)) + else { + assert(isa(AI) && "Unknown type of allocation inst!"); New = new AllocaInst(NewTy, 0, AI.getName(), &AI); + } // Scan to the end of the allocation instructions, to skip over a block of // allocas if possible... From lattner at cs.uiuc.edu Fri Nov 8 18:51:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Nov 8 18:51:00 2002 Subject: [llvm-commits] CVS: llvm/test/Makefile.tests Message-ID: <200211090050.SAA00974@apoc.cs.uiuc.edu> Changes in directory llvm/test: Makefile.tests updated: 1.48 -> 1.49 --- Log message: Allow tests to be run with release tools when ENABLE_OPTIMIZED=1 --- Diffs of the changes: Index: llvm/test/Makefile.tests diff -u llvm/test/Makefile.tests:1.48 llvm/test/Makefile.tests:1.49 --- llvm/test/Makefile.tests:1.48 Fri Nov 1 19:41:07 2002 +++ llvm/test/Makefile.tests Fri Nov 8 18:50:02 2002 @@ -24,11 +24,16 @@ .PRECIOUS: Output/%.llvm.bc .PRECIOUS: Output/%.llvm +ifdef ENABLE_OPTIMIZED +TOOLS = $(BUILD_ROOT_TOP)/tools/Release +else +TOOLS = $(BUILD_ROOT_TOP)/tools/Debug +endif + # LLVM Tool Definitions... # LCC = $(LLVMGCCDIR)/bin/llvm-gcc LCC1 = $(LLVMGCCDIR)/lib/gcc-lib/llvm/3.1/cc1 -TOOLS = $(BUILD_ROOT_TOP)/tools/Debug LLI = $(TOOLS)/lli LLC = $(TOOLS)/llc LAS = $(TOOLS)/as @@ -62,7 +67,7 @@ LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64 else ifeq ($(TRACEM), yes) - LLCFLAGS += -trace function + LLCFLAGS += -trace function LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64 endif endif From lattner at cs.uiuc.edu Sat Nov 9 13:16:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 13:16:01 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/htmlcoldiff.pl Message-ID: <200211091915.NAA07560@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: htmlcoldiff.pl added (r1.1) --- Log message: Checkin a simple script to highlight columns that change in two files --- Diffs of the changes: From lattner at cs.uiuc.edu Sat Nov 9 13:17:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 13:17:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/DSGraphStatus.html Message-ID: <200211091916.NAA15020@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: DSGraphStatus.html updated: 1.7 -> 1.8 --- Log message: Add highlighting of changes fields --- Diffs of the changes: Index: llvm/www/docs/DSGraphStatus.html diff -u llvm/www/docs/DSGraphStatus.html:1.7 llvm/www/docs/DSGraphStatus.html:1.8 --- llvm/www/docs/DSGraphStatus.html:1.7 Fri Nov 8 16:51:10 2002 +++ llvm/www/docs/DSGraphStatus.html Sat Nov 9 13:15:58 2002 @@ -8,6 +8,10 @@ particular pass. Runs that are all '*'d out were not completed because they were taking too long (time listed show how long I waited).

+Fields that appear in bold have changes from the last entry on the page. +Floating point entries are only highlighted if they double or half their +previous value.

+


Nov 8, 2002 #3:

@@ -23,46 +27,46 @@
 Name:                     Anlyz: LocTime: BUTime:  TDTime:  TotTime:      LocSize: BUSize:  TDSize:    TotSize:     NumFold  NumNodes   main   __main
 254.gap.lib                71.65 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
-255.vortex.lib              4.62 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
-300.twolf.lib              12.22 0.2369   0.8840   8.0785   9.9177   |    573880   770752   10364040   11708672   |    3514  161528+1101 854+0  854+0  
-197.parser.lib             11.73 0.1216   0.5217   9.3368   10.3099  |    461720   619960   12948496   14266336   |    2641  196932+1184 601+0  601+0  
-burg.llvm.lib               5.35 0.0857   0.2873   3.9878   4.5484   |    650608   906016   4691952    6248576    |    1555  72533+902  436+0  436+0  
-164.gzip.llvm.lib           1.33 0.0309   0.1085   0.5445   0.7708   |    284312   521048   1877416    2779368    |    67    16632+232  171+0  171+0  
-256.bzip2.lib               0.73 0.0191   0.0588   0.3611   0.4995   |    156760   336272   1390240    1956528    |    20    11456+201  148+0  148+0  
-optimizer-eval.llvm.lib     0.56 0.0129   0.0957   0.2881   0.4359   |    85720    178016   750424     1032352    |    *     3693+101   63+0   63+0   
-sim.llvm.lib                0.29 0.0126   0.0237   0.0731   0.1630   |    93240    106144   331688     626088     |    *     2739+67    99+0   99+0   
-181.mcf.lib                 0.28 0.0153   0.0379   0.0649   0.1457   |    136744   155416   202496     511544     |    178   1914+72    44+0   44+0   
-voronoi.llvm.lib            0.22 0.0122   0.0296   0.0728   0.1324   |    83568    94008    212560     404128     |    17    1733+106   30+0   30+0   
-sgefa.llvm.lib              0.19 0.0072   0.0375   0.0491   0.1131   |    102144   109744   117064     353720     |    *     634+55     31+0   31+0   
-bh.llvm.lib                 0.17 0.0098   0.0164   0.0260   0.0728   |    78048    82616    86688      311168     |    66    715+64     13+0   13+0   
-em3d.llvm.lib               0.11 0.0046   0.0114   0.0327   0.0590   |    36344    64760    125360     243088     |    9     1031+59    28+0   28+0   
-power.llvm.lib              0.09 0.0043   0.0053   0.0100   0.0296   |    22840    33912    30440      103016     |    *     277+35     9+0    9+0    
-tsp.llvm.lib                0.08 0.0043   0.0057   0.0066   0.0276   |    20640    25416    25784      86464      |    19    247+31     10+0   10+0   
-mst.llvm.lib                0.08 0.0033   0.0060   0.0123   0.0308   |    29088    31400    51632      126792     |    10    470+36     21+0   21+0   
-lists.llvm.lib              0.08 0.0035   0.0080   0.0111   0.0294   |    25048    33872    25520      96760      |    50    246+34     10+0   10+0   
-health.llvm.lib             0.08 0.0043   0.0083   0.0120   0.0344   |    31232    31256    45008      122464     |    71    361+40     14+0   14+0   
-perimeter.llvm.lib          0.07 0.0036   0.0047   0.0049   0.0251   |    15336    22904    15968      66864      |    *     105+24     4+0    4+0    
-objinst.llvm.lib            0.06 0.0016   0.0024   0.0090   0.0191   |    11032    15560    12416      52664      |    33    73+17      3+0    3+0    
-bisort.llvm.lib             0.06 0.0023   0.0036   0.0065   0.0202   |    14376    20968    22152      68568      |    *     210+27     10+0   10+0   
-llubenchmark.llvm.lib       0.05 0.0018   0.0024   0.0042   0.0166   |    11824    15464    23480      61776      |    *     144+20     15+0   15+0   
-hash.llvm.lib               0.05 0.0026   0.0044   0.0062   0.0206   |    18192    24928    23976      80496      |    *     241+23     7+0    7+0    
-methcall.llvm.lib           0.04 0.0014   0.0019   0.0031   0.0120   |    10824    9704     11128      45312      |    26    58+14      2+0    2+0    
+255.vortex.lib              4.62 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
+300.twolf.lib              12.22 0.2369   0.8840   8.0785   9.9177   |    573880   770752   10364040   11708672   |    3514  161528+1101 854+0  854+0  
+197.parser.lib             11.73 0.1216   0.5217   9.3368   10.3099  |    461720   619960   12948496   14266336   |    2641  196932+1184 601+0  601+0  
+burg.llvm.lib               5.35 0.0857   0.2873   3.9878   4.5484   |    650608   906016   4691952    6248576    |    1555  72533+902  436+0  436+0  
+164.gzip.llvm.lib           1.33 0.0309   0.1085   0.5445   0.7708   |    284312   521048   1877416    2779368    |    67    16632+232  171+0  171+0  
+256.bzip2.lib               0.73 0.0191   0.0588   0.3611   0.4995   |    156760   336272   1390240    1956528    |    20    11456+201  148+0  148+0  
+optimizer-eval.llvm.lib     0.56 0.0129   0.0957   0.2881   0.4359   |    85720    178016   750424     1032352    |    *     3693+101   63+0   63+0   
+sim.llvm.lib                0.29 0.0126   0.0237   0.0731   0.1630   |    93240    106144   331688     626088     |    *     2739+67    99+0   99+0   
+181.mcf.lib                 0.28 0.0153   0.0379   0.0649   0.1457   |    136744   155416   202496     511544     |    178   1914+72    44+0   44+0   
+voronoi.llvm.lib            0.22 0.0122   0.0296   0.0728   0.1324   |    83568    94008    212560     404128     |    17    1733+106   30+0   30+0   
+sgefa.llvm.lib              0.19 0.0072   0.0375   0.0491   0.1131   |    102144   109744   117064     353720     |    *     634+55     31+0   31+0   
+bh.llvm.lib                 0.17 0.0098   0.0164   0.0260   0.0728   |    78048    82616    86688      311168     |    66    715+64     13+0   13+0   
+em3d.llvm.lib               0.11 0.0046   0.0114   0.0327   0.0590   |    36344    64760    125360     243088     |    9     1031+59    28+0   28+0   
+power.llvm.lib              0.09 0.0043   0.0053   0.0100   0.0296   |    22840    33912    30440      103016     |    *     277+35     9+0    9+0    
+tsp.llvm.lib                0.08 0.0043   0.0057   0.0066   0.0276   |    20640    25416    25784      86464      |    19    247+31     10+0   10+0   
+mst.llvm.lib                0.08 0.0033   0.0060   0.0123   0.0308   |    29088    31400    51632      126792     |    10    470+36     21+0   21+0   
+lists.llvm.lib              0.08 0.0035   0.0080   0.0111   0.0294   |    25048    33872    25520      96760      |    50    246+34     10+0   10+0   
+health.llvm.lib             0.08 0.0043   0.0083   0.0120   0.0344   |    31232    31256    45008      122464     |    71    361+40     14+0   14+0   
+perimeter.llvm.lib          0.07 0.0036   0.0047   0.0049   0.0251   |    15336    22904    15968      66864      |    *     105+24     4+0    4+0    
+objinst.llvm.lib            0.06 0.0016   0.0024   0.0090   0.0191   |    11032    15560    12416      52664      |    33    73+17      3+0    3+0    
+bisort.llvm.lib             0.06 0.0023   0.0036   0.0065   0.0202   |    14376    20968    22152      68568      |    *     210+27     10+0   10+0   
+llubenchmark.llvm.lib       0.05 0.0018   0.0024   0.0042   0.0166   |    11824    15464    23480      61776      |    *     144+20     15+0   15+0   
+hash.llvm.lib               0.05 0.0026   0.0044   0.0062   0.0206   |    18192    24928    23976      80496      |    *     241+23     7+0    7+0    
+methcall.llvm.lib           0.04 0.0014   0.0019   0.0031   0.0120   |    10824    9704     11128      45312      |    26    58+14      2+0    2+0    
 ary3.llvm.lib               0.04 0.0010   0.0015   0.0014   0.0102   |    8752     17136    4168       45720      |    6     50+7       1+0    1+0    
-treeadd.llvm.lib            0.03 0.0011   0.0016   0.0023   0.0098   |    9080     8408     9944       39424      |    *     76+14      5+0    5+0    
-sieve.llvm.lib              0.03 0.0006   0.0006   0.0009   0.0063   |    7856     6056     2480       26760      |    *     30+4       2+0    2+0    
-pi.llvm.lib                 0.03 0.0006   0.0007   0.0012   0.0050   |    5696     5272     5584       16552      |    *     34+6       3+0    3+0    
+treeadd.llvm.lib            0.03 0.0011   0.0016   0.0023   0.0098   |    9080     8408     9944       39424      |    *     76+14      5+0    5+0    
+sieve.llvm.lib              0.03 0.0006   0.0006   0.0009   0.0063   |    7856     6056     2480       26760      |    *     30+4       2+0    2+0    
+pi.llvm.lib                 0.03 0.0006   0.0007   0.0012   0.0050   |    5696     5272     5584       16552      |    *     34+6       3+0    3+0    
 matrix.llvm.lib             0.03 0.0010   0.0017   0.0018   0.0096   |    8584     17680    4208       46232      |    *     46+11      1+0    1+0    
 heapsort.llvm.lib           0.03 0.0010   0.0009   0.0013   0.0076   |    2936     7224     3912       29240      |    *     45+6       3+0    3+0    
-sumarraymalloc.llvm.lib     0.02 0.0007   0.0009   0.0015   0.0072   |    2720     6872     7128       31152      |    *     38+8       2+0    2+0    
-sumarray.llvm.lib           0.02 0.0003   0.0002   0.0003   0.0025   |    864      3144     592        6712       |    *     7+2        0+0    0+0    
+sumarraymalloc.llvm.lib     0.02 0.0007   0.0009   0.0015   0.0072   |    2720     6872     7128       31152      |    *     38+8       2+0    2+0    
+sumarray.llvm.lib           0.02 0.0003   0.0002   0.0003   0.0025   |    864      3144     592        6712       |    *     7+2        0+0    0+0    
 random.llvm.lib             0.02 0.0006   0.0006   0.0009   0.0057   |    6184     1808     2752       23600      |    *     31+5       3+0    3+0    
-printargs.llvm.lib          0.02 0.0003   0.0004   0.0006   0.0028   |    1360     816      3480       5656       |    *     13+4       1+0    1+0    
-matrixTranspose.llvm.lib    0.02 0.0004   0.0004   0.0006   0.0034   |    5888     1224     4864       11976      |    *     17+4       3+0    3+0    
-indvars.llvm.lib            0.02 0.0005   0.0005   0.0005   0.0037   |    4680     3552     1200       9432       |    *     18+3       1+0    1+0    
+printargs.llvm.lib          0.02 0.0003   0.0004   0.0006   0.0028   |    1360     816      3480       5656       |    *     13+4       1+0    1+0    
+matrixTranspose.llvm.lib    0.02 0.0004   0.0004   0.0006   0.0034   |    5888     1224     4864       11976      |    *     17+4       3+0    3+0    
+indvars.llvm.lib            0.02 0.0005   0.0005   0.0005   0.0037   |    4680     3552     1200       9432       |    *     18+3       1+0    1+0    
 fib2.llvm.lib               0.02 0.0007   0.0008   0.0009   0.0059   |    6176     1808     2400       23008      |    *     25+6       1+0    1+0    
-sumarray2d.llvm.lib         0.01 0.0004   0.0004   0.0004   0.0030   |    1648     6024     4144       14136      |    *     15+3       1+0    1+0    
+sumarray2d.llvm.lib         0.01 0.0004   0.0004   0.0004   0.0030   |    1648     6024     4144       14136      |    *     15+3       1+0    1+0    
 hello.llvm.lib              0.01 0.0003   0.0003   0.0003   0.0022   |    880      592      2944       6672       |    *     8+3        1+0    1+0    
-ackermann.llvm.lib          0.00 0.0000   0.0000   0.0002   0.0004   |    0        0        832        832        |    *     0+0        *      *      
+ackermann.llvm.lib          0.00 0.0000   0.0000   0.0002   0.0004   |    0        0        832        832        |    *     0+0        *      *      
 

@@ -77,46 +81,46 @@

 Name:                     Anlyz: LocTime: BUTime:  TDTime:  TotTime:      LocSize: BUSize:  TDSize:    TotSize:     NumFold  NumNodes   main   __main
-254.gap.lib               130.47 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
-255.vortex.lib             86.17 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
-197.parser.lib             26.50 0.1601   1.4931   22.7485  24.7647  |    2187656  4037056  57704672   64165544   |    4550  196932+1184 601+0  601+0  
-300.twolf.lib              14.33 0.2311   1.0000   10.1733  12.1591  |    629008   1085616  15564712   17279336   |    4655  161528+1101 854+0  854+0  
-burg.llvm.lib               6.71 0.0904   0.3799   5.1871   5.8809   |    745152   1254280  6822216    8821648    |    3253  72533+902  436+0  436+0  
-164.gzip.llvm.lib           6.07 0.1158   0.9992   4.1925   5.3966   |    2113120  2772872  9043760    14026344   |    233   16632+232  171+0  171+0  
-256.bzip2.lib               2.16 0.0239   0.1987   1.6047   1.8899   |    372776   1059888  7503640    9009560    |    132   11456+201  148+0  148+0  
-sim.llvm.lib                1.54 0.0163   0.2356   1.0723   1.3738   |    106096   124280   400760     726152     |    41    2739+67    99+0   99+0   
-optimizer-eval.llvm.lib     0.58 0.0126   0.0890   0.3282   0.4696   |    110464   188584   1055832    1373072    |    287   3693+101   63+0   63+0   
-181.mcf.lib                 0.33 0.0155   0.0465   0.1437   0.2308   |    156864   225184   805584     1204520    |    209   1914+72    44+0   44+0   
-voronoi.llvm.lib            0.19 0.0111   0.0253   0.0644   0.1178   |    83248    93616    238648     429504     |    31    1733+106   30+0   30+0   
-sgefa.llvm.lib              0.18 0.0069   0.0398   0.0492   0.1156   |    104712   108472   178920     416872     |    67    634+55     31+0   31+0   
-bh.llvm.lib                 0.16 0.0100   0.0177   0.0355   0.0838   |    81376    93656    190104     428952     |    66    715+64     13+0   13+0   
-health.llvm.lib             0.10 0.0230   0.0084   0.0138   0.0551   |    31232    31552    56984      134736     |    75    361+40     14+0   14+0   
-em3d.llvm.lib               0.09 0.0045   0.0117   0.0255   0.0519   |    37336    67808    126960     248728     |    50    1031+59    28+0   28+0   
-power.llvm.lib              0.07 0.0035   0.0053   0.0105   0.0287   |    23432    31680    42680      113616     |    3     277+35     9+0    9+0    
-mst.llvm.lib                0.07 0.0033   0.0060   0.0145   0.0333   |    29080    31400    56720      131872     |    35    470+36     21+0   21+0   
-lists.llvm.lib              0.07 0.0079   0.0129   0.0170   0.0453   |    27616    39648    75280      154864     |    54    246+34     10+0   10+0   
-indvars.llvm.lib            0.07 0.0020   0.0257   0.0269   0.0569   |    85496    87560    161216     334272     |    *     18+3       1+0    1+0    
-tsp.llvm.lib                0.06 0.0041   0.0049   0.0065   0.0250   |    19360    26216    26712      86912      |    23    247+31     10+0   10+0   
-perimeter.llvm.lib          0.05 0.0024   0.0045   0.0039   0.0194   |    15336    22904    16288      67184      |    *     105+24     4+0    4+0    
-hash.llvm.lib               0.05 0.0029   0.0043   0.0066   0.0211   |    25880    18176    28168      85624      |    2     241+23     7+0    7+0    
-bisort.llvm.lib             0.05 0.0022   0.0036   0.0064   0.0192   |    14376    28616    22416      76480      |    3     210+27     10+0   10+0   
-llubenchmark.llvm.lib       0.04 0.0017   0.0026   0.0045   0.0169   |    11824    24304    18168      65304      |    8     144+20     15+0   15+0   
-treeadd.llvm.lib            0.03 0.0013   0.0016   0.0023   0.0101   |    9080     8408     11224      40704      |    2     76+14      5+0    5+0    
+254.gap.lib               130.47 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
+255.vortex.lib             86.17 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
+197.parser.lib             26.50 0.1601   1.4931   22.7485  24.7647  |    2187656  4037056  57704672   64165544   |    4550  196932+1184 601+0  601+0  
+300.twolf.lib              14.33 0.2311   1.0000   10.1733  12.1591  |    629008   1085616  15564712   17279336   |    4655  161528+1101 854+0  854+0  
+burg.llvm.lib               6.71 0.0904   0.3799   5.1871   5.8809   |    745152   1254280  6822216    8821648    |    3253  72533+902  436+0  436+0  
+164.gzip.llvm.lib           6.07 0.1158   0.9992   4.1925   5.3966   |    2113120  2772872  9043760    14026344   |    233   16632+232  171+0  171+0  
+256.bzip2.lib               2.16 0.0239   0.1987   1.6047   1.8899   |    372776   1059888  7503640    9009560    |    132   11456+201  148+0  148+0  
+sim.llvm.lib                1.54 0.0163   0.2356   1.0723   1.3738   |    106096   124280   400760     726152     |    41    2739+67    99+0   99+0   
+optimizer-eval.llvm.lib     0.58 0.0126   0.0890   0.3282   0.4696   |    110464   188584   1055832    1373072    |    287   3693+101   63+0   63+0   
+181.mcf.lib                 0.33 0.0155   0.0465   0.1437   0.2308   |    156864   225184   805584     1204520    |    209   1914+72    44+0   44+0   
+voronoi.llvm.lib            0.19 0.0111   0.0253   0.0644   0.1178   |    83248    93616    238648     429504     |    31    1733+106   30+0   30+0   
+sgefa.llvm.lib              0.18 0.0069   0.0398   0.0492   0.1156   |    104712   108472   178920     416872     |    67    634+55     31+0   31+0   
+bh.llvm.lib                 0.16 0.0100   0.0177   0.0355   0.0838   |    81376    93656    190104     428952     |    66    715+64     13+0   13+0   
+health.llvm.lib             0.10 0.0230   0.0084   0.0138   0.0551   |    31232    31552    56984      134736     |    75    361+40     14+0   14+0   
+em3d.llvm.lib               0.09 0.0045   0.0117   0.0255   0.0519   |    37336    67808    126960     248728     |    50    1031+59    28+0   28+0   
+power.llvm.lib              0.07 0.0035   0.0053   0.0105   0.0287   |    23432    31680    42680      113616     |    3     277+35     9+0    9+0    
+mst.llvm.lib                0.07 0.0033   0.0060   0.0145   0.0333   |    29080    31400    56720      131872     |    35    470+36     21+0   21+0   
+lists.llvm.lib              0.07 0.0079   0.0129   0.0170   0.0453   |    27616    39648    75280      154864     |    54    246+34     10+0   10+0   
+indvars.llvm.lib            0.07 0.0020   0.0257   0.0269   0.0569   |    85496    87560    161216     334272     |    *     18+3       1+0    1+0    
+tsp.llvm.lib                0.06 0.0041   0.0049   0.0065   0.0250   |    19360    26216    26712      86912      |    23    247+31     10+0   10+0   
+perimeter.llvm.lib          0.05 0.0024   0.0045   0.0039   0.0194   |    15336    22904    16288      67184      |    *     105+24     4+0    4+0    
+hash.llvm.lib               0.05 0.0029   0.0043   0.0066   0.0211   |    25880    18176    28168      85624      |    2     241+23     7+0    7+0    
+bisort.llvm.lib             0.05 0.0022   0.0036   0.0064   0.0192   |    14376    28616    22416      76480      |    3     210+27     10+0   10+0   
+llubenchmark.llvm.lib       0.04 0.0017   0.0026   0.0045   0.0169   |    11824    24304    18168      65304      |    8     144+20     15+0   15+0   
+treeadd.llvm.lib            0.03 0.0013   0.0016   0.0023   0.0101   |    9080     8408     11224      40704      |    2     76+14      5+0    5+0    
 sumarray2d.llvm.lib         0.03 0.0014   0.0097   0.0106   0.0238   |    42056    46440    83192      174008     |    *     15+3       1+0    1+0    
-sieve.llvm.lib              0.03 0.0008   0.0021   0.0032   0.0103   |    16064    14264    35312      76008      |    *     30+4       2+0    2+0    
-objinst.llvm.lib            0.03 0.0015   0.0024   0.0037   0.0134   |    11032    15488    11440      51616      |    39    73+17      3+0    3+0    
-methcall.llvm.lib           0.03 0.0014   0.0018   0.0030   0.0115   |    10824    9704     11128      45312      |    31    58+14      2+0    2+0    
-matrix.llvm.lib             0.03 0.0011   0.0017   0.0018   0.0109   |    8584     17680    4208       46232      |    *     46+11      1+0    1+0    
-ary3.llvm.lib               0.03 0.0010   0.0014   0.0014   0.0085   |    8752     17136    4168       45720      |    6     50+7       1+0    1+0    
-sumarraymalloc.llvm.lib     0.02 0.0007   0.0009   0.0013   0.0070   |    2720     12824    3376       33352      |    *     38+8       2+0    2+0    
-random.llvm.lib             0.02 0.0006   0.0009   0.0009   0.0060   |    6184     1808     2752       23600      |    *     31+5       3+0    3+0    
-pi.llvm.lib                 0.02 0.0006   0.0007   0.0011   0.0049   |    5696     5272     6544       17512      |    *     34+6       3+0    3+0    
+sieve.llvm.lib              0.03 0.0008   0.0021   0.0032   0.0103   |    16064    14264    35312      76008      |    *     30+4       2+0    2+0    
+objinst.llvm.lib            0.03 0.0015   0.0024   0.0037   0.0134   |    11032    15488    11440      51616      |    39    73+17      3+0    3+0    
+methcall.llvm.lib           0.03 0.0014   0.0018   0.0030   0.0115   |    10824    9704     11128      45312      |    31    58+14      2+0    2+0    
+matrix.llvm.lib             0.03 0.0011   0.0017   0.0018   0.0109   |    8584     17680    4208       46232      |    *     46+11      1+0    1+0    
+ary3.llvm.lib               0.03 0.0010   0.0014   0.0014   0.0085   |    8752     17136    4168       45720      |    6     50+7       1+0    1+0    
+sumarraymalloc.llvm.lib     0.02 0.0007   0.0009   0.0013   0.0070   |    2720     12824    3376       33352      |    *     38+8       2+0    2+0    
+random.llvm.lib             0.02 0.0006   0.0009   0.0009   0.0060   |    6184     1808     2752       23600      |    *     31+5       3+0    3+0    
+pi.llvm.lib                 0.02 0.0006   0.0007   0.0011   0.0049   |    5696     5272     6544       17512      |    *     34+6       3+0    3+0    
 matrixTranspose.llvm.lib    0.02 0.0007   0.0033   0.0034   0.0095   |    14088    9424     29480      52992      |    *     17+4       3+0    3+0    
-heapsort.llvm.lib           0.02 0.0008   0.0009   0.0013   0.0076   |    2936     7224     3912       29240      |    *     45+6       3+0    3+0    
-fib2.llvm.lib               0.02 0.0014   0.0008   0.0009   0.0067   |    6176     1808     2400       23008      |    *     25+6       1+0    1+0    
-sumarray.llvm.lib           0.01 0.0003   0.0003   0.0003   0.0022   |    1280     3552     584        7528       |    3     7+2        0+0    0+0    
-printargs.llvm.lib          0.01 0.0005   0.0004   0.0006   0.0030   |    1360     816      4760       6936       |    *     13+4       1+0    1+0    
-hello.llvm.lib              0.01 0.0003   0.0003   0.0003   0.0022   |    880      592      2944       6672       |    *     8+3        1+0    1+0    
+heapsort.llvm.lib           0.02 0.0008   0.0009   0.0013   0.0076   |    2936     7224     3912       29240      |    *     45+6       3+0    3+0    
+fib2.llvm.lib               0.02 0.0014   0.0008   0.0009   0.0067   |    6176     1808     2400       23008      |    *     25+6       1+0    1+0    
+sumarray.llvm.lib           0.01 0.0003   0.0003   0.0003   0.0022   |    1280     3552     584        7528       |    3     7+2        0+0    0+0    
+printargs.llvm.lib          0.01 0.0005   0.0004   0.0006   0.0030   |    1360     816      4760       6936       |    *     13+4       1+0    1+0    
+hello.llvm.lib              0.01 0.0003   0.0003   0.0003   0.0022   |    880      592      2944       6672       |    *     8+3        1+0    1+0    
 ackermann.llvm.lib          0.01 0.0000   0.0000   0.0001   0.0004   |    0        0        832        832        |    *     0+0        *      *      
 

@@ -349,7 +353,7 @@

Chris Lattner
-Last modified: Fri Nov 8 16:49:01 CST 2002 +Last modified: Sat Nov 9 13:12:36 CST 2002 From lattner at cs.uiuc.edu Sat Nov 9 13:23:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 13:23:00 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure.h Message-ID: <200211091922.NAA07621@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DataStructure.h updated: 1.51 -> 1.52 --- Log message: Remove GlobalDSGraph delcaration --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure.h:1.51 llvm/include/llvm/Analysis/DataStructure.h:1.52 --- llvm/include/llvm/Analysis/DataStructure.h:1.51 Fri Nov 8 15:24:51 2002 +++ llvm/include/llvm/Analysis/DataStructure.h Sat Nov 9 13:21:56 2002 @@ -14,9 +14,6 @@ class Type; class DSGraph; class DSNode; -class LocalDataStructures; // A collection of local graphs for a program -class BUDataStructures; // A collection of bu graphs for a program -class TDDataStructures; // A collection of td graphs for a program // FIXME: move this stuff to a private header namespace DataStructureAnalysis { @@ -60,6 +57,7 @@ } }; + // BUDataStructures - The analysis that computes the interprocedurally closed // data structure graphs for all of the functions in the program. This pass // only performs a "Bottom Up" propagation (hence the name). @@ -93,6 +91,7 @@ DSGraph &calculateGraph(Function &F); }; + // TDDataStructures - Analysis that computes new data structure graphs // for each function using the closed graphs for the callers computed // by the bottom-up pass. @@ -130,33 +129,5 @@ void ResolveCallSite(DSGraph &Graph, const DSCallSite &CallSite); }; - -#if 0 -// GlobalDSGraph - A common graph for all the globals and their outgoing links -// to externally visible nodes. This includes GlobalValues, New nodes, -// Cast nodes, and Calls. This graph can only be used by one of the -// individual function graphs, and it goes away when they all go away. -// -class GlobalDSGraph : public DSGraph { - hash_set Referrers; - void addReference(const DSGraph* referrer); - void removeReference(const DSGraph* referrer); - friend class DSGraph; // give access to Referrers - - GlobalDSGraph(const GlobalDSGraph &GlobalDSG); // Do not implement - - // Helper function for cloneGlobals and cloneCalls - DSNode* cloneNodeInto(DSNode *OldNode, - std::map &NodeCache, - bool GlobalsAreFinal = false); - -public: - GlobalDSGraph(); // Create an empty DSGraph - virtual ~GlobalDSGraph(); - - void cloneGlobals(DSGraph& Graph, bool CloneCalls = false); - void cloneCalls (DSGraph& Graph); -}; -#endif #endif From lattner at cs.uiuc.edu Sat Nov 9 13:25:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 13:25:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure.h Message-ID: <200211091924.NAA07893@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DataStructure.h updated: 1.52 -> 1.53 --- Log message: Remove unneccesary #include --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure.h:1.52 llvm/include/llvm/Analysis/DataStructure.h:1.53 --- llvm/include/llvm/Analysis/DataStructure.h:1.52 Sat Nov 9 13:21:56 2002 +++ llvm/include/llvm/Analysis/DataStructure.h Sat Nov 9 13:24:41 2002 @@ -7,13 +7,13 @@ #ifndef LLVM_ANALYSIS_DATA_STRUCTURE_H #define LLVM_ANALYSIS_DATA_STRUCTURE_H -#include "llvm/Analysis/DSSupport.h" #include "llvm/Pass.h" #include class Type; class DSGraph; class DSNode; +class DSCallSite; // FIXME: move this stuff to a private header namespace DataStructureAnalysis { From lattner at cs.uiuc.edu Sat Nov 9 13:26:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 13:26:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp Message-ID: <200211091925.NAA07906@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Local.cpp updated: 1.30 -> 1.31 --- Log message: #include Datastructure.h first --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.30 llvm/lib/Analysis/DataStructure/Local.cpp:1.31 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.30 Thu Nov 7 23:00:44 2002 +++ llvm/lib/Analysis/DataStructure/Local.cpp Sat Nov 9 13:25:10 2002 @@ -5,8 +5,8 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/DSGraph.h" #include "llvm/Analysis/DataStructure.h" +#include "llvm/Analysis/DSGraph.h" #include "llvm/iMemory.h" #include "llvm/iTerminators.h" #include "llvm/iPHINode.h" From lattner at cs.uiuc.edu Sat Nov 9 13:26:06 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 13:26:06 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200211091925.NAA07917@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.55 -> 1.56 --- Log message: Tighten up array handling --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.55 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.56 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.55 Fri Nov 8 18:49:05 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Nov 9 13:25:27 2002 @@ -135,10 +135,12 @@ // be used anyway. This greatly reduces the size of large static arrays used // as global variables, for example. // + bool WillBeArray = false; while (const ArrayType *AT = dyn_cast(NewTy)) { // FIXME: we might want to keep small arrays, but must be careful about // things like: [2 x [10000 x int*]] NewTy = AT->getElementType(); + WillBeArray = true; } // Figure out how big the new type we're merging in is... @@ -152,8 +154,9 @@ // If this is the first type that this node has seen, just accept it without // question.... assert(Offset == 0 && "Cannot have an offset into a void node!"); - assert(Ty.isArray == false && "This shouldn't happen!"); + assert(!Ty.isArray && "This shouldn't happen!"); Ty.Ty = NewTy; + Ty.isArray = WillBeArray; Size = NewTySize; // Calculate the number of outgoing links from this node. @@ -185,6 +188,7 @@ // const Type *OldTy = Ty.Ty; Ty.Ty = NewTy; + Ty.isArray = WillBeArray; Size = NewTySize; // Must grow links to be the appropriate size... From lattner at cs.uiuc.edu Sat Nov 9 14:01:02 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 14:01:02 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Local.cpp Message-ID: <200211092000.OAA09227@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.56 -> 1.57 Local.cpp updated: 1.31 -> 1.32 --- Log message: Add initial support for a globals graph --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.56 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.57 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.56 Sat Nov 9 13:25:27 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Nov 9 14:00:45 2002 @@ -501,14 +501,14 @@ // DSGraph Implementation //===----------------------------------------------------------------------===// -DSGraph::DSGraph(const DSGraph &G) : Func(G.Func) { +DSGraph::DSGraph(const DSGraph &G) : Func(G.Func), GlobalsGraph(0) { std::map NodeMap; RetNode = cloneInto(G, ScalarMap, NodeMap); } DSGraph::DSGraph(const DSGraph &G, std::map &NodeMap) - : Func(G.Func) { + : Func(G.Func), GlobalsGraph(0) { RetNode = cloneInto(G, ScalarMap, NodeMap); } @@ -1055,28 +1055,6 @@ //===----------------------------------------------------------------------===// // GlobalDSGraph Implementation //===----------------------------------------------------------------------===// - -GlobalDSGraph::GlobalDSGraph() : DSGraph(*(Function*)0, this) { -} - -GlobalDSGraph::~GlobalDSGraph() { - assert(Referrers.size() == 0 && - "Deleting global graph while references from other graphs exist"); -} - -void GlobalDSGraph::addReference(const DSGraph* referrer) { - if (referrer != this) - Referrers.insert(referrer); -} - -void GlobalDSGraph::removeReference(const DSGraph* referrer) { - if (referrer != this) { - assert(Referrers.find(referrer) != Referrers.end() && "This is very bad!"); - Referrers.erase(referrer); - if (Referrers.size() == 0) - delete this; - } -} #if 0 // Bits used in the next function Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.31 llvm/lib/Analysis/DataStructure/Local.cpp:1.32 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.31 Sat Nov 9 13:25:10 2002 +++ llvm/lib/Analysis/DataStructure/Local.cpp Sat Nov 9 14:00:45 2002 @@ -131,7 +131,7 @@ //===----------------------------------------------------------------------===// // DSGraph constructor - Simply use the GraphBuilder to construct the local // graph. -DSGraph::DSGraph(Function &F) : Func(&F) { +DSGraph::DSGraph(Function &F, DSGraph *GG) : Func(&F), GlobalsGraph(GG) { // Use the graph builder to construct the local version of the graph GraphBuilder B(*this, Nodes, RetNode, ScalarMap, FunctionCalls); markIncompleteNodes(); @@ -416,12 +416,16 @@ // Empty map so next time memory is released, data structures are not // re-deleted. DSInfo.clear(); + delete GlobalsGraph; + GlobalsGraph = 0; } bool LocalDataStructures::run(Module &M) { + GlobalsGraph = new DSGraph(); + // Calculate all of the graphs... for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) if (!I->isExternal()) - DSInfo.insert(std::make_pair(I, new DSGraph(*I))); + DSInfo.insert(std::make_pair(I, new DSGraph(*I, GlobalsGraph))); return false; } From lattner at cs.uiuc.edu Sat Nov 9 14:02:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 14:02:00 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h DataStructure.h Message-ID: <200211092001.OAA09242@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.32 -> 1.33 DataStructure.h updated: 1.53 -> 1.54 --- Log message: Add initial support for a globals graph --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.32 llvm/include/llvm/Analysis/DSGraph.h:1.33 --- llvm/include/llvm/Analysis/DSGraph.h:1.32 Fri Nov 8 16:28:55 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Sat Nov 9 14:01:01 2002 @@ -13,18 +13,13 @@ /// DSGraph - The graph that represents a function. /// class DSGraph { - Function *Func; + Function *Func; // Func - The LLVM function this graph corresponds to + DSGraph *GlobalsGraph; // Pointer to the common graph of global objects + + DSNodeHandle RetNode; // The node that gets returned... std::vector Nodes; - DSNodeHandle RetNode; // Node that gets returned... std::map ScalarMap; -#if 0 - // GlobalsGraph -- Reference to the common graph of globally visible objects. - // This includes GlobalValues, New nodes, Cast nodes, and Calls. - // - GlobalDSGraph* GlobalsGraph; -#endif - // FunctionCalls - This vector maintains a single entry for each call // instruction in the current graph. The first entry in the vector is the // scalar that holds the return value for the call, the second is the function @@ -41,18 +36,26 @@ void operator=(const DSGraph &); // DO NOT IMPLEMENT public: - DSGraph() : Func(0) {} // Create a new, empty, DSGraph. - DSGraph(Function &F); // Compute the local DSGraph + DSGraph() : Func(0), GlobalsGraph(0) {} // Create a new, empty, DSGraph. + DSGraph(Function &F, DSGraph *GlobalsGraph); // Compute the local DSGraph // Copy ctor - If you want to capture the node mapping between the source and // destination graph, you may optionally do this by specifying a map to record // this into. + // + // Note that a copied graph does not retain the GlobalsGraph pointer of the + // source. You need to set a new GlobalsGraph with the setGlobalsGraph + // method. + // DSGraph(const DSGraph &DSG); DSGraph(const DSGraph &DSG, std::map &NodeMap); ~DSGraph(); bool hasFunction() const { return Func != 0; } Function &getFunction() const { return *Func; } + + DSGraph *getGlobalsGraph() const { return GlobalsGraph; } + void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; } /// getNodes - Get a vector of all the nodes in the graph /// Index: llvm/include/llvm/Analysis/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure.h:1.53 llvm/include/llvm/Analysis/DataStructure.h:1.54 --- llvm/include/llvm/Analysis/DataStructure.h:1.53 Sat Nov 9 13:24:41 2002 +++ llvm/include/llvm/Analysis/DataStructure.h Sat Nov 9 14:01:01 2002 @@ -33,6 +33,7 @@ class LocalDataStructures : public Pass { // DSInfo, one graph for each function std::map DSInfo; + DSGraph *GlobalsGraph; public: ~LocalDataStructures() { releaseMemory(); } From lattner at cs.uiuc.edu Sat Nov 9 14:15:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 14:15:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp Message-ID: <200211092014.OAA09822@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Local.cpp updated: 1.32 -> 1.33 --- Log message: Don't put constants into the scalar map! --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.32 llvm/lib/Analysis/DataStructure/Local.cpp:1.33 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.32 Sat Nov 9 14:00:45 2002 +++ llvm/lib/Analysis/DataStructure/Local.cpp Sat Nov 9 14:14:03 2002 @@ -150,29 +150,33 @@ if (V == Constant::getNullValue(V->getType())) return 0; // Null doesn't point to anything, don't add to ScalarMap! - DSNodeHandle &NH = ScalarMap[V]; - if (NH.getNode()) - return NH; // Already have a node? Just return it... - if (Constant *C = dyn_cast(V)) if (ConstantPointerRef *CPR = dyn_cast(C)) { - return NH = getValueDest(*CPR->getValue()); + return getValueDest(*CPR->getValue()); } else if (ConstantExpr *CE = dyn_cast(C)) { if (CE->getOpcode() == Instruction::Cast) - return NH = getValueDest(*CE->getOperand(0)); + return getValueDest(*CE->getOperand(0)); if (CE->getOpcode() == Instruction::GetElementPtr) { visitGetElementPtrInst(*CE); - return ScalarMap[CE]; + std::map::iterator I = ScalarMap.find(CE); + assert(I != ScalarMap.end() && "GEP didn't get processed right?"); + DSNodeHandle NH = I->second; + ScalarMap.erase(I); // Remove constant from scalarmap + return NH; } // This returns a conservative unknown node for any unhandled ConstExpr - return NH = createNode(DSNode::UnknownNode); + return createNode(DSNode::UnknownNode); } else if (ConstantIntegral *CI = dyn_cast(C)) { // Random constants are unknown mem - return NH = createNode(DSNode::UnknownNode); + return createNode(DSNode::UnknownNode); } else { assert(0 && "Unknown constant type!"); } + + DSNodeHandle &NH = ScalarMap[V]; + if (NH.getNode()) + return NH; // Already have a node? Just return it... // Otherwise we need to create a new node to point to... DSNode *N; From lattner at cs.uiuc.edu Sat Nov 9 14:56:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 14:56:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200211092055.OAA11452@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.33 -> 1.34 --- Log message: Make removeTriviallyDeadNodes a private interface --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.33 llvm/include/llvm/Analysis/DSGraph.h:1.34 --- llvm/include/llvm/Analysis/DSGraph.h:1.33 Sat Nov 9 14:01:01 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Sat Nov 9 14:55:04 2002 @@ -126,19 +126,13 @@ // void markIncompleteNodes(bool markFormalArgs = true); - // removeTriviallyDeadNodes - After the graph has been constructed, this - // method removes all unreachable nodes that are created because they got - // merged with other nodes in the graph. - // - void removeTriviallyDeadNodes(bool KeepAllGlobals = false); - // 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 // from the caller's graph entirely. This is only appropriate to use when // inlining graphs. // - void removeDeadNodes(bool KeepAllGlobals = false, bool KeepCalls = true); + void removeDeadNodes(bool KeepAllGlobals, bool KeepCalls); // CloneFlags enum - Bits that may be passed into the cloneInto method to // specify how to clone the function graph. @@ -167,19 +161,15 @@ /// void mergeInGraph(DSCallSite &CS, const DSGraph &Graph, unsigned CloneFlags); -#if 0 - // cloneGlobalInto - Clone the given global node (or the node for the given - // GlobalValue) from the GlobalsGraph and all its target links (recursively). - // - DSNode* cloneGlobalInto(const DSNode* GNode); - DSNode* cloneGlobalInto(GlobalValue* GV) { - assert(!GV || (((DSGraph*) GlobalsGraph)->ScalarMap[GV] != 0)); - return GV? cloneGlobalInto(((DSGraph*) GlobalsGraph)->ScalarMap[GV]) : 0; - } -#endif - private: bool isNodeDead(DSNode *N); + + // removeTriviallyDeadNodes - After the graph has been constructed, this + // method removes all unreachable nodes that are created because they got + // merged with other nodes in the graph. This is used as the first step of + // removeDeadNodes. + // + void removeTriviallyDeadNodes(bool KeepAllGlobals = false); }; #endif From lattner at cs.uiuc.edu Sat Nov 9 14:56:07 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 14:56:07 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp DataStructure.cpp Local.cpp Steensgaard.cpp TopDownClosure.cpp Message-ID: <200211092055.OAA11473@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.36 -> 1.37 DataStructure.cpp updated: 1.57 -> 1.58 Local.cpp updated: 1.33 -> 1.34 Steensgaard.cpp updated: 1.10 -> 1.11 TopDownClosure.cpp updated: 1.25 -> 1.26 --- Log message: Make removeTriviallyDeadNodes a private interface of DSGraph --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.36 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.37 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.36 Fri Nov 8 16:27:25 2002 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Sat Nov 9 14:55:24 2002 @@ -154,10 +154,11 @@ } } while (Inlined && !FCs.empty()); +#if 0 Graph->maskIncompleteMarkers(); Graph->markIncompleteNodes(); - Graph->removeTriviallyDeadNodes(false); Graph->removeDeadNodes(/*KeepAllGlobals*/ true, /*KeepCalls*/ true); +#endif DEBUG(std::cerr << " [BU] Done inlining: " << F.getName() << " [" << Graph->getGraphSize() << "+" << Graph->getFunctionCalls().size() Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.57 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.58 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.57 Sat Nov 9 14:00:45 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Nov 9 14:55:24 2002 @@ -772,8 +772,7 @@ // bool DSGraph::isNodeDead(DSNode *N) { // Is it a trivially dead shadow node... - if (N->getReferrers().empty() && - (N->NodeType == 0 || N->NodeType == DSNode::DEAD)) + if (N->getReferrers().empty() && (N->NodeType & ~DSNode::DEAD) == 0) return true; // Is it a function node or some other trivially unused global? Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.33 llvm/lib/Analysis/DataStructure/Local.cpp:1.34 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.33 Sat Nov 9 14:14:03 2002 +++ llvm/lib/Analysis/DataStructure/Local.cpp Sat Nov 9 14:55:24 2002 @@ -74,9 +74,6 @@ getValueDest(*I); visit(G.getFunction()); // Single pass over the function - - // Not inlining, only eliminate trivially dead nodes. - G.removeTriviallyDeadNodes(); } private: @@ -135,6 +132,9 @@ // Use the graph builder to construct the local version of the graph GraphBuilder B(*this, Nodes, RetNode, ScalarMap, FunctionCalls); markIncompleteNodes(); + + // Remove any nodes made dead due to merging... + removeDeadNodes(true, true); } Index: llvm/lib/Analysis/DataStructure/Steensgaard.cpp diff -u llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.10 llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.11 --- llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.10 Fri Nov 8 15:27:37 2002 +++ llvm/lib/Analysis/DataStructure/Steensgaard.cpp Sat Nov 9 14:55:24 2002 @@ -194,7 +194,7 @@ ResultGraph->markIncompleteNodes(false); // Remove any nodes that are dead after all of the merging we have done... - ResultGraph->removeTriviallyDeadNodes(); + ResultGraph->removeDeadNodes(true, true); DEBUG(print(std::cerr, &M)); return false; Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.25 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.26 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.25 Fri Nov 8 16:26:43 2002 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Sat Nov 9 14:55:24 2002 @@ -180,7 +180,6 @@ CG.maskIncompleteMarkers(); CG.markIncompleteNodes(/*markFormals*/ !F.hasInternalLinkage() /*&& FIXME: NEED TO CHECK IF ALL CALLERS FOUND!*/); - CG.removeTriviallyDeadNodes(false); CG.removeDeadNodes(false, true) ;///*KeepAllGlobals*/ false, true); ///*KeepCalls*/ false); } From lattner at cs.uiuc.edu Sat Nov 9 15:01:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 15:01:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp DataStructure.cpp Local.cpp Steensgaard.cpp TopDownClosure.cpp Message-ID: <200211092100.PAA12115@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.37 -> 1.38 DataStructure.cpp updated: 1.58 -> 1.59 Local.cpp updated: 1.34 -> 1.35 Steensgaard.cpp updated: 1.11 -> 1.12 TopDownClosure.cpp updated: 1.26 -> 1.27 --- Log message: Clean up DSGraph::removeDeadNodes interface --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.37 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.38 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.37 Sat Nov 9 14:55:24 2002 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Sat Nov 9 15:00:47 2002 @@ -150,15 +150,9 @@ if (Inlined) { Graph->maskIncompleteMarkers(); Graph->markIncompleteNodes(); - Graph->removeDeadNodes(/*KeepAllGlobals*/ true, /*KeepCalls*/ true); + Graph->removeDeadNodes(/*KeepAllGlobals*/ true); } } while (Inlined && !FCs.empty()); - -#if 0 - Graph->maskIncompleteMarkers(); - Graph->markIncompleteNodes(); - Graph->removeDeadNodes(/*KeepAllGlobals*/ true, /*KeepCalls*/ true); -#endif DEBUG(std::cerr << " [BU] Done inlining: " << F.getName() << " [" << Graph->getGraphSize() << "+" << Graph->getFunctionCalls().size() Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.58 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.59 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.58 Sat Nov 9 14:55:24 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Nov 9 15:00:47 2002 @@ -981,10 +981,7 @@ // from the caller's graph entirely. This is only appropriate to use when // inlining graphs. // -void DSGraph::removeDeadNodes(bool KeepAllGlobals, bool KeepCalls) { - assert((!KeepAllGlobals || KeepCalls) && // FIXME: This should be an enum! - "KeepAllGlobals without KeepCalls is meaningless"); - +void DSGraph::removeDeadNodes(bool KeepAllGlobals) { // Reduce the amount of work we have to do... removeTriviallyDeadNodes(KeepAllGlobals); @@ -994,19 +991,17 @@ std::set Alive; // If KeepCalls, mark all nodes reachable by call nodes as alive... - if (KeepCalls) { - for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) { - for (unsigned j = 0, e = FunctionCalls[i].getNumPtrArgs(); j != e; ++j) - markAlive(FunctionCalls[i].getPtrArg(j).getNode(), Alive); - markAlive(FunctionCalls[i].getRetVal().getNode(), Alive); - markAlive(FunctionCalls[i].getCallee().getNode(), Alive); - } - for (unsigned i = 0, e = AuxFunctionCalls.size(); i != e; ++i) { - for (unsigned j = 0, e = AuxFunctionCalls[i].getNumPtrArgs(); j != e; ++j) - markAlive(AuxFunctionCalls[i].getPtrArg(j).getNode(), Alive); - markAlive(AuxFunctionCalls[i].getRetVal().getNode(), Alive); - markAlive(AuxFunctionCalls[i].getCallee().getNode(), Alive); - } + for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) { + for (unsigned j = 0, e = FunctionCalls[i].getNumPtrArgs(); j != e; ++j) + markAlive(FunctionCalls[i].getPtrArg(j).getNode(), Alive); + markAlive(FunctionCalls[i].getRetVal().getNode(), Alive); + markAlive(FunctionCalls[i].getCallee().getNode(), Alive); + } + for (unsigned i = 0, e = AuxFunctionCalls.size(); i != e; ++i) { + for (unsigned j = 0, e = AuxFunctionCalls[i].getNumPtrArgs(); j != e; ++j) + markAlive(AuxFunctionCalls[i].getPtrArg(j).getNode(), Alive); + markAlive(AuxFunctionCalls[i].getRetVal().getNode(), Alive); + markAlive(AuxFunctionCalls[i].getCallee().getNode(), Alive); } // Mark all nodes reachable by scalar nodes as alive... @@ -1022,7 +1017,7 @@ // Of course, if KeepAllGlobals is specified, they would be live already. if (!KeepAllGlobals) - markGlobalsAlive(*this, Alive, !KeepCalls); + markGlobalsAlive(*this, Alive, false); // Loop over all unreachable nodes, dropping their references... vector DeadNodes; @@ -1157,7 +1152,7 @@ if (CloneCalls) GlobalsGraph->cloneCalls(Graph); - GlobalsGraph->removeDeadNodes(/*KeepAllGlobals*/ true, /*KeepCalls*/ true); + GlobalsGraph->removeDeadNodes(/*KeepAllGlobals*/ true); #endif } Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.34 llvm/lib/Analysis/DataStructure/Local.cpp:1.35 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.34 Sat Nov 9 14:55:24 2002 +++ llvm/lib/Analysis/DataStructure/Local.cpp Sat Nov 9 15:00:47 2002 @@ -134,7 +134,7 @@ markIncompleteNodes(); // Remove any nodes made dead due to merging... - removeDeadNodes(true, true); + removeDeadNodes(true); } Index: llvm/lib/Analysis/DataStructure/Steensgaard.cpp diff -u llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.11 llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.12 --- llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.11 Sat Nov 9 14:55:24 2002 +++ llvm/lib/Analysis/DataStructure/Steensgaard.cpp Sat Nov 9 15:00:47 2002 @@ -194,7 +194,7 @@ ResultGraph->markIncompleteNodes(false); // Remove any nodes that are dead after all of the merging we have done... - ResultGraph->removeDeadNodes(true, true); + ResultGraph->removeDeadNodes(true); DEBUG(print(std::cerr, &M)); return false; Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.26 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.27 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.26 Sat Nov 9 14:55:24 2002 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Sat Nov 9 15:00:47 2002 @@ -180,8 +180,7 @@ CG.maskIncompleteMarkers(); CG.markIncompleteNodes(/*markFormals*/ !F.hasInternalLinkage() /*&& FIXME: NEED TO CHECK IF ALL CALLERS FOUND!*/); - CG.removeDeadNodes(false, true) ;///*KeepAllGlobals*/ false, true); - ///*KeepCalls*/ false); + CG.removeDeadNodes(/*KeepAllGlobals*/ false); } DEBUG(std::cerr << " [TD] Done inlining into callees for: " << F.getName() From lattner at cs.uiuc.edu Sat Nov 9 15:01:07 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 15:01:07 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200211092100.PAA12122@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.34 -> 1.35 --- Log message: Clean up DSGraph::removeDeadNodes interface --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.34 llvm/include/llvm/Analysis/DSGraph.h:1.35 --- llvm/include/llvm/Analysis/DSGraph.h:1.34 Sat Nov 9 14:55:04 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Sat Nov 9 15:00:49 2002 @@ -132,7 +132,7 @@ // from the caller's graph entirely. This is only appropriate to use when // inlining graphs. // - void removeDeadNodes(bool KeepAllGlobals, bool KeepCalls); + void removeDeadNodes(bool KeepAllGlobals); // CloneFlags enum - Bits that may be passed into the cloneInto method to // specify how to clone the function graph. From lattner at cs.uiuc.edu Sat Nov 9 15:03:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 15:03:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200211092102.PAA12186@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.59 -> 1.60 --- Log message: Move maskNodeTypes to header file --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.59 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.60 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.59 Sat Nov 9 15:00:47 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Nov 9 15:02:26 2002 @@ -1034,17 +1034,6 @@ std::for_each(DeadNodes.begin(), DeadNodes.end(), deleter); } - - -// maskNodeTypes - Apply a mask to all of the node types in the graph. This -// is useful for clearing out markers like Scalar or Incomplete. -// -void DSGraph::maskNodeTypes(unsigned char Mask) { - for (unsigned i = 0, e = Nodes.size(); i != e; ++i) - Nodes[i]->NodeType &= Mask; -} - - #if 0 //===----------------------------------------------------------------------===// // GlobalDSGraph Implementation From lattner at cs.uiuc.edu Sat Nov 9 15:03:06 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 15:03:06 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200211092102.PAA12193@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.35 -> 1.36 --- Log message: Move maskNodeTypes from cpp file --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.35 llvm/include/llvm/Analysis/DSGraph.h:1.36 --- llvm/include/llvm/Analysis/DSGraph.h:1.35 Sat Nov 9 15:00:49 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Sat Nov 9 15:02:30 2002 @@ -109,10 +109,13 @@ void dump() const; void writeGraphToFile(std::ostream &O, const std::string &GraphName) const; - // maskNodeTypes - Apply a mask to all of the node types in the graph. This - // is useful for clearing out markers like Scalar or Incomplete. - // - void maskNodeTypes(unsigned char Mask); + /// maskNodeTypes - Apply a mask to all of the node types in the graph. This + /// is useful for clearing out markers like Incomplete. + /// + void maskNodeTypes(unsigned char Mask) { + for (unsigned i = 0, e = Nodes.size(); i != e; ++i) + Nodes[i]->NodeType &= Mask; + } void maskIncompleteMarkers() { maskNodeTypes(~DSNode::Incomplete); } // markIncompleteNodes - Traverse the graph, identifying nodes that may be From lattner at cs.uiuc.edu Sat Nov 9 15:13:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 15:13:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Local.cpp Printer.cpp TopDownClosure.cpp Message-ID: <200211092112.PAA13409@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.38 -> 1.39 Local.cpp updated: 1.35 -> 1.36 Printer.cpp updated: 1.36 -> 1.37 TopDownClosure.cpp updated: 1.27 -> 1.28 --- Log message: Add globals graphs to all three passes --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.38 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.39 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.38 Sat Nov 9 15:00:47 2002 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Sat Nov 9 15:12:06 2002 @@ -18,6 +18,18 @@ using namespace DS; +// run - Calculate the bottom up data structure graphs for each function in the +// program. +// +bool BUDataStructures::run(Module &M) { + GlobalsGraph = new DSGraph(); + + // Simply calculate the graphs for each function... + for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) + if (!I->isExternal()) + calculateGraph(*I); + return false; +} // releaseMemory - If the pass pipeline is done with this pass, we can release // our memory... here... @@ -30,17 +42,8 @@ // Empty map so next time memory is released, data structures are not // re-deleted. DSInfo.clear(); -} - -// run - Calculate the bottom up data structure graphs for each function in the -// program. -// -bool BUDataStructures::run(Module &M) { - // Simply calculate the graphs for each function... - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal()) - calculateGraph(*I); - return false; + delete GlobalsGraph; + GlobalsGraph = 0; } DSGraph &BUDataStructures::calculateGraph(Function &F) { @@ -52,6 +55,7 @@ // Copy the local version into DSInfo... Graph = new DSGraph(getAnalysis().getDSGraph(F)); + Graph->setGlobalsGraph(GlobalsGraph); #if 0 // Populate the GlobalsGraph with globals from this one. Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.35 llvm/lib/Analysis/DataStructure/Local.cpp:1.36 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.35 Sat Nov 9 15:00:47 2002 +++ llvm/lib/Analysis/DataStructure/Local.cpp Sat Nov 9 15:12:06 2002 @@ -409,6 +409,16 @@ // LocalDataStructures Implementation //===----------------------------------------------------------------------===// +bool LocalDataStructures::run(Module &M) { + GlobalsGraph = new DSGraph(); + + // Calculate all of the graphs... + for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) + if (!I->isExternal()) + DSInfo.insert(std::make_pair(I, new DSGraph(*I, GlobalsGraph))); + return false; +} + // releaseMemory - If the pass pipeline is done with this pass, we can release // our memory... here... // @@ -422,14 +432,4 @@ DSInfo.clear(); delete GlobalsGraph; GlobalsGraph = 0; -} - -bool LocalDataStructures::run(Module &M) { - GlobalsGraph = new DSGraph(); - - // Calculate all of the graphs... - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal()) - DSInfo.insert(std::make_pair(I, new DSGraph(*I, GlobalsGraph))); - return false; } Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.36 llvm/lib/Analysis/DataStructure/Printer.cpp:1.37 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.36 Thu Nov 7 19:21:07 2002 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Sat Nov 9 15:12:06 2002 @@ -181,6 +181,16 @@ } } + DSGraph &GG = C.getGlobalsGraph(); + TotalNumNodes += GG.getGraphSize(); + TotalCallNodes += GG.getFunctionCalls().size(); + if (OnlyPrintMain) { + GG.writeGraphToFile(O, Prefix+"GlobalsGraph"); + } else { + O << "Skipped Writing '" << Prefix << "GlobalsGraph.dot'... [" + << GG.getGraphSize() << "+" << GG.getFunctionCalls().size() << "]\n"; + } + O << "\nGraphs contain [" << TotalNumNodes << "+" << TotalCallNodes << "] nodes total" << std::endl; } Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.27 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.28 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.27 Sat Nov 9 15:00:47 2002 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Sat Nov 9 15:12:06 2002 @@ -16,24 +16,12 @@ static RegisterAnalysis Y("tddatastructure", "Top-down Data Structure Analysis Closure"); -// releaseMemory - If the pass pipeline is done with this pass, we can release -// our memory... here... -// -void TDDataStructures::releaseMemory() { - for (std::map::iterator I = DSInfo.begin(), - E = DSInfo.end(); I != E; ++I) - delete I->second; - - // Empty map so next time memory is released, data structures are not - // re-deleted. - DSInfo.clear(); -} - // run - Calculate the top down data structure graphs for each function in the // program. // bool TDDataStructures::run(Module &M) { BUDataStructures &BU = getAnalysis(); + GlobalsGraph = new DSGraph(); // Calculate top-down from main... if (Function *F = M.getMainFunction()) @@ -43,9 +31,26 @@ for (Module::reverse_iterator I = M.rbegin(), E = M.rend(); I != E; ++I) if (!I->isExternal()) calculateGraph(*I); + + GraphDone.clear(); // Free temporary memory... return false; } +// releaseMemory - If the pass pipeline is done with this pass, we can release +// our memory... here... +// +void TDDataStructures::releaseMemory() { + for (std::map::iterator I = DSInfo.begin(), + E = DSInfo.end(); I != E; ++I) + delete I->second; + + // Empty map so next time memory is released, data structures are not + // re-deleted. + DSInfo.clear(); + delete GlobalsGraph; + GlobalsGraph = 0; +} + /// ResolveCallSite - This method is used to link the actual arguments together /// with the formal arguments for a function call in the top-down closure. This /// method assumes that the call site arguments have been mapped into nodes @@ -77,6 +82,7 @@ if (G == 0) { // Not created yet? Clone BU graph... G = new DSGraph(getAnalysis().getDSGraph(F)); G->getAuxFunctionCalls().clear(); + G->setGlobalsGraph(GlobalsGraph); } return *G; } From lattner at cs.uiuc.edu Sat Nov 9 15:13:07 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 15:13:07 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure.h Message-ID: <200211092112.PAA13416@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DataStructure.h updated: 1.54 -> 1.55 --- Log message: Add globals graphs to all three passes --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure.h:1.54 llvm/include/llvm/Analysis/DataStructure.h:1.55 --- llvm/include/llvm/Analysis/DataStructure.h:1.54 Sat Nov 9 14:01:01 2002 +++ llvm/include/llvm/Analysis/DataStructure.h Sat Nov 9 15:12:07 2002 @@ -46,6 +46,8 @@ return *I->second; } + DSGraph &getGlobalsGraph() const { return *GlobalsGraph; } + // print - Print out the analysis results... void print(std::ostream &O, const Module *M) const; @@ -66,6 +68,7 @@ class BUDataStructures : public Pass { // DSInfo, one graph for each function std::map DSInfo; + DSGraph *GlobalsGraph; public: ~BUDataStructures() { releaseMemory(); } @@ -78,7 +81,9 @@ return *I->second; } - // print - Print out the analysis results... + DSGraph &getGlobalsGraph() const { return *GlobalsGraph; } + + // print - Print out the analysis results... void print(std::ostream &O, const Module *M) const; // If the pass pipeline is done with this pass, we can release our memory... @@ -101,6 +106,7 @@ // DSInfo, one graph for each function std::map DSInfo; std::set GraphDone; + DSGraph *GlobalsGraph; public: ~TDDataStructures() { releaseMemory(); } @@ -112,6 +118,8 @@ assert(I != DSInfo.end() && "Function not in module!"); return *I->second; } + + DSGraph &getGlobalsGraph() const { return *GlobalsGraph; } // print - Print out the analysis results... void print(std::ostream &O, const Module *M) const; From lattner at cs.uiuc.edu Sat Nov 9 15:42:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 15:42:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp Message-ID: <200211092141.PAA13463@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Printer.cpp updated: 1.37 -> 1.38 --- Log message: Fix logic --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.37 llvm/lib/Analysis/DataStructure/Printer.cpp:1.38 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.37 Sat Nov 9 15:12:06 2002 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Sat Nov 9 15:40:58 2002 @@ -184,7 +184,7 @@ DSGraph &GG = C.getGlobalsGraph(); TotalNumNodes += GG.getGraphSize(); TotalCallNodes += GG.getFunctionCalls().size(); - if (OnlyPrintMain) { + if (!OnlyPrintMain) { GG.writeGraphToFile(O, Prefix+"GlobalsGraph"); } else { O << "Skipped Writing '" << Prefix << "GlobalsGraph.dot'... [" From lattner at cs.uiuc.edu Sat Nov 9 15:42:06 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 15:42:06 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp Message-ID: <200211092141.PAA13475@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Printer.cpp updated: 1.38 -> 1.39 --- Log message: Remove obsolete code --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.38 llvm/lib/Analysis/DataStructure/Printer.cpp:1.39 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.38 Sat Nov 9 15:40:58 2002 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Sat Nov 9 15:41:44 2002 @@ -203,22 +203,8 @@ void BUDataStructures::print(std::ostream &O, const Module *M) const { printCollection(*this, O, M, "bu."); -#if 0 - for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) - if (!I->isExternal()) { - (*getDSGraph(*I).GlobalsGraph)->writeGraphToFile(O, "gg.program"); - break; - } -#endif } void TDDataStructures::print(std::ostream &O, const Module *M) const { printCollection(*this, O, M, "td."); -#if 0 - for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) - if (!I->isExternal()) { - (*getDSGraph(*I).GlobalsGraph)->writeGraphToFile(O, "gg.program"); - break; - } -#endif } From lattner at cs.uiuc.edu Sat Nov 9 16:08:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 16:08:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp DataStructure.cpp Local.cpp Steensgaard.cpp TopDownClosure.cpp Message-ID: <200211092207.QAA14685@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.39 -> 1.40 DataStructure.cpp updated: 1.60 -> 1.61 Local.cpp updated: 1.36 -> 1.37 Steensgaard.cpp updated: 1.12 -> 1.13 TopDownClosure.cpp updated: 1.28 -> 1.29 --- Log message: eliminate the ability to remove global nodes from deadNodeElminate... for now. This slows stuff down a bit, but it should get much better before it gets any worse. --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.39 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.40 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.39 Sat Nov 9 15:12:06 2002 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Sat Nov 9 16:06:59 2002 @@ -154,7 +154,7 @@ if (Inlined) { Graph->maskIncompleteMarkers(); Graph->markIncompleteNodes(); - Graph->removeDeadNodes(/*KeepAllGlobals*/ true); + Graph->removeDeadNodes(); } } while (Inlined && !FCs.empty()); Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.60 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.61 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.60 Sat Nov 9 15:02:26 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Nov 9 16:06:59 2002 @@ -810,9 +810,9 @@ // other nodes in the graph. These nodes will all be trivially unreachable, so // we don't have to perform any non-trivial analysis here. // -void DSGraph::removeTriviallyDeadNodes(bool KeepAllGlobals) { +void DSGraph::removeTriviallyDeadNodes() { for (unsigned i = 0; i != Nodes.size(); ++i) - if (!KeepAllGlobals || !(Nodes[i]->NodeType & DSNode::GlobalNode)) + if (!(Nodes[i]->NodeType & DSNode::GlobalNode)) if (isNodeDead(Nodes[i])) { // This node is dead! delete Nodes[i]; // Free memory... Nodes.erase(Nodes.begin()+i--); // Remove from node list... @@ -981,9 +981,9 @@ // from the caller's graph entirely. This is only appropriate to use when // inlining graphs. // -void DSGraph::removeDeadNodes(bool KeepAllGlobals) { +void DSGraph::removeDeadNodes() { // Reduce the amount of work we have to do... - removeTriviallyDeadNodes(KeepAllGlobals); + removeTriviallyDeadNodes(); // FIXME: Merge nontrivially identical call nodes... @@ -1012,13 +1012,6 @@ // The return value is alive as well... markAlive(RetNode.getNode(), Alive); - // Mark all globals or cast nodes that can reach a live node as alive. - // This also marks all nodes reachable from such nodes as alive. - // Of course, if KeepAllGlobals is specified, they would be live already. - - if (!KeepAllGlobals) - markGlobalsAlive(*this, Alive, false); - // Loop over all unreachable nodes, dropping their references... vector DeadNodes; DeadNodes.reserve(Nodes.size()); // Only one allocation is allowed. @@ -1126,23 +1119,6 @@ NewNode->NodeType &= ~(DSNode::AllocaNode | DSNode::ScalarNode); return NewNode; -} - - -// GlobalDSGraph::cloneGlobals - Clone global nodes and all their externally -// visible target links (and recursively their such links) into this graph. -// -void GlobalDSGraph::cloneGlobals(DSGraph& Graph, bool CloneCalls) { - std::map NodeCache; -#if 0 - for (unsigned i = 0, N = Graph.Nodes.size(); i < N; ++i) - if (Graph.Nodes[i]->NodeType & DSNode::GlobalNode) - GlobalsGraph->cloneNodeInto(Graph.Nodes[i], NodeCache, false); - if (CloneCalls) - GlobalsGraph->cloneCalls(Graph); - - GlobalsGraph->removeDeadNodes(/*KeepAllGlobals*/ true); -#endif } Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.36 llvm/lib/Analysis/DataStructure/Local.cpp:1.37 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.36 Sat Nov 9 15:12:06 2002 +++ llvm/lib/Analysis/DataStructure/Local.cpp Sat Nov 9 16:06:59 2002 @@ -134,7 +134,7 @@ markIncompleteNodes(); // Remove any nodes made dead due to merging... - removeDeadNodes(true); + removeDeadNodes(); } Index: llvm/lib/Analysis/DataStructure/Steensgaard.cpp diff -u llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.12 llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.13 --- llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.12 Sat Nov 9 15:00:47 2002 +++ llvm/lib/Analysis/DataStructure/Steensgaard.cpp Sat Nov 9 16:06:59 2002 @@ -194,7 +194,7 @@ ResultGraph->markIncompleteNodes(false); // Remove any nodes that are dead after all of the merging we have done... - ResultGraph->removeDeadNodes(true); + ResultGraph->removeDeadNodes(); DEBUG(print(std::cerr, &M)); return false; Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.28 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.29 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.28 Sat Nov 9 15:12:06 2002 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Sat Nov 9 16:06:59 2002 @@ -186,7 +186,7 @@ CG.maskIncompleteMarkers(); CG.markIncompleteNodes(/*markFormals*/ !F.hasInternalLinkage() /*&& FIXME: NEED TO CHECK IF ALL CALLERS FOUND!*/); - CG.removeDeadNodes(/*KeepAllGlobals*/ false); + CG.removeDeadNodes(); } DEBUG(std::cerr << " [TD] Done inlining into callees for: " << F.getName() From lattner at cs.uiuc.edu Sat Nov 9 16:08:10 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 16:08:10 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200211092207.QAA14692@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.36 -> 1.37 --- Log message: eliminate the ability to remove global nodes from deadNodeElminate... for now. This slows stuff down a bit, but it should get much better before it gets any worse. --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.36 llvm/include/llvm/Analysis/DSGraph.h:1.37 --- llvm/include/llvm/Analysis/DSGraph.h:1.36 Sat Nov 9 15:02:30 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Sat Nov 9 16:07:02 2002 @@ -135,7 +135,7 @@ // from the caller's graph entirely. This is only appropriate to use when // inlining graphs. // - void removeDeadNodes(bool KeepAllGlobals); + void removeDeadNodes(); // CloneFlags enum - Bits that may be passed into the cloneInto method to // specify how to clone the function graph. @@ -172,7 +172,7 @@ // merged with other nodes in the graph. This is used as the first step of // removeDeadNodes. // - void removeTriviallyDeadNodes(bool KeepAllGlobals = false); + void removeTriviallyDeadNodes(); }; #endif From lattner at cs.uiuc.edu Sat Nov 9 21:36:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 21:36:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/FunctionResolve/2002-11-09-ExternFn.ll Message-ID: <200211100335.VAA21084@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/FunctionResolve: 2002-11-09-ExternFn.ll added (r1.1) --- Log message: New testcase --- Diffs of the changes: From lattner at cs.uiuc.edu Sat Nov 9 21:38:02 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Nov 9 21:38:02 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp Message-ID: <200211100337.VAA21275@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: FunctionResolution.cpp updated: 1.15 -> 1.16 --- Log message: Fix testcase: FunctionResolve/2002-11-09-ExternFn.ll --- Diffs of the changes: Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.15 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.16 --- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.15 Thu Nov 7 18:38:20 2002 +++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Sat Nov 9 21:36:55 2002 @@ -130,8 +130,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; + cerr << "Parameter types conflict for: '" << OldMT + << "' and '" << ConcreteMT << "'\n"; return Changed; } @@ -231,31 +231,24 @@ return false; // Don't know how to handle this, bail out! } - // Ignore globals that are never used so they don't cause spurious - // warnings... here we will actually DCE the function so that it isn't used - // later. - // - if (Globals[i]->isExternal() && Globals[i]->use_empty()) { - if (isFunction) { - M.getFunctionList().erase(cast(Globals[i])); - ++NumResolved; - } else { - M.getGlobalList().erase(cast(Globals[i])); - ++NumGlobals; - } - - Globals.erase(Globals.begin()+i); - Changed = true; - } else if (isFunction) { + if (isFunction) { // For functions, we look to merge functions definitions of "int (...)" // to 'int (int)' or 'int ()' or whatever else is not completely generic. // Function *F = cast(Globals[i]); if (!F->isExternal()) { - if (Concrete) + if (Concrete && !Concrete->isExternal()) return false; // Found two different functions types. Can't choose! Concrete = Globals[i]; + } else if (Concrete) { + if (Concrete->isExternal()) // If we have multiple external symbols...x + if (F->getFunctionType()->getNumParams() > + cast(Concrete)->getFunctionType()->getNumParams()) + Concrete = F; // We are more concrete than "Concrete"! + + } else { + Concrete = F; } ++i; } else { @@ -341,6 +334,31 @@ 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 + // dead. If so, remove them now. + + for (Module::iterator I = M.begin(), E = M.end(); I != E; ) + if (I->isExternal() && I->use_empty()) { + Function *F = I; + ++I; + M.getFunctionList().erase(F); + ++NumResolved; + Changed = true; + } else { + ++I; + } + + for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ) + if (I->isExternal() && I->use_empty()) { + GlobalVariable *GV = I; + ++I; + M.getGlobalList().erase(GV); + ++NumGlobals; + Changed = true; + } else { + ++I; + } return Changed; } From lattner at cs.uiuc.edu Sun Nov 10 00:42:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 00:42:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/DSAnalysis/recursion.ll Message-ID: <200211100641.AAA10380@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/DSAnalysis: recursion.ll added (r1.1) --- Log message: Add new test that causes infinite recursion in bu pass --- Diffs of the changes: From lattner at cs.uiuc.edu Sun Nov 10 00:42:07 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 00:42:07 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/DSAnalysis/Makefile Message-ID: <200211100641.AAA10391@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/DSAnalysis: Makefile updated: 1.3 -> 1.4 --- Log message: Run local, bu, & td analyses --- Diffs of the changes: Index: llvm/test/Regression/Transforms/DSAnalysis/Makefile diff -u llvm/test/Regression/Transforms/DSAnalysis/Makefile:1.3 llvm/test/Regression/Transforms/DSAnalysis/Makefile:1.4 --- llvm/test/Regression/Transforms/DSAnalysis/Makefile:1.3 Sun Nov 3 18:33:19 2002 +++ llvm/test/Regression/Transforms/DSAnalysis/Makefile Sun Nov 10 00:41:19 2002 @@ -17,7 +17,7 @@ all:: $(addprefix Output/, $(TESTS:%.ll=%.out)) Output/%.out: %.ll $(LANALYZE) Output/.dir - (cd Output/; $(LANALYZE_ABS) -datastructure ../$< || \ + (cd Output/; $(LANALYZE_ABS) -tddatastructure ../$< || \ ( rm -f ../$@; ../$(FAILURE) ../$@ )) all:: $(addprefix Output/, $(FTESTS:%.llx=%.llx.out)) From lattner at cs.uiuc.edu Sun Nov 10 00:48:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 00:48:01 2002 Subject: [llvm-commits] CVS: llvm/include/Support/GraphWriter.h Message-ID: <200211100647.AAA10439@apoc.cs.uiuc.edu> Changes in directory llvm/include/Support: GraphWriter.h updated: 1.11 -> 1.12 --- Log message: Fix a problem where bad graphs could be generated --- Diffs of the changes: Index: llvm/include/Support/GraphWriter.h diff -u llvm/include/Support/GraphWriter.h:1.11 llvm/include/Support/GraphWriter.h:1.12 --- llvm/include/Support/GraphWriter.h:1.11 Sun Oct 27 13:12:37 2002 +++ llvm/include/Support/GraphWriter.h Sun Nov 10 00:47:03 2002 @@ -126,7 +126,6 @@ // Figure out which edge this targets... unsigned Offset = std::distance(GTraits::child_begin(TargetNode), TargetIt); - if (Offset > 64) Offset = 64; // Targetting the truncated part? DestPort = (int)Offset; } @@ -160,6 +159,9 @@ void emitEdge(const void *SrcNodeID, int SrcNodePort, const void *DestNodeID, int DestNodePort, const std::string &Attrs) { + if (SrcNodePort > 64) return; // Eminating from truncated part? + if (DestNodePort > 64) DestNodePort = 64; // Targetting the truncated part? + O << "\tNode" << SrcNodeID; if (SrcNodePort >= 0) O << ":g" << SrcNodePort; From lattner at cs.uiuc.edu Sun Nov 10 00:48:07 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 00:48:07 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200211100647.AAA10450@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.37 -> 1.38 --- Log message: Add capability to set a preference of what call vector is printed to dot files --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.37 llvm/include/llvm/Analysis/DSGraph.h:1.38 --- llvm/include/llvm/Analysis/DSGraph.h:1.37 Sat Nov 9 16:07:02 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Sun Nov 10 00:47:35 2002 @@ -15,6 +15,7 @@ class DSGraph { Function *Func; // Func - The LLVM function this graph corresponds to DSGraph *GlobalsGraph; // Pointer to the common graph of global objects + bool PrintAuxCalls; // Should this graph print the Aux calls vector? DSNodeHandle RetNode; // The node that gets returned... std::vector Nodes; @@ -57,6 +58,12 @@ DSGraph *getGlobalsGraph() const { return GlobalsGraph; } void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; } + // setPrintAuxCalls - If you call this method, the auxillary call vector will + // be printed instead of the standard call vector to the dot file. + // + void setPrintAuxCalls() { PrintAuxCalls = true; } + bool shouldPrintAuxCalls() const { return PrintAuxCalls; } + /// getNodes - Get a vector of all the nodes in the graph /// const std::vector &getNodes() const { return Nodes; } @@ -85,6 +92,9 @@ std::vector &getAuxFunctionCalls() { return AuxFunctionCalls; } + const std::vector &getAuxFunctionCalls() const { + return AuxFunctionCalls; + } /// getNodeForValue - Given a value that is used or defined in the body of the /// current function, return the DSNode that it points to. @@ -167,6 +177,7 @@ private: bool isNodeDead(DSNode *N); +public: // removeTriviallyDeadNodes - After the graph has been constructed, this // method removes all unreachable nodes that are created because they got // merged with other nodes in the graph. This is used as the first step of From lattner at cs.uiuc.edu Sun Nov 10 00:49:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 00:49:00 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSNode.h Message-ID: <200211100648.AAA10467@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSNode.h updated: 1.13 -> 1.14 --- Log message: Implement swapping --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSNode.h diff -u llvm/include/llvm/Analysis/DSNode.h:1.13 llvm/include/llvm/Analysis/DSNode.h:1.14 --- llvm/include/llvm/Analysis/DSNode.h:1.13 Fri Nov 8 18:48:52 2002 +++ llvm/include/llvm/Analysis/DSNode.h Sun Nov 10 00:48:24 2002 @@ -271,4 +271,19 @@ *this = Node; } +inline void DSNodeHandle::swap(DSNodeHandle &NH) { + std::swap(Offset, NH.Offset); + if (N != NH.N) { + if (N) { + N->removeReferrer(this); + N->addReferrer(&NH); + } + if (NH.N) { + N->removeReferrer(&NH); + N->addReferrer(this); + } + std::swap(N, NH.N); + } +} + #endif From lattner at cs.uiuc.edu Sun Nov 10 00:49:06 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 00:49:06 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSSupport.h Message-ID: <200211100648.AAA10474@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSSupport.h updated: 1.5 -> 1.6 --- Log message: Implement support for swapping. Callsites now sort by callee --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSSupport.h diff -u llvm/include/llvm/Analysis/DSSupport.h:1.5 llvm/include/llvm/Analysis/DSSupport.h:1.6 --- llvm/include/llvm/Analysis/DSSupport.h:1.5 Wed Nov 6 23:21:15 2002 +++ llvm/include/llvm/Analysis/DSSupport.h Sun Nov 10 00:48:11 2002 @@ -68,6 +68,8 @@ } bool operator!=(const DSNodeHandle &H) const { return !operator==(H); } + inline void swap(DSNodeHandle &H); + // Allow explicit conversion to DSNode... DSNode *getNode() const { return N; } unsigned getOffset() const { return Offset; } @@ -95,6 +97,7 @@ inline void setLink(unsigned Num, const DSNodeHandle &NH); }; +inline void swap(DSNodeHandle &NH1, DSNodeHandle &NH2) { NH1.swap(NH2); } //===----------------------------------------------------------------------===// /// DSTypeRec - This structure is used to represent a single type that is held @@ -205,11 +208,21 @@ return CallArgs[i]; } + void swap(DSCallSite &CS) { + if (this != &CS) { + std::swap(Inst, CS.Inst); + std::swap(RetVal, CS.RetVal); + std::swap(Callee, CS.Callee); + std::swap(CallArgs, CS.CallArgs); + std::swap(ResolvingCaller, CS.ResolvingCaller); + } + } + bool operator<(const DSCallSite &CS) const { + if (Callee < CS.Callee) return true; // This must sort by callee first! + if (Callee > CS.Callee) return false; if (RetVal < CS.RetVal) return true; if (RetVal > CS.RetVal) return false; - if (Callee < CS.Callee) return true; - if (Callee > CS.Callee) return false; return CallArgs < CS.CallArgs; } @@ -219,5 +232,6 @@ } }; +inline void swap(DSCallSite &CS1, DSCallSite &CS2) { CS1.swap(CS2); } #endif From lattner at cs.uiuc.edu Sun Nov 10 00:53:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 00:53:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Message-ID: <200211100652.AAA10516@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.40 -> 1.41 --- Log message: * Bottom-Up graphs print the Aux call vector * Significantly improve DEBUG output * Aggressively fold calls together if we inlined a graph that provides call nodes. * Add a bailout if the current graph has over 200 call nodes in it, this is a really whacky case that should never happen. --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.40 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.41 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.40 Sat Nov 9 16:06:59 2002 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Sun Nov 10 00:52:47 2002 @@ -27,7 +27,7 @@ // Simply calculate the graphs for each function... for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) if (!I->isExternal()) - calculateGraph(*I); + calculateGraph(*I, 0); return false; } @@ -46,7 +46,7 @@ GlobalsGraph = 0; } -DSGraph &BUDataStructures::calculateGraph(Function &F) { +DSGraph &BUDataStructures::calculateGraph(Function &F, unsigned Indent) { // Make sure this graph has not already been calculated, or that we don't get // into an infinite loop with mutually recursive functions. // @@ -56,11 +56,7 @@ // Copy the local version into DSInfo... Graph = new DSGraph(getAnalysis().getDSGraph(F)); Graph->setGlobalsGraph(GlobalsGraph); - -#if 0 - // Populate the GlobalsGraph with globals from this one. - Graph->GlobalsGraph->cloneGlobals(*Graph, /*cloneCalls*/ false); -#endif + Graph->setPrintAuxCalls(); // Start resolving calls... std::vector &FCs = Graph->getAuxFunctionCalls(); @@ -68,7 +64,8 @@ // Start with a copy of the original call sites... FCs = Graph->getFunctionCalls(); - DEBUG(std::cerr << " [BU] Inlining: " << F.getName() << "\n"); + DEBUG(std::cerr << std::string(Indent*4, ' ') + << "[BU] Calculating graph for: " << F.getName() << "\n"); bool Inlined; do { @@ -86,6 +83,8 @@ std::vector Callees = Call.getCallee().getNode()->getGlobals(); + unsigned OldNumCalls = FCs.size(); + // Loop over the functions, inlining whatever we can... for (unsigned c = 0; c != Callees.size(); ++c) { // Must be a function type, so this cast MUST succeed. @@ -94,7 +93,8 @@ if (&FI == &F) { // Self recursion... simply link up the formal arguments with the // actual arguments... - DEBUG(std::cerr << "\t[BU] Self Inlining: " << F.getName() << "\n"); + DEBUG(std::cerr << std::string(Indent*4, ' ') + << " [BU] Self Inlining: " << F.getName() << "\n"); // Handle self recursion by resolving the arguments and return value Graph->mergeInGraph(Call, *Graph, DSGraph::StripAllocaBit); @@ -103,17 +103,20 @@ Callees.erase(Callees.begin()+c--); } else if (!FI.isExternal()) { - DEBUG(std::cerr << "\t[BU] In " << F.getName() << " inlining: " + DEBUG(std::cerr << std::string(Indent*4, ' ') + << " [BU] In " << F.getName() << " inlining: " << FI.getName() << "\n"); // Get the data structure graph for the called function, closing it // if possible (which is only impossible in the case of mutual // recursion... // - DSGraph &GI = calculateGraph(FI); // Graph to inline + DSGraph &GI = calculateGraph(FI, Indent+1); // Graph to inline - DEBUG(std::cerr << "\t\t[BU] Got graph for " << FI.getName() - << " in: " << F.getName() << "\n"); + DEBUG(std::cerr << std::string(Indent*4, ' ') + << " [BU] Got graph for " << FI.getName() + << " in: " << F.getName() << "[" << GI.getGraphSize() << "+" + << GI.getAuxFunctionCalls().size() << "]\n"); // Handle self recursion by resolving the arguments and return value Graph->mergeInGraph(Call, GI, DSGraph::StripAllocaBit | @@ -124,7 +127,7 @@ } else if (FI.getName() == "printf" || FI.getName() == "sscanf" || FI.getName() == "fprintf" || FI.getName() == "open" || - FI.getName() == "sprintf") { + FI.getName() == "sprintf" || FI.getName() == "fputs") { // FIXME: These special cases (eg printf) should go away when we can // define functions that take a variable number of arguments. @@ -146,7 +149,26 @@ assert(0 && "Unimpl!"); Inlined = true; } + + // If we just inlined a function that had call nodes, chances are that + // the call nodes are redundant with ones we already have. Eliminate + // those call nodes now. + // + if (FCs.size() > OldNumCalls) + Graph->removeTriviallyDeadNodes(); } + + if (FCs.size() > 200) { + std::cerr << "Aborted inlining fn: '" << F.getName() << "'!" + << std::endl; + Graph->maskIncompleteMarkers(); + Graph->markIncompleteNodes(); + Graph->removeDeadNodes(); + Graph->writeGraphToFile(std::cerr, "crap."+F.getName()); + exit(1); + return *Graph; + } + } // Recompute the Incomplete markers. If there are any function calls left @@ -156,11 +178,15 @@ Graph->markIncompleteNodes(); Graph->removeDeadNodes(); } + } while (Inlined && !FCs.empty()); - DEBUG(std::cerr << " [BU] Done inlining: " << F.getName() << " [" - << Graph->getGraphSize() << "+" << Graph->getFunctionCalls().size() + DEBUG(std::cerr << std::string(Indent*4, ' ') + << "[BU] Done inlining: " << F.getName() << " [" + << Graph->getGraphSize() << "+" << Graph->getAuxFunctionCalls().size() << "]\n"); + + //Graph->writeGraphToFile(std::cerr, "bu_" + F.getName()); return *Graph; } From lattner at cs.uiuc.edu Sun Nov 10 00:54:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 00:54:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure.h Message-ID: <200211100653.AAA10525@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DataStructure.h updated: 1.55 -> 1.56 --- Log message: Add hasGraph() methods to all of the passes for the printer --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure.h:1.55 llvm/include/llvm/Analysis/DataStructure.h:1.56 --- llvm/include/llvm/Analysis/DataStructure.h:1.55 Sat Nov 9 15:12:07 2002 +++ llvm/include/llvm/Analysis/DataStructure.h Sun Nov 10 00:53:19 2002 @@ -39,6 +39,10 @@ virtual bool run(Module &M); + bool hasGraph(const Function &F) const { + return DSInfo.find(&F) != DSInfo.end(); + } + // getDSGraph - Return the data structure graph for the specified function. DSGraph &getDSGraph(const Function &F) const { std::map::const_iterator I = DSInfo.find(&F); @@ -74,6 +78,10 @@ virtual bool run(Module &M); + bool hasGraph(const Function &F) const { + return DSInfo.find(&F) != DSInfo.end(); + } + // getDSGraph - Return the data structure graph for the specified function. DSGraph &getDSGraph(const Function &F) const { std::map::const_iterator I = DSInfo.find(&F); @@ -94,7 +102,7 @@ AU.addRequired(); } private: - DSGraph &calculateGraph(Function &F); + DSGraph &calculateGraph(Function &F, unsigned Indent); }; @@ -111,6 +119,10 @@ ~TDDataStructures() { releaseMemory(); } virtual bool run(Module &M); + + bool hasGraph(const Function &F) const { + return DSInfo.find(&F) != DSInfo.end(); + } // getDSGraph - Return the data structure graph for the specified function. DSGraph &getDSGraph(const Function &F) const { From lattner at cs.uiuc.edu Sun Nov 10 00:54:07 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 00:54:07 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp Message-ID: <200211100653.AAA10536@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Local.cpp updated: 1.37 -> 1.38 --- Log message: Initialize PrintAuxCalls member --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.37 llvm/lib/Analysis/DataStructure/Local.cpp:1.38 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.37 Sat Nov 9 16:06:59 2002 +++ llvm/lib/Analysis/DataStructure/Local.cpp Sun Nov 10 00:53:38 2002 @@ -129,6 +129,7 @@ // DSGraph constructor - Simply use the GraphBuilder to construct the local // graph. DSGraph::DSGraph(Function &F, DSGraph *GG) : Func(&F), GlobalsGraph(GG) { + PrintAuxCalls = false; // Use the graph builder to construct the local version of the graph GraphBuilder B(*this, Nodes, RetNode, ScalarMap, FunctionCalls); markIncompleteNodes(); From lattner at cs.uiuc.edu Sun Nov 10 00:55:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 00:55:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp Message-ID: <200211100654.AAA10547@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Printer.cpp updated: 1.39 -> 1.40 --- Log message: Honor the shouldPrintAuxCalls flag --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.39 llvm/lib/Analysis/DataStructure/Printer.cpp:1.40 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.39 Sat Nov 9 15:41:44 2002 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Sun Nov 10 00:53:59 2002 @@ -112,7 +112,9 @@ } // Output all of the call nodes... - const std::vector &FCs = G->getFunctionCalls(); + const std::vector &FCs = + G->shouldPrintAuxCalls() ? G->getAuxFunctionCalls() + : G->getFunctionCalls(); for (unsigned i = 0, e = FCs.size(); i != e; ++i) { const DSCallSite &Call = FCs[i]; GW.emitSimpleNode(&Call, "shape=record", "call", Call.getNumPtrArgs()+2); @@ -169,15 +171,18 @@ unsigned TotalNumNodes = 0, TotalCallNodes = 0; for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) - if (!I->isExternal()) { + if (C.hasGraph(*I)) { DSGraph &Gr = C.getDSGraph((Function&)*I); TotalNumNodes += Gr.getGraphSize(); - TotalCallNodes += Gr.getFunctionCalls().size(); + unsigned NumCalls = Gr.shouldPrintAuxCalls() ? + Gr.getAuxFunctionCalls().size() : Gr.getFunctionCalls().size(); + + TotalCallNodes += NumCalls; if (I->getName() == "main" || !OnlyPrintMain) Gr.writeGraphToFile(O, Prefix+I->getName()); else { O << "Skipped Writing '" << Prefix+I->getName() << ".dot'... [" - << Gr.getGraphSize() << "+" << Gr.getFunctionCalls().size() << "]\n"; + << Gr.getGraphSize() << "+" << NumCalls << "]\n"; } } From lattner at cs.uiuc.edu Sun Nov 10 00:55:07 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 00:55:07 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/generate_report.pl Message-ID: <200211100654.AAA10564@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: generate_report.pl updated: 1.6 -> 1.7 --- Log message: Fix regular expressions that were WRONG :( --- Diffs of the changes: Index: llvm/test/DSGraphs/generate_report.pl diff -u llvm/test/DSGraphs/generate_report.pl:1.6 llvm/test/DSGraphs/generate_report.pl:1.7 --- llvm/test/DSGraphs/generate_report.pl:1.6 Fri Nov 8 14:48:05 2002 +++ llvm/test/DSGraphs/generate_report.pl Sun Nov 10 00:54:35 2002 @@ -76,8 +76,8 @@ print "| "; printField("([0-9]+).*completely folded", $Record, -5); printField("Graphs contain \\[([0-9+]+)\\] nodes total", $Record, -10); - printField("\.main\.dot.... \\[([0-9+]+)\\]", $Record, -6); - printField("\.__main\.dot.... \\[([0-9+]+)\\]", $Record, -6); + printField("\\.main\\.dot'... \\[([0-9+]+)\\]", $Record, -6); + printField("\\.__main\\.dot'... \\[([0-9+]+)\\]", $Record, -6); } print "\n"; #print "#####\n"; From lattner at cs.uiuc.edu Sun Nov 10 00:55:13 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 00:55:13 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/dummylib.c Message-ID: <200211100655.AAA10571@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: dummylib.c updated: 1.2 -> 1.3 --- Log message: Add a bunch of functions for gap --- Diffs of the changes: Index: llvm/test/DSGraphs/dummylib.c diff -u llvm/test/DSGraphs/dummylib.c:1.2 llvm/test/DSGraphs/dummylib.c:1.3 --- llvm/test/DSGraphs/dummylib.c:1.2 Fri Nov 8 14:47:52 2002 +++ llvm/test/DSGraphs/dummylib.c Sun Nov 10 00:54:20 2002 @@ -27,7 +27,10 @@ int fseek(FILE *stream, long offset, int whence) { return 0; } int fputs(const char *s, FILE *stream) { return 0; } void rewind(FILE*F) { } - +int fileno(FILE *stream) { return 1; } +char *ttyname(int desc) { return 0; } +long sysconf(int name) { return 0; } +char *tmpnam(char *s) { return s; } void *calloc(size_t A, size_t B) { return malloc(A*B); } void *realloc(void *ptr, size_t N) { return ptr; } @@ -39,6 +42,27 @@ ssize_t read(int fildes, void *buf, size_t nbyte) { return nbyte; } int close(int FD) { return 0; } int rename(const char *oldpath, const char *newpath) { return 0; } +ssize_t write(int fd, const void *buf, size_t count) { return 0; } +pid_t getpid(void) { return 0; } +pid_t getppid(void) { return 0; } +void setbuf(FILE *stream, char *buf) {} +int isatty(int desc) { return 0; } + + +#include +clock_t times(struct tms *buf) { return 0; } + + +#include +int setjmp(jmp_buf env) { return 0; } +void longjmp(jmp_buf env, int val) {} +int kill(pid_t pid, int sig) { return 0; } +int system(const char *string) { return 0; } +char *getenv(const char *name) { return 0; } +typedef void (*sighandler_t)(int); + +sighandler_t signal(int signum, sighandler_t handler) { return handler; } + @@ -47,6 +71,8 @@ int strncmp(const char *s1, const char *s2, size_t n) { return 0; } char *strncpy(char *s1, const char *s2, size_t n) { return s1; } char *strpbrk(const char *s, const char *accept) { return (char*)s; } +char *strncat(char *dest, const char *src, size_t n) { return dest; } + long clock() { return 0; } char *ctime(const time_t *timep) { return 0; } From lattner at cs.uiuc.edu Sun Nov 10 00:56:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 00:56:00 2002 Subject: [llvm-commits] CVS: llvm/www/docs/DSGraphStatus.html Message-ID: <200211100655.AAA23582@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: DSGraphStatus.html updated: 1.8 -> 1.9 --- Log message: Add more numbers --- Diffs of the changes: Index: llvm/www/docs/DSGraphStatus.html diff -u llvm/www/docs/DSGraphStatus.html:1.8 llvm/www/docs/DSGraphStatus.html:1.9 --- llvm/www/docs/DSGraphStatus.html:1.8 Sat Nov 9 13:15:58 2002 +++ llvm/www/docs/DSGraphStatus.html Sun Nov 10 00:55:29 2002 @@ -13,6 +13,59 @@ previous value.


+

Nov 9, 2002:

+ +Same as the
previous run, but now with a small tweak: +constants are never put into the scalar map for a function. This is in +preparation for the global graph work, but it does speed analysis up +marginally:

+ +

+Name:                     Anlyz: LocTime: BUTime:  TDTime:  TotTime:      LocSize: BUSize:  TDSize:    TotSize:     NumFold  NumNodes   main   __main
+254.gap.lib                 2.16 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
+255.vortex.lib              1.11 *        *        *        *        |    *        *        *          *          |    *     *          *      *      
+300.twolf.lib              11.63 0.2468   0.7464   7.5333   9.2461   |    595576   795896   10397040   11788512   |    3577  161901+1222 854+0  854+0  
+197.parser.lib             10.97 0.1258   0.4903   8.6508   9.5864   |    464920   621904   12987664   14309904   |    2643  197546+1185 601+0  601+0  
+burg.llvm.lib               5.18 0.0904   0.2948   3.7480   4.3338   |    576064   893240   4821880    6356592    |    1557  72659+919  436+0  436+0  
+164.gzip.llvm.lib           1.28 0.0355   0.1037   0.5037   0.7448   |    228456   511192   1971048    2809016    |    70    16642+233  171+0  171+0  
+256.bzip2.lib               0.69 0.0201   0.0535   0.3301   0.4626   |    163016   284360   1450312    1970944    |    20    11464+202  148+0  148+0  
+optimizer-eval.llvm.lib     0.57 0.0195   0.0846   0.3000   0.4423   |    86832    180296   702840     988152     |    *     3693+101   63+0   63+0   
+sim.llvm.lib                0.26 0.0137   0.0195   0.0619   0.1439   |    92280    106632   330888     602464     |    *     2738+67    99+0   99+0   
+181.mcf.lib                 0.23 0.0164   0.0294   0.0572   0.1265   |    133872   128088   229576     508384     |    180   1923+73    44+0   44+0   
+voronoi.llvm.lib            0.19 0.0119   0.0245   0.0606   0.1138   |    83592    93192    211920     402648     |    17    1734+106   30+0   30+0   
+sgefa.llvm.lib              0.17 0.0071   0.0333   0.0406   0.0994   |    88880    102320   133176     349144     |    *     634+55     31+0   31+0   
+bh.llvm.lib                 0.15 0.0102   0.0154   0.0239   0.0697   |    77528    80672    110160     316400     |    66    716+64     13+0   13+0   
+em3d.llvm.lib               0.09 0.0045   0.0105   0.0229   0.0477   |    37816    55256    123168     232944     |    8     1032+59    28+0   28+0   
+mst.llvm.lib                0.07 0.0033   0.0056   0.0115   0.0310   |    30744    21600    62072      129088     |    10    471+36     21+0   21+0   
+health.llvm.lib             0.07 0.0042   0.0080   0.0105   0.0313   |    31520    31784    45624      123896     |    71    362+40     14+0   14+0   
+tsp.llvm.lib                0.06 0.0046   0.0047   0.0060   0.0240   |    19552    26040    25800      85696      |    19    248+31     10+0   10+0   
+power.llvm.lib              0.06 0.0034   0.0050   0.0086   0.0254   |    30904    31232    29704      99512      |    *     277+35     9+0    9+0    
+perimeter.llvm.lib          0.05 0.0025   0.0044   0.0037   0.0195   |    15760    24296    8552       61448      |    *     106+24     4+0    4+0    
+lists.llvm.lib              0.05 0.0037   0.0075   0.0105   0.0283   |    25912    29360    28352      101472     |    50    252+34     10+0   10+0   
+hash.llvm.lib               0.05 0.0025   0.0040   0.0059   0.0194   |    18464    25408    24192      81464      |    *     242+23     7+0    7+0    
+llubenchmark.llvm.lib       0.04 0.0017   0.0022   0.0038   0.0198   |    12040    13368    17600      54016      |    *     145+20     15+0   15+0   
+bisort.llvm.lib             0.04 0.0024   0.0035   0.0051   0.0176   |    14648    28160    22256      76136      |    *     211+27     10+0   10+0   
+treeadd.llvm.lib            0.03 0.0011   0.0015   0.0020   0.0090   |    9320     8552     10120      44152      |    *     77+14      5+0    5+0    
+sieve.llvm.lib              0.03 0.0006   0.0006   0.0008   0.0063   |    8032     1720     2552       22672      |    *     31+4       2+0    2+0    
+objinst.llvm.lib            0.03 0.0015   0.0021   0.0036   0.0129   |    11272    19896    6096       50920      |    33    74+17      3+0    3+0    
+methcall.llvm.lib           0.03 0.0014   0.0018   0.0028   0.0111   |    10936    15720    5152       45064      |    26    59+14      2+0    2+0    
+matrix.llvm.lib             0.03 0.0014   0.0023   0.0025   0.0118   |    8984     8096     4352       37776      |    *     47+11      1+0    1+0    
+ary3.llvm.lib               0.03 0.0010   0.0014   0.0014   0.0084   |    8992     8624     4344       37624      |    6     52+7       1+0    1+0    
+sumarraymalloc.llvm.lib     0.02 0.0007   0.0009   0.0012   0.0069   |    2936     6984     7216       31496      |    *     39+8       2+0    2+0    
+random.llvm.lib             0.02 0.0006   0.0006   0.0008   0.0057   |    2336     6000     2856       26944      |    *     32+5       3+0    3+0    
+pi.llvm.lib                 0.02 0.0006   0.0006   0.0013   0.0047   |    5816     7240     6688       19744      |    *     34+6       3+0    3+0    
+heapsort.llvm.lib           0.02 0.0007   0.0009   0.0012   0.0070   |    3128     7336     4008       29640      |    *     46+6       3+0    3+0    
+fib2.llvm.lib               0.02 0.0007   0.0008   0.0008   0.0056   |    5704     1928     2520       22440      |    *     26+6       1+0    1+0    
+sumarray.llvm.lib           0.01 0.0003   0.0002   0.0003   0.0022   |    960      3176     608        6856       |    *     7+2        0+0    0+0    
+sumarray2d.llvm.lib         0.01 0.0003   0.0003   0.0004   0.0028   |    1736     6056     1064       11176      |    *     15+3       1+0    1+0    
+printargs.llvm.lib          0.01 0.0003   0.0004   0.0005   0.0026   |    1464     848      3512       5824       |    *     13+4       1+0    1+0    
+matrixTranspose.llvm.lib    0.01 0.0004   0.0004   0.0005   0.0030   |    4384     1248     3824       9456       |    *     17+4       3+0    3+0    
+indvars.llvm.lib            0.01 0.0004   0.0005   0.0005   0.0033   |    4800     7440     1224       13464      |    *     18+3       1+0    1+0    
+hello.llvm.lib              0.01 0.0003   0.0003   0.0003   0.0021   |    976      3024     2968       9224       |    *     8+3        1+0    1+0    
+ackermann.llvm.lib          0.00 0.0000   0.0000   0.0001   0.0004   |    72       0        832        904        |    *     0+0        *      *      
+

+ +


Nov 8, 2002 #3:

Same as the
previous run, but now we automatically @@ -353,7 +406,7 @@
Chris Lattner
-Last modified: Sat Nov 9 13:12:36 CST 2002 +Last modified: Sat Nov 9 14:13:12 CST 2002 From lattner at cs.uiuc.edu Sun Nov 10 00:56:07 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 00:56:07 2002 Subject: [llvm-commits] CVS: llvm/tools/analyze/analyze.cpp Message-ID: <200211100655.AAA10601@apoc.cs.uiuc.edu> Changes in directory llvm/tools/analyze: analyze.cpp updated: 1.47 -> 1.48 --- Log message: Add a timer to evaluate bytecode load time and space requirements --- Diffs of the changes: Index: llvm/tools/analyze/analyze.cpp diff -u llvm/tools/analyze/analyze.cpp:1.47 llvm/tools/analyze/analyze.cpp:1.48 --- llvm/tools/analyze/analyze.cpp:1.47 Wed Nov 6 00:16:08 2002 +++ llvm/tools/analyze/analyze.cpp Sun Nov 10 00:55:02 2002 @@ -16,6 +16,7 @@ #include "llvm/Assembly/Parser.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Support/PassNameParser.h" +#include "Support/Timer.h" #include @@ -101,11 +102,14 @@ AnalysesList(cl::desc("Analyses available:")); +static Timer BytecodeLoadTimer("Bytecode Loader"); + int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, " llvm analysis printer tool\n"); Module *CurMod = 0; try { + TimeRegion RegionTimer(BytecodeLoadTimer); CurMod = ParseBytecodeFile(InputFilename); if (!CurMod && !(CurMod = ParseAssemblyFile(InputFilename))){ std::cerr << argv[0] << ": input file didn't read correctly.\n"; From lattner at cs.uiuc.edu Sun Nov 10 01:01:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 01:01:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200211100700.BAA10902@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.61 -> 1.62 --- Log message: * Dramatically rework liveness evaluation. * Implement the first step of the Globals graph: Deleting nodes from function graphs. In practice, these nodes need to be moved to the globals graph, but this will be taken care of later. Note that the graphs computed right now are not strictly correct! --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.61 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.62 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.61 Sat Nov 9 16:06:59 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sun Nov 10 00:59:55 2002 @@ -502,6 +502,7 @@ //===----------------------------------------------------------------------===// DSGraph::DSGraph(const DSGraph &G) : Func(G.Func), GlobalsGraph(0) { + PrintAuxCalls = false; std::map NodeMap; RetNode = cloneInto(G, ScalarMap, NodeMap); } @@ -509,6 +510,7 @@ DSGraph::DSGraph(const DSGraph &G, std::map &NodeMap) : Func(G.Func), GlobalsGraph(0) { + PrintAuxCalls = false; RetNode = cloneInto(G, ScalarMap, NodeMap); } @@ -738,7 +740,7 @@ // Then the return value is certainly incomplete! markIncompleteNode(Call.getRetVal().getNode()); - // All objects pointed to by function arguments are incomplete though! + // All objects pointed to by function arguments are incomplete! for (unsigned i = 0, e = Call.getNumPtrArgs(); i != e; ++i) markIncompleteNode(Call.getPtrArg(i).getNode()); } @@ -747,7 +749,6 @@ for (unsigned i = 0, e = Nodes.size(); i != e; ++i) if (Nodes[i]->NodeType & DSNode::GlobalNode) { DSNode *N = Nodes[i]; - // FIXME: Make more efficient by looking over Links directly for (unsigned i = 0, e = N->getSize(); i < e; i += DS::PointerSize) if (DSNode *DSN = N->getLink(i).getNode()) markIncompleteNode(DSN); @@ -771,21 +772,23 @@ // dead. // bool DSGraph::isNodeDead(DSNode *N) { - // Is it a trivially dead shadow node... - if (N->getReferrers().empty() && (N->NodeType & ~DSNode::DEAD) == 0) - return true; - - // Is it a function node or some other trivially unused global? - if ((N->NodeType & ~DSNode::GlobalNode) == 0 && N->getSize() == 0 && - N->getReferrers().size() == N->getGlobals().size()) { - - // Remove the globals from the ScalarMap, so that the referrer count will go - // down to zero. - removeRefsToGlobal(N, ScalarMap); - assert(N->getReferrers().empty() && "Referrers should all be gone now!"); - return true; - } + // Is it a trivially dead shadow node? + return N->getReferrers().empty() && (N->NodeType & ~DSNode::DEAD) == 0 +} +static inline void killIfUselessEdge(DSNodeHandle &Edge) { + if (DSNode *N = Edge.getNode()) // Is there an edge? + if (N->getReferrers().size() == 1) // Does it point to a lonely node? + if ((N->NodeType & ~DSNode::Incomplete) == 0 && // No interesting info? + N->getType().Ty == Type::VoidTy && !N->isNodeCompletelyFolded()) + Edge.setNode(0); // Kill the edge! +} + +static inline bool nodeContainsExternalFunction(const DSNode *N) { + const std::vector &Globals = N->getGlobals(); + for (unsigned i = 0, e = Globals.size(); i != e; ++i) + if (Globals[i]->isExternal()) + return true; return false; } @@ -793,7 +796,51 @@ const std::string &where) { // Remove trivially identical function calls unsigned NumFns = Calls.size(); - std::sort(Calls.begin(), Calls.end()); + std::sort(Calls.begin(), Calls.end()); // Sort by callee as primary key! + + // Scan the call list cleaning it up as necessary... + DSNode *LastCalleeNode = 0; + unsigned NumDuplicateCalls = 0; + bool LastCalleeContainsExternalFunction = false; + for (unsigned i = 0, e = Calls.size(); i != e; ++i) { + DSCallSite &CS = Calls[i]; + + // If the return value or any arguments point to a void node with no + // information at all in it, and the call node is the only node to point + // to it, remove the edge to the node (killing the node). + // + killIfUselessEdge(CS.getRetVal()); + for (unsigned a = 0, e = CS.getNumPtrArgs(); a != e; ++a) + killIfUselessEdge(CS.getPtrArg(a)); + + // If this call site calls the same function as the last call site, and if + // the function pointer contains an external function, this node will never + // be resolved. Merge the arguments of the call node because no information + // will be lost. + // + if (CS.getCallee().getNode() == LastCalleeNode) { + ++NumDuplicateCalls; + if (NumDuplicateCalls == 1) { + LastCalleeContainsExternalFunction = + nodeContainsExternalFunction(LastCalleeNode); + } + + if (LastCalleeContainsExternalFunction || + // This should be more than enough context sensitivity! + // FIXME: Evaluate how many times this is tripped! + NumDuplicateCalls > 20) { + DSCallSite &OCS = Calls[i-1]; + OCS.getRetVal().mergeWith(CS.getRetVal()); + for (unsigned a = 0, e = CS.getNumPtrArgs(); a != e; ++a) + OCS.getPtrArg(a).mergeWith(CS.getPtrArg(a)); + // The node will now be eliminated as a duplicate! + } + } else { + LastCalleeNode = CS.getCallee().getNode(); + NumDuplicateCalls = 0; + } + } + Calls.erase(std::unique(Calls.begin(), Calls.end()), Calls.end()); @@ -805,20 +852,21 @@ << " call nodes in " << where << "\n";); } + // removeTriviallyDeadNodes - After the graph has been constructed, this method // removes all unreachable nodes that are created because they got merged with // other nodes in the graph. These nodes will all be trivially unreachable, so // we don't have to perform any non-trivial analysis here. // void DSGraph::removeTriviallyDeadNodes() { - for (unsigned i = 0; i != Nodes.size(); ++i) - if (!(Nodes[i]->NodeType & DSNode::GlobalNode)) - if (isNodeDead(Nodes[i])) { // This node is dead! - delete Nodes[i]; // Free memory... - Nodes.erase(Nodes.begin()+i--); // Remove from node list... - } - removeIdenticalCalls(FunctionCalls, Func ? Func->getName() : ""); + removeIdenticalCalls(AuxFunctionCalls, Func ? Func->getName() : ""); + + for (unsigned i = 0; i != Nodes.size(); ++i) + if (isNodeDead(Nodes[i])) { // This node is dead! + delete Nodes[i]; // Free memory... + Nodes.erase(Nodes.begin()+i--); // Remove from node list... + } } @@ -827,152 +875,65 @@ // 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 - Alive.insert(N); for (unsigned i = 0, e = N->getSize(); i < e; i += DS::PointerSize) - if (DSNode *DSN = N->getLink(i).getNode()) - if (!Alive.count(DSN)) - markAlive(DSN, Alive); + markAlive(N->getLink(i).getNode(), Alive); } -static bool checkGlobalAlive(DSNode *N, std::set &Alive, - std::set &Visiting) { +// 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. +// +// This function returns true if the specified node is alive. +// +static bool markAliveIfCanReachAlive(DSNode *N, std::set &Alive, + std::set &Visited) { if (N == 0) return false; - if (Visiting.count(N)) return false; // terminate recursion on a cycle - Visiting.insert(N); - - // If any immediate successor is alive, N is alive - for (unsigned i = 0, e = N->getSize(); i < e; i += DS::PointerSize) - if (DSNode *DSN = N->getLink(i).getNode()) - if (Alive.count(DSN)) { - Visiting.erase(N); - return true; - } - - // Else if any successor reaches a live node, N is alive - for (unsigned i = 0, e = N->getSize(); i < e; i += DS::PointerSize) - if (DSNode *DSN = N->getLink(i).getNode()) - if (checkGlobalAlive(DSN, Alive, Visiting)) { - Visiting.erase(N); return true; - } - - Visiting.erase(N); - return false; -} + // If we know that this node is alive, return so! + if (Alive.count(N)) return true; + // 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 + // No recursion, insert into Visited... + Visited.insert(VI, N); -// markGlobalsIteration - Recursive helper function for markGlobalsAlive(). -// This would be unnecessary if function calls were real nodes! In that case, -// the simple iterative loop in the first few lines below suffice. -// -static void markGlobalsIteration(std::set& GlobalNodes, - vector &Calls, - std::set &Alive, - bool FilterCalls) { - - // Iterate, marking globals or cast nodes alive until no new live nodes - // are added to Alive - std::set Visiting; // Used to identify cycles - std::set::iterator I = GlobalNodes.begin(), E = GlobalNodes.end(); - for (size_t liveCount = 0; liveCount < Alive.size(); ) { - liveCount = Alive.size(); - for ( ; I != E; ++I) - if (Alive.count(*I) == 0) { - Visiting.clear(); - if (checkGlobalAlive(*I, Alive, Visiting)) - markAlive(*I, Alive); - } - } + if (N->NodeType & DSNode::GlobalNode) + return false; // Global nodes will be marked on their own - // Find function calls with some dead and some live nodes. - // Since all call nodes must be live if any one is live, we have to mark - // all nodes of the call as live and continue the iteration (via recursion). - if (FilterCalls) { - bool Recurse = false; - for (unsigned i = 0, ei = Calls.size(); i < ei; ++i) { - bool CallIsDead = true, CallHasDeadArg = false; - DSCallSite &CS = Calls[i]; - for (unsigned j = 0, ej = CS.getNumPtrArgs(); j != ej; ++j) - if (DSNode *N = CS.getPtrArg(j).getNode()) { - bool ArgIsDead = !Alive.count(N); - CallHasDeadArg |= ArgIsDead; - CallIsDead &= ArgIsDead; - } - - if (DSNode *N = CS.getRetVal().getNode()) { - bool RetIsDead = !Alive.count(N); - CallHasDeadArg |= RetIsDead; - CallIsDead &= RetIsDead; - } + bool ChildrenAreAlive = false; - DSNode *N = CS.getCallee().getNode(); - bool FnIsDead = !Alive.count(N); - CallHasDeadArg |= FnIsDead; - CallIsDead &= FnIsDead; - - if (!CallIsDead && CallHasDeadArg) { - // Some node in this call is live and another is dead. - // Mark all nodes of call as live and iterate once more. - Recurse = true; - for (unsigned j = 0, ej = CS.getNumPtrArgs(); j != ej; ++j) - markAlive(CS.getPtrArg(j).getNode(), Alive); - markAlive(CS.getRetVal().getNode(), Alive); - markAlive(CS.getCallee().getNode(), Alive); - } - } - if (Recurse) - markGlobalsIteration(GlobalNodes, Calls, Alive, FilterCalls); - } + for (unsigned i = 0, e = N->getSize(); i < e; i += DS::PointerSize) + ChildrenAreAlive |= markAliveIfCanReachAlive(N->getLink(i).getNode(), + Alive, Visited); + if (ChildrenAreAlive) + markAlive(N, Alive); + return ChildrenAreAlive; } +static bool CallSiteUsesAliveArgs(DSCallSite &CS, std::set &Alive, + std::set &Visited) { + if (markAliveIfCanReachAlive(CS.getRetVal().getNode(), Alive, Visited) || + markAliveIfCanReachAlive(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)) + return true; + return false; +} -// markGlobalsAlive - Mark global nodes and cast nodes alive if they -// can reach any other live node. Since this can produce new live nodes, -// we use a simple iterative algorithm. -// -static void markGlobalsAlive(DSGraph &G, std::set &Alive, - bool FilterCalls) { - // Add global and cast nodes to a set so we don't walk all nodes every time - std::set GlobalNodes; - for (unsigned i = 0, e = G.getNodes().size(); i != e; ++i) - if (G.getNodes()[i]->NodeType & DSNode::GlobalNode) - GlobalNodes.insert(G.getNodes()[i]); - - // Add all call nodes to the same set - vector &Calls = G.getAuxFunctionCalls(); - if (FilterCalls) { - for (unsigned i = 0, e = Calls.size(); i != e; ++i) { - for (unsigned j = 0, e = Calls[i].getNumPtrArgs(); j != e; ++j) - if (DSNode *N = Calls[i].getPtrArg(j).getNode()) - GlobalNodes.insert(N); - if (DSNode *N = Calls[i].getRetVal().getNode()) - GlobalNodes.insert(N); - if (DSNode *N = Calls[i].getCallee().getNode()) - GlobalNodes.insert(N); - } - } - - // Iterate and recurse until no new live node are discovered. - // This would be a simple iterative loop if function calls were real nodes! - markGlobalsIteration(GlobalNodes, Calls, Alive, FilterCalls); - - // Free up references to dead globals from the ScalarMap - std::set::iterator I = GlobalNodes.begin(), E = GlobalNodes.end(); - for( ; I != E; ++I) - if (Alive.count(*I) == 0) - removeRefsToGlobal(*I, G.getScalarMap()); - - // Delete dead function calls - if (FilterCalls) - for (int ei = Calls.size(), i = ei-1; i >= 0; --i) { - bool CallIsDead = true; - for (unsigned j = 0, ej = Calls[i].getNumPtrArgs(); - CallIsDead && j != ej; ++j) - CallIsDead = Alive.count(Calls[i].getPtrArg(j).getNode()) == 0; - if (CallIsDead) - Calls.erase(Calls.begin() + i); // remove the call entirely - } +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 @@ -989,28 +950,62 @@ // Alive - a set that holds all nodes found to be reachable/alive. std::set Alive; + std::vector > GlobalNodes; - // If KeepCalls, mark all nodes reachable by call nodes as alive... - for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) { - for (unsigned j = 0, e = FunctionCalls[i].getNumPtrArgs(); j != e; ++j) - markAlive(FunctionCalls[i].getPtrArg(j).getNode(), Alive); - markAlive(FunctionCalls[i].getRetVal().getNode(), Alive); - markAlive(FunctionCalls[i].getCallee().getNode(), Alive); - } - for (unsigned i = 0, e = AuxFunctionCalls.size(); i != e; ++i) { - for (unsigned j = 0, e = AuxFunctionCalls[i].getNumPtrArgs(); j != e; ++j) - markAlive(AuxFunctionCalls[i].getPtrArg(j).getNode(), Alive); - markAlive(AuxFunctionCalls[i].getRetVal().getNode(), Alive); - markAlive(AuxFunctionCalls[i].getCallee().getNode(), Alive); - } - - // Mark all nodes reachable by scalar nodes as alive... + // Mark all nodes reachable by (non-global) scalar nodes as alive... for (std::map::iterator I = ScalarMap.begin(), E = ScalarMap.end(); I != E; ++I) - markAlive(I->second.getNode(), Alive); + if (!isa(I->first)) // Don't mark globals! + markAlive(I->second.getNode(), 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); + + // If any global nodes points to a non-global that is "alive", the global is + // "alive" as well... + // + std::set Visited; + for (unsigned i = 0, e = GlobalNodes.size(); i != e; ++i) + markAliveIfCanReachAlive(GlobalNodes[i].second, Alive, Visited); + + 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); + 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); + AuxFCallsAlive[i] = true; + } + + // Remove all dead function calls... + unsigned CurIdx = 0; + for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) + if (FCallsAlive[i]) + FunctionCalls[CurIdx++].swap(FunctionCalls[i]); + // Crop all the bad ones out... + FunctionCalls.erase(FunctionCalls.begin()+CurIdx, FunctionCalls.end()); + + // Remove all dead aux function calls... + CurIdx = 0; + for (unsigned i = 0, e = AuxFunctionCalls.size(); i != e; ++i) + if (AuxFCallsAlive[i]) + AuxFunctionCalls[CurIdx++].swap(AuxFunctionCalls[i]); + // Crop all the bad ones out... + AuxFunctionCalls.erase(AuxFunctionCalls.begin()+CurIdx, + AuxFunctionCalls.end()); + + + // Remove all unreachable globals from the ScalarMap + for (unsigned i = 0, e = GlobalNodes.size(); i != e; ++i) + if (!Alive.count(GlobalNodes[i].second)) + ScalarMap.erase(GlobalNodes[i].first); // Loop over all unreachable nodes, dropping their references... vector DeadNodes; From lattner at cs.uiuc.edu Sun Nov 10 01:32:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 01:32:01 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/generate_report.pl Message-ID: <200211100731.BAA12304@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: generate_report.pl updated: 1.7 -> 1.8 --- Log message: Print info about hte globals graph and about bytecode size and load times --- Diffs of the changes: Index: llvm/test/DSGraphs/generate_report.pl diff -u llvm/test/DSGraphs/generate_report.pl:1.7 llvm/test/DSGraphs/generate_report.pl:1.8 --- llvm/test/DSGraphs/generate_report.pl:1.7 Sun Nov 10 00:54:35 2002 +++ llvm/test/DSGraphs/generate_report.pl Sun Nov 10 01:31:18 2002 @@ -38,13 +38,13 @@ # Output the headers for the report.... printf("%-25s ", "Name:"); if ($SHOW_TIMES) { - printf("%6s %-8s %-8s %-8s %-8s ", - "Anlyz:", "LocTime:", "BUTime:", "TDTime:", "TotTime:"); + printf("%6s %-8s %-8s %-8s %-8s %-8s ", + "Anlyz:", "LocTime:", "BUTime:", "TDTime:", "TotTime:", "BCTime:"); } -printf("%-8s %-8s %-10s %-10s " . "%-8s %-10s %-6s %-6s\n", - "LocSize:", "BUSize:", "TDSize:", "TotSize:", - "NumFold", "NumNodes", "main", "__main"); +printf("%-8s %-8s %-8s %-8s %-8s " . "%-8s %-10s %-6s %-6s %-6s\n", + "LocSize:", "BUSize:", "TDSize:", "TotSize:", "BCSize:", + "NumFold", "NumNodes", "main", "__main", "GlobGr"); foreach $Record (@Records) { # Print BM name @@ -64,20 +64,23 @@ printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ Bottom-up', $Record, -8); printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ Top-down', $Record, -8); printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ TOTAL', $Record, -8); - print "| "; + printField('([0-9.]+) \([^)]+\)[ ]*[0-9]+ Bytecode', $Record, -8); + print "| "; } # Print Sizes printField("([0-9]+) Local", $Record, -8); printField("([0-9]+) Bottom-up", $Record, -8); - printField("([0-9]+) Top-down", $Record, -10); - printField("([0-9]+) TOTAL", $Record, -10); + printField("([0-9]+) Top-down", $Record, -8); + printField("([0-9]+) TOTAL", $Record, -8); + printField("([0-9]+) Bytecode", $Record, -8); print "| "; printField("([0-9]+).*completely folded", $Record, -5); printField("Graphs contain \\[([0-9+]+)\\] nodes total", $Record, -10); printField("\\.main\\.dot'... \\[([0-9+]+)\\]", $Record, -6); printField("\\.__main\\.dot'... \\[([0-9+]+)\\]", $Record, -6); + printField("\\.GlobalsGraph\\.dot'... \\[([0-9+]+)\\]", $Record, -6); } print "\n"; #print "#####\n"; From lattner at cs.uiuc.edu Sun Nov 10 01:32:07 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 01:32:07 2002 Subject: [llvm-commits] CVS: llvm/test/DSGraphs/htmlcoldiff.pl Message-ID: <200211100731.BAA12313@apoc.cs.uiuc.edu> Changes in directory llvm/test/DSGraphs: htmlcoldiff.pl updated: 1.1 -> 1.2 --- Log message: Add code to handle adding columns to the results --- Diffs of the changes: Index: llvm/test/DSGraphs/htmlcoldiff.pl diff -u llvm/test/DSGraphs/htmlcoldiff.pl:1.1 llvm/test/DSGraphs/htmlcoldiff.pl:1.2 --- llvm/test/DSGraphs/htmlcoldiff.pl:1.1 Sat Nov 9 13:15:05 2002 +++ llvm/test/DSGraphs/htmlcoldiff.pl Sun Nov 10 01:31:02 2002 @@ -41,16 +41,18 @@ print $Field; } else { # If it's not a seperator, diff it... my $Hilight = 0; - my $FieldComp = $FieldsCompare[$FieldNo]; - if ($Field =~ /[0-9]+\.[0-9]+/ && $FieldComp =~ /[0-9]+\.[0-9]+/ && - $Field != 0) { # Handle floating point numbers special - # They are only highlighted if they change by 20% or more... - my $Change = $FieldComp/$Field; - $Hilight = 1 if ($Change > 2 || $Change < 0.5); - - } elsif ($Field ne $FieldComp) { - $Hilight = 1; + if (@FieldsCompare > $FieldNo) { + my $FieldComp = $FieldsCompare[$FieldNo]; + if ($Field =~ /[0-9]+\.[0-9]+/ && $FieldComp =~ /[0-9]+\.[0-9]+/ && + $Field != 0) { # Handle floating point numbers special + # They are only highlighted if they change by 20% or more... + my $Change = $FieldComp/$Field; + $Hilight = 1 if ($Change > 2 || $Change < 0.5); + + } elsif ($Field ne $FieldComp) { + $Hilight = 1; + } } print "" if $Hilight; From lattner at cs.uiuc.edu Sun Nov 10 01:32:14 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 01:32:14 2002 Subject: [llvm-commits] CVS: llvm/www/docs/DSGraphStatus.html Message-ID: <200211100731.BAA23813@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: DSGraphStatus.html updated: 1.9 -> 1.10 --- Log message: Add more info --- Diffs of the changes: Index: llvm/www/docs/DSGraphStatus.html diff -u llvm/www/docs/DSGraphStatus.html:1.9 llvm/www/docs/DSGraphStatus.html:1.10 --- llvm/www/docs/DSGraphStatus.html:1.9 Sun Nov 10 00:55:29 2002 +++ llvm/www/docs/DSGraphStatus.html Sun Nov 10 01:31:38 2002 @@ -13,6 +13,70 @@ previous value.


+

Nov 9, 2002 #2:

+ +This has the first part of the globals graph implemented, this simply deletes +the nodes that should be moved to the globals graph, without saving them and +then later merging them back in (The GlobGr size indicates the size of the +globals graph: right now it is empty, this will be fixed in the future). From +this we can get some best case times that the final algorithm will not be +able to match, but it is interesting to see badly how the N2 case +hurts the TD pass.

+ +Note that I now know that gap and vortex are not working because of an infinite +loop in the algorithm, now that this is identified, hopefully it will be fixed +shortly.

+ +Note that these numbers are still with a debug build. Compiling with +optimizations and without assertions improves run time 3-4x.

+ +

+Name:                     Anlyz: LocTime: BUTime:  TDTime:  TotTime:      LocSize: BUSize:  TDSize:    TotSize:     NumFold  NumNodes   main   __main GlobGr
+254.gap.lib                 4.92 *        *        *        *        |    *        *        *          *          |    *     *          *      *      *      
+255.vortex.lib              2.78 *        *        *        *        |    *        *        *          *          |    *     *          *      *      *      
+300.twolf.lib               3.50 0.2890   0.3094   0.5272   1.6337   |    487976   434248   418472     1340696    |    794   4223+808   88+45  0+0    0+0    
+197.parser.lib              1.70 0.1517   0.1978   0.2152   0.7588   |    408560   243688   213776     985496     |    1327  2257+706   14+6   0+0    0+0    
+burg.llvm.lib               1.14 0.1056   0.1296   0.1720   0.5084   |    530224   478880   179080     1188184    |    722   2167+577   30+7   0+0    0+0    
+164.gzip.llvm.lib           0.65 0.0406   0.0256   0.0328   0.1651   |    201664   129304   70864      499448     |    24    971+87     8+2    0+0    0+0    
+optimizer-eval.llvm.lib     0.40 0.0170   0.0366   0.2099   0.3047   |    81584    79352    62232      241544     |    *     309+41     72+27  0+0    0+0    
+256.bzip2.lib               0.29 0.0249   0.0107   0.0112   0.0943   |    139536   84752    39720      336224     |    *     563+37     8+2    0+0    0+0    
+181.mcf.lib                 0.20 0.0185   0.0247   0.0285   0.1042   |    111384   145912   43544      318080     |    156   393+51     23+10  0+0    0+0    
+sim.llvm.lib                0.18 0.0143   0.0106   0.0129   0.0765   |    55376    83072    21968      255424     |    *     261+36     39+22  0+0    0+0    
+voronoi.llvm.lib            0.15 0.0152   0.0203   0.0309   0.0807   |    79696    87280    27336      208088     |    18    299+77     15+8   0+0    0+0    
+bh.llvm.lib                 0.13 0.0120   0.0100   0.0110   0.0506   |    55864    72480    27632      220640     |    61    194+35     6+2    0+0    0+0    
+sgefa.llvm.lib              0.12 0.0088   0.0165   0.0199   0.0616   |    85904    82032    67032      260632     |    *     130+24     24+14  0+0    0+0    
+health.llvm.lib             0.07 0.0051   0.0065   0.0054   0.0243   |    29880    31328    7816       76624      |    71    79+29      10+4   0+0    0+0    
+em3d.llvm.lib               0.07 0.0059   0.0058   0.0058   0.0254   |    24280    33360    13344      87784      |    10    179+27     12+4   0+0    0+0    
+power.llvm.lib              0.06 0.0043   0.0029   0.0051   0.0197   |    28512    17808    8008       62168      |    *     81+18      11+2   0+0    0+0    
+tsp.llvm.lib                0.05 0.0051   0.0031   0.0027   0.0185   |    25704    14576    5040       52488      |    21    42+15      7+4    0+0    0+0    
+perimeter.llvm.lib          0.05 0.0030   0.0036   0.0020   0.0163   |    14936    22008    4296       53856      |    *     35+15      7+4    0+0    0+0    
+mst.llvm.lib                0.05 0.0051   0.0033   0.0038   0.0193   |    27408    16880    7216       66352      |    10    97+15      12+3   0+0    0+0    
+lists.llvm.lib              0.05 0.0042   0.0058   0.0071   0.0227   |    24544    17384    13696      67736      |    30    67+26      3+1    0+0    0+0    
+hash.llvm.lib               0.05 0.0030   0.0033   0.0041   0.0168   |    17936    25000    8544       64752      |    *     117+17     14+6   0+0    0+0    
+objinst.llvm.lib            0.04 0.0018   0.0018   0.0033   0.0122   |    11072    16344    12040      53016      |    35    45+14      16+10  0+0    0+0    
+methcall.llvm.lib           0.04 0.0017   0.0015   0.0029   0.0111   |    10984    9816     11880      46696      |    30    43+12      14+8   0+0    0+0    
+llubenchmark.llvm.lib       0.04 0.0021   0.0010   0.0015   0.0115   |    4728     9384     2808       33656      |    *     31+7       15+5   0+0    0+0    
+bisort.llvm.lib             0.04 0.0029   0.0022   0.0019   0.0128   |    13608    11840    3888       46256      |    *     35+13      7+4    0+0    0+0    
+treeadd.llvm.lib            0.03 0.0014   0.0009   0.0010   0.0071   |    3856     12496    2392       35088      |    *     25+7       6+3    0+0    0+0    
+sumarraymalloc.llvm.lib     0.03 0.0009   0.0008   0.0010   0.0063   |    7040     2192     2656       26000      |    *     23+5       7+4    0+0    0+0    
+sieve.llvm.lib              0.03 0.0007   0.0005   0.0006   0.0063   |    2176     5832     1968       23424      |    *     22+2       12+1   0+0    0+0    
+matrixTranspose.llvm.lib    0.03 0.0005   0.0002   0.0003   0.0026   |    4248     792      1088       8520       |    *     8+1        5+1    0+0    0+0    
+matrix.llvm.lib             0.03 0.0013   0.0013   0.0015   0.0085   |    8720     8704     3416       36888      |    *     38+9       12+8   0+0    0+0    
+ary3.llvm.lib               0.03 0.0012   0.0012   0.0012   0.0078   |    8648     14136    3328       37712      |    6     44+5       12+3   0+0    0+0    
+random.llvm.lib             0.02 0.0008   0.0004   0.0005   0.0047   |    2056     4720     1656       21416      |    *     15+2       3+1    0+0    0+0    
+pi.llvm.lib                 0.02 0.0007   0.0003   0.0005   0.0036   |    5392     1384     4768       11544      |    *     17+2       13+2   0+0    0+0    
+hello.llvm.lib              0.02 0.0004   0.0001   0.0001   0.0015   |    752      2952     472        6512       |    *     2+0        0+0    0+0    0+0    
+heapsort.llvm.lib           0.02 0.0009   0.0006   0.0007   0.0062   |    7448     6864     2360       28040      |    *     26+3       7+2    0+0    0+0    
+fib2.llvm.lib               0.02 0.0008   0.0007   0.0007   0.0055   |    2416     5680     2000       25744      |    *     21+5       8+3    0+0    0+0    
+ackermann.llvm.lib          0.02 0.0007   0.0004   0.0005   0.0046   |    1744     5368     1552       22048      |    *     13+2       3+1    0+0    0+0    
+sumarray.llvm.lib           0.01 0.0003   0.0002   0.0002   0.0021   |    904      2232     624        3760       |    *     6+1        4+1    0+0    0+0    
+sumarray2d.llvm.lib         0.01 0.0004   0.0002   0.0003   0.0026   |    4208     856      3656       10904      |    *     10+1       7+1    0+0    0+0    
+printargs.llvm.lib          0.01 0.0004   0.0002   0.0003   0.0023   |    1240     704      1064       5152       |    *     6+1        4+1    0+0    0+0    
+indvars.llvm.lib            0.01 0.0005   0.0003   0.0003   0.0030   |    1744     4088     1032       9704       |    *     13+1       8+1    0+0    0+0    
+

+ + +


Nov 9, 2002:

Same as the
previous run, but now with a small tweak: @@ -406,7 +470,7 @@
Chris Lattner
-Last modified: Sat Nov 9 14:13:12 CST 2002 +Last modified: Sun Nov 10 01:26:16 CST 2002 From lattner at cs.uiuc.edu Sun Nov 10 01:47:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 01:47:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200211100746.BAA12357@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.62 -> 1.63 --- Log message: Fix a bug that could trigger when varargs call sites had non-matching number of arguments --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.62 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.63 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.62 Sun Nov 10 00:59:55 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sun Nov 10 01:46:08 2002 @@ -773,7 +773,7 @@ // bool DSGraph::isNodeDead(DSNode *N) { // Is it a trivially dead shadow node? - return N->getReferrers().empty() && (N->NodeType & ~DSNode::DEAD) == 0 + return N->getReferrers().empty() && (N->NodeType & ~DSNode::DEAD) == 0; } static inline void killIfUselessEdge(DSNodeHandle &Edge) { @@ -831,9 +831,16 @@ NumDuplicateCalls > 20) { DSCallSite &OCS = Calls[i-1]; OCS.getRetVal().mergeWith(CS.getRetVal()); - for (unsigned a = 0, e = CS.getNumPtrArgs(); a != e; ++a) + + for (unsigned a = 0, + e = std::min(CS.getNumPtrArgs(), OCS.getNumPtrArgs()); + a != e; ++a) OCS.getPtrArg(a).mergeWith(CS.getPtrArg(a)); // The node will now be eliminated as a duplicate! + if (CS.getNumPtrArgs() < OCS.getNumPtrArgs()) + CS = OCS; + else if (CS.getNumPtrArgs() > OCS.getNumPtrArgs()) + OCS = CS; } } else { LastCalleeNode = CS.getCallee().getNode(); From lattner at cs.uiuc.edu Sun Nov 10 17:47:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 17:47:01 2002 Subject: [llvm-commits] CVS: llvm/include/Support/TarjanSCCIterator.h Message-ID: <200211102346.RAA31227@apoc.cs.uiuc.edu> Changes in directory llvm/include/Support: TarjanSCCIterator.h updated: 1.1 -> 1.2 --- Log message: Add tarj_end() method --- Diffs of the changes: Index: llvm/include/Support/TarjanSCCIterator.h diff -u llvm/include/Support/TarjanSCCIterator.h:1.1 llvm/include/Support/TarjanSCCIterator.h:1.2 --- llvm/include/Support/TarjanSCCIterator.h:1.1 Mon Nov 4 08:15:57 2002 +++ llvm/include/Support/TarjanSCCIterator.h Sun Nov 10 17:46:31 2002 @@ -215,6 +215,11 @@ return TarjanSCC_iterator::begin(G); } +template +TarjanSCC_iterator tarj_end(T G) +{ + return TarjanSCC_iterator::end(G); +} //===----------------------------------------------------------------------===// From lattner at cs.uiuc.edu Sun Nov 10 17:48:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 17:48:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure.h Message-ID: <200211102347.RAA31248@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DataStructure.h updated: 1.56 -> 1.57 --- Log message: add method --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure.h:1.56 llvm/include/llvm/Analysis/DataStructure.h:1.57 --- llvm/include/llvm/Analysis/DataStructure.h:1.56 Sun Nov 10 00:53:19 2002 +++ llvm/include/llvm/Analysis/DataStructure.h Sun Nov 10 17:47:02 2002 @@ -103,6 +103,9 @@ } private: DSGraph &calculateGraph(Function &F, unsigned Indent); + bool ResolveFunctionCalls(DSGraph &G, unsigned &FirstResolvableCall, + std::map &InProcess, + unsigned Indent); }; From lattner at cs.uiuc.edu Sun Nov 10 17:48:07 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 17:48:07 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSSupport.h Message-ID: <200211102347.RAA31255@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSSupport.h updated: 1.6 -> 1.7 --- Log message: Add code to be able to merge two call sites --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSSupport.h diff -u llvm/include/llvm/Analysis/DSSupport.h:1.6 llvm/include/llvm/Analysis/DSSupport.h:1.7 --- llvm/include/llvm/Analysis/DSSupport.h:1.6 Sun Nov 10 00:48:11 2002 +++ llvm/include/llvm/Analysis/DSSupport.h Sun Nov 10 17:46:51 2002 @@ -218,6 +218,17 @@ } } + // MergeWith - Merge the return value and parameters of the these two call + // sites. + void mergeWith(DSCallSite &CS) { + getRetVal().mergeWith(CS.getRetVal()); + unsigned MinArgs = getNumPtrArgs(); + if (CS.getNumPtrArgs() < MinArgs) MinArgs = CS.getNumPtrArgs(); + + for (unsigned a = 0; a != MinArgs; ++a) + getPtrArg(a).mergeWith(CS.getPtrArg(a)); + } + bool operator<(const DSCallSite &CS) const { if (Callee < CS.Callee) return true; // This must sort by callee first! if (Callee > CS.Callee) return false; From lattner at cs.uiuc.edu Sun Nov 10 18:02:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 18:02:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp Message-ID: <200211110001.SAA31296@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Printer.cpp updated: 1.40 -> 1.41 --- Log message: Print the right call set size --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.40 llvm/lib/Analysis/DataStructure/Printer.cpp:1.41 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.40 Sun Nov 10 00:53:59 2002 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Sun Nov 10 18:01:02 2002 @@ -155,7 +155,9 @@ if (F.good()) { print(F); - O << " [" << getGraphSize() << "+" << getFunctionCalls().size() << "]\n"; + unsigned NumCalls = shouldPrintAuxCalls() ? + getAuxFunctionCalls().size() : getFunctionCalls().size(); + O << " [" << getGraphSize() << "+" << NumCalls << "]\n"; } else { O << " error opening file for writing!\n"; } From lattner at cs.uiuc.edu Sun Nov 10 18:02:08 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 18:02:08 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Message-ID: <200211110001.SAA31310@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.41 -> 1.42 --- Log message: Fix infinite loop in the BU algorithm. Unfortunately this dies a serious death when handling moderately sized SCC's, but what can you do --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.41 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.42 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.41 Sun Nov 10 00:52:47 2002 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Sun Nov 10 18:01:34 2002 @@ -46,27 +46,170 @@ GlobalsGraph = 0; } + +// Return true if a graph was inlined +// Can not modify the part of the AuxCallList < FirstResolvableCall. +// +bool BUDataStructures::ResolveFunctionCalls(DSGraph &G, + unsigned &FirstResolvableCall, + std::map &InProcess, + unsigned Indent) { + std::vector &FCs = G.getAuxFunctionCalls(); + bool Changed = false; + + // Loop while there are call sites that we can resolve! + while (FirstResolvableCall != FCs.size()) { + DSCallSite Call = FCs[FirstResolvableCall]; + + // If the function list is incomplete... + if (Call.getCallee().getNode()->NodeType & DSNode::Incomplete) { + // If incomplete, we cannot resolve it, so leave it at the beginning of + // the call list with the other unresolvable calls... + ++FirstResolvableCall; + } else { + // Start inlining all of the functions we can... some may not be + // inlinable if they are external... + // + const std::vector &Callees = + Call.getCallee().getNode()->getGlobals(); + + bool hasExternalTarget = false; + + // Loop over the functions, inlining whatever we can... + for (unsigned c = 0, e = Callees.size(); c != e; ++c) { + // Must be a function type, so this cast should succeed unless something + // really wierd is happening. + Function &FI = cast(*Callees[c]); + + if (FI.getName() == "printf" || FI.getName() == "sscanf" || + FI.getName() == "fprintf" || FI.getName() == "open" || + FI.getName() == "sprintf" || FI.getName() == "fputs") { + // Ignore + } else if (FI.isExternal()) { + // If the function is external, then we cannot resolve this call site! + hasExternalTarget = true; + break; + } else { + std::map::iterator I = + InProcess.lower_bound(&FI); + + if (I != InProcess.end() && I->first == &FI) { // Recursion detected? + // Merge two call sites to eliminate recursion... + Call.mergeWith(I->second); + + DEBUG(std::cerr << std::string(Indent*2, ' ') + << "* Recursion detected for function " << FI.getName()<<"\n"); + } else { + DEBUG(std::cerr << std::string(Indent*2, ' ') + << "Inlining: " << FI.getName() << "\n"); + + // Get the data structure graph for the called function, closing it + // if possible... + // + DSGraph &GI = calculateGraph(FI, Indent+1); // Graph to inline + + DEBUG(std::cerr << std::string(Indent*2, ' ') + << "Got graph for: " << FI.getName() << "[" + << GI.getGraphSize() << "+" + << GI.getAuxFunctionCalls().size() << "] " + << " in: " << G.getFunction().getName() << "[" + << G.getGraphSize() << "+" + << G.getAuxFunctionCalls().size() << "]\n"); + + // Keep track of how many call sites are added by the inlining... + unsigned NumCalls = FCs.size(); + + // Resolve the arguments and return value + G.mergeInGraph(Call, GI, DSGraph::StripAllocaBit | + DSGraph::DontCloneCallNodes); + + // Added a call site? + if (FCs.size() != NumCalls) { + // Otherwise we need to inline the graph. Temporarily add the + // current function to the InProcess map to be able to handle + // recursion successfully. + // + I = InProcess.insert(I, std::make_pair(&FI, Call)); + + // ResolveFunctionCalls - Resolve the function calls that just got + // inlined... + // + Changed |= ResolveFunctionCalls(G, NumCalls, InProcess, Indent+1); + + // Now that we are done processing the inlined graph, remove our + // cycle detector record... + // + //InProcess.erase(I); + } + } + } + } + + if (hasExternalTarget) { + // If we cannot resolve this call site... + ++FirstResolvableCall; + } else { + Changed = true; + FCs.erase(FCs.begin()+FirstResolvableCall); + } + } + } + + return Changed; +} + DSGraph &BUDataStructures::calculateGraph(Function &F, unsigned Indent) { // Make sure this graph has not already been calculated, or that we don't get // into an infinite loop with mutually recursive functions. // - DSGraph *&Graph = DSInfo[&F]; - if (Graph) return *Graph; + DSGraph *&GraphPtr = DSInfo[&F]; + if (GraphPtr) return *GraphPtr; // Copy the local version into DSInfo... - Graph = new DSGraph(getAnalysis().getDSGraph(F)); - Graph->setGlobalsGraph(GlobalsGraph); - Graph->setPrintAuxCalls(); + GraphPtr = new DSGraph(getAnalysis().getDSGraph(F)); + DSGraph &Graph = *GraphPtr; + + Graph.setGlobalsGraph(GlobalsGraph); + Graph.setPrintAuxCalls(); // Start resolving calls... - std::vector &FCs = Graph->getAuxFunctionCalls(); + std::vector &FCs = Graph.getAuxFunctionCalls(); // Start with a copy of the original call sites... - FCs = Graph->getFunctionCalls(); + FCs = Graph.getFunctionCalls(); - DEBUG(std::cerr << std::string(Indent*4, ' ') + DEBUG(std::cerr << std::string(Indent*2, ' ') << "[BU] Calculating graph for: " << F.getName() << "\n"); + bool Changed; + while (1) { + unsigned FirstResolvableCall = 0; + std::map InProcess; + + // Insert a call site for self to handle self recursion... + std::vector Args; + Args.reserve(F.asize()); + for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I) + if (isPointerType(I->getType())) + Args.push_back(Graph.getNodeForValue(I)); + + InProcess.insert(std::make_pair(&F, + DSCallSite(*(CallInst*)0, Graph.getRetNode(),(DSNode*)0,Args))); + + Changed = ResolveFunctionCalls(Graph, FirstResolvableCall, InProcess, + Indent); + + if (Changed) { + Graph.maskIncompleteMarkers(); + Graph.markIncompleteNodes(); + Graph.removeDeadNodes(); + break; + } else { + break; + } + } + +#if 0 bool Inlined; do { Inlined = false; @@ -93,18 +236,18 @@ if (&FI == &F) { // Self recursion... simply link up the formal arguments with the // actual arguments... - DEBUG(std::cerr << std::string(Indent*4, ' ') - << " [BU] Self Inlining: " << F.getName() << "\n"); + DEBUG(std::cerr << std::string(Indent*2, ' ') + << "[BU] Self Inlining: " << F.getName() << "\n"); // Handle self recursion by resolving the arguments and return value - Graph->mergeInGraph(Call, *Graph, DSGraph::StripAllocaBit); + Graph.mergeInGraph(Call, Graph, DSGraph::StripAllocaBit); // Erase the entry in the callees vector Callees.erase(Callees.begin()+c--); } else if (!FI.isExternal()) { - DEBUG(std::cerr << std::string(Indent*4, ' ') - << " [BU] In " << F.getName() << " inlining: " + DEBUG(std::cerr << std::string(Indent*2, ' ') + << "[BU] In " << F.getName() << " inlining: " << FI.getName() << "\n"); // Get the data structure graph for the called function, closing it @@ -113,13 +256,13 @@ // DSGraph &GI = calculateGraph(FI, Indent+1); // Graph to inline - DEBUG(std::cerr << std::string(Indent*4, ' ') - << " [BU] Got graph for " << FI.getName() + DEBUG(std::cerr << std::string(Indent*2, ' ') + << "[BU] Got graph for " << FI.getName() << " in: " << F.getName() << "[" << GI.getGraphSize() << "+" << GI.getAuxFunctionCalls().size() << "]\n"); // Handle self recursion by resolving the arguments and return value - Graph->mergeInGraph(Call, GI, DSGraph::StripAllocaBit | + Graph.mergeInGraph(Call, GI, DSGraph::StripAllocaBit | DSGraph::DontCloneCallNodes); // Erase the entry in the Callees vector @@ -150,23 +293,26 @@ Inlined = true; } + +#if 0 // If we just inlined a function that had call nodes, chances are that // the call nodes are redundant with ones we already have. Eliminate // those call nodes now. // - if (FCs.size() > OldNumCalls) - Graph->removeTriviallyDeadNodes(); + if (FCs.size() >= OldNumCalls) + Graph.removeTriviallyDeadNodes(); +#endif } if (FCs.size() > 200) { std::cerr << "Aborted inlining fn: '" << F.getName() << "'!" << std::endl; - Graph->maskIncompleteMarkers(); - Graph->markIncompleteNodes(); - Graph->removeDeadNodes(); - Graph->writeGraphToFile(std::cerr, "crap."+F.getName()); + Graph.maskIncompleteMarkers(); + Graph.markIncompleteNodes(); + Graph.removeDeadNodes(); + Graph.writeGraphToFile(std::cerr, "crap."+F.getName()); exit(1); - return *Graph; + return Graph; } } @@ -174,19 +320,20 @@ // Recompute the Incomplete markers. If there are any function calls left // now that are complete, we must loop! if (Inlined) { - Graph->maskIncompleteMarkers(); - Graph->markIncompleteNodes(); - Graph->removeDeadNodes(); + Graph.maskIncompleteMarkers(); + Graph.markIncompleteNodes(); + Graph.removeDeadNodes(); } } while (Inlined && !FCs.empty()); +#endif - DEBUG(std::cerr << std::string(Indent*4, ' ') + DEBUG(std::cerr << std::string(Indent*2, ' ') << "[BU] Done inlining: " << F.getName() << " [" - << Graph->getGraphSize() << "+" << Graph->getAuxFunctionCalls().size() + << Graph.getGraphSize() << "+" << Graph.getAuxFunctionCalls().size() << "]\n"); - //Graph->writeGraphToFile(std::cerr, "bu_" + F.getName()); + Graph.writeGraphToFile(std::cerr, "bu_" + F.getName()); - return *Graph; + return Graph; } From lattner at cs.uiuc.edu Sun Nov 10 18:02:15 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 18:02:15 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200211110001.SAA31315@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.63 -> 1.64 --- Log message: Use call site mergeWith method to simplify code --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.63 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.64 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.63 Sun Nov 10 01:46:08 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sun Nov 10 18:00:46 2002 @@ -830,12 +830,8 @@ // FIXME: Evaluate how many times this is tripped! NumDuplicateCalls > 20) { DSCallSite &OCS = Calls[i-1]; - OCS.getRetVal().mergeWith(CS.getRetVal()); + OCS.mergeWith(CS); - for (unsigned a = 0, - e = std::min(CS.getNumPtrArgs(), OCS.getNumPtrArgs()); - a != e; ++a) - OCS.getPtrArg(a).mergeWith(CS.getPtrArg(a)); // The node will now be eliminated as a duplicate! if (CS.getNumPtrArgs() < OCS.getNumPtrArgs()) CS = OCS; From lattner at cs.uiuc.edu Sun Nov 10 21:38:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Nov 10 21:38:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200211110337.VAA01398@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.64 -> 1.65 --- Log message: Mark stuff reachable by _AUX_ calls as incomplete in the BU graph --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.64 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.65 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.64 Sun Nov 10 18:00:46 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sun Nov 10 21:36:55 2002 @@ -716,6 +716,14 @@ markIncompleteNode(DSN); } +static void markIncomplete(DSCallSite &Call) { + // Then the return value is certainly incomplete! + markIncompleteNode(Call.getRetVal().getNode()); + + // All objects pointed to by function arguments are incomplete! + for (unsigned i = 0, e = Call.getNumPtrArgs(); i != e; ++i) + markIncompleteNode(Call.getPtrArg(i).getNode()); +} // markIncompleteNodes - Traverse the graph, identifying nodes that may be // modified by other functions that have not been resolved yet. This marks @@ -735,15 +743,13 @@ markIncompleteNode(ScalarMap[I].getNode()); // Mark stuff passed into functions calls as being incomplete... - for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) { - DSCallSite &Call = FunctionCalls[i]; - // Then the return value is certainly incomplete! - markIncompleteNode(Call.getRetVal().getNode()); - - // All objects pointed to by function arguments are incomplete! - for (unsigned i = 0, e = Call.getNumPtrArgs(); i != e; ++i) - markIncompleteNode(Call.getPtrArg(i).getNode()); - } + if (!shouldPrintAuxCalls()) + for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) + markIncomplete(FunctionCalls[i]); + else + for (unsigned i = 0, e = AuxFunctionCalls.size(); i != e; ++i) + markIncomplete(AuxFunctionCalls[i]); + // Mark all of the nodes pointed to by global nodes as incomplete... for (unsigned i = 0, e = Nodes.size(); i != e; ++i)