[llvm-commits] CVS: llvm/lib/Transforms/Scalar/ADCE.cpp
Changes in directory llvm/lib/Transforms/Scalar: ADCE.cpp updated: 1.105 -> 1.106 --- Log message: Revert changes that caused breakage. --- Diffs of the changes: (+19 -15) ADCE.cpp | 34 +++--- 1 files changed, 19 insertions(+), 15 deletions(-) Index: llvm/lib/Transforms/Scalar/ADCE.cpp diff -u llvm/lib/Transforms/Scalar/ADCE.cpp:1.105 llvm/lib/Transforms/Scalar/ADCE.cpp:1.106 --- llvm/lib/Transforms/Scalar/ADCE.cpp:1.105 Tue Apr 17 23:55:33 2007 +++ llvm/lib/Transforms/Scalar/ADCE.cpp Wed Apr 18 01:46:57 2007 @@ -68,7 +68,7 @@ // can be marked live that wouldn't necessarily be otherwise. AU.addRequired(); AU.addRequired(); -AU.addRequired(); +AU.addRequired(); AU.addRequired(); } @@ -246,8 +246,8 @@ // have any post-dominance information, thus we cannot perform our // transformations safely. // - PostETForest &ET = getAnalysis(); - if (ET.getNodeForBlock(&Func->getEntryBlock()) == 0) { + PostDominatorTree &DT = getAnalysis(); + if (DT[&Func->getEntryBlock()] == 0) { WorkList.clear(); return MadeChanges; } @@ -258,7 +258,7 @@ // function which unwinds, exits or has side-effects, we don't want to delete // the infinite loop or those blocks leading up to it. for (Function::iterator I = Func->begin(), E = Func->end(); I != E; ++I) -if (ET.getNodeForBlock(I) == 0 && ReachableBBs.count(I)) +if (DT[I] == 0 && ReachableBBs.count(I)) for (pred_iterator PI = pred_begin(I), E = pred_end(I); PI != E; ++PI) markInstructionLive((*PI)->getTerminator()); @@ -383,16 +383,16 @@ // postdominator that is alive, and the last postdominator that is // dead... // - BasicBlock *LastDead = TI->getSuccessor(i); - BasicBlock *NextAlive = 0; - - if (LastDead) { -NextAlive = ET.getIDom(LastDead); -while (!AliveBlocks.count(NextAlive)) { - LastDead = NextAlive; - NextAlive = ET.getIDom(NextAlive); - if (NextAlive == 0) { -LastDead = 0; + PostDominatorTree::Node *LastNode = DT[TI->getSuccessor(i)]; + PostDominatorTree::Node *NextNode = 0; + + if (LastNode) { +NextNode = LastNode->getIDom(); +while (!AliveBlocks.count(NextNode->getBlock())) { + LastNode = NextNode; + NextNode = NextNode->getIDom(); + if (NextNode == 0) { +LastNode = 0; break; } } @@ -406,7 +406,7 @@ // drawback of ADCE, so in the future if we choose to revisit the // decision, this is where it should be. // - if (LastDead == 0) {// No postdominator! + if (LastNode == 0) {// No postdominator! if (!isa(TI)) { // Call RemoveSuccessor to transmogrify the terminator instruction // to not contain the outgoing branch, or to create a new @@ -427,6 +427,10 @@ } } else { +// Get the basic blocks that we need... +BasicBlock *LastDead = LastNode->getBlock(); +BasicBlock *NextAlive = NextNode->getBlock(); + // Make the conditional branch now go to the next alive block... TI->getSuccessor(i)->removePredecessor(BB); TI->setSuccessor(i, NextAlive); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [126245] Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/ Week-of-Mon-20070416/047943.html
Hi Devang, > if > (StartOffsetInBits > FirstUnallocatedByte*8) > > is true then > > (StartOffsetFromByteBoundry == 0) > > is always true. If so, we could simply this even further. In other > words, if we need pad bytes for a new field then it always starts at > byte boundary. Can you think of an example where this is not true ? yes, this need not be true in Ada, where bitfields can be placed wherever you like, for example type Second_Bitfield_Not_At_Bitoffset_Zero is record A : Character; B : Integer; end record; for Second_Bitfield_Not_At_Bitoffset_Zero use record A at 0 range 0 .. 7; B at 0 range 27 .. 64; end record; -- "gaps__second_bitfield_not_at_bitoffset_zero", size 72 -- Fields: -- "a", size 8, offset 0, bit offset 0 -- "b", size 32, offset 0, bit offset 27 Best wishes, Duncan. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LICM.cpp
Changes in directory llvm/lib/Transforms/Scalar: LICM.cpp updated: 1.91 -> 1.92 --- Log message: Switch more uses of DominatorTree over to ETForest. --- Diffs of the changes: (+24 -22) LICM.cpp | 46 -- 1 files changed, 24 insertions(+), 22 deletions(-) Index: llvm/lib/Transforms/Scalar/LICM.cpp diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.91 llvm/lib/Transforms/Scalar/LICM.cpp:1.92 --- llvm/lib/Transforms/Scalar/LICM.cpp:1.91Tue Apr 17 13:21:36 2007 +++ llvm/lib/Transforms/Scalar/LICM.cpp Wed Apr 18 00:43:13 2007 @@ -72,7 +72,8 @@ AU.setPreservesCFG(); AU.addRequiredID(LoopSimplifyID); AU.addRequired(); - AU.addRequired(); + AU.addRequired(); + AU.addRequired(); // For scalar promotion (mem2reg) AU.addRequired(); // For scalar promotion (mem2reg) AU.addRequired(); } @@ -86,6 +87,7 @@ // Various analyses that we use... AliasAnalysis *AA; // Current AliasAnalysis information LoopInfo *LI; // Current LoopInfo +ETForest *ET; // ETForest for the current Loop... DominatorTree *DT; // Dominator Tree for the current Loop... DominanceFrontier *DF; // Current Dominance Frontier @@ -98,19 +100,19 @@ /// SinkRegion - Walk the specified region of the CFG (defined by all blocks /// dominated by the specified block, and that are in the current loop) in -/// reverse depth first order w.r.t the DominatorTree. This allows us to +/// reverse depth first order w.r.t the ETForest. This allows us to /// visit uses before definitions, allowing us to sink a loop body in one /// pass without iteration. /// -void SinkRegion(DominatorTree::Node *N); +void SinkRegion(BasicBlock *BB); /// HoistRegion - Walk the specified region of the CFG (defined by all /// blocks dominated by the specified block, and that are in the current -/// loop) in depth first order w.r.t the DominatorTree. This allows us to +/// loop) in depth first order w.r.t the ETForest. This allows us to /// visit definitions before uses, allowing us to hoist a loop body in one /// pass without iteration. /// -void HoistRegion(DominatorTree::Node *N); +void HoistRegion(BasicBlock *BB); /// inSubLoop - Little predicate that returns true if the specified basic /// block is in a subloop of the current one, not the current one itself. @@ -135,21 +137,20 @@ if (BlockInLoop == LoopHeader) return true; - DominatorTree::Node *BlockInLoopNode = DT->getNode(BlockInLoop); - DominatorTree::Node *IDom= DT->getNode(ExitBlock); + BasicBlock *IDom = ExitBlock; // Because the exit block is not in the loop, we know we have to get _at // least_ its immediate dominator. do { // Get next Immediate Dominator. -IDom = IDom->getIDom(); +IDom = ET->getIDom(IDom); // If we have got to the header of the loop, then the instructions block // did not dominate the exit node, so we can't hoist it. -if (IDom->getBlock() == LoopHeader) +if (IDom == LoopHeader) return false; - } while (IDom != BlockInLoopNode); + } while (IDom != BlockInLoop); return true; } @@ -213,6 +214,7 @@ LI = &getAnalysis(); AA = &getAnalysis(); DF = &getAnalysis(); + ET = &getAnalysis(); DT = &getAnalysis(); CurAST = new AliasSetTracker(*AA); @@ -252,8 +254,8 @@ // us to sink instructions in one pass, without iteration. AFter sinking // instructions, we perform another pass to hoist them out of the loop. // - SinkRegion(DT->getNode(L->getHeader())); - HoistRegion(DT->getNode(L->getHeader())); + SinkRegion(L->getHeader()); + HoistRegion(L->getHeader()); // Now that all loop invariants have been removed from the loop, promote any // memory references to scalars that we can... @@ -270,19 +272,19 @@ /// SinkRegion - Walk the specified region of the CFG (defined by all blocks /// dominated by the specified block, and that are in the current loop) in -/// reverse depth first order w.r.t the DominatorTree. This allows us to visit +/// reverse depth first order w.r.t the ETForest. This allows us to visit /// uses before definitions, allowing us to sink a loop body in one pass without /// iteration. /// -void LICM::SinkRegion(DominatorTree::Node *N) { - assert(N != 0 && "Null dominator tree node?"); - BasicBlock *BB = N->getBlock(); +void LICM::SinkRegion(BasicBlock *BB) { + assert(BB != 0 && "Null sink block?"); // If this subregion is not in the top level loop at all, exit. if (!CurLoop->contains(BB)) return; // We are processing blocks in reverse dfo, so process children first... - const std::vector &Children = N->getChildren(); + std::vector Children; + ET->getChildren(BB, Children); for (unsigned i = 0, e = Children
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/bigint.c bigint.reference_output
Changes in directory llvm-test/SingleSource/UnitTests/Integer: bigint.c updated: 1.7 -> 1.8 bigint.reference_output updated: 1.1 -> 1.2 --- Log message: Try bigger integer bit widths. --- Diffs of the changes: (+3 -3) bigint.c|2 +- bigint.reference_output |4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) Index: llvm-test/SingleSource/UnitTests/Integer/bigint.c diff -u llvm-test/SingleSource/UnitTests/Integer/bigint.c:1.7 llvm-test/SingleSource/UnitTests/Integer/bigint.c:1.8 --- llvm-test/SingleSource/UnitTests/Integer/bigint.c:1.7 Tue Apr 17 19:53:49 2007 +++ llvm-test/SingleSource/UnitTests/Integer/bigint.c Wed Apr 18 00:40:12 2007 @@ -17,7 +17,7 @@ const uint10 bnd = 1023; -int169 x = 0xULL; +int500 x = 0xULL; int169 y = -0xabcdefdeULL; int my_test() Index: llvm-test/SingleSource/UnitTests/Integer/bigint.reference_output diff -u llvm-test/SingleSource/UnitTests/Integer/bigint.reference_output:1.1 llvm-test/SingleSource/UnitTests/Integer/bigint.reference_output:1.2 --- llvm-test/SingleSource/UnitTests/Integer/bigint.reference_output:1.1 Thu Jan 18 20:22:46 2007 +++ llvm-test/SingleSource/UnitTests/Integer/bigint.reference_outputWed Apr 18 00:40:12 2007 @@ -1,3 +1,3 @@ -rem = -56805 -rem2 = -97569 +rem = 54392 +rem2 = 143376 exit 0 ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp
Changes in directory llvm/lib/Transforms/Scalar: CorrelatedExprs.cpp updated: 1.56 -> 1.57 --- Log message: Use ETForest instead of DominatorTree. --- Diffs of the changes: (+11 -11) CorrelatedExprs.cpp | 22 +++--- 1 files changed, 11 insertions(+), 11 deletions(-) Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.56 llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.57 --- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.56 Thu Mar 1 01:54:15 2007 +++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp Wed Apr 18 00:25:43 2007 @@ -224,14 +224,12 @@ std::map RankMap; std::map RegionInfoMap; ETForest *EF; -DominatorTree *DT; public: virtual bool runOnFunction(Function &F); // We don't modify the program, so we preserve all analyses virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); - AU.addRequired(); AU.addRequiredID(BreakCriticalEdgesID); }; @@ -302,7 +300,6 @@ // tree. Note that our traversal will not even touch unreachable basic // blocks. EF = &getAnalysis(); - DT = &getAnalysis(); std::set VisitedBlocks; bool Changed = TransformRegion(&F.getEntryBlock(), VisitedBlocks); @@ -349,14 +346,16 @@ // blocks that are dominated by this one, we can safely propagate the // information down now. // - DominatorTree::Node *BBN = (*DT)[BB]; - if (!RI.empty())// Time opt: only propagate if we can change something -for (unsigned i = 0, e = BBN->getChildren().size(); i != e; ++i) { - BasicBlock *Dominated = BBN->getChildren()[i]->getBlock(); - assert(RegionInfoMap.find(Dominated) == RegionInfoMap.end() && + std::vector children; + EF->getChildren(BB, children); + if (!RI.empty()) {// Time opt: only propagate if we can change something +for (std::vector::iterator CI = children.begin(), E = children.end(); + CI != E; ++CI) { + assert(RegionInfoMap.find(*CI) == RegionInfoMap.end() && "RegionInfo should be calculated in dominanace order!"); - getRegionInfo(Dominated) = RI; + getRegionInfo(*CI) = RI; } + } // Now that all of our successors have information if they deserve it, // propagate any information our terminator instruction finds to our @@ -379,8 +378,9 @@ } // Now that all of our successors have information, recursively process them. - for (unsigned i = 0, e = BBN->getChildren().size(); i != e; ++i) -Changed |= TransformRegion(BBN->getChildren()[i]->getBlock(),VisitedBlocks); + for (std::vector::iterator CI = children.begin(), E = children.end(); + CI != E; ++CI) +Changed |= TransformRegion(*CI, VisitedBlocks); return Changed; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Analysis/Dominators.h ET-Forest.h
Changes in directory llvm/include/llvm/Analysis: Dominators.h updated: 1.73 -> 1.74 ET-Forest.h updated: 1.9 -> 1.10 --- Log message: Add accessor to get the blocks immediately dominated by a given block to ETForest. --- Diffs of the changes: (+22 -0) Dominators.h | 14 ++ ET-Forest.h |8 2 files changed, 22 insertions(+) Index: llvm/include/llvm/Analysis/Dominators.h diff -u llvm/include/llvm/Analysis/Dominators.h:1.73 llvm/include/llvm/Analysis/Dominators.h:1.74 --- llvm/include/llvm/Analysis/Dominators.h:1.73Tue Apr 17 23:38:39 2007 +++ llvm/include/llvm/Analysis/Dominators.h Wed Apr 18 00:25:09 2007 @@ -327,6 +327,20 @@ const ETNode *idom = NodeA->getFather(); return idom ? idom->getData() : 0; } + + void getChildren(BasicBlock *A, std::vector& children) { +ETNode *NodeA = getNode(A); +const ETNode* son = NodeA->getSon(); + +if (!son) return; +children.push_back(son->getData()); + +const ETNode* brother = son->getBrother(); +while (brother != son) { + children.push_back(brother->getData()); + brother = brother->getBrother(); +} + } virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); Index: llvm/include/llvm/Analysis/ET-Forest.h diff -u llvm/include/llvm/Analysis/ET-Forest.h:1.9 llvm/include/llvm/Analysis/ET-Forest.h:1.10 --- llvm/include/llvm/Analysis/ET-Forest.h:1.9 Wed Feb 21 13:57:33 2007 +++ llvm/include/llvm/Analysis/ET-Forest.h Wed Apr 18 00:25:09 2007 @@ -275,6 +275,14 @@ return DFSNumOut; } + const ETNode *getSon() const { +return Son; + } + + const ETNode *getBrother() const { +return Left; + } + private: // Data represented by the node void *data; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp LiveVariables.cpp PHIElimination.cpp TwoAddressInstructionPass.cpp
Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.236 -> 1.237 LiveVariables.cpp updated: 1.72 -> 1.73 PHIElimination.cpp updated: 1.56 -> 1.57 TwoAddressInstructionPass.cpp updated: 1.46 -> 1.47 --- Log message: VarInfo::UsedBlocks is no longer used. Remove. --- Diffs of the changes: (+2 -17) LiveIntervalAnalysis.cpp |3 +-- LiveVariables.cpp |9 + PHIElimination.cpp|3 --- TwoAddressInstructionPass.cpp |4 4 files changed, 2 insertions(+), 17 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.236 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.237 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.236 Tue Apr 17 21:30:19 2007 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Apr 18 00:04:38 2007 @@ -1058,10 +1058,9 @@ for (const unsigned *AS = mri_->getAliasSet(repDstReg); *AS; ++AS) getInterval(*AS).MergeInClobberRanges(SrcInt); } else { -// Merge UsedBlocks info if the destination is a virtual register. +// Merge use info if the destination is a virtual register. LiveVariables::VarInfo& dVI = lv_->getVarInfo(repDstReg); LiveVariables::VarInfo& sVI = lv_->getVarInfo(repSrcReg); -dVI.UsedBlocks |= sVI.UsedBlocks; dVI.NumUses += sVI.NumUses; } Index: llvm/lib/CodeGen/LiveVariables.cpp diff -u llvm/lib/CodeGen/LiveVariables.cpp:1.72 llvm/lib/CodeGen/LiveVariables.cpp:1.73 --- llvm/lib/CodeGen/LiveVariables.cpp:1.72 Tue Apr 17 15:22:11 2007 +++ llvm/lib/CodeGen/LiveVariables.cpp Wed Apr 18 00:04:38 2007 @@ -48,9 +48,6 @@ cerr << " Alive in blocks: "; for (unsigned i = 0, e = AliveBlocks.size(); i != e; ++i) if (AliveBlocks[i]) cerr << i << ", "; - cerr << " Used in blocks: "; - for (unsigned i = 0, e = UsedBlocks.size(); i != e; ++i) -if (UsedBlocks[i]) cerr << i << ", "; cerr << "\n Killed by:"; if (Kills.empty()) cerr << " No instructions.\n"; @@ -73,7 +70,6 @@ } VarInfo &VI = VirtRegInfo[RegIdx]; VI.AliveBlocks.resize(MF->getNumBlockIDs()); - VI.UsedBlocks.resize(MF->getNumBlockIDs()); return VI; } @@ -138,9 +134,6 @@ MachineInstr *MI) { assert(VRInfo.DefInst && "Register use before def!"); - unsigned BBNum = MBB->getNumber(); - - VRInfo.UsedBlocks[BBNum] = true; VRInfo.NumUses++; // Check to see if this basic block is already a kill block... @@ -163,7 +156,7 @@ // If this virtual register is already marked as alive in this basic block, // that means it is alive in at least one of the successor block, it's not // a kill. - if (!VRInfo.AliveBlocks[BBNum]) + if (!VRInfo.AliveBlocks[MBB->getNumber()]) VRInfo.Kills.push_back(MI); // Update all dominating blocks to mark them known live. Index: llvm/lib/CodeGen/PHIElimination.cpp diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.56 llvm/lib/CodeGen/PHIElimination.cpp:1.57 --- llvm/lib/CodeGen/PHIElimination.cpp:1.56Tue Apr 17 19:36:11 2007 +++ llvm/lib/CodeGen/PHIElimination.cpp Wed Apr 18 00:04:38 2007 @@ -163,8 +163,6 @@ // Realize that the destination register is defined by the PHI copy now, not // the PHI itself. LV->getVarInfo(DestReg).DefInst = PHICopy; - -LV->getVarInfo(IncomingReg).UsedBlocks[MBB.getNumber()] = true; } // Adjust the VRegPHIUseCount map to account for the removal of this PHI @@ -215,7 +213,6 @@ // instruction kills the incoming value. // LiveVariables::VarInfo &InRegVI = LV->getVarInfo(SrcReg); -InRegVI.UsedBlocks[opBlock.getNumber()] = true; // Loop over all of the successors of the basic block, checking to see // if the value is either live in the block, or if it is killed in the Index: llvm/lib/CodeGen/TwoAddressInstructionPass.cpp diff -u llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.46 llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.47 --- llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.46 Sun Mar 18 04:02:31 2007 +++ llvm/lib/CodeGen/TwoAddressInstructionPass.cpp Wed Apr 18 00:04:38 2007 @@ -197,10 +197,6 @@ LiveVariables::VarInfo& varInfo = LV.getVarInfo(regA); varInfo.DefInst = prevMi; - // update live variables for regB - LiveVariables::VarInfo& varInfoB = LV.getVarInfo(regB); - // regB is used in this BB. - varInfoB.UsedBlocks[mbbi->getNumber()] = true; if (LV.removeVirtualRegisterKilled(regB, mbbi, mi)) LV.addVirtualRegisterKilled(regB, prevMi); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h
Changes in directory llvm/include/llvm/CodeGen: LiveVariables.h updated: 1.37 -> 1.38 --- Log message: VarInfo::UsedBlocks is no longer used. Remove. --- Diffs of the changes: (+0 -4) LiveVariables.h |4 1 files changed, 4 deletions(-) Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.37 llvm/include/llvm/CodeGen/LiveVariables.h:1.38 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.37 Tue Apr 17 15:22:11 2007 +++ llvm/include/llvm/CodeGen/LiveVariables.h Wed Apr 18 00:04:38 2007 @@ -79,10 +79,6 @@ /// BitVector AliveBlocks; -/// UsedBlocks - Set of blocks of which this value is actually used. This -/// is a bit set which uses the basic block number as an index. -BitVector UsedBlocks; - /// NumUses - Number of uses of this register across the entire function. /// unsigned NumUses; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/ADCE.cpp
Changes in directory llvm/lib/Transforms/Scalar: ADCE.cpp updated: 1.104 -> 1.105 --- Log message: Use ETForest instead of DominatorTree. --- Diffs of the changes: (+15 -19) ADCE.cpp | 34 +++--- 1 files changed, 15 insertions(+), 19 deletions(-) Index: llvm/lib/Transforms/Scalar/ADCE.cpp diff -u llvm/lib/Transforms/Scalar/ADCE.cpp:1.104 llvm/lib/Transforms/Scalar/ADCE.cpp:1.105 --- llvm/lib/Transforms/Scalar/ADCE.cpp:1.104 Mon Feb 12 20:10:56 2007 +++ llvm/lib/Transforms/Scalar/ADCE.cpp Tue Apr 17 23:55:33 2007 @@ -68,7 +68,7 @@ // can be marked live that wouldn't necessarily be otherwise. AU.addRequired(); AU.addRequired(); -AU.addRequired(); +AU.addRequired(); AU.addRequired(); } @@ -246,8 +246,8 @@ // have any post-dominance information, thus we cannot perform our // transformations safely. // - PostDominatorTree &DT = getAnalysis(); - if (DT[&Func->getEntryBlock()] == 0) { + PostETForest &ET = getAnalysis(); + if (ET.getNodeForBlock(&Func->getEntryBlock()) == 0) { WorkList.clear(); return MadeChanges; } @@ -258,7 +258,7 @@ // function which unwinds, exits or has side-effects, we don't want to delete // the infinite loop or those blocks leading up to it. for (Function::iterator I = Func->begin(), E = Func->end(); I != E; ++I) -if (DT[I] == 0 && ReachableBBs.count(I)) +if (ET.getNodeForBlock(I) == 0 && ReachableBBs.count(I)) for (pred_iterator PI = pred_begin(I), E = pred_end(I); PI != E; ++PI) markInstructionLive((*PI)->getTerminator()); @@ -383,16 +383,16 @@ // postdominator that is alive, and the last postdominator that is // dead... // - PostDominatorTree::Node *LastNode = DT[TI->getSuccessor(i)]; - PostDominatorTree::Node *NextNode = 0; - - if (LastNode) { -NextNode = LastNode->getIDom(); -while (!AliveBlocks.count(NextNode->getBlock())) { - LastNode = NextNode; - NextNode = NextNode->getIDom(); - if (NextNode == 0) { -LastNode = 0; + BasicBlock *LastDead = TI->getSuccessor(i); + BasicBlock *NextAlive = 0; + + if (LastDead) { +NextAlive = ET.getIDom(LastDead); +while (!AliveBlocks.count(NextAlive)) { + LastDead = NextAlive; + NextAlive = ET.getIDom(NextAlive); + if (NextAlive == 0) { +LastDead = 0; break; } } @@ -406,7 +406,7 @@ // drawback of ADCE, so in the future if we choose to revisit the // decision, this is where it should be. // - if (LastNode == 0) {// No postdominator! + if (LastDead == 0) {// No postdominator! if (!isa(TI)) { // Call RemoveSuccessor to transmogrify the terminator instruction // to not contain the outgoing branch, or to create a new @@ -427,10 +427,6 @@ } } else { -// Get the basic blocks that we need... -BasicBlock *LastDead = LastNode->getBlock(); -BasicBlock *NextAlive = NextNode->getBlock(); - // Make the conditional branch now go to the next alive block... TI->getSuccessor(i)->removePredecessor(BB); TI->setSuccessor(i, NextAlive); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Utils/CodeExtractor.cpp
Changes in directory llvm/lib/Transforms/Utils: CodeExtractor.cpp updated: 1.53 -> 1.54 --- Log message: Use new ETForest accessor. --- Diffs of the changes: (+4 -4) CodeExtractor.cpp |8 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/lib/Transforms/Utils/CodeExtractor.cpp diff -u llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.53 llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.54 --- llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.53Mon Apr 16 13:10:23 2007 +++ llvm/lib/Transforms/Utils/CodeExtractor.cpp Tue Apr 17 23:46:35 2007 @@ -142,14 +142,14 @@ // Okay, update dominator sets. The blocks that dominate the new one are the // blocks that dominate TIBB plus the new block itself. if (EF) { -DominatorTree::Node* idom = DT->getNode(OldPred)->getIDom(); -DT->createNewNode(NewBB, idom); -EF->addNewBlock(NewBB, idom->getBlock()); +BasicBlock* idom = EF->getIDom(OldPred); +DT->createNewNode(NewBB, DT->getNode(idom)); +EF->addNewBlock(NewBB, idom); // Additionally, NewBB replaces OldPred as the immediate dominator of blocks Function *F = Header->getParent(); for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) - if (DT->getNode(I)->getIDom()->getBlock() == OldPred) { + if (EF->getIDom(I) == OldPred) { DT->changeImmediateDominator(DT->getNode(I), DT->getNode(NewBB)); EF->setImmediateDominator(I, NewBB); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Utils/LCSSA.cpp
Changes in directory llvm/lib/Transforms/Utils: LCSSA.cpp updated: 1.36 -> 1.37 --- Log message: Use ETForest instead of DominatorTree. --- Diffs of the changes: (+18 -21) LCSSA.cpp | 39 ++- 1 files changed, 18 insertions(+), 21 deletions(-) Index: llvm/lib/Transforms/Utils/LCSSA.cpp diff -u llvm/lib/Transforms/Utils/LCSSA.cpp:1.36 llvm/lib/Transforms/Utils/LCSSA.cpp:1.37 --- llvm/lib/Transforms/Utils/LCSSA.cpp:1.36Sat Apr 14 17:10:17 2007 +++ llvm/lib/Transforms/Utils/LCSSA.cpp Tue Apr 17 23:39:32 2007 @@ -49,7 +49,7 @@ struct VISIBILITY_HIDDEN LCSSA : public FunctionPass { // Cached analysis information for the current function. LoopInfo *LI; -DominatorTree *DT; +ETForest *ET; std::vector LoopBlocks; virtual bool runOnFunction(Function &F); @@ -66,14 +66,14 @@ AU.addRequiredID(LoopSimplifyID); AU.addPreservedID(LoopSimplifyID); AU.addRequired(); - AU.addRequired(); + AU.addRequired(); } private: void getLoopValuesUsedOutsideLoop(Loop *L, SetVector &AffectedValues); -Value *GetValueForBlock(DominatorTree::Node *BB, Instruction *OrigInst, -std::map &Phis); +Value *GetValueForBlock(BasicBlock *BB, Instruction *OrigInst, +std::map &Phis); /// inLoop - returns true if the given block is within the current loop const bool inLoop(BasicBlock* B) { @@ -92,7 +92,7 @@ bool changed = false; LI = &getAnalysis(); - DT = &getAnalysis(); + ET = &getAnalysis(); for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) changed |= visitSubloop(*I); @@ -142,18 +142,17 @@ ++NumLCSSA; // We are applying the transformation // Keep track of the blocks that have the value available already. - std::map Phis; + std::map Phis; - DominatorTree::Node *InstrNode = DT->getNode(Instr->getParent()); + //ETNode *InstrNode = ET->getNodeForBlock(Instr->getParent()); // Insert the LCSSA phi's into the exit blocks (dominated by the value), and // add them to the Phi's map. for (std::vector::const_iterator BBI = exitBlocks.begin(), BBE = exitBlocks.end(); BBI != BBE; ++BBI) { BasicBlock *BB = *BBI; -DominatorTree::Node *ExitBBNode = DT->getNode(BB); -Value *&Phi = Phis[ExitBBNode]; -if (!Phi && InstrNode->dominates(ExitBBNode)) { +Value *&Phi = Phis[BB]; +if (!Phi && ET->dominates(Instr->getParent(), BB)) { PHINode *PN = new PHINode(Instr->getType(), Instr->getName()+".lcssa", BB->begin()); PN->reserveOperandSpace(std::distance(pred_begin(BB), pred_end(BB))); @@ -186,7 +185,7 @@ // Otherwise, patch up uses of the value with the appropriate LCSSA Phi, // inserting PHI nodes into join points where needed. -Value *Val = GetValueForBlock(DT->getNode(UserBB), Instr, Phis); +Value *Val = GetValueForBlock(UserBB, Instr, Phis); // Preincrement the iterator to avoid invalidating it when we change the // value. @@ -225,8 +224,8 @@ /// GetValueForBlock - Get the value to use within the specified basic block. /// available values are in Phis. -Value *LCSSA::GetValueForBlock(DominatorTree::Node *BB, Instruction *OrigInst, - std::map &Phis) { +Value *LCSSA::GetValueForBlock(BasicBlock *BB, Instruction *OrigInst, + std::map &Phis) { // If there is no dominator info for this BB, it is unreachable. if (BB == 0) return UndefValue::get(OrigInst->getType()); @@ -235,7 +234,7 @@ Value *&V = Phis[BB]; if (V) return V; - DominatorTree::Node *IDom = BB->getIDom(); + BasicBlock* IDom = ET->getIDom(BB); // Otherwise, there are two cases: we either have to insert a PHI node or we // don't. We need to insert a PHI node if this block is not dominated by one @@ -248,24 +247,22 @@ // dominate this block. Note that we *know* that the block defining the // original instruction is in the idom chain, because if it weren't, then the // original value didn't dominate this use. - if (!inLoop(IDom->getBlock())) { + if (!inLoop(IDom)) { // Idom is not in the loop, we must still be "below" the exit block and must // be fully dominated by the value live in the idom. return V = GetValueForBlock(IDom, OrigInst, Phis); } - BasicBlock *BBN = BB->getBlock(); - // Otherwise, the idom is the loop, so we need to insert a PHI node. Do so // now, then get values to fill in the incoming values for the PHI. PHINode *PN = new PHINode(OrigInst->getType(), OrigInst->getName()+".lcssa", -BBN->begin()); - PN->reserveOperandSpace(std::distance(pred_begin(BBN), pred_end(BBN))); +BB->begin()); + PN->reserveOperandSpace(std::distance(pred_begin(BB), pred_end(BB))); V = PN;
[llvm-commits] CVS: llvm/include/llvm/Analysis/Dominators.h
Changes in directory llvm/include/llvm/Analysis: Dominators.h updated: 1.72 -> 1.73 --- Log message: Add an accessor to make ETForest more useful. --- Diffs of the changes: (+7 -0) Dominators.h |7 +++ 1 files changed, 7 insertions(+) Index: llvm/include/llvm/Analysis/Dominators.h diff -u llvm/include/llvm/Analysis/Dominators.h:1.72 llvm/include/llvm/Analysis/Dominators.h:1.73 --- llvm/include/llvm/Analysis/Dominators.h:1.72Sun Apr 15 18:14:18 2007 +++ llvm/include/llvm/Analysis/Dominators.h Tue Apr 17 23:38:39 2007 @@ -320,6 +320,13 @@ return NULL; return Common->getData(); } + + /// Return the immediate dominator of A. + BasicBlock *getIDom(BasicBlock *A) { +ETNode *NodeA = getNode(A); +const ETNode *idom = NodeA->getFather(); +return idom ? idom->getData() : 0; + } virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.292 -> 1.293 --- Log message: allow SRL to simplify its operands, as it doesn't demand all bits as input. --- Diffs of the changes: (+7 -1) DAGCombiner.cpp |8 +++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.292 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.293 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.292 Tue Apr 17 22:05:22 2007 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Apr 17 22:06:49 2007 @@ -1728,7 +1728,7 @@ // if (shl x, c) is known to be zero, return 0 if (TLI.MaskedValueIsZero(SDOperand(N, 0), MVT::getIntVTBitMask(VT))) return DAG.getConstant(0, VT); - if (SimplifyDemandedBits(SDOperand(N, 0))) + if (N1C && SimplifyDemandedBits(SDOperand(N, 0))) return SDOperand(N, 0); // fold (shl (shl x, c1), c2) -> 0 or (shl x, c1+c2) if (N1C && N0.getOpcode() == ISD::SHL && @@ -1907,6 +1907,12 @@ return DAG.getNode(ISD::XOR, VT, Op, DAG.getConstant(1, VT)); } } + + // fold operands of srl based on knowledge that the low bits are not + // demanded. + if (N1C && SimplifyDemandedBits(SDOperand(N, 0))) +return SDOperand(N, 0); + return SDOperand(); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.291 -> 1.292 --- Log message: When replacing a node in SimplifyDemandedBits, if the old node used any single-use nodes, they will be dead soon. Make sure to remove them before processing other nodes. This implements CodeGen/X86/shl_elim.ll --- Diffs of the changes: (+8 -1) DAGCombiner.cpp |9 - 1 files changed, 8 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.291 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.292 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.291 Tue Apr 17 14:03:21 2007 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Apr 17 22:05:22 2007 @@ -182,6 +182,13 @@ // something else needing this node. if (TLO.Old.Val->use_empty()) { removeFromWorkList(TLO.Old.Val); + +// If the operands of this node are only used by the node, they will now +// be dead. Make sure to visit them first to delete dead nodes early. +for (unsigned i = 0, e = TLO.Old.Val->getNumOperands(); i != e; ++i) + if (TLO.Old.Val->getOperand(i).Val->hasOneUse()) +AddToWorkList(TLO.Old.Val->getOperand(i).Val); + DAG.DeleteNode(TLO.Old.Val); } return true; @@ -1838,6 +1845,7 @@ // if (srl x, c) is known to be zero, return 0 if (N1C && TLI.MaskedValueIsZero(SDOperand(N, 0), ~0ULL >> (64-OpSizeInBits))) return DAG.getConstant(0, VT); + // fold (srl (srl x, c1), c2) -> 0 or (srl x, c1+c2) if (N1C && N0.getOpcode() == ISD::SRL && N0.getOperand(1).getOpcode() == ISD::Constant) { @@ -1899,7 +1907,6 @@ return DAG.getNode(ISD::XOR, VT, Op, DAG.getConstant(1, VT)); } } - return SDOperand(); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CodeGen/X86/shl_elim.ll
Changes in directory llvm/test/CodeGen/X86: shl_elim.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+13 -0) shl_elim.ll | 13 + 1 files changed, 13 insertions(+) Index: llvm/test/CodeGen/X86/shl_elim.ll diff -c /dev/null llvm/test/CodeGen/X86/shl_elim.ll:1.1 *** /dev/null Tue Apr 17 22:04:47 2007 --- llvm/test/CodeGen/X86/shl_elim.ll Tue Apr 17 22:04:37 2007 *** *** 0 --- 1,13 + ; RUN: llvm-as < %s | llc -march=x86 | grep {movl 8(.esp), %eax} + ; RUN: llvm-as < %s | llc -march=x86 | grep {shll .15, .eax} + ; RUN: llvm-as < %s | llc -march=x86 | grep {sarl .16, .eax} + + define i32 @test1(i64 %a) { + %tmp29 = lshr i64 %a, 24; [#uses=1] + %tmp23 = trunc i64 %tmp29 to i32; [#uses=1] + %tmp410 = lshr i32 %tmp23, 9; [#uses=1] + %tmp45 = trunc i32 %tmp410 to i16 ; [#uses=1] + %tmp456 = sext i16 %tmp45 to i32; [#uses=1] + ret i32 %tmp456 + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: TargetLowering.cpp updated: 1.111 -> 1.112 --- Log message: fix a pasto --- Diffs of the changes: (+1 -1) TargetLowering.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp diff -u llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.111 llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.112 --- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.111 Tue Apr 17 17:53:02 2007 +++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cppTue Apr 17 22:01:40 2007 @@ -583,7 +583,7 @@ SDOperand NewSA = TLO.DAG.getConstant(ShAmt-C1, Op.getOperand(1).getValueType()); MVT::ValueType VT = Op.getValueType(); - return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SRL, VT, + return TLO.CombineTo(Op, TLO.DAG.getNode(Opc, VT, InOp.getOperand(0), NewSA)); } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CodeGen/X86/2007-04-17-LiveIntervalAssert.ll
Changes in directory llvm/test/CodeGen/X86: 2007-04-17-LiveIntervalAssert.ll added (r1.1) --- Log message: New crasher test case. --- Diffs of the changes: (+42 -0) 2007-04-17-LiveIntervalAssert.ll | 42 +++ 1 files changed, 42 insertions(+) Index: llvm/test/CodeGen/X86/2007-04-17-LiveIntervalAssert.ll diff -c /dev/null llvm/test/CodeGen/X86/2007-04-17-LiveIntervalAssert.ll:1.1 *** /dev/null Tue Apr 17 21:35:20 2007 --- llvm/test/CodeGen/X86/2007-04-17-LiveIntervalAssert.ll Tue Apr 17 21:35:10 2007 *** *** 0 --- 1,42 + ; RUN: llvm-as < %s | llc -mtriple=i686-apple-darwin -relocation-model=pic --disable-fp-elim + + %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 } + %struct.__sFILEX = type opaque + %struct.__sbuf = type { i8*, i32 } + %struct.partition_def = type { i32, [1 x %struct.partition_elem] } + %struct.partition_elem = type { i32, %struct.partition_elem*, i32 } + + define void @partition_print(%struct.partition_def* %part) { + entry: + br i1 false, label %bb.preheader, label %bb99 + + bb.preheader: ; preds = %entry + br i1 false, label %cond_true, label %cond_next90 + + cond_true:; preds = %bb.preheader + br i1 false, label %bb32, label %bb87.critedge + + bb32: ; preds = %bb32, %cond_true + %i.2115.0 = phi i32 [ 0, %cond_true ], [ %indvar.next127, %bb32 ] ; [#uses=1] + %c.2112.0 = phi i32 [ 0, %cond_true ], [ %tmp49, %bb32 ] ; [#uses=1] + %tmp43 = getelementptr %struct.partition_def* %part, i32 0, i32 1, i32 %c.2112.0, i32 1 ; <%struct.partition_elem**> [#uses=1] + %tmp44 = load %struct.partition_elem** %tmp43 ; <%struct.partition_elem*> [#uses=1] + %tmp4445 = ptrtoint %struct.partition_elem* %tmp44 to i32 ; [#uses=1] + %tmp48 = sub i32 %tmp4445, 0; [#uses=1] + %tmp49 = sdiv i32 %tmp48, 12; [#uses=1] + %indvar.next127 = add i32 %i.2115.0, 1 ; [#uses=2] + %exitcond128 = icmp eq i32 %indvar.next127, 0 ; [#uses=1] + br i1 %exitcond128, label %bb58, label %bb32 + + bb58: ; preds = %bb32 + ret void + + bb87.critedge:; preds = %cond_true + ret void + + cond_next90: ; preds = %bb.preheader + ret void + + bb99: ; preds = %entry + ret void + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h
Changes in directory llvm/include/llvm/CodeGen: LiveIntervalAnalysis.h updated: 1.78 -> 1.79 --- Log message: Don't populate TryAgainList when coalescing only physical registers with virtual registers. --- Diffs of the changes: (+1 -1) LiveIntervalAnalysis.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h diff -u llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.78 llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.79 --- llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.78 Tue Apr 17 15:32:26 2007 +++ llvm/include/llvm/CodeGen/LiveIntervalAnalysis.hTue Apr 17 21:30:19 2007 @@ -205,7 +205,7 @@ /// CopyCoallesceInMBB - Coallsece copies in the specified MBB, putting /// copies that cannot yet be coallesced into the "TryAgain" list. void CopyCoallesceInMBB(MachineBasicBlock *MBB, - std::vector &TryAgain, bool PhysOnly = false); + std::vector *TryAgain, bool PhysOnly = false); /// JoinCopy - Attempt to join intervals corresponding to SrcReg/DstReg, /// which are the src/dst of the copy instruction CopyMI. This returns true ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.235 -> 1.236 --- Log message: Don't populate TryAgainList when coalescing only physical registers with virtual registers. --- Diffs of the changes: (+6 -6) LiveIntervalAnalysis.cpp | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.235 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.236 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.235 Tue Apr 17 15:32:26 2007 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Apr 17 21:30:19 2007 @@ -1473,7 +1473,7 @@ void LiveIntervals::CopyCoallesceInMBB(MachineBasicBlock *MBB, -std::vector &TryAgain, bool PhysOnly) { +std::vector *TryAgain, bool PhysOnly) { DOUT << ((Value*)MBB->getBasicBlock())->getName() << ":\n"; for (MachineBasicBlock::iterator MII = MBB->begin(), E = MBB->end(); @@ -1484,8 +1484,8 @@ unsigned SrcReg, DstReg; if (!tii_->isMoveInstr(*Inst, SrcReg, DstReg)) continue; -if (!JoinCopy(Inst, SrcReg, DstReg, PhysOnly)) - TryAgain.push_back(getCopyRec(Inst, SrcReg, DstReg)); +if (TryAgain && !JoinCopy(Inst, SrcReg, DstReg, PhysOnly)) + TryAgain->push_back(getCopyRec(Inst, SrcReg, DstReg)); } } @@ -1502,7 +1502,7 @@ // If there are no loops in the function, join intervals in function order. for (MachineFunction::iterator I = mf_->begin(), E = mf_->end(); I != E; ++I) - CopyCoallesceInMBB(I, TryAgainList); + CopyCoallesceInMBB(I, &TryAgainList); } else { // Otherwise, join intervals in inner loops before other intervals. // Unfortunately we can't just iterate over loop hierarchy here because @@ -1519,9 +1519,9 @@ // Finally, join intervals in loop nest order. for (unsigned i = 0, e = MBBs.size(); i != e; ++i) - CopyCoallesceInMBB(MBBs[i].second, TryAgainList, true); + CopyCoallesceInMBB(MBBs[i].second, NULL, true); for (unsigned i = 0, e = MBBs.size(); i != e; ++i) - CopyCoallesceInMBB(MBBs[i].second, TryAgainList, false); + CopyCoallesceInMBB(MBBs[i].second, &TryAgainList, false); } // Joining intervals can allow other intervals to be joined. Iteratively join ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/PostDominators.cpp
Changes in directory llvm/lib/Analysis: PostDominators.cpp updated: 1.66 -> 1.67 --- Log message: Cache DT[*SI] lookup. --- Diffs of the changes: (+4 -2) PostDominators.cpp |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/Analysis/PostDominators.cpp diff -u llvm/lib/Analysis/PostDominators.cpp:1.66 llvm/lib/Analysis/PostDominators.cpp:1.67 --- llvm/lib/Analysis/PostDominators.cpp:1.66 Tue Apr 17 19:53:01 2007 +++ llvm/lib/Analysis/PostDominators.cppTue Apr 17 20:19:55 2007 @@ -282,10 +282,12 @@ if (BB) for (pred_iterator SI = pred_begin(BB), SE = pred_end(BB); - SI != SE; ++SI) + SI != SE; ++SI) { // Does Node immediately dominate this predecessor? - if (DT[*SI] && DT[*SI]->getIDom() != Node) + DominatorTree::Node *SINode = DT[*SI]; + if (SINode && SINode->getIDom() != Node) S.insert(*SI); +} // At this point, S is DFlocal. Now we union in DFup's of our children... // Loop through and visit the nodes that Node immediately dominates (Node's ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp
Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.269 -> 1.270 --- Log message: don't access argument list of prototypes --- Diffs of the changes: (+24 -7) AsmWriter.cpp | 31 --- 1 files changed, 24 insertions(+), 7 deletions(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.269 llvm/lib/VMCore/AsmWriter.cpp:1.270 --- llvm/lib/VMCore/AsmWriter.cpp:1.269 Thu Apr 12 13:32:50 2007 +++ llvm/lib/VMCore/AsmWriter.cpp Tue Apr 17 19:57:22 2007 @@ -970,13 +970,30 @@ // Loop over the arguments, printing them... unsigned Idx = 1; - for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end(); - I != E; ++I) { -// Insert commas as we go... the first arg doesn't get a comma -if (I != F->arg_begin()) Out << ", "; -printArgument(I, (Attrs ? Attrs->getParamAttrs(Idx) -: uint16_t(ParamAttr::None))); -Idx++; + if (!F->isDeclaration()) { +// If this isn't a declaration, print the argument names as well. +for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end(); + I != E; ++I) { + // Insert commas as we go... the first arg doesn't get a comma + if (I != F->arg_begin()) Out << ", "; + printArgument(I, (Attrs ? Attrs->getParamAttrs(Idx) + : uint16_t(ParamAttr::None))); + Idx++; +} + } else { +// Otherwise, print the types from the function type. +for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) { + // Insert commas as we go... the first arg doesn't get a comma + if (i) Out << ", "; + + // Output type... + printType(FT->getParamType(i)); + + unsigned ArgAttrs = ParamAttr::None; + if (Attrs) ArgAttrs = Attrs->getParamAttrs(i+1); + if (ArgAttrs != ParamAttr::None) +Out << ' ' << ParamAttrsList::getParamAttrsText(ArgAttrs); +} } // Finish printing arguments... ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/bit_set.c bit_set.reference_output bit_set_cpp.cpp bit_set_cpp.reference_output constval.cpp constval.reference_output arith.c array.c bigi
Changes in directory llvm-test/SingleSource/UnitTests/Integer: bit_set.c added (r1.1) bit_set.reference_output added (r1.1) bit_set_cpp.cpp added (r1.1) bit_set_cpp.reference_output added (r1.1) constval.cpp added (r1.1) constval.reference_output added (r1.1) arith.c updated: 1.8 -> 1.9 array.c updated: 1.6 -> 1.7 bigint.c updated: 1.6 -> 1.7 bit_concat.c updated: 1.3 -> 1.4 bit_concat_cpp.cpp updated: 1.2 -> 1.3 bit_select.c updated: 1.3 -> 1.4 bit_select_cpp.cpp updated: 1.1 -> 1.2 bitbit.c updated: 1.6 -> 1.7 bitlogic.c updated: 1.6 -> 1.7 bits.h updated: 1.1 -> 1.2 cppfield2.cpp updated: 1.1 -> 1.2 matrix.c updated: 1.8 -> 1.9 part_select.c updated: 1.3 -> 1.4 part_select_cpp.cpp updated: 1.1 -> 1.2 part_select_cpp.reference_output updated: 1.1 -> 1.2 arith.h (r1.1) removed array.h (r1.1) removed bigint.h (r1.1) removed bitbit.h (r1.1) removed bitlogic.h (r1.1) removed matrix.h (r1.2) removed --- Log message: Clean this test suite up. Remove unnecessary header files. Make all the bit tests use standard typenaming conventions and macros for builtins. Add more tests for other bit manipulation intrinsics. --- Diffs of the changes: (+329 -121) arith.c |2 array.c |2 bigint.c |3 - bit_concat.c | 10 ++-- bit_concat_cpp.cpp |6 +- bit_select.c |6 +- bit_select_cpp.cpp |2 bit_set.c| 37 +++ bit_set.reference_output | 49 bit_set_cpp.cpp | 34 + bit_set_cpp.reference_output | 49 bitbit.c |2 bitlogic.c |2 bits.h | 58 +++ constval.cpp | 28 +++ constval.reference_output|3 + cppfield2.cpp| 13 ++--- matrix.c |2 part_select.c| 20 ++-- part_select_cpp.cpp | 27 --- part_select_cpp.reference_output | 95 +++ 21 files changed, 329 insertions(+), 121 deletions(-) Index: llvm-test/SingleSource/UnitTests/Integer/bit_set.c diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/bit_set.c:1.1 *** /dev/null Tue Apr 17 19:54:00 2007 --- llvm-test/SingleSource/UnitTests/Integer/bit_set.c Tue Apr 17 19:53:49 2007 *** *** 0 --- 1,37 + //===--- bit_select.c --- Test The bit_select builtin -===// + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===--===// + // + // This test case tests the __builtin_bit_select builtin function llvm-gcc. + // bit_select selects one bit out of a larger + // + //===--===// + + #include + #include "bits.h" + + #ifdef ENABLE_LARGE_INTEGERS + typedef uint250 BitType; + BitType X = 0; + #else + typedef uint47 BitType; + BitType X = 0; + #endif + + int main(int argc, char** argv) + { + + int i; + + printBits(X); + printf("\n"); + for (i = bitwidthof(BitType); i > 0; --i) { + X = bit_set(X, 1, i-1); + printBits(X); + printf("\n"); + } + return 0; + } Index: llvm-test/SingleSource/UnitTests/Integer/bit_set.reference_output diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/bit_set.reference_output:1.1 *** /dev/null Tue Apr 17 19:54:07 2007 --- llvm-test/SingleSource/UnitTests/Integer/bit_set.reference_output Tue Apr 17 19:53:49 2007 *** *** 0 --- 1,49 + 000 + 100 + 110 + 111 + 000 + 100 + 110 + 111 + 000 + 100 + 110 + 111 + 000 + 100 + 110 + 111 + 000 + 100 + 110 + 111 + 000 + 100 + 1
[llvm-commits] CVS: llvm/lib/Analysis/PostDominators.cpp
Changes in directory llvm/lib/Analysis: PostDominators.cpp updated: 1.65 -> 1.66 --- Log message: Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070416/047971.html --- Diffs of the changes: (+1 -1) PostDominators.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Analysis/PostDominators.cpp diff -u llvm/lib/Analysis/PostDominators.cpp:1.65 llvm/lib/Analysis/PostDominators.cpp:1.66 --- llvm/lib/Analysis/PostDominators.cpp:1.65 Sun Apr 15 18:14:18 2007 +++ llvm/lib/Analysis/PostDominators.cppTue Apr 17 19:53:01 2007 @@ -284,7 +284,7 @@ for (pred_iterator SI = pred_begin(BB), SE = pred_end(BB); SI != SE; ++SI) // Does Node immediately dominate this predecessor? - if (DT[*SI]->getIDom() != Node) + if (DT[*SI] && DT[*SI]->getIDom() != Node) S.insert(*SI); // At this point, S is DFlocal. Now we union in DFup's of our children... ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Analysis/Dominators/2007-04-17-PostDominanceFrontier.ll
Changes in directory llvm/test/Analysis/Dominators: 2007-04-17-PostDominanceFrontier.ll added (r1.1) --- Log message: New test. --- Diffs of the changes: (+692 -0) 2007-04-17-PostDominanceFrontier.ll | 692 1 files changed, 692 insertions(+) Index: llvm/test/Analysis/Dominators/2007-04-17-PostDominanceFrontier.ll diff -c /dev/null llvm/test/Analysis/Dominators/2007-04-17-PostDominanceFrontier.ll:1.1 *** /dev/null Tue Apr 17 19:51:53 2007 --- llvm/test/Analysis/Dominators/2007-04-17-PostDominanceFrontier.ll Tue Apr 17 19:51:43 2007 *** *** 0 --- 1,692 + ; RUN: llvm-upgrade < %s | llvm-as | opt -postdomfrontier -disable-output + + void @SManager() { + entry: + br label %bb.outer + + bb.outer: ; preds = %bb193, %entry + br label %bb.outer156 + + bb.loopexit: ; preds = %bb442 + br label %bb.outer156 + + bb.outer156: ; preds = %bb.loopexit, %bb.outer + br label %bb + + bb: ; preds = %bb.backedge, %bb.outer156 + br i1 false, label %cond_true, label %bb.cond_next_crit_edge + + bb.cond_next_crit_edge: ; preds = %bb + br label %cond_next + + cond_true:; preds = %bb + br label %cond_next + + cond_next:; preds = %cond_true, %bb.cond_next_crit_edge + br i1 false, label %cond_next.bb.backedge_crit_edge, label %cond_next107 + + cond_next.bb.backedge_crit_edge: ; preds = %cond_next + br label %bb.backedge + + bb.backedge: ; preds = %cond_true112.bb.backedge_crit_edge, %cond_next.bb.backedge_crit_edge + br label %bb + + cond_next107: ; preds = %cond_next + br i1 false, label %cond_true112, label %cond_next197 + + cond_true112: ; preds = %cond_next107 + br i1 false, label %cond_true118, label %cond_true112.bb.backedge_crit_edge + + cond_true112.bb.backedge_crit_edge: ; preds = %cond_true112 + br label %bb.backedge + + cond_true118: ; preds = %cond_true112 + br i1 false, label %bb123.preheader, label %cond_true118.bb148_crit_edge + + cond_true118.bb148_crit_edge: ; preds = %cond_true118 + br label %bb148 + + bb123.preheader: ; preds = %cond_true118 + br label %bb123 + + bb123:; preds = %bb142.bb123_crit_edge, %bb123.preheader + br i1 false, label %bb123.bb142_crit_edge, label %cond_next.i57 + + bb123.bb142_crit_edge:; preds = %bb123 + br label %bb142 + + cond_next.i57:; preds = %bb123 + br i1 false, label %cond_true135, label %cond_next.i57.bb142_crit_edge + + cond_next.i57.bb142_crit_edge:; preds = %cond_next.i57 + br label %bb142 + + cond_true135: ; preds = %cond_next.i57 + br label %bb142 + + bb142:; preds = %cond_true135, %cond_next.i57.bb142_crit_edge, %bb123.bb142_crit_edge + br i1 false, label %bb148.loopexit, label %bb142.bb123_crit_edge + + bb142.bb123_crit_edge:; preds = %bb142 + br label %bb123 + + bb148.loopexit: ; preds = %bb142 + br label %bb148 + + bb148:; preds = %bb148.loopexit, %cond_true118.bb148_crit_edge + br i1 false, label %bb151.preheader, label %bb148.bb177_crit_edge + + bb148.bb177_crit_edge:; preds = %bb148 + br label %bb177 + + bb151.preheader: ; preds = %bb148 + br label %bb151 + + bb151:; preds = %bb171.bb151_crit_edge, %bb151.preheader + br i1 false, label %bb151.bb171_crit_edge, label %cond_next.i49 + + bb151.bb171_crit_edge:; preds = %bb151 + br label %bb171 + + cond_next.i49:; preds = %bb151 + br i1 false, label %cond_true164, label %cond_next.i49.bb171_crit_edge + + cond_next.i49.bb171_crit_edge:; preds = %cond_next.i49 + br label %bb171 + + cond_true164: ; preds = %cond_next.i49 + br label %bb171 + + bb171:; preds = %cond_true164, %cond_next.i49.bb171_crit_edge, %bb151.bb171_crit_edge + br i1 false, label %bb177.loopexit, label %bb171.bb151_crit_edge + + bb171.bb151_crit_edge:; preds = %bb171 + br label %bb151 + + bb177.loopexit: ; preds = %bb171 + br label %bb177 + + bb177:; preds = %bb177.loopexit, %bb148.bb177_crit_edge + br i1 false, label %bb180.preheader, label %bb177.bb193_crit_edge + + bb177.bb193_crit_edge:; preds = %bb177 + br label %bb193 + + bb180.preheader: ; preds = %bb177 + br label %bb180 + + bb180:; preds = %bb180.bb180_crit_edge, %bb180.preheader + br i1 false, label %bb193.loopexit, label %bb180.bb180_crit_edge + + bb180.bb180_crit_edge:; preds = %bb180 + br label %bb180 + + bb193.loopexit: ; preds
[llvm-commits] CVS: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h
Changes in directory llvm/include/llvm/Analysis: ScalarEvolutionExpander.h updated: 1.14 -> 1.15 --- Log message: what's an & between friends? --- Diffs of the changes: (+1 -1) ScalarEvolutionExpander.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h diff -u llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.14 llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.15 --- llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.14 Fri Apr 13 00:04:18 2007 +++ llvm/include/llvm/Analysis/ScalarEvolutionExpander.hTue Apr 17 19:43:05 2007 @@ -92,7 +92,7 @@ /// InsertBinop - Insert the specified binary operator, doing a small amount /// of work to avoid inserting an obviously redundant operation. static Value *InsertBinop(Instruction::BinaryOps Opcode, Value *LHS, - Value *RHS, Instruction *InsertPt); + Value *RHS, Instruction *&InsertPt); protected: Value *expand(SCEV *S) { // Check to see if we already expanded this. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/PHIElimination.cpp
Changes in directory llvm/lib/CodeGen: PHIElimination.cpp updated: 1.55 -> 1.56 --- Log message: Increment use count of new virtuals created during PHI elimination. --- Diffs of the changes: (+3 -0) PHIElimination.cpp |3 +++ 1 files changed, 3 insertions(+) Index: llvm/lib/CodeGen/PHIElimination.cpp diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.55 llvm/lib/CodeGen/PHIElimination.cpp:1.56 --- llvm/lib/CodeGen/PHIElimination.cpp:1.55Sun Mar 18 04:02:31 2007 +++ llvm/lib/CodeGen/PHIElimination.cpp Tue Apr 17 19:36:11 2007 @@ -138,6 +138,9 @@ if (LV) { MachineInstr *PHICopy = prior(AfterPHIsIt); +// Increment use count of the newly created virtual register. +LV->getVarInfo(IncomingReg).NumUses++; + // Add information to LiveVariables to know that the incoming value is // killed. Note that because the value is defined in several places (once // each for each incoming block), the "def" block and instruction fields ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp
Changes in directory llvm-poolalloc/lib/PoolAllocate: TransformFunctionBody.cpp updated: 1.63 -> 1.64 --- Log message: This is really really ugly --- Diffs of the changes: (+2 -1) TransformFunctionBody.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp diff -u llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.63 llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.64 --- llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.63 Tue Apr 17 18:38:04 2007 +++ llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp Tue Apr 17 19:29:02 2007 @@ -654,7 +654,8 @@ Value *Align = ConstantInt::get(Type::Int32Ty,0); Value* Opts[3] = {ArgVal, ElSize, Align}; new CallInst(PAInfo.PoolInit, Opts, 3,"", TheCall); - new CallInst(PAInfo.PoolDestroy, ArgVal, "", TheCall+1); + BasicBlock::iterator BBI = TheCall; + new CallInst(PAInfo.PoolDestroy, ArgVal, "", ++BBI); } //probably need to update DSG // std::cerr << "WARNING: NULL POOL ARGUMENTS ARE PASSED IN!\n"; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp
> @@ -654,7 +654,7 @@ > Value *Align = ConstantInt::get(Type::Int32Ty,0); >Value* Opts[3] = {ArgVal, ElSize, Align}; > new CallInst(PAInfo.PoolInit, Opts, 3,"", TheCall); > - new CallInst(PAInfo.PoolDestroy, ArgVal, "", TheCall->getNext > ()); > + new CallInst(PAInfo.PoolDestroy, ArgVal, "", TheCall+1); > } FWIW, this isn't right: you are passing in a pointer past the call instruction :) -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolutionExpander.cpp
Changes in directory llvm/lib/Analysis: ScalarEvolutionExpander.cpp updated: 1.16 -> 1.17 --- Log message: Be more careful when inserting reused instructions. This fixes CodeGen/Generic/2007-04-17-lsr-crash.ll --- Diffs of the changes: (+7 -2) ScalarEvolutionExpander.cpp |9 +++-- 1 files changed, 7 insertions(+), 2 deletions(-) Index: llvm/lib/Analysis/ScalarEvolutionExpander.cpp diff -u llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.16 llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.17 --- llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.16 Fri Apr 13 00:04:18 2007 +++ llvm/lib/Analysis/ScalarEvolutionExpander.cpp Tue Apr 17 18:43:50 2007 @@ -71,15 +71,20 @@ /// InsertBinop - Insert the specified binary operator, doing a small amount /// of work to avoid inserting an obviously redundant operation. Value *SCEVExpander::InsertBinop(Instruction::BinaryOps Opcode, Value *LHS, - Value *RHS, Instruction *InsertPt) { + Value *RHS, Instruction *&InsertPt) { // Do a quick scan to see if we have this binop nearby. If so, reuse it. unsigned ScanLimit = 6; for (BasicBlock::iterator IP = InsertPt, E = InsertPt->getParent()->begin(); ScanLimit; --IP, --ScanLimit) { if (BinaryOperator *BinOp = dyn_cast(IP)) if (BinOp->getOpcode() == Opcode && BinOp->getOperand(0) == LHS && - BinOp->getOperand(1) == RHS) + BinOp->getOperand(1) == RHS) { +// If we found the instruction *at* the insert point, insert later +// instructions after it. +if (BinOp == InsertPt) + InsertPt = ++IP; return BinOp; + } if (IP == E) break; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CodeGen/Generic/2007-04-17-lsr-crash.ll
Changes in directory llvm/test/CodeGen/Generic: 2007-04-17-lsr-crash.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+35 -0) 2007-04-17-lsr-crash.ll | 35 +++ 1 files changed, 35 insertions(+) Index: llvm/test/CodeGen/Generic/2007-04-17-lsr-crash.ll diff -c /dev/null llvm/test/CodeGen/Generic/2007-04-17-lsr-crash.ll:1.1 *** /dev/null Tue Apr 17 18:43:41 2007 --- llvm/test/CodeGen/Generic/2007-04-17-lsr-crash.ll Tue Apr 17 18:43:31 2007 *** *** 0 --- 1,35 + ; RUN: llvm-as < %s | llc + + define void @foo(i32 %inTextSize) { + entry: + br label %bb236.outer + + cond_next193: ; preds = %bb236 + %tmp211 = add i32 %inTextSize_addr.1.ph17, -2 ; [#uses=1] + br i1 false, label %cond_next232, label %cond_true227 + + cond_true227: ; preds = %cond_next193 + ret void + + cond_next232: ; preds = %cond_next193 + %indvar.next49 = add i32 %indvar48, 1 ; [#uses=1] + br label %bb236.outer + + bb236.outer: ; preds = %cond_next232, %entry + %indvar48 = phi i32 [ %indvar.next49, %cond_next232 ], [ 0, %entry ] ; [#uses=2] + %inTextSize_addr.1.ph17 = phi i32 [ %tmp211, %cond_next232 ], [ %inTextSize, %entry ] ; [#uses=3] + %tmp.50 = sub i32 0, %indvar48 ; [#uses=1] + %tmp219 = icmp eq i32 %tmp.50, 0; [#uses=1] + br i1 %tmp219, label %bb236.us, label %bb236 + + bb236.us: ; preds = %bb236.outer + %inTextSize_addr.1.us = add i32 0, %inTextSize_addr.1.ph17 ; [#uses=0] + ret void + + bb236:; preds = %bb236.outer + %tmp238 = icmp eq i32 %inTextSize_addr.1.ph17, 0; [#uses=1] + br i1 %tmp238, label %exit, label %cond_next193 + + exit: ; preds = %bb236 + ret void + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-poolalloc/lib/DSA/BottomUpClosure.cpp CallTargets.cpp DataStructure.cpp DataStructureAA.cpp DataStructureOpt.cpp DataStructureStats.cpp GraphChecker.cpp Local.cpp Printer.cpp
Changes in directory llvm-poolalloc/lib/DSA: BottomUpClosure.cpp updated: 1.131 -> 1.132 CallTargets.cpp updated: 1.11 -> 1.12 DataStructure.cpp updated: 1.260 -> 1.261 DataStructureAA.cpp updated: 1.42 -> 1.43 DataStructureOpt.cpp updated: 1.18 -> 1.19 DataStructureStats.cpp updated: 1.27 -> 1.28 GraphChecker.cpp updated: 1.24 -> 1.25 Local.cpp updated: 1.169 -> 1.170 Printer.cpp updated: 1.93 -> 1.94 Steensgaard.cpp updated: 1.70 -> 1.71 TopDownClosure.cpp updated: 1.99 -> 1.100 --- Log message: Normalize Flag names and functions, also add a couple informative ones --- Diffs of the changes: (+74 -78) BottomUpClosure.cpp|4 ++-- CallTargets.cpp|4 ++-- DataStructure.cpp | 38 +- DataStructureAA.cpp| 12 ++-- DataStructureOpt.cpp |6 +++--- DataStructureStats.cpp |2 +- GraphChecker.cpp | 16 Local.cpp | 42 +- Printer.cpp| 16 Steensgaard.cpp| 10 +- TopDownClosure.cpp |2 +- 11 files changed, 74 insertions(+), 78 deletions(-) Index: llvm-poolalloc/lib/DSA/BottomUpClosure.cpp diff -u llvm-poolalloc/lib/DSA/BottomUpClosure.cpp:1.131 llvm-poolalloc/lib/DSA/BottomUpClosure.cpp:1.132 --- llvm-poolalloc/lib/DSA/BottomUpClosure.cpp:1.131Wed Apr 11 12:37:43 2007 +++ llvm-poolalloc/lib/DSA/BottomUpClosure.cpp Tue Apr 17 18:41:06 2007 @@ -133,7 +133,7 @@ if (CS.isDirectCall()) { if (isResolvableFunc(CS.getCalleeFunc())) Callees.push_back(CS.getCalleeFunc()); - } else if (!CS.getCalleeNode()->isIncomplete()) { + } else if (!CS.getCalleeNode()->isIncompleteNode()) { // Get all callees. unsigned OldSize = Callees.size(); CS.getCalleeNode()->addFullFunctionList(Callees); @@ -313,7 +313,7 @@ // Free should take a single pointer argument, mark it as heap memory. DSNodeHandle N(new DSNode(0, DSG)); -N.getNode()->setHeapNodeMarker(); +N.getNode()->setHeapMarker(); DSG->getNodeForValue(F->arg_begin()).mergeWith(N); } else { Index: llvm-poolalloc/lib/DSA/CallTargets.cpp diff -u llvm-poolalloc/lib/DSA/CallTargets.cpp:1.11 llvm-poolalloc/lib/DSA/CallTargets.cpp:1.12 --- llvm-poolalloc/lib/DSA/CallTargets.cpp:1.11 Fri Feb 23 16:49:32 2007 +++ llvm-poolalloc/lib/DSA/CallTargets.cpp Tue Apr 17 18:41:06 2007 @@ -53,11 +53,11 @@ DSNode* N = T->getDSGraph(*cs.getCaller()) .getNodeForValue(cs.getCalledValue()).getNode(); N->addFullFunctionList(IndMap[cs]); - if (N->isComplete() && IndMap[cs].size()) { + if (N->isCompleteNode() && IndMap[cs].size()) { CompleteSites.insert(cs); ++CompleteInd; } - if (N->isComplete() && !IndMap[cs].size()) { + if (N->isCompleteNode() && !IndMap[cs].size()) { ++CompleteEmpty; cerr << "Call site empty: '" << cs.getInstruction()->getName() Index: llvm-poolalloc/lib/DSA/DataStructure.cpp diff -u llvm-poolalloc/lib/DSA/DataStructure.cpp:1.260 llvm-poolalloc/lib/DSA/DataStructure.cpp:1.261 --- llvm-poolalloc/lib/DSA/DataStructure.cpp:1.260 Wed Apr 11 12:37:43 2007 +++ llvm-poolalloc/lib/DSA/DataStructure.cppTue Apr 17 18:41:06 2007 @@ -182,7 +182,7 @@ void DSNode::assertOK() const { assert((Ty != Type::VoidTy || Ty == Type::VoidTy && (Size == 0 || - (NodeType & DSNode::Array))) && + (NodeType & DSNode::ArrayNode))) && "Node not OK!"); assert(ParentGraph && "Node has no parent?"); @@ -203,7 +203,7 @@ assert((Offset < To->Size || (Offset == To->Size && Offset == 0)) && "Forwarded offset is wrong!"); ForwardNH.setTo(To, Offset); - NodeType = DEAD; + NodeType = DeadNode; Size = 0; Ty = Type::VoidTy; @@ -252,7 +252,7 @@ // If this node has a size that is <= 1, we don't need to create a forwarding // node. if (getSize() <= 1) { -NodeType |= DSNode::Array; +NodeType |= DSNode::ArrayNode; Ty = Type::VoidTy; Size = 1; assert(Links.size() <= 1 && "Size is 1, but has more links?"); @@ -262,7 +262,7 @@ // some referrers may have an offset that is > 0. By forcing them to // forward, the forwarder has the opportunity to correct the offset. DSNode *DestNode = new DSNode(0, ParentGraph); -DestNode->NodeType = NodeType|DSNode::Array; +DestNode->NodeType = NodeType|DSNode::ArrayNode; DestNode->Ty = Type::VoidTy; DestNode->Size = 1; DestNode->Globals.swap(Globals); @@ -535,8 +535,8 @@ } Ty = NewTy; -NodeType &= ~Array; -if (WillBeArray) NodeType |= Array; +NodeType &= ~ArrayNode; +if (WillBeArray) NodeType |= ArrayNode; Size = NewTySize; // Calculate the number of outgoing links fro
[llvm-commits] CVS: llvm-poolalloc/include/dsa/DSGraph.h DSNode.h
Changes in directory llvm-poolalloc/include/dsa: DSGraph.h updated: 1.114 -> 1.115 DSNode.h updated: 1.61 -> 1.62 --- Log message: Normalize Flag names and functions, also add a couple informative ones --- Diffs of the changes: (+48 -43) DSGraph.h |8 ++--- DSNode.h | 83 -- 2 files changed, 48 insertions(+), 43 deletions(-) Index: llvm-poolalloc/include/dsa/DSGraph.h diff -u llvm-poolalloc/include/dsa/DSGraph.h:1.114 llvm-poolalloc/include/dsa/DSGraph.h:1.115 --- llvm-poolalloc/include/dsa/DSGraph.h:1.114 Wed Apr 11 12:37:43 2007 +++ llvm-poolalloc/include/dsa/DSGraph.hTue Apr 17 18:41:06 2007 @@ -415,7 +415,7 @@ for (node_iterator I = node_begin(), E = node_end(); I != E; ++I) I->maskNodeTypes(Mask); } - void maskIncompleteMarkers() { maskNodeTypes(~DSNode::Incomplete); } + void maskIncompleteMarkers() { maskNodeTypes(~DSNode::IncompleteNode); } // markIncompleteNodes - Traverse the graph, identifying nodes that may be // modified by other functions that have not been resolved yet. This marks @@ -564,13 +564,13 @@ ReachabilityCloner(DSGraph &dest, const DSGraph &src, unsigned cloneFlags) : Dest(dest), Src(src), CloneFlags(cloneFlags) { assert(&Dest != &Src && "Cannot clone from graph to same graph!"); -BitsToKeep = ~DSNode::DEAD; +BitsToKeep = ~DSNode::DeadNode; if (CloneFlags & DSGraph::StripAllocaBit) BitsToKeep &= ~DSNode::AllocaNode; if (CloneFlags & DSGraph::StripModRefBits) - BitsToKeep &= ~(DSNode::Modified | DSNode::Read); + BitsToKeep &= ~(DSNode::ModifiedNode | DSNode::ReadNode); if (CloneFlags & DSGraph::StripIncompleteBit) - BitsToKeep &= ~DSNode::Incomplete; + BitsToKeep &= ~DSNode::IncompleteNode; } DSNodeHandle getClonedNH(const DSNodeHandle &SrcNH); Index: llvm-poolalloc/include/dsa/DSNode.h diff -u llvm-poolalloc/include/dsa/DSNode.h:1.61 llvm-poolalloc/include/dsa/DSNode.h:1.62 --- llvm-poolalloc/include/dsa/DSNode.h:1.61Wed Dec 13 23:51:06 2006 +++ llvm-poolalloc/include/dsa/DSNode.h Tue Apr 17 18:41:06 2007 @@ -80,20 +80,23 @@ DSNode(const DSNode &); // DO NOT IMPLEMENT public: enum NodeTy { -ShadowNode = 0,// Nothing is known about this node... -AllocaNode = 1 << 0, // This node was allocated with alloca -HeapNode= 1 << 1, // This node was allocated with malloc -GlobalNode = 1 << 2, // This node was allocated by a global var decl -UnknownNode = 1 << 3, // This node points to unknown allocated memory -Incomplete = 1 << 4, // This node may not be complete +ShadowNode = 0,// Nothing is known about this node... +AllocaNode = 1 << 0, // This node was allocated with alloca +HeapNode= 1 << 1, // This node was allocated with malloc +GlobalNode = 1 << 2, // This node was allocated by a global var decl +UnknownNode = 1 << 3, // This node points to unknown allocated memory +IncompleteNode = 1 << 4, // This node may not be complete + +ModifiedNode= 1 << 5, // This node is modified in this context +ReadNode= 1 << 6, // This node is read in this context + +ArrayNode = 1 << 7, // This node is treated like an array +ExternalNode= 1 << 8, // This node comes from an external source +IntToPtrNode= 1 << 9, // This node comes from an int cast +PtrToIntNode= 1 << 10, // This node excapes to an int cast -Modified= 1 << 5, // This node is modified in this context -Read= 1 << 6, // This node is read in this context - -Array = 1 << 7, // This node is treated like an array -External= 1 << 8, // This node comes from an external source //#ifndef NDEBUG -DEAD= 1 << 9, // This node is dead and should not be pointed to +DeadNode= 1 << 11, // This node is dead and should not be pointed to //#endif Composition = AllocaNode | HeapNode | GlobalNode | UnknownNode @@ -147,7 +150,7 @@ /// const Type *getType() const { return Ty; } - bool isArray() const { return NodeType & Array; } + bool isArray() const { return NodeType & ArrayNode; } /// hasNoReferrers - Return true if nothing is pointing to this node at all. /// @@ -332,36 +335,38 @@ /// getNodeFlags - Return all of the flags set on the node. If the DEAD flag /// is set, hide it from the caller. /// - unsigned getNodeFlags() const { return NodeType & ~DEAD; } + unsigned getNodeFlags() const { return NodeType & ~DeadNode; } - bool isAllocaNode() const { return NodeType & AllocaNode; } - bool isHeapNode()const { return NodeType & HeapNode; } - bool isGlobalNode() const { return NodeType & GlobalNode; } - bool isUnknownNode() const { return NodeType & UnknownNode; } - - bool isModified() const { return NodeType & Modified; } - bool isRead() const
[llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp
Changes in directory llvm-poolalloc/lib/PoolAllocate: TransformFunctionBody.cpp updated: 1.62 -> 1.63 --- Log message: Fix --- Diffs of the changes: (+1 -1) TransformFunctionBody.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp diff -u llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.62 llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.63 --- llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.62 Wed Apr 11 12:27:53 2007 +++ llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp Tue Apr 17 18:38:04 2007 @@ -654,7 +654,7 @@ Value *Align = ConstantInt::get(Type::Int32Ty,0); Value* Opts[3] = {ArgVal, ElSize, Align}; new CallInst(PAInfo.PoolInit, Opts, 3,"", TheCall); - new CallInst(PAInfo.PoolDestroy, ArgVal, "", TheCall->getNext()); + new CallInst(PAInfo.PoolDestroy, ArgVal, "", TheCall+1); } //probably need to update DSG // std::cerr << "WARNING: NULL POOL ARGUMENTS ARE PASSED IN!\n"; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/MRegisterInfo.cpp
Changes in directory llvm/lib/Target: MRegisterInfo.cpp updated: 1.23 -> 1.24 --- Log message: Oops. Didn't mean to check in a quick hack. --- Diffs of the changes: (+16 -8) MRegisterInfo.cpp | 24 1 files changed, 16 insertions(+), 8 deletions(-) Index: llvm/lib/Target/MRegisterInfo.cpp diff -u llvm/lib/Target/MRegisterInfo.cpp:1.23 llvm/lib/Target/MRegisterInfo.cpp:1.24 --- llvm/lib/Target/MRegisterInfo.cpp:1.23 Tue Apr 17 15:23:34 2007 +++ llvm/lib/Target/MRegisterInfo.cpp Tue Apr 17 18:33:39 2007 @@ -34,18 +34,26 @@ MRegisterInfo::~MRegisterInfo() {} +/// getAllocatableSetForRC - Toggle the bits that represent allocatable +/// registers for the specific register class. +static void getAllocatableSetForRC(MachineFunction &MF, + const TargetRegisterClass *RC, BitVector &R){ + for (TargetRegisterClass::iterator I = RC->allocation_order_begin(MF), + E = RC->allocation_order_end(MF); I != E; ++I) +R.set(*I); +} + BitVector MRegisterInfo::getAllocatableSet(MachineFunction &MF, const TargetRegisterClass *RC) const { BitVector Allocatable(NumRegs); - for (MRegisterInfo::regclass_iterator I = regclass_begin(), - E = regclass_end(); I != E; ++I) { -const TargetRegisterClass *TRC = *I; -if (RC && TRC != RC) - continue; -for (TargetRegisterClass::iterator I = TRC->allocation_order_begin(MF), - E = TRC->allocation_order_end(MF); I != E; ++I) - Allocatable.set(*I); + if (RC) { +getAllocatableSetForRC(MF, RC, Allocatable); +return Allocatable; } + + for (MRegisterInfo::regclass_iterator I = regclass_begin(), + E = regclass_end(); I != E; ++I) +getAllocatableSetForRC(MF, *I, Allocatable); return Allocatable; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/bit_select.c
Changes in directory llvm-test/SingleSource/UnitTests/Integer: bit_select.c updated: 1.2 -> 1.3 --- Log message: Update to use bits.h --- Diffs of the changes: (+5 -6) bit_select.c | 11 +-- 1 files changed, 5 insertions(+), 6 deletions(-) Index: llvm-test/SingleSource/UnitTests/Integer/bit_select.c diff -u llvm-test/SingleSource/UnitTests/Integer/bit_select.c:1.2 llvm-test/SingleSource/UnitTests/Integer/bit_select.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/bit_select.c:1.2 Mon Feb 12 11:52:59 2007 +++ llvm-test/SingleSource/UnitTests/Integer/bit_select.c Tue Apr 17 18:18:07 2007 @@ -11,15 +11,14 @@ //===--===// #include +#include #ifdef ENABLE_LARGE_INTEGERS -typedef int __attribute__((bitwidth(250))) BitType; +typedef Int250 BitType; const BitType X = 0xULL; -int numbits = 250; #else -typedef int __attribute__((bitwidth(47))) BitType; +typedef Int47 BitType; const BitType X = 0xULL; -int numbits = 47; #endif int main(int argc, char** argv) @@ -33,8 +32,8 @@ BitType i; - for (i = numbits-1; i >= 0; --i) { -if (__builtin_bit_select(Y, i)) + for (i = bitwidthof(BitType); i > 0; --i) { +if (bit_select(Y, i-1)) printf("1"); else printf("0"); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/bit_concat.c bit_concat_cpp.cpp bit_concat_cpp.reference_output bit_concat.reference_output
Changes in directory llvm-test/SingleSource/UnitTests/Integer: bit_concat.c updated: 1.2 -> 1.3 bit_concat_cpp.cpp updated: 1.1 -> 1.2 bit_concat_cpp.reference_output updated: 1.1 -> 1.2 bit_concat.reference_output updated: 1.2 -> 1.3 --- Log message: Revise this test to use the new header file and to shift before we add so that we don't alway have the low order bit being 0. Update reference output as a consequence of the formula change. --- Diffs of the changes: (+233 -261) bit_concat.c| 40 ++ bit_concat.reference_output | 172 ++--- bit_concat_cpp.cpp | 46 ++- bit_concat_cpp.reference_output | 236 4 files changed, 233 insertions(+), 261 deletions(-) Index: llvm-test/SingleSource/UnitTests/Integer/bit_concat.c diff -u llvm-test/SingleSource/UnitTests/Integer/bit_concat.c:1.2 llvm-test/SingleSource/UnitTests/Integer/bit_concat.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/bit_concat.c:1.2 Mon Feb 12 14:57:48 2007 +++ llvm-test/SingleSource/UnitTests/Integer/bit_concat.c Tue Apr 17 18:12:36 2007 @@ -1,4 +1,4 @@ -//===--- part_select.c --- Test The bit_select builtin ===// +//===--- bit_concat.c --- Test The bit_concat builtin ===// // // This file was developed by Reid Spencer and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. @@ -12,28 +12,14 @@ #include #include +#include "bits.h" -typedef unsigned int __attribute__((bitwidth(17))) BitType1; -typedef unsigned int __attribute__((bitwidth(19))) BitType2; -typedef unsigned long long __attribute__((bitwidth(36))) ConcatType; -int numbits1 = 17; -int numbits2 = 19; - -void printBits(ConcatType val, int numbits ) { - int j; - for (j = numbits; j > 0; --j) { -if (__builtin_bit_select(val, j)) - printf("1"); -else - printf("0"); - } -} int main(int argc, char** argv) { - BitType1 X = 0; - BitType2 Y = 0; - ConcatType Z = 0; + Int17 X = 0; + Int19 Y = 0; + Int36 Z = 0; int i, j; int count = (argc > 1 ? atoi(argv[1]) % 128 : 128); @@ -41,21 +27,21 @@ for (i = 0; i < count; i++) { Y = X = 0; -for (j = 0; j < numbits1; j++) { - X += (rand() % 2 == 0 ? 0 : 1); +for (j = 0; j < bitwidthof(Int17); j++) { X <<= 1; + X += (rand() % 2 == 0 ? 0 : 1); } -for (j = 0; j < numbits2; j++) { - Y += (rand() % 2 == 0 ? 0 : 1); +for (j = 0; j < bitwidthof(Int19); j++) { Y <<= 1; + Y += (rand() % 2 == 0 ? 0 : 1); } -Z = __builtin_bit_concat(X, Y); +Z = bit_concat(X, Y); printf("bit_concat("); -printBits(X, numbits1); +printBits(X); printf(","); -printBits(Y, numbits2); +printBits(Y); printf(") = "); -printBits(Z, numbits1 + numbits2); +printBits(Z); printf("\n"); } return 0; Index: llvm-test/SingleSource/UnitTests/Integer/bit_concat_cpp.cpp diff -u llvm-test/SingleSource/UnitTests/Integer/bit_concat_cpp.cpp:1.1 llvm-test/SingleSource/UnitTests/Integer/bit_concat_cpp.cpp:1.2 --- llvm-test/SingleSource/UnitTests/Integer/bit_concat_cpp.cpp:1.1 Wed Mar 28 11:31:50 2007 +++ llvm-test/SingleSource/UnitTests/Integer/bit_concat_cpp.cpp Tue Apr 17 18:12:36 2007 @@ -12,50 +12,36 @@ #include #include - -typedef unsigned int __attribute__((bitwidth(17))) BitType1; -typedef unsigned int __attribute__((bitwidth(19))) BitType2; -typedef unsigned long long __attribute__((bitwidth(36))) ConcatType; -int numbits1 = 17; -int numbits2 = 19; - -void printBits(ConcatType val, int numbits ) { - int j; - for (j = numbits; j > 0; --j) { -if (__builtin_bit_select(val, j)) - printf("1"); -else - printf("0"); - } -} +#include "bits.h" int main(int argc, char** argv) { - BitType1 X = 0; - BitType2 Y = 0; - ConcatType Z = 0; - int i, j; int count = (argc > 1 ? atoi(argv[1]) % 128 : 128); + Int17 X = 0; + Int19 Y = 0; + Int36 Z = 0; + srand(count); - for (i = 0; i < count; i++) { + for (int i = 0; i < count; i++) { Y = X = 0; -for (j = 0; j < numbits1; j++) { - X += (rand() % 2 == 0 ? 0 : 1); +for (int j = 0; j < bitwidthof(X); j++) { X <<= 1; + X += (rand() % 2 == 0 ? 0 : 1); } -for (j = 0; j < numbits2; j++) { - Y += (rand() % 2 == 0 ? 0 : 1); +for (int j = 0; j < bitwidthof(Y); j++) { Y <<= 1; + Y += (rand() % 2 == 0 ? 0 : 1); } -Z = __builtin_bit_concat(X, Y); +Z = bit_concat(X, Y); printf("bit_concat("); -printBits(X, numbits1); +printBits(X); +printf("(%d),",int(X)); printf(","); -printBits(Y, numbits2); -printf(") = "); -printBits(Z, numbits1 + numbits2); +printBits(Y); +printf("(%d)) = ",int(Y)); +printBits(Z); printf("\n"); } return 0; Index: llvm-test/SingleSource/UnitTests/Integer/bit_concat_cpp.refere
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/bits.h
Changes in directory llvm-test/SingleSource/UnitTests/Integer: bits.h added (r1.1) --- Log message: Add a helper header file for these test cases. --- Diffs of the changes: (+89 -0) bits.h | 89 + 1 files changed, 89 insertions(+) Index: llvm-test/SingleSource/UnitTests/Integer/bits.h diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/bits.h:1.1 *** /dev/null Tue Apr 17 18:10:30 2007 --- llvm-test/SingleSource/UnitTests/Integer/bits.h Tue Apr 17 18:10:20 2007 *** *** 0 --- 1,89 + //===--- bits.h --- Test The bit_select builtin ---===// + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===--===// + // + // This header file contains some type and macro definitiosn useful for working + // with bit accurate types and the bitwise builtins + // + //===--===// + + #include + #include + + typedef unsigned int __attribute__((bitwidth(1))) Int1; + typedef unsigned int __attribute__((bitwidth(2))) Int2; + typedef unsigned int __attribute__((bitwidth(3))) Int3; + typedef unsigned int __attribute__((bitwidth(4))) Int4; + typedef unsigned int __attribute__((bitwidth(5))) Int5; + typedef unsigned int __attribute__((bitwidth(6))) Int6; + typedef unsigned int __attribute__((bitwidth(7))) Int7; + typedef unsigned int __attribute__((bitwidth(8))) Int8; + typedef unsigned int __attribute__((bitwidth(16))) Int16; + typedef unsigned int __attribute__((bitwidth(17))) Int17; + typedef unsigned int __attribute__((bitwidth(19))) Int19; + typedef unsigned int __attribute__((bitwidth(17))) Int32; + typedef unsigned int __attribute__((bitwidth(36))) Int36; + typedef unsigned int __attribute__((bitwidth(47))) Int47; + typedef unsigned int __attribute__((bitwidth(48))) Int48; + typedef unsigned int __attribute__((bitwidth(64))) Int64; + typedef unsigned int __attribute__((bitwidth(65))) Int65; + typedef unsigned int __attribute__((bitwidth(128))) Int128; + /*typedef unsigned int __attribute__((bitwidth(256))) Int256; */ + + #define bitwidthof(TORV) (__bitwidthof__(typeof(TORV))) + + #define bit_concat(X, Y) ({ \ + unsigned int __attribute__((bitwidth(__bitwidthof__(X)+__bitwidthof__(Y R; \ + typeof(X) X2 = X; \ + typeof(Y) Y2 = Y; \ + __builtin_bit_concat(&R, &X2, &Y2); \ + R; \ + }) + + #define bit_select(Val, Bit) ({ \ + typeof(Val) Val2 = Val; \ + __builtin_bit_select(&Val2, Bit); \ + }) + + #define bit_set(Val, Repl, Bit) ({ \ + typeof(Val) Result = 0; \ + typeof(Val) Val2 = Val; \ + typeof(Repl) Repl2 = Repl; \ + __builtin_bit_set(&Result, &Val2, &Repl, Bit); \ + Result; \ + }) + + + #define part_select(Val, Lo, Hi) ({ \ + typeof(Val) Result = 0; \ + typeof(Val) Val2 = Val; \ + __builtin_bit_part_select(&Result, &Val2, Lo, Hi); \ + Result; \ + }) + + #define part_set(Val, Repl, Lo, Hi) ({ \ + typeof(Val) Result = 0; \ + typeof(Val) Val2 = Val; \ + typeof(Repl) Repl2 = Repl; \ + __builtin_bit_part_set(&Result, &Val2, &Repl2, Lo, Hi); \ + Result; \ + }) + + #define reduce(how, what) { \ + typeof(what) what2 = what; \ + __bulitin_bit_reduce_ ## how(&what2); \ + } + + #define printBits(val) { \ + int bit = bitwidthof(val); \ + for ( ; bit > 0; --bit) { \ + if (bit_select(val, bit-1)) \ + putchar('1'); \ + else \ + putchar('0'); \ + } \ + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: TargetLowering.cpp updated: 1.110 -> 1.111 --- Log message: Fix a bug in my previous patch, grabbing the shift amount width from the wrong operand. --- Diffs of the changes: (+2 -2) TargetLowering.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp diff -u llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.110 llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.111 --- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.110 Tue Apr 17 16:14:16 2007 +++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cppTue Apr 17 17:53:02 2007 @@ -581,7 +581,7 @@ } SDOperand NewSA = -TLO.DAG.getConstant(ShAmt-C1, Op.getOperand(0).getValueType()); +TLO.DAG.getConstant(ShAmt-C1, Op.getOperand(1).getValueType()); MVT::ValueType VT = Op.getValueType(); return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SRL, VT, InOp.getOperand(0), NewSA)); @@ -619,7 +619,7 @@ } SDOperand NewSA = -TLO.DAG.getConstant(Diff, Op.getOperand(0).getValueType()); +TLO.DAG.getConstant(Diff, Op.getOperand(1).getValueType()); return TLO.CombineTo(Op, TLO.DAG.getNode(Opc, VT, InOp.getOperand(0), NewSA)); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/ARM/ARMInstrInfo.td
Changes in directory llvm/lib/Target/ARM: ARMInstrInfo.td updated: 1.95 -> 1.96 --- Log message: dag combiner just got better at pruning bits. This fixes CodeGen/ARM/rev.ll --- Diffs of the changes: (+1 -1) ARMInstrInfo.td |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.95 llvm/lib/Target/ARM/ARMInstrInfo.td:1.96 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.95Sun Apr 1 20:30:03 2007 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Tue Apr 17 17:39:58 2007 @@ -982,7 +982,7 @@ "revsh $dst, $src", [(set GPR:$dst, (sext_inreg -(or (srl (and GPR:$src, 0x), 8), +(or (srl (and GPR:$src, 0xFF00), 8), (shl GPR:$src, 8)), i16))]>, Requires<[IsARM, HasV6]>; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Target/MRegisterInfo.cpp
> MRegisterInfo::~MRegisterInfo() {} > > -BitVector MRegisterInfo::getAllocatableSet(MachineFunction &MF) > const { > +BitVector MRegisterInfo::getAllocatableSet(MachineFunction &MF, > + const > TargetRegisterClass *RC) const { >BitVector Allocatable(NumRegs); >for (MRegisterInfo::regclass_iterator I = regclass_begin(), > E = regclass_end(); I != E; ++I) { > +const TargetRegisterClass *TRC = *I; > +if (RC && TRC != RC) > + continue; If RC is specified, you should just scan it, instead of walking regclass_begin->end to find it. -Chris > +for (TargetRegisterClass::iterator I = TRC- > >allocation_order_begin(MF), > + E = TRC->allocation_order_end(MF); I != E; ++I) >Allocatable.set(*I); >} >return Allocatable; > > > > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [126246] If all struct bitfields are packed then struct is packed.
Revision: 126246 Author: dpatel Date: 2007-04-17 14:59:37 -0700 (Tue, 17 Apr 2007) Log Message: --- If all struct bitfields are packed then struct is packed. This fixes recent SingleSource 2003-05-21-BitFieldHandling.c regression. Modified Paths: -- apple-local/branches/llvm/gcc/llvm-types.cpp Modified: apple-local/branches/llvm/gcc/llvm-types.cpp === --- apple-local/branches/llvm/gcc/llvm-types.cpp2007-04-17 20:29:12 UTC (rev 126245) +++ apple-local/branches/llvm/gcc/llvm-types.cpp2007-04-17 21:59:37 UTC (rev 126246) @@ -945,7 +945,7 @@ /// getLLVMType - Return the LLVM type for the specified object. /// const Type *getLLVMType() const { -return StructType::get(Elements, Packed); +return StructType::get(Elements, Packed || AllBitFields); } /// getSizeAsLLVMStruct - Return the size of this struct if it were converted ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-www/DevMtgMay2007.html
Changes in directory llvm-www: DevMtgMay2007.html updated: 1.110 -> 1.111 --- Log message: Add Calum Wilkie. --- Diffs of the changes: (+4 -3) DevMtgMay2007.html |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.110 llvm-www/DevMtgMay2007.html:1.111 --- llvm-www/DevMtgMay2007.html:1.110 Mon Apr 16 12:00:32 2007 +++ llvm-www/DevMtgMay2007.html Tue Apr 17 16:27:27 2007 @@ -307,13 +307,13 @@ Andrew LenharthUIUC Julien LerougeApple Inc. Nick LewyckyIndependent +Efrem LipkinCoDesign Confirmed Attendees NameOrganization -Efrem LipkinCoDesign Gabe McArthurIndependent Paul McJonesAdobe Systems Incorporated. Scott MichelAerospace @@ -332,11 +332,12 @@ Sarah ThompsonNASA, Ames Research Center Bill WendlingApple Inc. Marcel WeiherMetaObject +Calum WilkieMicrochip Technology - Total confirmed: 37 + Total confirmed: 38 Unconfirmed Attendees NameOrganization @@ -354,6 +355,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss"; alt="Valid CSS!"> http://validator.w3.org/check/referer";>http://www.w3.org/Icons/valid-html401"; alt="Valid HTML 4.01!"> -Last modified: $Date: 2007/04/16 17:00:32 $ +Last modified: $Date: 2007/04/17 21:27:27 $ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: TargetLowering.cpp updated: 1.109 -> 1.110 --- Log message: Fold (x << c1)>> c2 into a single shift if the bits shifted out aren't used. This compiles: int baz(long long a) { return (short)(((int)(a >>24)) >> 9); } into: _baz: srwi r2, r3, 1 extsh r3, r2 blr on PPC, instead of: _baz: slwi r2, r3, 8 srwi r2, r2, 9 extsh r3, r2 blr GCC produces: _baz: srwi r10,r4,24 insrwi r10,r3,24,0 srawi r9,r3,24 srawi r3,r10,9 extsh r3,r3 blr This implements CodeGen/PowerPC/shl_elim.ll --- Diffs of the changes: (+52 -5) TargetLowering.cpp | 57 - 1 files changed, 52 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp diff -u llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.109 llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.110 --- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.109 Mon Apr 16 13:10:22 2007 +++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cppTue Apr 17 16:14:16 2007 @@ -563,7 +563,32 @@ break; case ISD::SHL: if (ConstantSDNode *SA = dyn_cast(Op.getOperand(1))) { - if (SimplifyDemandedBits(Op.getOperand(0), DemandedMask >> SA->getValue(), + unsigned ShAmt = SA->getValue(); + SDOperand InOp = Op.getOperand(0); + + // If this is ((X >>u C1) << ShAmt), see if we can simplify this into a + // single shift. We can do this if the bottom bits (which are shifted + // out) are never demanded. + if (InOp.getOpcode() == ISD::SRL && + isa(InOp.getOperand(1))) { +if (ShAmt && (DemandedMask & ((1ULL << ShAmt)-1)) == 0) { + unsigned C1 = cast(InOp.getOperand(1))->getValue(); + unsigned Opc = ISD::SHL; + int Diff = ShAmt-C1; + if (Diff < 0) { +Diff = -Diff; +Opc = ISD::SRL; + } + + SDOperand NewSA = +TLO.DAG.getConstant(ShAmt-C1, Op.getOperand(0).getValueType()); + MVT::ValueType VT = Op.getValueType(); + return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SRL, VT, + InOp.getOperand(0), NewSA)); +} + } + + if (SimplifyDemandedBits(Op.getOperand(0), DemandedMask >> ShAmt, KnownZero, KnownOne, TLO, Depth+1)) return true; KnownZero <<= SA->getValue(); @@ -575,11 +600,33 @@ if (ConstantSDNode *SA = dyn_cast(Op.getOperand(1))) { MVT::ValueType VT = Op.getValueType(); unsigned ShAmt = SA->getValue(); + uint64_t TypeMask = MVT::getIntVTBitMask(VT); + unsigned VTSize = MVT::getSizeInBits(VT); + SDOperand InOp = Op.getOperand(0); + + // If this is ((X << C1) >>u ShAmt), see if we can simplify this into a + // single shift. We can do this if the top bits (which are shifted out) + // are never demanded. + if (InOp.getOpcode() == ISD::SHL && + isa(InOp.getOperand(1))) { +if (ShAmt && (DemandedMask & (~0ULL << (VTSize-ShAmt))) == 0) { + unsigned C1 = cast(InOp.getOperand(1))->getValue(); + unsigned Opc = ISD::SRL; + int Diff = ShAmt-C1; + if (Diff < 0) { +Diff = -Diff; +Opc = ISD::SHL; + } + + SDOperand NewSA = +TLO.DAG.getConstant(Diff, Op.getOperand(0).getValueType()); + return TLO.CombineTo(Op, TLO.DAG.getNode(Opc, VT, + InOp.getOperand(0), NewSA)); +} + } // Compute the new bits that are at the top now. - uint64_t TypeMask = MVT::getIntVTBitMask(VT); - if (SimplifyDemandedBits(Op.getOperand(0), - (DemandedMask << ShAmt) & TypeMask, + if (SimplifyDemandedBits(InOp, (DemandedMask << ShAmt) & TypeMask, KnownZero, KnownOne, TLO, Depth+1)) return true; assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); @@ -589,7 +636,7 @@ KnownOne >>= ShAmt; uint64_t HighBits = (1ULL << ShAmt)-1; - HighBits <<= MVT::getSizeInBits(VT) - ShAmt; + HighBits <<= VTSize - ShAmt; KnownZero |= HighBits; // High bits known zero. } break; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CodeGen/PowerPC/shl_elim.ll
Changes in directory llvm/test/CodeGen/PowerPC: shl_elim.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+11 -0) shl_elim.ll | 11 +++ 1 files changed, 11 insertions(+) Index: llvm/test/CodeGen/PowerPC/shl_elim.ll diff -c /dev/null llvm/test/CodeGen/PowerPC/shl_elim.ll:1.1 *** /dev/null Tue Apr 17 16:12:36 2007 --- llvm/test/CodeGen/PowerPC/shl_elim.ll Tue Apr 17 16:12:26 2007 *** *** 0 --- 1,11 + ; RUN: llvm-as < %s | llc -march=ppc32 | not grep slwi + + define i32 @test1(i64 %a) { + %tmp29 = lshr i64 %a, 24; [#uses=1] + %tmp23 = trunc i64 %tmp29 to i32; [#uses=1] + %tmp410 = lshr i32 %tmp23, 9; [#uses=1] + %tmp45 = trunc i32 %tmp410 to i16 ; [#uses=1] + %tmp456 = sext i16 %tmp45 to i32; [#uses=1] + ret i32 %tmp456 + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [126245] Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/ Week-of-Mon-20070416/047943.html
Hi, if (StartOffsetInBits > FirstUnallocatedByte*8) is true then (StartOffsetFromByteBoundry == 0) is always true. If so, we could simply this even further. In other words, if we need pad bytes for a new field then it always starts at byte boundary. Can you think of an example where this is not true ? Thanks, - Devang On Apr 17, 2007, at 1:42 PM, Duncan Sands wrote: > Hi Devang, I just posted a fix which fixes some other issues too. > A few lines earlier: > >if (StartOffsetFromByteBoundry != 0) { > // New field does not start at byte boundry. > PadBits = StartOffsetInBits - (FirstUnallocatedByte*8); > PadBytes = PadBits/8 + 1; >} > >PadBytes += StartOffsetInBits/8-FirstUnallocatedByte; > > If StartOffsetFromByteBoundry != 0, then PadBytes gets added to twice, > setting it to 2*PadBits/8 + 1. > >> Pad = ArrayType::get(Pad, PadBytes); >> Info.addElement(Pad, FirstUnallocatedByte, PadBytes); >> FirstUnallocatedByte = StartOffsetInBits/8; >> -// This field will use some of the bits from this PadBytes. >> -FieldSizeInBits = FieldSizeInBits - (PadBytes*8 - PadBits); >> +// This field will use some of the bits from this PadBytes, if >> +// starting offset is not at byte boundry. >> +if (StartOffsetFromByteBoundry != 0) >> + FieldSizeInBits = FieldSizeInBits - (8 - PadBits); > > Here PadBits can be bigger than 8, which will lead to a bad result :) > Even if it is less than 8 this can create a negative FieldSizeInBits. > For example, if FieldSizeInBits=1, StartOffsetFromByteBoundry=1, then > typically PadBits=1, meaning you are setting FieldSizeInBits to -6 > here! > >> } >> >> // Now, Field starts at FirstUnallocatedByte and everything is >> aligned. > > Best wishes, > > Duncan. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CFrontend/2007-04-17-ZeroSizeBitFields.c
Changes in directory llvm/test/CFrontend: 2007-04-17-ZeroSizeBitFields.c updated: 1.1 -> 1.2 --- Log message: Use // not ; since this is C. --- Diffs of the changes: (+2 -2) 2007-04-17-ZeroSizeBitFields.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/test/CFrontend/2007-04-17-ZeroSizeBitFields.c diff -u llvm/test/CFrontend/2007-04-17-ZeroSizeBitFields.c:1.1 llvm/test/CFrontend/2007-04-17-ZeroSizeBitFields.c:1.2 --- llvm/test/CFrontend/2007-04-17-ZeroSizeBitFields.c:1.1 Tue Apr 17 15:29:12 2007 +++ llvm/test/CFrontend/2007-04-17-ZeroSizeBitFields.c Tue Apr 17 15:50:33 2007 @@ -1,4 +1,4 @@ -; PR 1332 -; RUN: %llvmgcc %s -S -o /dev/null +// PR 1332 +// RUN: %llvmgcc %s -S -o /dev/null struct Z { int a:1; int :0; int c:1; } z; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [126245] Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/ Week-of-Mon-20070416/047943.html
Hi Devang, I just posted a fix which fixes some other issues too. A few lines earlier: if (StartOffsetFromByteBoundry != 0) { // New field does not start at byte boundry. PadBits = StartOffsetInBits - (FirstUnallocatedByte*8); PadBytes = PadBits/8 + 1; } PadBytes += StartOffsetInBits/8-FirstUnallocatedByte; If StartOffsetFromByteBoundry != 0, then PadBytes gets added to twice, setting it to 2*PadBits/8 + 1. >Pad = ArrayType::get(Pad, PadBytes); > Info.addElement(Pad, FirstUnallocatedByte, PadBytes); > FirstUnallocatedByte = StartOffsetInBits/8; > -// This field will use some of the bits from this PadBytes. > -FieldSizeInBits = FieldSizeInBits - (PadBytes*8 - PadBits); > +// This field will use some of the bits from this PadBytes, if > +// starting offset is not at byte boundry. > +if (StartOffsetFromByteBoundry != 0) > + FieldSizeInBits = FieldSizeInBits - (8 - PadBits); Here PadBits can be bigger than 8, which will lead to a bad result :) Even if it is less than 8 this can create a negative FieldSizeInBits. For example, if FieldSizeInBits=1, StartOffsetFromByteBoundry=1, then typically PadBits=1, meaning you are setting FieldSizeInBits to -6 here! >} > >// Now, Field starts at FirstUnallocatedByte and everything is aligned. Best wishes, Duncan. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] llvm-gcc: fix for PR1332
On Apr 17, 2007, at 1:29 PM, Duncan Sands wrote: The testcase: struct Z { int :1; int :0; int :1; } z; The zero width field causes the second :1 field to start at bit 32. This requires inserting 24 bits of padding. For some obscure reason the padding logic subtracts the number of bits of padding from the new field size before adding it, meaning that it tries to add -23 new bits rather than +1, causing an assertion failure. I just checked in simpler fix. Need to reduce field size only if start of field is not at byte boundary. - Devang With the attached patch struct Z converts to %struct.Z = type { i8, [3 x i8], i8 } Lightly tested. Ciao, Duncan. Index: gcc.llvm/gcc/llvm-types.cpp === --- gcc.llvm.orig/gcc/llvm-types.cpp 2007-04-17 21:22:37.0 +0200 +++ gcc.llvm/gcc/llvm-types.cpp 2007-04-17 22:17:11.0 +0200 @@ -1184,7 +1184,7 @@ } } -// Add new element which is a bit field. Size is not the size of bit filed, +// Add new element which is a bit field. Size is not the size of bit field, // but size of bits required to determine type of new Field which will be // used to access this bit field. void StructTypeConversionInfo::addNewBitField(unsigned Size, @@ -1192,7 +1192,7 @@ // Figure out the LLVM type that we will use for the new field. // Note, Size is not necessarily size of the new field. It indicates - // additional bits required after FirstunallocatedByte to cover new field. + // additional bits required after FirstUnallocatedByte to cover new field. const Type *NewFieldTy; if (Size <= 8) NewFieldTy = Type::Int8Ty; @@ -1368,22 +1368,21 @@ if (StartOffsetInBits > FirstUnallocatedByte*8) { // If there is padding between the last field and the struct, insert // explicit bytes into the field to represent it. -unsigned PadBytes = 0; -unsigned PadBits = 0; -if (StartOffsetFromByteBoundry != 0) { - // New field does not start at byte boundry. - PadBits = StartOffsetInBits - (FirstUnallocatedByte*8); - PadBytes = PadBits/8 + 1; +unsigned PadBytes = StartOffsetInBits/8-FirstUnallocatedByte; +if (PadBytes > 0) { + const Type *Pad = Type::Int8Ty; + if (PadBytes != 1) +Pad = ArrayType::get(Pad, PadBytes); + Info.addElement(Pad, FirstUnallocatedByte, PadBytes); } - -PadBytes += StartOffsetInBits/8-FirstUnallocatedByte; -const Type *Pad = Type::Int8Ty; -if (PadBytes != 1) - Pad = ArrayType::get(Pad, PadBytes); -Info.addElement(Pad, FirstUnallocatedByte, PadBytes); FirstUnallocatedByte = StartOffsetInBits/8; -// This field will use some of the bits from this PadBytes. -FieldSizeInBits = FieldSizeInBits - (PadBytes*8 - PadBits); +if (StartOffsetFromByteBoundry > 0) { + // New field does not start at byte boundry. + // Create a byte for the start to live in and try again. + Info.addElement(Type::Int8Ty, FirstUnallocatedByte, 1); + DecodeStructBitField(Field, Info); + return; +} } // Now, Field starts at FirstUnallocatedByte and everything is aligned. // RUN: %llvmgcc %s -S -o - // PR1332 struct Z { int :1; int :0; int :1; } z; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp RegAllocLinearScan.cpp
Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.234 -> 1.235 RegAllocLinearScan.cpp updated: 1.142 -> 1.143 --- Log message: Copy coalescing change to prevent a physical register from being pin to a long live interval that has low usage density. 1. Change order of coalescing to join physical registers with virtual registers first before virtual register intervals become too long. 2. Check size and usage density to determine if it's worthwhile to join. 3. If joining is aborted, assign virtual register live interval allocation preference field to the physical register. 4. Register allocator should try to allocate to the preferred register first (if available) to create identify moves that can be eliminated. --- Diffs of the changes: (+98 -86) LiveIntervalAnalysis.cpp | 153 +++ RegAllocLinearScan.cpp | 31 ++--- 2 files changed, 98 insertions(+), 86 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.234 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.235 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.234 Wed Apr 4 02:40:01 2007 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Apr 17 15:32:26 2007 @@ -30,6 +30,7 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" +#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" #include @@ -87,8 +88,11 @@ mri_ = tm_->getRegisterInfo(); tii_ = tm_->getInstrInfo(); lv_ = &getAnalysis(); - allocatableRegs_ = mri_->getAllocatableSet(fn); r2rMap_.grow(mf_->getSSARegMap()->getLastVirtReg()); + allocatableRegs_ = mri_->getAllocatableSet(fn); + for (MRegisterInfo::regclass_iterator I = mri_->regclass_begin(), + E = mri_->regclass_end(); I != E; ++I) +allocatableRCRegs_.insert(std::make_pair(*I,mri_->getAllocatableSet(fn, *I))); // Number MachineInstrs and MachineBasicBlocks. // Initialize MBB indexes to a sentinal. @@ -120,10 +124,16 @@ } // Join (coallesce) intervals if requested. - if (EnableJoining) joinIntervals(); + if (EnableJoining) { +joinIntervals(); +DOUT << "** INTERVALS POST JOINING **\n"; +for (iterator I = begin(), E = end(); I != E; ++I) { + I->second.print(DOUT, mri_); + DOUT << "\n"; +} + } numIntervalsAfter += getNumIntervals(); - // perform a final pass over the instructions and compute spill // weights, coalesce virtual registers and remove identity moves. @@ -156,6 +166,7 @@ mii = mbbi->erase(mii); ++numPeep; } else { +SmallSet UniqueUses; for (unsigned i = 0, e = mii->getNumOperands(); i != e; ++i) { const MachineOperand &mop = mii->getOperand(i); if (mop.isRegister() && mop.getReg() && @@ -164,6 +175,10 @@ unsigned reg = rep(mop.getReg()); mii->getOperand(i).setReg(reg); +// Multiple uses of reg by the same instruction. It should not +// contribute to spill weight again. +if (UniqueUses.count(reg) != 0) + continue; LiveInterval &RegInt = getInterval(reg); float w = (mop.isUse()+mop.isDef()) * powf(10.0F, (float)loopDepth); // If the definition instruction is re-materializable, its spill @@ -173,6 +188,7 @@ if (RegInt.remat && !tii_->isLoadFromStackSlot(RegInt.remat, Dummy)) w /= 2; RegInt.weight += w; +UniqueUses.insert(reg); } } ++mii; @@ -188,15 +204,15 @@ // it and hope it will be easier to allocate for this li. if (isZeroLengthInterval(&LI)) LI.weight = HUGE_VALF; - + + // Slightly prefer live interval that has been assigned a preferred reg. + if (LI.preference) +LI.weight *= 1.01F; + // Divide the weight of the interval by its size. This encourages // spilling of intervals that are large and have few uses, and // discourages spilling of small intervals with many uses. - unsigned Size = 0; - for (LiveInterval::iterator II = LI.begin(), E = LI.end(); II != E;++II) -Size += II->end - II->start; - - LI.weight /= Size; + LI.weight /= LI.getSize(); } } @@ -866,14 +882,15 @@ return true; } + /// JoinCopy - Attempt to join intervals corresponding to SrcReg/DstReg, /// which are the src/dst of the copy instruction CopyMI. This returns true /// if the copy was successfully coallesced away, or if it is never possible -/// to coallesce these this copy, due to register constraints. It returns +/// to coallesce this copy, due to register constraints. It returns /// false if it is not currently possible to coallesce this interval, but /// it may be possible if other things get coallesced. bool LiveInterval
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h
Changes in directory llvm/include/llvm/CodeGen: LiveIntervalAnalysis.h updated: 1.77 -> 1.78 --- Log message: Copy coalescing change to prevent a physical register from being pin to a long live interval that has low usage density. 1. Change order of coalescing to join physical registers with virtual registers first before virtual register intervals become too long. 2. Check size and usage density to determine if it's worthwhile to join. 3. If joining is aborted, assign virtual register live interval allocation preference field to the physical register. 4. Register allocator should try to allocate to the preferred register first (if available) to create identify moves that can be eliminated. --- Diffs of the changes: (+6 -2) LiveIntervalAnalysis.h |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) Index: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h diff -u llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.77 llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.78 --- llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.77 Mon Apr 2 13:49:18 2007 +++ llvm/include/llvm/CodeGen/LiveIntervalAnalysis.hTue Apr 17 15:32:26 2007 @@ -23,6 +23,7 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/LiveInterval.h" #include "llvm/ADT/BitVector.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/IndexedMap.h" namespace llvm { @@ -30,6 +31,7 @@ class LiveVariables; class MRegisterInfo; class TargetInstrInfo; + class TargetRegisterClass; class VirtRegMap; class LiveIntervals : public MachineFunctionPass { @@ -56,6 +58,7 @@ Reg2RegMap r2rMap_; BitVector allocatableRegs_; +DenseMap allocatableRCRegs_; /// JoinedLIs - Keep track which register intervals have been coalesced /// with other intervals. @@ -202,7 +205,7 @@ /// CopyCoallesceInMBB - Coallsece copies in the specified MBB, putting /// copies that cannot yet be coallesced into the "TryAgain" list. void CopyCoallesceInMBB(MachineBasicBlock *MBB, -std::vector &TryAgain); + std::vector &TryAgain, bool PhysOnly = false); /// JoinCopy - Attempt to join intervals corresponding to SrcReg/DstReg, /// which are the src/dst of the copy instruction CopyMI. This returns true @@ -210,7 +213,8 @@ /// to coallesce these this copy, due to register constraints. It returns /// false if it is not currently possible to coallesce this interval, but /// it may be possible if other things get coallesced. -bool JoinCopy(MachineInstr *CopyMI, unsigned SrcReg, unsigned DstReg); +bool JoinCopy(MachineInstr *CopyMI, unsigned SrcReg, unsigned DstReg, + bool PhysOnly = false); /// JoinIntervals - Attempt to join these two intervals. On failure, this /// returns false. Otherwise, if one of the intervals being joined is a ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [126245] Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/ Week-of-Mon-20070416/047943.html
Revision: 126245 Author: dpatel Date: 2007-04-17 13:29:12 -0700 (Tue, 17 Apr 2007) Log Message: --- Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070416/047943.html Modified Paths: -- apple-local/branches/llvm/gcc/llvm-types.cpp Modified: apple-local/branches/llvm/gcc/llvm-types.cpp === --- apple-local/branches/llvm/gcc/llvm-types.cpp2007-04-17 16:28:45 UTC (rev 126244) +++ apple-local/branches/llvm/gcc/llvm-types.cpp2007-04-17 20:29:12 UTC (rev 126245) @@ -1382,8 +1382,10 @@ Pad = ArrayType::get(Pad, PadBytes); Info.addElement(Pad, FirstUnallocatedByte, PadBytes); FirstUnallocatedByte = StartOffsetInBits/8; -// This field will use some of the bits from this PadBytes. -FieldSizeInBits = FieldSizeInBits - (PadBytes*8 - PadBits); +// This field will use some of the bits from this PadBytes, if +// starting offset is not at byte boundry. +if (StartOffsetFromByteBoundry != 0) + FieldSizeInBits = FieldSizeInBits - (8 - PadBits); } // Now, Field starts at FirstUnallocatedByte and everything is aligned. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CFrontend/2007-04-17-ZeroSizeBitFields.c
Changes in directory llvm/test/CFrontend: 2007-04-17-ZeroSizeBitFields.c added (r1.1) --- Log message: New test case. --- Diffs of the changes: (+4 -0) 2007-04-17-ZeroSizeBitFields.c |4 1 files changed, 4 insertions(+) Index: llvm/test/CFrontend/2007-04-17-ZeroSizeBitFields.c diff -c /dev/null llvm/test/CFrontend/2007-04-17-ZeroSizeBitFields.c:1.1 *** /dev/null Tue Apr 17 15:29:22 2007 --- llvm/test/CFrontend/2007-04-17-ZeroSizeBitFields.c Tue Apr 17 15:29:12 2007 *** *** 0 --- 1,4 + ; PR 1332 + ; RUN: %llvmgcc %s -S -o /dev/null + + struct Z { int a:1; int :0; int c:1; } z; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] llvm-gcc: fix for PR1332
The testcase: struct Z { int :1; int :0; int :1; } z; The zero width field causes the second :1 field to start at bit 32. This requires inserting 24 bits of padding. For some obscure reason the padding logic subtracts the number of bits of padding from the new field size before adding it, meaning that it tries to add -23 new bits rather than +1, causing an assertion failure. With the attached patch struct Z converts to %struct.Z = type { i8, [3 x i8], i8 } Lightly tested. Ciao, Duncan. Index: gcc.llvm/gcc/llvm-types.cpp === --- gcc.llvm.orig/gcc/llvm-types.cpp 2007-04-17 21:22:37.0 +0200 +++ gcc.llvm/gcc/llvm-types.cpp 2007-04-17 22:17:11.0 +0200 @@ -1184,7 +1184,7 @@ } } -// Add new element which is a bit field. Size is not the size of bit filed, +// Add new element which is a bit field. Size is not the size of bit field, // but size of bits required to determine type of new Field which will be // used to access this bit field. void StructTypeConversionInfo::addNewBitField(unsigned Size, @@ -1192,7 +1192,7 @@ // Figure out the LLVM type that we will use for the new field. // Note, Size is not necessarily size of the new field. It indicates - // additional bits required after FirstunallocatedByte to cover new field. + // additional bits required after FirstUnallocatedByte to cover new field. const Type *NewFieldTy; if (Size <= 8) NewFieldTy = Type::Int8Ty; @@ -1368,22 +1368,21 @@ if (StartOffsetInBits > FirstUnallocatedByte*8) { // If there is padding between the last field and the struct, insert // explicit bytes into the field to represent it. -unsigned PadBytes = 0; -unsigned PadBits = 0; -if (StartOffsetFromByteBoundry != 0) { - // New field does not start at byte boundry. - PadBits = StartOffsetInBits - (FirstUnallocatedByte*8); - PadBytes = PadBits/8 + 1; +unsigned PadBytes = StartOffsetInBits/8-FirstUnallocatedByte; +if (PadBytes > 0) { + const Type *Pad = Type::Int8Ty; + if (PadBytes != 1) +Pad = ArrayType::get(Pad, PadBytes); + Info.addElement(Pad, FirstUnallocatedByte, PadBytes); } - -PadBytes += StartOffsetInBits/8-FirstUnallocatedByte; -const Type *Pad = Type::Int8Ty; -if (PadBytes != 1) - Pad = ArrayType::get(Pad, PadBytes); -Info.addElement(Pad, FirstUnallocatedByte, PadBytes); FirstUnallocatedByte = StartOffsetInBits/8; -// This field will use some of the bits from this PadBytes. -FieldSizeInBits = FieldSizeInBits - (PadBytes*8 - PadBits); +if (StartOffsetFromByteBoundry > 0) { + // New field does not start at byte boundry. + // Create a byte for the start to live in and try again. + Info.addElement(Type::Int8Ty, FirstUnallocatedByte, 1); + DecodeStructBitField(Field, Info); + return; +} } // Now, Field starts at FirstUnallocatedByte and everything is aligned. // RUN: %llvmgcc %s -S -o - // PR1332 struct Z { int :1; int :0; int :1; } z; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp
Changes in directory llvm/lib/CodeGen: LiveInterval.cpp updated: 1.43 -> 1.44 --- Log message: Add a register allocation preference field; add a method to compute size of a live interval. --- Diffs of the changes: (+9 -0) LiveInterval.cpp |9 + 1 files changed, 9 insertions(+) Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.43 llvm/lib/CodeGen/LiveInterval.cpp:1.44 --- llvm/lib/CodeGen/LiveInterval.cpp:1.43 Sat Dec 16 23:15:13 2006 +++ llvm/lib/CodeGen/LiveInterval.cpp Tue Apr 17 15:25:11 2007 @@ -349,6 +349,8 @@ ValueNumberInfo.clear(); ValueNumberInfo.append(NewValueNumberInfo.begin(), NewValueNumberInfo.end()); weight += Other.weight; + if (Other.preference && !preference) +preference = Other.preference; } /// MergeRangesInAsValue - Merge all of the intervals in RHS into this live @@ -467,6 +469,13 @@ } } +unsigned LiveInterval::getSize() const { + unsigned Sum = 0; + for (const_iterator I = begin(), E = end(); I != E; ++I) +Sum += I->end - I->start; + return Sum; +} + std::ostream& llvm::operator<<(std::ostream& os, const LiveRange &LR) { return os << '[' << LR.start << ',' << LR.end << ':' << LR.ValId << ")"; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveInterval.h
Changes in directory llvm/include/llvm/CodeGen: LiveInterval.h updated: 1.35 -> 1.36 --- Log message: Add a register allocation preference field; add a method to compute size of a live interval. --- Diffs of the changes: (+6 -1) LiveInterval.h |7 ++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/LiveInterval.h diff -u llvm/include/llvm/CodeGen/LiveInterval.h:1.35 llvm/include/llvm/CodeGen/LiveInterval.h:1.36 --- llvm/include/llvm/CodeGen/LiveInterval.h:1.35 Tue Mar 20 03:13:50 2007 +++ llvm/include/llvm/CodeGen/LiveInterval.hTue Apr 17 15:25:11 2007 @@ -81,6 +81,7 @@ struct LiveInterval { typedef SmallVector Ranges; unsigned reg;// the register of this interval +unsigned preference; // preferred register to allocate for this interval float weight;// weight of this interval MachineInstr* remat; // definition if the definition rematerializable Ranges ranges; // the ranges in which this register is live @@ -94,7 +95,7 @@ public: LiveInterval(unsigned Reg, float Weight) - : reg(Reg), weight(Weight), remat(NULL) { + : reg(Reg), preference(0), weight(Weight), remat(NULL) { } typedef Ranges::iterator iterator; @@ -256,6 +257,10 @@ removeRange(LR.start, LR.end); } +/// getSize - Returns the sum of sizes of all the LiveRange's. +/// +unsigned getSize() const; + bool operator<(const LiveInterval& other) const { return beginNumber() < other.beginNumber(); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/MRegisterInfo.h
Changes in directory llvm/include/llvm/Target: MRegisterInfo.h updated: 1.102 -> 1.103 --- Log message: Change getAllocatableSet() so it returns allocatable registers for a specific register class. --- Diffs of the changes: (+4 -2) MRegisterInfo.h |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Target/MRegisterInfo.h diff -u llvm/include/llvm/Target/MRegisterInfo.h:1.102 llvm/include/llvm/Target/MRegisterInfo.h:1.103 --- llvm/include/llvm/Target/MRegisterInfo.h:1.102 Tue Mar 20 03:05:54 2007 +++ llvm/include/llvm/Target/MRegisterInfo.hTue Apr 17 15:23:34 2007 @@ -241,8 +241,10 @@ } /// getAllocatableSet - Returns a bitset indexed by register number - /// indicating if a register is allocatable or not. - BitVector getAllocatableSet(MachineFunction &MF) const; + /// indicating if a register is allocatable or not. If a register class is + /// specified, returns the subset for the class. + BitVector getAllocatableSet(MachineFunction &MF, + const TargetRegisterClass *RC = NULL) const; const TargetRegisterDesc &operator[](unsigned RegNo) const { assert(RegNo < NumRegs && ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/MRegisterInfo.cpp
Changes in directory llvm/lib/Target: MRegisterInfo.cpp updated: 1.22 -> 1.23 --- Log message: Change getAllocatableSet() so it returns allocatable registers for a specific register class. --- Diffs of the changes: (+7 -4) MRegisterInfo.cpp | 11 +++ 1 files changed, 7 insertions(+), 4 deletions(-) Index: llvm/lib/Target/MRegisterInfo.cpp diff -u llvm/lib/Target/MRegisterInfo.cpp:1.22 llvm/lib/Target/MRegisterInfo.cpp:1.23 --- llvm/lib/Target/MRegisterInfo.cpp:1.22 Mon Feb 19 15:49:53 2007 +++ llvm/lib/Target/MRegisterInfo.cpp Tue Apr 17 15:23:34 2007 @@ -34,13 +34,16 @@ MRegisterInfo::~MRegisterInfo() {} -BitVector MRegisterInfo::getAllocatableSet(MachineFunction &MF) const { +BitVector MRegisterInfo::getAllocatableSet(MachineFunction &MF, + const TargetRegisterClass *RC) const { BitVector Allocatable(NumRegs); for (MRegisterInfo::regclass_iterator I = regclass_begin(), E = regclass_end(); I != E; ++I) { -const TargetRegisterClass *RC = *I; -for (TargetRegisterClass::iterator I = RC->allocation_order_begin(MF), - E = RC->allocation_order_end(MF); I != E; ++I) +const TargetRegisterClass *TRC = *I; +if (RC && TRC != RC) + continue; +for (TargetRegisterClass::iterator I = TRC->allocation_order_begin(MF), + E = TRC->allocation_order_end(MF); I != E; ++I) Allocatable.set(*I); } return Allocatable; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/LiveVariables.cpp
Changes in directory llvm/lib/CodeGen: LiveVariables.cpp updated: 1.71 -> 1.72 --- Log message: Keep track of number of uses within the function per virtual register. --- Diffs of the changes: (+1 -0) LiveVariables.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/LiveVariables.cpp diff -u llvm/lib/CodeGen/LiveVariables.cpp:1.71 llvm/lib/CodeGen/LiveVariables.cpp:1.72 --- llvm/lib/CodeGen/LiveVariables.cpp:1.71 Sat Mar 17 04:29:54 2007 +++ llvm/lib/CodeGen/LiveVariables.cpp Tue Apr 17 15:22:11 2007 @@ -141,6 +141,7 @@ unsigned BBNum = MBB->getNumber(); VRInfo.UsedBlocks[BBNum] = true; + VRInfo.NumUses++; // Check to see if this basic block is already a kill block... if (!VRInfo.Kills.empty() && VRInfo.Kills.back()->getParent() == MBB) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveVariables.h
Changes in directory llvm/include/llvm/CodeGen: LiveVariables.h updated: 1.36 -> 1.37 --- Log message: Keep track of number of uses within the function per virtual register. --- Diffs of the changes: (+5 -1) LiveVariables.h |6 +- 1 files changed, 5 insertions(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.36 llvm/include/llvm/CodeGen/LiveVariables.h:1.37 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.36 Sat Mar 17 04:29:54 2007 +++ llvm/include/llvm/CodeGen/LiveVariables.h Tue Apr 17 15:22:11 2007 @@ -83,12 +83,16 @@ /// is a bit set which uses the basic block number as an index. BitVector UsedBlocks; +/// NumUses - Number of uses of this register across the entire function. +/// +unsigned NumUses; + /// Kills - List of MachineInstruction's which are the last use of this /// virtual register (kill it) in their basic block. /// std::vector Kills; -VarInfo() : DefInst(0) {} +VarInfo() : DefInst(0), NumUses(0) {} /// removeKill - Delete a kill corresponding to the specified /// machine instruction. Returns true if there was a kill ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Thanks Anton! On Apr 17, 2007, at 12:34 PM, Anton Korobeynikov wrote: > > > Changes in directory llvm/lib/Target/X86: > > X86ISelLowering.cpp updated: 1.392 -> 1.393 > --- > Log message: > > Add comment > > > --- > Diffs of the changes: (+9 -0) > > X86ISelLowering.cpp |9 + > 1 files changed, 9 insertions(+) > > > Index: llvm/lib/Target/X86/X86ISelLowering.cpp > diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.392 llvm/lib/ > Target/X86/X86ISelLowering.cpp:1.393 > --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.392 Tue Apr 17 > 12:21:52 2007 > +++ llvm/lib/Target/X86/X86ISelLowering.cpp Tue Apr 17 14:34:00 2007 > @@ -3406,8 +3406,17 @@ > } > } > > + > +// Lower dynamic stack allocation to _alloca call for Cygwin/Mingw > targets. > +// Calls to _alloca is needed to probe the stack when allocating > more than 4k > +// bytes in one go. Touching the stack at 4K increments is > necessary to ensure > +// that the guard pages used by the OS virtual memory manager are > allocated in > +// correct sequence. > SDOperand X86TargetLowering::LowerDYNAMIC_STACKALLOC(SDOperand Op, > SelectionDAG > &DAG) { > + assert(Subtarget->isTargetCygMing() && > + "This should be used only on Cygwin/Mingw targets"); > + >// Get the inputs. >SDOperand Chain = Op.getOperand(0); >SDOperand Size = Op.getOperand(1); > > > > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.392 -> 1.393 --- Log message: Add comment --- Diffs of the changes: (+9 -0) X86ISelLowering.cpp |9 + 1 files changed, 9 insertions(+) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.392 llvm/lib/Target/X86/X86ISelLowering.cpp:1.393 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.392 Tue Apr 17 12:21:52 2007 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Tue Apr 17 14:34:00 2007 @@ -3406,8 +3406,17 @@ } } + +// Lower dynamic stack allocation to _alloca call for Cygwin/Mingw targets. +// Calls to _alloca is needed to probe the stack when allocating more than 4k +// bytes in one go. Touching the stack at 4K increments is necessary to ensure +// that the guard pages used by the OS virtual memory manager are allocated in +// correct sequence. SDOperand X86TargetLowering::LowerDYNAMIC_STACKALLOC(SDOperand Op, SelectionDAG &DAG) { + assert(Subtarget->isTargetCygMing() && + "This should be used only on Cygwin/Mingw targets"); + // Get the inputs. SDOperand Chain = Op.getOperand(0); SDOperand Size = Op.getOperand(1); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.290 -> 1.291 --- Log message: SIGN_EXTEND_INREG does not demand its top bits. Give SimplifyDemandedBits a chance to hack on it. This compiles: int baz(long long a) { return (short)(((int)(a >>24)) >> 9); } into: _baz: slwi r2, r3, 8 srwi r2, r2, 9 extsh r3, r2 blr instead of: _baz: srwi r2, r4, 24 rlwimi r2, r3, 8, 0, 23 srwi r2, r2, 9 extsh r3, r2 blr This implements CodeGen/PowerPC/sign_ext_inreg1.ll --- Diffs of the changes: (+6 -1) DAGCombiner.cpp |7 ++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.290 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.291 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.290 Wed Apr 11 11:51:53 2007 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Apr 17 14:03:21 2007 @@ -2429,10 +2429,15 @@ return DAG.getNode(ISD::SIGN_EXTEND_INREG, VT, N0.getOperand(0), N1); } - // fold (sext_in_reg x) -> (zext_in_reg x) if the sign bit is zero + // fold (sext_in_reg x) -> (zext_in_reg x) if the sign bit is known zero. if (TLI.MaskedValueIsZero(N0, 1ULL << (EVTBits-1))) return DAG.getZeroExtendInReg(N0, EVT); + // fold operands of sext_in_reg based on knowledge that the top bits are not + // demanded. + if (SimplifyDemandedBits(SDOperand(N, 0))) +return SDOperand(N, 0); + // fold (sext_in_reg (load x)) -> (smaller sextload x) // fold (sext_in_reg (srl (load x), c)) -> (smaller sextload (x+c/evtbits)) SDOperand NarrowLoad = ReduceLoadWidth(N); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CodeGen/PowerPC/sign_ext_inreg1.ll
Changes in directory llvm/test/CodeGen/PowerPC: sign_ext_inreg1.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+12 -0) sign_ext_inreg1.ll | 12 1 files changed, 12 insertions(+) Index: llvm/test/CodeGen/PowerPC/sign_ext_inreg1.ll diff -c /dev/null llvm/test/CodeGen/PowerPC/sign_ext_inreg1.ll:1.1 *** /dev/null Tue Apr 17 14:03:12 2007 --- llvm/test/CodeGen/PowerPC/sign_ext_inreg1.llTue Apr 17 14:03:02 2007 *** *** 0 --- 1,12 + ; RUN: llvm-as < %s | llc -march=ppc32 | grep srwi + ; RUN: llvm-as < %s | llc -march=ppc32 | not grep rlwimi + + define i32 @baz(i64 %a) { + %tmp29 = lshr i64 %a, 24; [#uses=1] + %tmp23 = trunc i64 %tmp29 to i32; [#uses=1] + %tmp410 = lshr i32 %tmp23, 9; [#uses=1] + %tmp45 = trunc i32 %tmp410 to i16 ; [#uses=1] + %tmp456 = sext i16 %tmp45 to i32; [#uses=1] + ret i32 %tmp456 + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/ADT/ilist
Changes in directory llvm/include/llvm/ADT: ilist updated: 1.26 -> 1.27 --- Log message: Commit an patch from Gabor Greif in Mar 2005. This eliminates the tail pointer from ilist, storing it in the prev pointer of the first node in the list instead. This shrinks ilist from 8 to 4 bytes, BasicBlock from 40->36 bytes, Function from 76->68 bytes, Module from 52->44 bytes. --- Diffs of the changes: (+37 -18) ilist | 55 +-- 1 files changed, 37 insertions(+), 18 deletions(-) Index: llvm/include/llvm/ADT/ilist diff -u llvm/include/llvm/ADT/ilist:1.26 llvm/include/llvm/ADT/ilist:1.27 --- llvm/include/llvm/ADT/ilist:1.26Wed Jun 15 13:28:44 2005 +++ llvm/include/llvm/ADT/ilist Tue Apr 17 13:41:42 2007 @@ -8,7 +8,7 @@ //===--===// // // This file defines classes to implement an intrusive doubly linked list class -// (ie each node of the list must contain a next and previous field for the +// (i.e. each node of the list must contain a next and previous field for the // list. // // The ilist_traits trait class is used to gain access to the next and previous @@ -22,7 +22,7 @@ // really want to know if it's empty. // // The ilist class is implemented by allocating a 'tail' node when the list is -// created (using ilist_traits<>::createEndMarker()). This tail node is +// created (using ilist_traits<>::createSentinel()). This tail node is // absolutely required because the user must be able to compute end()-1. Because // of this, users of the direct next/prev links will see an extra link on the // end of the list, which should be ignored. @@ -134,7 +134,7 @@ // Increment and decrement operators... ilist_iterator &operator--() { // predecrement - Back up NodePtr = Traits::getPrev(NodePtr); -assert(NodePtr && "--'d off the beginning of an ilist!"); +assert(Traits::getNext(NodePtr) && "--'d off the beginning of an ilist!"); return *this; } ilist_iterator &operator++() { // preincrement - Advance @@ -213,12 +213,20 @@ //===--===// // // iplist - The subset of list functionality that can safely be used on nodes of -// polymorphic types, ie a heterogeneus list with a common base class that holds -// the next/prev pointers... +// polymorphic types, i.e. a heterogenous list with a common base class that +// holds the next/prev pointers... // template > class iplist : public Traits { - NodeTy *Head, *Tail; + NodeTy *Head; + + // Use the prev node pointer of 'head' as the tail pointer. This is really a + // circularly linked list where we snip the 'next' link from the sentinel node + // back to the first node in the list (to preserve assertions about going off + // the end of the list). + NodeTy *getTail() { return getPrev(Head); } + const NodeTy *getTail() const { return getPrev(Head); } + void setTail(NodeTy *N) { setPrev(Head, N); } static bool op_less(NodeTy &L, NodeTy &R) { return L < R; } static bool op_equal(NodeTy &L, NodeTy &R) { return L == R; } @@ -235,28 +243,28 @@ typedef std::reverse_iterator const_reverse_iterator; typedef std::reverse_iterator reverse_iterator; - iplist() : Head(Traits::createSentinel()), Tail(Head) { + iplist() : Head(Traits::createSentinel()) { setNext(Head, 0); -setPrev(Head, 0); +setTail(Head); } - ~iplist() { clear(); Traits::destroySentinel(Tail); } + ~iplist() { clear(); Traits::destroySentinel(getTail()); } // Iterator creation methods. iterator begin() { return iterator(Head); } const_iterator begin() const { return const_iterator(Head); } - iterator end() { return iterator(Tail); } - const_iterator end() const { return const_iterator(Tail); } + iterator end() { return iterator(getTail()); } + const_iterator end() const { return const_iterator(getTail()); } // reverse iterator creation methods. reverse_iterator rbegin(){ return reverse_iterator(end()); } const_reverse_iterator rbegin() const{ return const_reverse_iterator(end()); } reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rend() const {return const_reverse_iterator(begin());} + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } // Miscellaneous inspection routines. size_type max_size() const { return size_type(-1); } - bool empty() const { return Head == Tail; } + bool empty() const { return Head == getTail(); } // Front and back accessor functions... reference front() { @@ -269,17 +277,16 @@ } reference back() { assert(!empty() && "Called back() on empty list!"); -return *getPrev(Tail); +return *getPrev(getTail()); } const_reference back() const { assert(!empty() && "Called back() on empty list!
[llvm-commits] CVS: llvm/include/llvm/GlobalVariable.h Function.h
Changes in directory llvm/include/llvm: GlobalVariable.h updated: 1.43 -> 1.44 Function.h updated: 1.79 -> 1.80 --- Log message: make getnext/getprev accessors private. --- Diffs of the changes: (+15 -15) Function.h | 18 +- GlobalVariable.h | 12 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) Index: llvm/include/llvm/GlobalVariable.h diff -u llvm/include/llvm/GlobalVariable.h:1.43 llvm/include/llvm/GlobalVariable.h:1.44 --- llvm/include/llvm/GlobalVariable.h:1.43 Tue Apr 17 13:15:04 2007 +++ llvm/include/llvm/GlobalVariable.h Tue Apr 17 13:30:41 2007 @@ -93,12 +93,6 @@ } } - // getNext/Prev - Return the next or previous global variable in the list. -GlobalVariable *getNext() { return Next; } - const GlobalVariable *getNext() const { return Next; } -GlobalVariable *getPrev() { return Prev; } - const GlobalVariable *getPrev() const { return Prev; } - /// If the value is a global constant, its value is immutable throughout the /// runtime execution of the program. Assigning a value into the constant /// leads to undefined behavior. @@ -132,6 +126,12 @@ static inline bool classof(const Value *V) { return V->getValueID() == Value::GlobalVariableVal; } +private: + // getNext/Prev - Return the next or previous global variable in the list. +GlobalVariable *getNext() { return Next; } + const GlobalVariable *getNext() const { return Next; } +GlobalVariable *getPrev() { return Prev; } + const GlobalVariable *getPrev() const { return Prev; } }; } // End llvm namespace Index: llvm/include/llvm/Function.h diff -u llvm/include/llvm/Function.h:1.79 llvm/include/llvm/Function.h:1.80 --- llvm/include/llvm/Function.h:1.79 Tue Apr 17 00:33:04 2007 +++ llvm/include/llvm/Function.hTue Apr 17 13:30:41 2007 @@ -149,15 +149,6 @@ void eraseFromParent(); - // getNext/Prev - Return the next or previous function in the list. These - // methods should never be used directly, and are only used to implement the - // function list as part of the module. - // -Function *getNext() { return Next; } - const Function *getNext() const { return Next; } -Function *getPrev() { return Prev; } - const Function *getPrev() const { return Prev; } - /// Get the underlying elements of the Function... the basic block list is /// empty for external functions. /// @@ -252,6 +243,15 @@ Function *Obj = 0; return unsigned(reinterpret_cast(&Obj->ArgumentList)); } +private: + // getNext/Prev - Return the next or previous function in the list. These + // methods should never be used directly, and are only used to implement the + // function list as part of the module. + // + Function *getNext() { return Next; } + const Function *getNext() const { return Next; } + Function *getPrev() { return Prev; } + const Function *getPrev() const { return Prev; } }; inline ValueSymbolTable * ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LICM.cpp
Changes in directory llvm/lib/Transforms/Scalar: LICM.cpp updated: 1.90 -> 1.91 --- Log message: Spell doFinalization right, so that it is a proper virtual override and gets called. --- Diffs of the changes: (+1 -1) LICM.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/LICM.cpp diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.90 llvm/lib/Transforms/Scalar/LICM.cpp:1.91 --- llvm/lib/Transforms/Scalar/LICM.cpp:1.90Sat Apr 14 18:32:02 2007 +++ llvm/lib/Transforms/Scalar/LICM.cpp Tue Apr 17 13:21:36 2007 @@ -77,7 +77,7 @@ AU.addRequired(); } -bool doFinalize() { +bool doFinalization() { LoopToAliasMap.clear(); return false; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/BasicBlock.h
Changes in directory llvm/include/llvm: BasicBlock.h updated: 1.67 -> 1.68 --- Log message: make next/prev accessors private --- Diffs of the changes: (+8 -6) BasicBlock.h | 14 -- 1 files changed, 8 insertions(+), 6 deletions(-) Index: llvm/include/llvm/BasicBlock.h diff -u llvm/include/llvm/BasicBlock.h:1.67 llvm/include/llvm/BasicBlock.h:1.68 --- llvm/include/llvm/BasicBlock.h:1.67 Tue Apr 17 00:33:04 2007 +++ llvm/include/llvm/BasicBlock.h Tue Apr 17 13:16:39 2007 @@ -82,12 +82,6 @@ const Function *getParent() const { return Parent; } Function *getParent() { return Parent; } - // getNext/Prev - Return the next or previous basic block in the list. -BasicBlock *getNext() { return Next; } - const BasicBlock *getNext() const { return Next; } -BasicBlock *getPrev() { return Prev; } - const BasicBlock *getPrev() const { return Prev; } - /// use_back - Specialize the methods defined in Value, as we know that an /// BasicBlock can only be used by Instructions (specifically PHI and terms). Instruction *use_back() { return cast(*use_begin());} @@ -201,6 +195,14 @@ BasicBlock *Obj = 0; return unsigned(reinterpret_cast(&Obj->InstList)); } + +private: + // getNext/Prev - Return the next or previous basic block in the list. Access + // these with Function::iterator. + BasicBlock *getNext() { return Next; } + const BasicBlock *getNext() const { return Next; } + BasicBlock *getPrev() { return Prev; } + const BasicBlock *getPrev() const { return Prev; } }; inline int ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/GlobalVariable.h
Changes in directory llvm/include/llvm: GlobalVariable.h updated: 1.42 -> 1.43 --- Log message: bool on darwin/ppc is 4 bytes. --- Diffs of the changes: (+2 -2) GlobalVariable.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/GlobalVariable.h diff -u llvm/include/llvm/GlobalVariable.h:1.42 llvm/include/llvm/GlobalVariable.h:1.43 --- llvm/include/llvm/GlobalVariable.h:1.42 Mon Apr 16 22:26:42 2007 +++ llvm/include/llvm/GlobalVariable.h Tue Apr 17 13:15:04 2007 @@ -41,8 +41,8 @@ void setNext(GlobalVariable *N) { Next = N; } void setPrev(GlobalVariable *N) { Prev = N; } - bool isConstantGlobal; // Is this a global constant? - bool isThreadLocalSymbol;// Is this symbol "Thread Local"? + bool isConstantGlobal : 1; // Is this a global constant? + bool isThreadLocalSymbol : 1;// Is this symbol "Thread Local"? Use Initializer; public: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp LowerSwitch.cpp
Changes in directory llvm/lib/Transforms/Utils: BreakCriticalEdges.cpp updated: 1.43 -> 1.44 LowerSwitch.cpp updated: 1.37 -> 1.38 --- Log message: remove use of BasicBlock::getNext --- Diffs of the changes: (+6 -3) BreakCriticalEdges.cpp |3 ++- LowerSwitch.cpp|6 -- 2 files changed, 6 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp diff -u llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.43 llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.44 --- llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.43 Sun Apr 15 03:47:27 2007 +++ llvm/lib/Transforms/Utils/BreakCriticalEdges.cppTue Apr 17 13:09:47 2007 @@ -129,7 +129,8 @@ // Insert the block into the function... right after the block TI lives in. Function &F = *TIBB->getParent(); - F.getBasicBlockList().insert(TIBB->getNext(), NewBB); + Function::iterator FBBI = TIBB; + F.getBasicBlockList().insert(++FBBI, NewBB); // If there are any PHI nodes in DestBB, we need to update them so that they // merge incoming values from NewBB instead of from TIBB. Index: llvm/lib/Transforms/Utils/LowerSwitch.cpp diff -u llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.37 llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.38 --- llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.37 Mon Apr 16 13:10:23 2007 +++ llvm/lib/Transforms/Utils/LowerSwitch.cpp Tue Apr 17 13:09:47 2007 @@ -155,7 +155,8 @@ // left branch if it is and right branch if not. Function* F = OrigBlock->getParent(); BasicBlock* NewNode = new BasicBlock("NodeBlock"); - F->getBasicBlockList().insert(OrigBlock->getNext(), NewNode); + Function::iterator FI = OrigBlock; + F->getBasicBlockList().insert(++FI, NewNode); ICmpInst* Comp = new ICmpInst(ICmpInst::ICMP_SLT, Val, Pivot.Low, "Pivot"); NewNode->getInstList().push_back(Comp); @@ -175,7 +176,8 @@ { Function* F = OrigBlock->getParent(); BasicBlock* NewLeaf = new BasicBlock("LeafBlock"); - F->getBasicBlockList().insert(OrigBlock->getNext(), NewLeaf); + Function::iterator FI = OrigBlock; + F->getBasicBlockList().insert(++FI, NewLeaf); // Emit comparison ICmpInst* Comp = NULL; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Instruction.h
Changes in directory llvm/include/llvm: Instruction.h updated: 1.84 -> 1.85 --- Log message: Instruction:: Next/Prev accessors are now private --- Diffs of the changes: (+8 -7) Instruction.h | 15 --- 1 files changed, 8 insertions(+), 7 deletions(-) Index: llvm/include/llvm/Instruction.h diff -u llvm/include/llvm/Instruction.h:1.84 llvm/include/llvm/Instruction.h:1.85 --- llvm/include/llvm/Instruction.h:1.84Mon Apr 16 22:26:42 2007 +++ llvm/include/llvm/Instruction.h Tue Apr 17 13:03:55 2007 @@ -82,13 +82,6 @@ inline const BasicBlock *getParent() const { return Parent; } inline BasicBlock *getParent() { return Parent; } - // getNext/Prev - Return the next or previous instruction in the list. The - // last node in the list is a terminator instruction. -Instruction *getNext() { return Next; } - const Instruction *getNext() const { return Next; } -Instruction *getPrev() { return Prev; } - const Instruction *getPrev() const { return Prev; } - /// removeFromParent - This method unlinks 'this' from the containing basic /// block, but does not delete it. /// @@ -231,6 +224,14 @@ #define LAST_OTHER_INST(N) OtherOpsEnd = N+1 #include "llvm/Instruction.def" }; + +private: + // getNext/Prev - Return the next or previous instruction in the list. The + // last node in the list is a terminator instruction. + Instruction *getNext() { return Next; } + const Instruction *getNext() const { return Next; } + Instruction *getPrev() { return Prev; } + const Instruction *getPrev() const { return Prev; } }; } // End llvm namespace ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/ARM/README.txt
Changes in directory llvm/lib/Target/ARM: README.txt updated: 1.21 -> 1.22 --- Log message: add a note --- Diffs of the changes: (+43 -0) README.txt | 43 +++ 1 files changed, 43 insertions(+) Index: llvm/lib/Target/ARM/README.txt diff -u llvm/lib/Target/ARM/README.txt:1.21 llvm/lib/Target/ARM/README.txt:1.22 --- llvm/lib/Target/ARM/README.txt:1.21 Tue Mar 20 17:32:39 2007 +++ llvm/lib/Target/ARM/README.txt Tue Apr 17 13:03:00 2007 @@ -476,3 +476,46 @@ in a load / store. 2. Allow iv reuse even when a type conversion is required. For example, i8 and i32 load / store addressing modes are identical. + + +//===-===// + +This: + +int foo(int a, int b, int c, int d) { + long long acc = (long long)a * (long long)b; + acc += (long long)c * (long long)d; + return (int)(acc >> 32); +} + +Should compile to use SMLAL (Signed Multiply Accumulate Long) which multiplies +two signed 32-bit values to produce a 64-bit value, and accumulates this with +a 64-bit value. + +We currently get this with v6: + +_foo: +mul r12, r1, r0 +smmul r1, r1, r0 +smmul r0, r3, r2 +mul r3, r3, r2 +adds r3, r3, r12 +adc r0, r0, r1 +bx lr + +and this with v4: + +_foo: +stmfd sp!, {r7, lr} +mov r7, sp +mul r12, r1, r0 +smull r0, r1, r1, r0 +smull lr, r0, r3, r2 +mul r3, r3, r2 +adds r3, r3, r12 +adc r0, r0, r1 +ldmfd sp!, {r7, pc} + +This apparently occurs in real code. + +//===-===// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/RSProfiling.cpp
Changes in directory llvm/lib/Transforms/Instrumentation: RSProfiling.cpp updated: 1.22 -> 1.23 --- Log message: remove use of BasicBlock::getNext --- Diffs of the changes: (+4 -3) RSProfiling.cpp |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Instrumentation/RSProfiling.cpp diff -u llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.22 llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.23 --- llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.22Tue Apr 17 12:51:03 2007 +++ llvm/lib/Transforms/Instrumentation/RSProfiling.cpp Tue Apr 17 12:54:12 2007 @@ -455,10 +455,11 @@ // add in edge from C using x in A' //a: - BasicBlock* bbC = new BasicBlock("choice", &F, src->getNext() ); + Function::iterator BBN = src; ++BBN; + BasicBlock* bbC = new BasicBlock("choice", &F, BBN); //ChoicePoints.insert(bbC); - BasicBlock* bbCp = -new BasicBlock("choice", &F, cast(Translate(src))->getNext() ); + BBN = cast(Translate(src)); + BasicBlock* bbCp = new BasicBlock("choice", &F, ++BBN); ChoicePoints.insert(bbCp); //b: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/LoadValueNumbering.cpp
Changes in directory llvm/lib/Analysis: LoadValueNumbering.cpp updated: 1.38 -> 1.39 --- Log message: Remove use of Instruction::getNext --- Diffs of the changes: (+12 -9) LoadValueNumbering.cpp | 21 - 1 files changed, 12 insertions(+), 9 deletions(-) Index: llvm/lib/Analysis/LoadValueNumbering.cpp diff -u llvm/lib/Analysis/LoadValueNumbering.cpp:1.38 llvm/lib/Analysis/LoadValueNumbering.cpp:1.39 --- llvm/lib/Analysis/LoadValueNumbering.cpp:1.38 Fri Apr 6 23:43:07 2007 +++ llvm/lib/Analysis/LoadValueNumbering.cppTue Apr 17 12:52:45 2007 @@ -336,15 +336,18 @@ // we see any candidate loads, then we know they have the same value # as LI. // bool LoadInvalidatedInBBAfter = false; - for (BasicBlock::iterator I = LI->getNext(); I != LoadBB->end(); ++I) { -// If this instruction is a load, then this instruction returns the same -// value as LI. -if (isa(I) && cast(I)->getOperand(0) == LoadPtr) - RetVals.push_back(I); - -if (AA.getModRefInfo(I, LoadPtr, LoadSize) & AliasAnalysis::Mod) { - LoadInvalidatedInBBAfter = true; - break; + { +BasicBlock::iterator I = LI; +for (++I; I != LoadBB->end(); ++I) { + // If this instruction is a load, then this instruction returns the same + // value as LI. + if (isa(I) && cast(I)->getOperand(0) == LoadPtr) +RetVals.push_back(I); + + if (AA.getModRefInfo(I, LoadPtr, LoadSize) & AliasAnalysis::Mod) { +LoadInvalidatedInBBAfter = true; +break; + } } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/RSProfiling.cpp
Changes in directory llvm/lib/Transforms/Instrumentation: RSProfiling.cpp updated: 1.21 -> 1.22 --- Log message: eliminate use of Instruction::getNext() --- Diffs of the changes: (+15 -13) RSProfiling.cpp | 28 +++- 1 files changed, 15 insertions(+), 13 deletions(-) Index: llvm/lib/Transforms/Instrumentation/RSProfiling.cpp diff -u llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.21 llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.22 --- llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.21Mon Apr 16 13:10:23 2007 +++ llvm/lib/Transforms/Instrumentation/RSProfiling.cpp Tue Apr 17 12:51:03 2007 @@ -230,9 +230,10 @@ void GlobalRandomCounterOpt::PrepFunction(Function* F) { //make a local temporary to cache the global BasicBlock& bb = F->getEntryBlock(); - AI = new AllocaInst(T, 0, "localcounter", bb.begin()); - LoadInst* l = new LoadInst(Counter, "counterload", AI->getNext()); - new StoreInst(l, AI, l->getNext()); + BasicBlock::iterator InsertPt = bb.begin(); + AI = new AllocaInst(T, 0, "localcounter", InsertPt); + LoadInst* l = new LoadInst(Counter, "counterload", InsertPt); + new StoreInst(l, AI, InsertPt); //modify all functions and return values to restore the local variable to/from //the global variable @@ -240,25 +241,26 @@ fib != fie; ++fib) for(BasicBlock::iterator bib = fib->begin(), bie = fib->end(); bib != bie; ++bib) - if (isa(&*bib)) { + if (isa(bib)) { LoadInst* l = new LoadInst(AI, "counter", bib); new StoreInst(l, Counter, bib); -l = new LoadInst(Counter, "counter", bib->getNext()); -new StoreInst(l, AI, l->getNext()); - } else if (isa(&*bib)) { +l = new LoadInst(Counter, "counter", ++bib); +new StoreInst(l, AI, bib--); + } else if (isa(bib)) { LoadInst* l = new LoadInst(AI, "counter", bib); new StoreInst(l, Counter, bib); -BasicBlock* bb = cast(&*bib)->getNormalDest(); -Instruction* i = bb->begin(); -while (isa(i)) i = i->getNext(); +BasicBlock* bb = cast(bib)->getNormalDest(); +BasicBlock::iterator i = bb->begin(); +while (isa(i)) + ++i; l = new LoadInst(Counter, "counter", i); -bb = cast(&*bib)->getUnwindDest(); +bb = cast(bib)->getUnwindDest(); i = bb->begin(); -while (isa(i)) i = i->getNext(); +while (isa(i)) ++i; l = new LoadInst(Counter, "counter", i); -new StoreInst(l, AI, l->getNext()); +new StoreInst(l, AI, i); } else if (isa(&*bib) || isa(&*bib)) { LoadInst* l = new LoadInst(AI, "counter", bib); new StoreInst(l, Counter, bib); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Changes in directory llvm/lib/Transforms/Utils: SimplifyCFG.cpp updated: 1.120 -> 1.121 --- Log message: remove use of Instruction::getNext --- Diffs of the changes: (+5 -3) SimplifyCFG.cpp |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.120 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.121 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.120 Sun Apr 1 20:44:59 2007 +++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Tue Apr 17 12:47:54 2007 @@ -1447,10 +1447,11 @@ // predecessor and use logical operations to pick the right destination. BasicBlock *TrueDest = BI->getSuccessor(0); BasicBlock *FalseDest = BI->getSuccessor(1); - if (Instruction *Cond = dyn_cast(BI->getCondition())) + if (Instruction *Cond = dyn_cast(BI->getCondition())) { +BasicBlock::iterator CondIt = Cond; if ((isa(Cond) || isa(Cond)) && Cond->getParent() == BB && &BB->front() == Cond && -Cond->getNext() == BI && Cond->hasOneUse() && +&*++CondIt == BI && Cond->hasOneUse() && TrueDest != BB && FalseDest != BB) for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI!=E; ++PI) if (BranchInst *PBI = dyn_cast((*PI)->getTerminator())) @@ -1496,8 +1497,9 @@ return SimplifyCFG(BB) | 1; } } + } - // Scan predessor blocks for conditional branchs. + // Scan predessor blocks for conditional branches. for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) if (BranchInst *PBI = dyn_cast((*PI)->getTerminator())) if (PBI != BI && PBI->isConditional()) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.178 -> 1.179 --- Log message: eliminate use of Instruction::getPrev(). Patch by Gabor Greif in 2005. --- Diffs of the changes: (+6 -3) Execution.cpp |9 ++--- 1 files changed, 6 insertions(+), 3 deletions(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.178 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.179 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.178Mon Apr 16 16:50:40 2007 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Tue Apr 17 12:38:28 2007 @@ -866,16 +866,19 @@ // If it is an unknown intrinsic function, use the intrinsic lowering // class to transform it into hopefully tasty LLVM code. // - Instruction *Prev = CS.getInstruction()->getPrev(); + BasicBlock::iterator me(CS.getInstruction()); BasicBlock *Parent = CS.getInstruction()->getParent(); + bool atBegin(Parent->begin() == me); + if (!atBegin) +--me; IL->LowerIntrinsicCall(cast(CS.getInstruction())); // Restore the CurInst pointer to the first instruction newly inserted, if // any. - if (!Prev) { + if (atBegin) { SF.CurInst = Parent->begin(); } else { -SF.CurInst = Prev; +SF.CurInst = me; ++SF.CurInst; } return; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.202 -> 1.203 --- Log message: eliminate a use of Instruction::getPrev(), patch by Gabor Greif in 2005. --- Diffs of the changes: (+2 -1) Verifier.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.202 llvm/lib/VMCore/Verifier.cpp:1.203 --- llvm/lib/VMCore/Verifier.cpp:1.202 Wed Apr 11 21:48:46 2007 +++ llvm/lib/VMCore/Verifier.cppTue Apr 17 12:36:12 2007 @@ -640,7 +640,8 @@ // This can be tested by checking whether the instruction before this is // either nonexistent (because this is begin()) or is a PHI node. If not, // then there is some other instruction before a PHI. - Assert2(&PN.getParent()->front() == &PN || isa(PN.getPrev()), + Assert2(&PN == &PN.getParent()->front() || + isa(--BasicBlock::iterator(&PN)), "PHI nodes not grouped at top of basic block!", &PN, PN.getParent()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp X86AsmPrinter.cpp X86AsmPrinter.h X86ISelLowering.cpp X86IntelAsmPrinter.cpp X86MachineFunctionInfo.h X86RegisterInfo.cpp
Changes in directory llvm/lib/Target/X86: X86ATTAsmPrinter.cpp updated: 1.99 -> 1.100 X86AsmPrinter.cpp updated: 1.238 -> 1.239 X86AsmPrinter.h updated: 1.43 -> 1.44 X86ISelLowering.cpp updated: 1.391 -> 1.392 X86IntelAsmPrinter.cpp updated: 1.69 -> 1.70 X86MachineFunctionInfo.h updated: 1.4 -> 1.5 X86RegisterInfo.cpp updated: 1.210 -> 1.211 --- Log message: rename X86FunctionInfo to X86MachineFunctionInfo to match the header file it is defined in. --- Diffs of the changes: (+23 -21) X86ATTAsmPrinter.cpp |2 +- X86AsmPrinter.cpp|8 X86AsmPrinter.h |2 +- X86ISelLowering.cpp | 12 +++- X86IntelAsmPrinter.cpp |2 +- X86MachineFunctionInfo.h | 16 X86RegisterInfo.cpp |2 +- 7 files changed, 23 insertions(+), 21 deletions(-) Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.99 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.100 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.99 Sat Mar 24 21:01:03 2007 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cppTue Apr 17 12:21:52 2007 @@ -92,7 +92,7 @@ // Populate function information map. Actually, We don't want to populate // non-stdcall or non-fastcall functions' information right now. if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall) -FunctionInfoMap[F] = *MF.getInfo(); +FunctionInfoMap[F] = *MF.getInfo(); X86SharedAsmPrinter::decorateName(CurrentFnName, F); Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.238 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.239 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.238 Sat Mar 31 08:11:52 2007 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Tue Apr 17 12:21:52 2007 @@ -32,9 +32,9 @@ #include "llvm/Target/TargetOptions.h" using namespace llvm; -static X86FunctionInfo calculateFunctionInfo(const Function *F, - const TargetData *TD) { - X86FunctionInfo Info; +static X86MachineFunctionInfo calculateFunctionInfo(const Function *F, +const TargetData *TD) { + X86MachineFunctionInfo Info; uint64_t Size = 0; switch (F->getCallingConv()) { @@ -77,7 +77,7 @@ FMFInfoMap::const_iterator info_item = FunctionInfoMap.find(F); - const X86FunctionInfo *Info; + const X86MachineFunctionInfo *Info; if (info_item == FunctionInfoMap.end()) { // Calculate apropriate function info and populate map FunctionInfoMap[F] = calculateFunctionInfo(F, TM.getTargetData()); Index: llvm/lib/Target/X86/X86AsmPrinter.h diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.43 llvm/lib/Target/X86/X86AsmPrinter.h:1.44 --- llvm/lib/Target/X86/X86AsmPrinter.h:1.43Fri Jan 26 15:22:28 2007 +++ llvm/lib/Target/X86/X86AsmPrinter.h Tue Apr 17 12:21:52 2007 @@ -48,7 +48,7 @@ // // This structure is using e.g. for name decoration for stdcall & fastcall'ed // function, since we have to use arguments' size for decoration. - typedef std::map FMFInfoMap; + typedef std::map FMFInfoMap; FMFInfoMap FunctionInfoMap; void decorateName(std::string& Name, const GlobalValue* GV); Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.391 llvm/lib/Target/X86/X86ISelLowering.cpp:1.392 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.391 Tue Apr 17 04:20:00 2007 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Tue Apr 17 12:21:52 2007 @@ -729,7 +729,8 @@ RegSaveFrameIndex = 0xAAA; // X86-64 only. ReturnAddrIndex = 0;// No return address slot generated yet. - MF.getInfo()->setBytesToPopOnReturn(BytesToPopOnReturn); + MF.getInfo() +->setBytesToPopOnReturn(BytesToPopOnReturn); // Return the new list of results. return DAG.getNode(ISD::MERGE_VALUES, Op.Val->getVTList(), @@ -973,7 +974,8 @@ BytesToPopOnReturn = StackSize; // Callee pops all stack arguments. BytesCallerReserves = 0; - MF.getInfo()->setBytesToPopOnReturn(BytesToPopOnReturn); + MF.getInfo() +->setBytesToPopOnReturn(BytesToPopOnReturn); // Return the new list of results. return DAG.getNode(ISD::MERGE_VALUES, Op.Val->getVTList(), @@ -3441,7 +3443,7 @@ if (Fn->hasExternalLinkage() && Subtarget->isTargetCygMing() && Fn->getName() == "main") -MF.getInfo()->setForceFramePointer(true); +MF.getInfo()->setForceFramePointer(true); unsigned CC = cast(Op.getOperand(1))->getValue(); if (Subtarget->is64Bit()) @@ -3457,10 +3459,10 @@ case CallingConv::C: return LowerCCCArguments(Op, DAG); case CallingConv::X86_StdCall: - MF.getInfo()->setDecorationStyle(StdCall); + MF.getInfo()->setDecorationStyle(StdCall); return LowerCCCArguments(Op, DAG, true); case CallingConv::X86_FastCall: - MF.getInfo()->setDecorationStyle(FastCall); + MF.getInfo()->setDecorationStyle(FastCall);
Re: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86ISelLowering.h X86InstrInfo.td X86RegisterInfo.cpp
> > Implemented correct stack probing on mingw/cygwin for dynamic > alloca's. > Also, fixed static case in presence of eax livin. This fixes PR331: > http://llvm.org/PR331 Cool :) > > +SDOperand X86TargetLowering::LowerDYNAMIC_STACKALLOC(SDOperand Op, > + SelectionDAG > &DAG) { Please add a comment above this that explains why this lowering is needed. Also, please assert that the subtarget isCygMing() on entry, to make it obvious to the reader that this is cygwin-specific lowering code. Thanks Anton! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [126244] Use ConstantInt:: getAllOnesValue to get hold of -1 in CEIL_DIV_EXPR.
Revision: 126244 Author: clattner Date: 2007-04-17 09:28:45 -0700 (Tue, 17 Apr 2007) Log Message: --- Use ConstantInt::getAllOnesValue to get hold of -1 in CEIL_DIV_EXPR. Patch by Duncan Sands Modified Paths: -- apple-local/branches/llvm/gcc/llvm-convert.cpp Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp === --- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-04-17 07:31:45 UTC (rev 126243) +++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-04-17 16:28:45 UTC (rev 126244) @@ -3244,7 +3244,7 @@ const Type *Ty = ConvertType(TREE_TYPE(exp)); Constant *Zero = ConstantInt::get(Ty, 0); Constant *One = ConstantInt::get(Ty, 1); - Constant *MinusOne = ConstantInt::get(Ty, -1U); + Constant *MinusOne = ConstantInt::getAllOnesValue(Ty); Value *LHS = Emit(TREE_OPERAND(exp, 0), 0); Value *RHS = Emit(TREE_OPERAND(exp, 1), 0); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] llvm-gcc: use ConstantInt::getAllOnesValue to get -1
Use ConstantInt::getAllOnesValue to get hold of -1 in CEIL_DIV_EXPR. Ciao, Duncan. Index: gcc.llvm.master/gcc/llvm-convert.cpp === --- gcc.llvm.master.orig/gcc/llvm-convert.cpp 2007-04-17 18:06:16.0 +0200 +++ gcc.llvm.master/gcc/llvm-convert.cpp 2007-04-17 18:03:56.0 +0200 @@ -3244,7 +3244,7 @@ const Type *Ty = ConvertType(TREE_TYPE(exp)); Constant *Zero = ConstantInt::get(Ty, 0); Constant *One = ConstantInt::get(Ty, 1); - Constant *MinusOne = ConstantInt::get(Ty, -1U); + Constant *MinusOne = ConstantInt::getAllOnesValue(Ty); Value *LHS = Emit(TREE_OPERAND(exp, 0), 0); Value *RHS = Emit(TREE_OPERAND(exp, 1), 0); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86ISelLowering.h X86InstrInfo.td X86RegisterInfo.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.390 -> 1.391 X86ISelLowering.h updated: 1.97 -> 1.98 X86InstrInfo.td updated: 1.301 -> 1.302 X86RegisterInfo.cpp updated: 1.209 -> 1.210 --- Log message: Implemented correct stack probing on mingw/cygwin for dynamic alloca's. Also, fixed static case in presence of eax livin. This fixes PR331: http://llvm.org/PR331 PS: Why don't we still have push/pop instructions? :) --- Diffs of the changes: (+68 -5) X86ISelLowering.cpp | 36 +++- X86ISelLowering.h |1 + X86InstrInfo.td |3 +++ X86RegisterInfo.cpp | 33 + 4 files changed, 68 insertions(+), 5 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.390 llvm/lib/Target/X86/X86ISelLowering.cpp:1.391 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.390 Mon Apr 16 13:10:23 2007 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Tue Apr 17 04:20:00 2007 @@ -237,7 +237,10 @@ setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand); if (Subtarget->is64Bit()) setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i64, Expand); - setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32 , Expand); + if (Subtarget->isTargetCygMing()) +setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32, Custom); + else +setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32, Expand); if (X86ScalarSSE) { // Set up the FP register classes. @@ -3401,6 +3404,36 @@ } } +SDOperand X86TargetLowering::LowerDYNAMIC_STACKALLOC(SDOperand Op, + SelectionDAG &DAG) { + // Get the inputs. + SDOperand Chain = Op.getOperand(0); + SDOperand Size = Op.getOperand(1); + // FIXME: Ensure alignment here + + TargetLowering::ArgListTy Args; + TargetLowering::ArgListEntry Entry; + MVT::ValueType IntPtr = getPointerTy(); + MVT::ValueType SPTy = (Subtarget->is64Bit() ? MVT::i64 : MVT::i32); + const Type *IntPtrTy = getTargetData()->getIntPtrType(); + + Entry.Node= Size; + Entry.Ty = IntPtrTy; + Entry.isInReg = true; // Should pass in EAX + Args.push_back(Entry); + std::pair CallResult = +LowerCallTo(Chain, IntPtrTy, false, false, CallingConv::C, false, +DAG.getExternalSymbol("_alloca", IntPtr), Args, DAG); + + SDOperand SP = DAG.getCopyFromReg(CallResult.second, X86StackPtr, SPTy); + + std::vector Tys; + Tys.push_back(SPTy); + Tys.push_back(MVT::Other); + SDOperand Ops[2] = { SP, CallResult.second }; + return DAG.getNode(ISD::MERGE_VALUES, Tys, Ops, 2); +} + SDOperand X86TargetLowering::LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG) { MachineFunction &MF = DAG.getMachineFunction(); @@ -4002,6 +4035,7 @@ case ISD::INTRINSIC_WO_CHAIN: return LowerINTRINSIC_WO_CHAIN(Op, DAG); case ISD::RETURNADDR: return LowerRETURNADDR(Op, DAG); case ISD::FRAMEADDR: return LowerFRAMEADDR(Op, DAG); + case ISD::DYNAMIC_STACKALLOC: return LowerDYNAMIC_STACKALLOC(Op, DAG); } return SDOperand(); } Index: llvm/lib/Target/X86/X86ISelLowering.h diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.97 llvm/lib/Target/X86/X86ISelLowering.h:1.98 --- llvm/lib/Target/X86/X86ISelLowering.h:1.97 Mon Apr 9 18:31:19 2007 +++ llvm/lib/Target/X86/X86ISelLowering.h Tue Apr 17 04:20:00 2007 @@ -401,6 +401,7 @@ SDOperand LowerJumpTable(SDOperand Op, SelectionDAG &DAG); SDOperand LowerCALL(SDOperand Op, SelectionDAG &DAG); SDOperand LowerRET(SDOperand Op, SelectionDAG &DAG); +SDOperand LowerDYNAMIC_STACKALLOC(SDOperand Op, SelectionDAG &DAG); SDOperand LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG); SDOperand LowerREADCYCLCECOUNTER(SDOperand Op, SelectionDAG &DAG); SDOperand LowerVASTART(SDOperand Op, SelectionDAG &DAG); Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.301 llvm/lib/Target/X86/X86InstrInfo.td:1.302 --- llvm/lib/Target/X86/X86InstrInfo.td:1.301 Tue Apr 10 17:10:25 2007 +++ llvm/lib/Target/X86/X86InstrInfo.td Tue Apr 17 04:20:00 2007 @@ -477,6 +477,9 @@ def POP32r : I<0x58, AddRegFrm, (ops GR32:$reg), "pop{l} $reg", []>, Imp<[ESP],[ESP]>; +def PUSH32r : I<0x50, AddRegFrm, + (ops GR32:$reg), "push{l} $reg", []>, Imp<[ESP],[ESP]>; + def MovePCtoStack : I<0, Pseudo, (ops piclabel:$label), "call $label", []>; Index: llvm/lib/Target/X86/X86RegisterInfo.cpp diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.209 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.210 --- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.209 Tue Apr 3 01:18:31 2007 +++ llvm/lib/Target/X86/X86RegisterInfo.cpp Tue Apr 17 04:20:00 2007 @@ -1039,14 +1039,39 @@ if (NumBytes) { // adjust stack pointer: ESP -= numbytes if (NumBytes >= 4096 && Subtarget->isTargetCygMing()) { + // Check, whether EA
[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
Changes in directory llvm/include/llvm/CodeGen: SelectionDAGNodes.h updated: 1.183 -> 1.184 --- Log message: Implemented correct stack probing on mingw/cygwin for dynamic alloca's. Also, fixed static case in presence of eax livin. This fixes PR331: http://llvm.org/PR331 PS: Why don't we still have push/pop instructions? :) --- Diffs of the changes: (+5 -4) SelectionDAGNodes.h |9 + 1 files changed, 5 insertions(+), 4 deletions(-) Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.183 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.184 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.183 Sun Apr 1 02:28:37 2007 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Tue Apr 17 04:20:00 2007 @@ -430,10 +430,11 @@ TRUNCSTORE, // DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned -// to a specified boundary. The first operand is the token chain, the -// second is the number of bytes to allocate, and the third is the alignment -// boundary. The size is guaranteed to be a multiple of the stack -// alignment, and the alignment is guaranteed to be bigger than the stack +// to a specified boundary. This node always has two return values: a new +// stack pointer value and a chain. The first operand is the token chain, +// the second is the number of bytes to allocate, and the third is the +// alignment boundary. The size is guaranteed to be a multiple of the stack +// alignment, and the alignment is guaranteed to be bigger than the stack // alignment (if required) or 0 to get standard stack alignment. DYNAMIC_STACKALLOC, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CodeGen/X86/mingw-alloca.ll
Changes in directory llvm/test/CodeGen/X86: mingw-alloca.ll added (r1.1) --- Log message: Implemented correct stack probing on mingw/cygwin for dynamic alloca's. Also, fixed static case in presence of eax livin. This fixes PR331: http://llvm.org/PR331 PS: Why don't we still have push/pop instructions? :) --- Diffs of the changes: (+27 -0) mingw-alloca.ll | 27 +++ 1 files changed, 27 insertions(+) Index: llvm/test/CodeGen/X86/mingw-alloca.ll diff -c /dev/null llvm/test/CodeGen/X86/mingw-alloca.ll:1.1 *** /dev/null Tue Apr 17 04:20:10 2007 --- llvm/test/CodeGen/X86/mingw-alloca.ll Tue Apr 17 04:20:00 2007 *** *** 0 --- 1,27 + ; RUN: llvm-as < %s | llc -o %t -f + ; RUN: grep __alloca %t | wc -l | grep 2 + ; RUN: grep 8028 %t + ; RUN: grep {pushl %eax} %t + ; RUN: grep 8024 %t | wc -l | grep 2 + + target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" + target triple = "i386-mingw32" + + define void @foo1(i32 %N) { + entry: + %tmp14 = alloca i32, i32 %N ; [#uses=1] + call void @bar1( i32* %tmp14 ) + ret void + } + + declare void @bar1(i32*) + + define void @foo2(i32 inreg %N) { + entry: + %A2 = alloca [2000 x i32], align 16 ; <[2000 x i32]*> [#uses=1] + %A2.sub = getelementptr [2000 x i32]* %A2, i32 0, i32 0 ; [#uses=1] + call void @bar2( i32* %A2.sub, i32 %N ) + ret void + } + + declare void @bar2(i32*, i32) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/CBackend/CBackend.cpp
Changes in directory llvm/lib/Target/CBackend: CBackend.cpp updated: 1.337 -> 1.338 --- Log message: Implemented correct stack probing on mingw/cygwin for dynamic alloca's. Also, fixed static case in presence of eax livin. This fixes PR331: http://llvm.org/PR331 PS: Why don't we still have push/pop instructions? :) --- Diffs of the changes: (+2 -2) CBackend.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/CBackend/CBackend.cpp diff -u llvm/lib/Target/CBackend/CBackend.cpp:1.337 llvm/lib/Target/CBackend/CBackend.cpp:1.338 --- llvm/lib/Target/CBackend/CBackend.cpp:1.337 Fri Apr 13 17:52:03 2007 +++ llvm/lib/Target/CBackend/CBackend.cpp Tue Apr 17 04:20:00 2007 @@ -1281,8 +1281,8 @@ // Alloca is hard to get, and we don't want to include stdlib.h here. Out << "/* get a declaration for alloca */\n" << "#if defined(__CYGWIN__) || defined(__MINGW32__)\n" - << "extern void *_alloca(unsigned long);\n" - << "#define alloca(x) _alloca(x)\n" + << "#define alloca(x) __builtin_alloca((x))\n" + << "#define _alloca(x) __builtin_alloca((x))\n" << "#elif defined(__APPLE__)\n" << "extern void *__builtin_alloca(unsigned long);\n" << "#define alloca(x) __builtin_alloca(x)\n" ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits