From baldrick at free.fr Mon Jul 26 02:54:17 2010 From: baldrick at free.fr (Duncan Sands) Date: Mon, 26 Jul 2010 07:54:17 -0000 Subject: [llvm-commits] [llvm] r109393 - /llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Message-ID: <20100726075418.06E0D2A6C12D@llvm.org> Author: baldrick Date: Mon Jul 26 02:54:17 2010 New Revision: 109393 URL: http://llvm.org/viewvc/llvm-project?rev=109393&view=rev Log: Pacify gcc-4.5 which wrongly thinks that RExcess (passed as the Excess parameter) may be used uninitialized in the callers of HighRegPressure. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=109393&r1=109392&r2=109393&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Mon Jul 26 02:54:17 2010 @@ -1192,11 +1192,12 @@ } bool HighRegPressure(const SUnit *SU, unsigned &Excess) const { + Excess = 0; + if (!TLI) return false; bool High = false; - Excess = 0; for (SUnit::const_pred_iterator I = SU->Preds.begin(),E = SU->Preds.end(); I != E; ++I) { if (I->isCtrl()) From daniel at zuster.org Mon Jul 26 10:28:59 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 26 Jul 2010 08:28:59 -0700 Subject: [llvm-commits] [llvm] r109302 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp In-Reply-To: <20100724005322.9283F2A6C12C@llvm.org> References: <20100724005322.9283F2A6C12C@llvm.org> Message-ID: Hi Devang, The backend should not be introducing dependencies on the current working directory. This kind of stuff needs to be in the frontend. - Daniel On Fri, Jul 23, 2010 at 5:53 PM, Devang Patel wrote: > Author: dpatel > Date: Fri Jul 23 19:53:22 2010 > New Revision: 109302 > > URL: http://llvm.org/viewvc/llvm-project?rev=109302&view=rev > Log: > Use current working directory when Dirname is empty. This only happens when absolute source file path is used on compiler command line. > > Modified: > ? ?llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=109302&r1=109301&r2=109302&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Jul 23 19:53:22 2010 > @@ -1753,6 +1753,11 @@ > ?/// maps as well. > ?unsigned DwarfDebug::GetOrCreateSourceID(StringRef DirName, StringRef FileName){ > ? unsigned DId; > + ?if (DirName.empty()) { > + ? ?llvm::sys::Path CWD = llvm::sys::Path::GetCurrentDirectory(); > + ? ?DirName = StringRef(CWD.c_str(), CWD.size()); > + ?} > + > ? StringMap::iterator DI = DirectoryIdMap.find(DirName); > ? if (DI != DirectoryIdMap.end()) { > ? ? DId = DI->getValue(); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From gohman at apple.com Mon Jul 26 11:01:15 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 26 Jul 2010 16:01:15 -0000 Subject: [llvm-commits] [llvm] r109394 - /llvm/trunk/lib/MC/MCDisassembler/ Message-ID: <20100726160115.EA1222A6C12C@llvm.org> Author: djg Date: Mon Jul 26 11:01:15 2010 New Revision: 109394 URL: http://llvm.org/viewvc/llvm-project?rev=109394&view=rev Log: Add an svn:ignore. Modified: llvm/trunk/lib/MC/MCDisassembler/ (props changed) Propchange: llvm/trunk/lib/MC/MCDisassembler/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Jul 26 11:01:15 2010 @@ -0,0 +1,9 @@ +Debug +Debug+Checks +Debug+Coverage +Debug+Coverage-Asserts +Release +Release-Asserts +Release+Coverage +Debug+Asserts +Release+Asserts From clattner at apple.com Mon Jul 26 12:05:48 2010 From: clattner at apple.com (Chris Lattner) Date: Mon, 26 Jul 2010 10:05:48 -0700 Subject: [llvm-commits] [llvm] r109302 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp In-Reply-To: References: <20100724005322.9283F2A6C12C@llvm.org> Message-ID: <8701F036-6C65-4803-AFA8-824E74CD9AB8@apple.com> Completely agreed. With a compiler server (for example) the individual compiler instances and the backend may be running in completely different directories. -Chris On Jul 26, 2010, at 8:28 AM, Daniel Dunbar wrote: > Hi Devang, > > The backend should not be introducing dependencies on the current > working directory. This kind of stuff needs to be in the frontend. > > - Daniel > > On Fri, Jul 23, 2010 at 5:53 PM, Devang Patel wrote: >> Author: dpatel >> Date: Fri Jul 23 19:53:22 2010 >> New Revision: 109302 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=109302&view=rev >> Log: >> Use current working directory when Dirname is empty. This only happens when absolute source file path is used on compiler command line. >> >> Modified: >> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp >> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=109302&r1=109301&r2=109302&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Jul 23 19:53:22 2010 >> @@ -1753,6 +1753,11 @@ >> /// maps as well. >> unsigned DwarfDebug::GetOrCreateSourceID(StringRef DirName, StringRef FileName){ >> unsigned DId; >> + if (DirName.empty()) { >> + llvm::sys::Path CWD = llvm::sys::Path::GetCurrentDirectory(); >> + DirName = StringRef(CWD.c_str(), CWD.size()); >> + } >> + >> StringMap::iterator DI = DirectoryIdMap.find(DirName); >> if (DI != DirectoryIdMap.end()) { >> DId = DI->getValue(); >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From fjahanian at apple.com Mon Jul 26 12:14:50 2010 From: fjahanian at apple.com (Fariborz Jahanian) Date: Mon, 26 Jul 2010 17:14:50 -0000 Subject: [llvm-commits] [test-suite] r109397 - /test-suite/trunk/SingleSource/UnitTests/block-call-r7674133.cpp Message-ID: <20100726171450.612D12A6C12C@llvm.org> Author: fjahanian Date: Mon Jul 26 12:14:50 2010 New Revision: 109397 URL: http://llvm.org/viewvc/llvm-project?rev=109397&view=rev Log: This test is only for when blocks are enabled. Modified: test-suite/trunk/SingleSource/UnitTests/block-call-r7674133.cpp Modified: test-suite/trunk/SingleSource/UnitTests/block-call-r7674133.cpp URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/block-call-r7674133.cpp?rev=109397&r1=109396&r2=109397&view=diff ============================================================================== --- test-suite/trunk/SingleSource/UnitTests/block-call-r7674133.cpp (original) +++ test-suite/trunk/SingleSource/UnitTests/block-call-r7674133.cpp Mon Jul 26 12:14:50 2010 @@ -1,4 +1,4 @@ -#ifdef __clang__ +#if defined(__BLOCKS__) && defined(__clang__) extern "C" void abort(void); class Test { @@ -10,7 +10,7 @@ ~Test() { - i = -1;; + i = -1; } Test(const Test&r) @@ -28,7 +28,7 @@ int main (int , char * const []) { -#ifdef __clang__ +#if defined(__BLOCKS__) && defined(__clang__) Test t; ^{ t.speak(); }(); #endif From gohman at apple.com Mon Jul 26 12:34:05 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 26 Jul 2010 17:34:05 -0000 Subject: [llvm-commits] [llvm] r109398 - /llvm/trunk/lib/Analysis/RegionInfo.cpp Message-ID: <20100726173405.3F8FC2A6C12C@llvm.org> Author: djg Date: Mon Jul 26 12:34:05 2010 New Revision: 109398 URL: http://llvm.org/viewvc/llvm-project?rev=109398&view=rev Log: Use DominatorTree::properlyDominates instead of dominates with an explicit inequality check. Modified: llvm/trunk/lib/Analysis/RegionInfo.cpp Modified: llvm/trunk/lib/Analysis/RegionInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/RegionInfo.cpp?rev=109398&r1=109397&r2=109398&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/RegionInfo.cpp (original) +++ llvm/trunk/lib/Analysis/RegionInfo.cpp Mon Jul 26 12:34:05 2010 @@ -356,7 +356,7 @@ // Do not allow edges pointing into the region. for (DST::iterator SI = exitSuccs->begin(), SE = exitSuccs->end(); SI != SE; ++SI) - if (DT->dominates(entry, *SI) && *SI != entry && *SI != exit) + if (DT->properlyDominates(entry, *SI) && *SI != exit) return false; From baldrick at free.fr Mon Jul 26 12:34:56 2010 From: baldrick at free.fr (Duncan Sands) Date: Mon, 26 Jul 2010 17:34:56 -0000 Subject: [llvm-commits] [dragonegg] r109399 - /dragonegg/trunk/llvm-types.cpp Message-ID: <20100726173456.B96322A6C12C@llvm.org> Author: baldrick Date: Mon Jul 26 12:34:56 2010 New Revision: 109399 URL: http://llvm.org/viewvc/llvm-project?rev=109399&view=rev Log: Remove extraneous "inline" keyword that was left behind when this function was was moved out of line. Modified: dragonegg/trunk/llvm-types.cpp Modified: dragonegg/trunk/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-types.cpp?rev=109399&r1=109398&r2=109399&view=diff ============================================================================== --- dragonegg/trunk/llvm-types.cpp (original) +++ dragonegg/trunk/llvm-types.cpp Mon Jul 26 12:34:56 2010 @@ -225,7 +225,7 @@ } /// getFieldOffsetInBits - Return the bit offset of a FIELD_DECL in a structure. -inline uint64_t getFieldOffsetInBits(tree field) { +uint64_t getFieldOffsetInBits(tree field) { assert(OffsetIsLLVMCompatible(field) && "Offset is not constant!"); uint64_t Result = getInt64(DECL_FIELD_BIT_OFFSET(field), true); Result += getInt64(DECL_FIELD_OFFSET(field), true) * BITS_PER_UNIT; From gohman at apple.com Mon Jul 26 12:35:32 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 26 Jul 2010 17:35:32 -0000 Subject: [llvm-commits] [llvm] r109400 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <20100726173532.CC3A72A6C12C@llvm.org> Author: djg Date: Mon Jul 26 12:35:32 2010 New Revision: 109400 URL: http://llvm.org/viewvc/llvm-project?rev=109400&view=rev Log: A block dominates itself, by definition. Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=109400&r1=109399&r2=109400&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Mon Jul 26 12:35:32 2010 @@ -677,7 +677,7 @@ for(pred_iterator PI = pred_begin(FrontierBB), PE = pred_end(FrontierBB); PI != PE; ++PI) { BasicBlock *P = *PI; - if (P == DeadBB || DT->dominates(DeadBB, P)) + if (DT->dominates(DeadBB, P)) PredBlocks.push_back(P); } From gohman at apple.com Mon Jul 26 12:37:36 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 26 Jul 2010 17:37:36 -0000 Subject: [llvm-commits] [llvm] r109401 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <20100726173736.ABAB42A6C12C@llvm.org> Author: djg Date: Mon Jul 26 12:37:36 2010 New Revision: 109401 URL: http://llvm.org/viewvc/llvm-project?rev=109401&view=rev Log: Use DominatorTree::properlyDominates instead of dominates with an explicit inequality check. Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=109401&r1=109400&r2=109401&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Mon Jul 26 12:37:36 2010 @@ -799,7 +799,7 @@ // the dominance frontiers. for (Loop::block_iterator I = LP->block_begin(), E = LP->block_end(); I != E; ++I) { - if (*I == CondBB || !DT->dominates(CondBB, *I)) continue; + if (!DT->properlyDominates(CondBB, *I)) continue; DominanceFrontier::iterator BBDF = DF->find(*I); DominanceFrontier::DomSetType::iterator DomSetI = BBDF->second.begin(); DominanceFrontier::DomSetType::iterator DomSetE = BBDF->second.end(); From gohman at apple.com Mon Jul 26 12:38:15 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 26 Jul 2010 17:38:15 -0000 Subject: [llvm-commits] [llvm] r109402 - /llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp Message-ID: <20100726173815.398792A6C12C@llvm.org> Author: djg Date: Mon Jul 26 12:38:15 2010 New Revision: 109402 URL: http://llvm.org/viewvc/llvm-project?rev=109402&view=rev Log: A block dominates itself, by definition. Modified: llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp Modified: llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp?rev=109402&r1=109401&r2=109402&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp Mon Jul 26 12:38:15 2010 @@ -338,7 +338,7 @@ for (SmallPtrSet::iterator UI = URoRInvokes.begin(), UE = URoRInvokes.end(); UI != UE; ++UI) { const BasicBlock *URoRBB = (*UI)->getParent(); - if (SelBB == URoRBB || DT->dominates(SelBB, URoRBB)) { + if (DT->dominates(SelBB, URoRBB)) { SelsToConvert.insert(*SI); break; } From gohman at apple.com Mon Jul 26 12:39:33 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 26 Jul 2010 17:39:33 -0000 Subject: [llvm-commits] [llvm] r109403 - /llvm/trunk/lib/VMCore/Dominators.cpp Message-ID: <20100726173933.DC39A2A6C12D@llvm.org> Author: djg Date: Mon Jul 26 12:39:33 2010 New Revision: 109403 URL: http://llvm.org/viewvc/llvm-project?rev=109403&view=rev Log: Fix formatting. Modified: llvm/trunk/lib/VMCore/Dominators.cpp Modified: llvm/trunk/lib/VMCore/Dominators.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=109403&r1=109402&r2=109403&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Dominators.cpp (original) +++ llvm/trunk/lib/VMCore/Dominators.cpp Mon Jul 26 12:39:33 2010 @@ -123,8 +123,8 @@ // NewBB is split and now it has one successor. Update dominance frontier to // reflect this change. void DominanceFrontier::splitBlock(BasicBlock *NewBB) { - assert(NewBB->getTerminator()->getNumSuccessors() == 1 - && "NewBB should have a single successor!"); + assert(NewBB->getTerminator()->getNumSuccessors() == 1 && + "NewBB should have a single successor!"); BasicBlock *NewBBSucc = NewBB->getTerminator()->getSuccessor(0); SmallVector PredBlocks; From gohman at apple.com Mon Jul 26 12:41:46 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 26 Jul 2010 17:41:46 -0000 Subject: [llvm-commits] [llvm] r109404 - /llvm/trunk/lib/VMCore/Dominators.cpp Message-ID: <20100726174146.285E72A6C12C@llvm.org> Author: djg Date: Mon Jul 26 12:41:45 2010 New Revision: 109404 URL: http://llvm.org/viewvc/llvm-project?rev=109404&view=rev Log: Exit a search loop when the search goal is found. Modified: llvm/trunk/lib/VMCore/Dominators.cpp Modified: llvm/trunk/lib/VMCore/Dominators.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=109404&r1=109403&r2=109404&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Dominators.cpp (original) +++ llvm/trunk/lib/VMCore/Dominators.cpp Mon Jul 26 12:41:45 2010 @@ -161,8 +161,10 @@ bool DominatesPred = false; for (pred_iterator PI = pred_begin(*SetI), E = pred_end(*SetI); PI != E; ++PI) - if (DT.dominates(NewBB, *PI)) + if (DT.dominates(NewBB, *PI)) { DominatesPred = true; + break; + } if (!DominatesPred) Set.erase(SetI++); else From gohman at apple.com Mon Jul 26 12:45:33 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 26 Jul 2010 17:45:33 -0000 Subject: [llvm-commits] [llvm] r109405 - /llvm/trunk/lib/VMCore/Dominators.cpp Message-ID: <20100726174533.5D53E2A6C12C@llvm.org> Author: djg Date: Mon Jul 26 12:45:33 2010 New Revision: 109405 URL: http://llvm.org/viewvc/llvm-project?rev=109405&view=rev Log: Avoid copying and recopying a std::set. Modified: llvm/trunk/lib/VMCore/Dominators.cpp Modified: llvm/trunk/lib/VMCore/Dominators.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=109405&r1=109404&r2=109405&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Dominators.cpp (original) +++ llvm/trunk/lib/VMCore/Dominators.cpp Mon Jul 26 12:45:33 2010 @@ -140,12 +140,8 @@ // NewBBSucc inherits original NewBB frontier. DominanceFrontier::iterator NewBBI = find(NewBB); - if (NewBBI != end()) { - DominanceFrontier::DomSetType NewBBSet = NewBBI->second; - DominanceFrontier::DomSetType NewBBSuccSet; - NewBBSuccSet.insert(NewBBSet.begin(), NewBBSet.end()); - addBasicBlock(NewBBSucc, NewBBSuccSet); - } + if (NewBBI != end()) + addBasicBlock(NewBBSucc, NewBBI->second); // If NewBB dominates NewBBSucc, then DF(NewBB) is now going to be the // DF(NewBBSucc) without the stuff that the new block does not dominate From echristo at apple.com Mon Jul 26 12:53:07 2010 From: echristo at apple.com (Eric Christopher) Date: Mon, 26 Jul 2010 17:53:07 -0000 Subject: [llvm-commits] [llvm] r109407 - /llvm/trunk/utils/TableGen/FastISelEmitter.cpp Message-ID: <20100726175307.C5FC32A6C12C@llvm.org> Author: echristo Date: Mon Jul 26 12:53:07 2010 New Revision: 109407 URL: http://llvm.org/viewvc/llvm-project?rev=109407&view=rev Log: 80-col. Modified: llvm/trunk/utils/TableGen/FastISelEmitter.cpp Modified: llvm/trunk/utils/TableGen/FastISelEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FastISelEmitter.cpp?rev=109407&r1=109406&r2=109407&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/FastISelEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/FastISelEmitter.cpp Mon Jul 26 12:53:07 2010 @@ -208,7 +208,8 @@ typedef std::map RetPredMap; typedef std::map TypeRetPredMap; typedef std::map OpcodeTypeRetPredMap; - typedef std::map OperandsOpcodeTypeRetPredMap; + typedef std::map + OperandsOpcodeTypeRetPredMap; OperandsOpcodeTypeRetPredMap SimplePatterns; @@ -375,7 +376,8 @@ SubRegNo, PhysRegInputs }; - assert(!SimplePatterns[Operands][OpcodeName][VT][RetVT].count(PredicateCheck) && + assert(!SimplePatterns[Operands][OpcodeName][VT][RetVT] + .count(PredicateCheck) && "Duplicate pattern!"); SimplePatterns[Operands][OpcodeName][VT][RetVT][PredicateCheck] = Memo; } From gohman at apple.com Mon Jul 26 12:55:15 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 26 Jul 2010 17:55:15 -0000 Subject: [llvm-commits] [llvm] r109408 - /llvm/trunk/lib/VMCore/Dominators.cpp Message-ID: <20100726175515.B76F12A6C12C@llvm.org> Author: djg Date: Mon Jul 26 12:55:15 2010 New Revision: 109408 URL: http://llvm.org/viewvc/llvm-project?rev=109408&view=rev Log: Fix (at least) quadratic worst-case complexity in DominanceFrontier::splitBlock: don't visit all blocks in the function, and don't iterate over the split blocks' predecessor lists for each block visited. Also, remove the special-case test for the entry block. Splitting the entry block isn't common enough to make this worthwhile. This fixes a major compile-time bottleneck which is exposed now that LoopSimplify isn't being redundantly run both before and after DominanceFrontier. Modified: llvm/trunk/lib/VMCore/Dominators.cpp Modified: llvm/trunk/lib/VMCore/Dominators.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=109408&r1=109407&r2=109408&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Dominators.cpp (original) +++ llvm/trunk/lib/VMCore/Dominators.cpp Mon Jul 26 12:55:15 2010 @@ -127,17 +127,6 @@ "NewBB should have a single successor!"); BasicBlock *NewBBSucc = NewBB->getTerminator()->getSuccessor(0); - SmallVector PredBlocks; - for (pred_iterator PI = pred_begin(NewBB), PE = pred_end(NewBB); - PI != PE; ++PI) - PredBlocks.push_back(*PI); - - if (PredBlocks.empty()) - // If NewBB does not have any predecessors then it is a entry block. - // In this case, NewBB and its successor NewBBSucc dominates all - // other blocks. - return; - // NewBBSucc inherits original NewBB frontier. DominanceFrontier::iterator NewBBI = find(NewBB); if (NewBBI != end()) @@ -147,7 +136,9 @@ // DF(NewBBSucc) without the stuff that the new block does not dominate // a predecessor of. DominatorTree &DT = getAnalysis(); - if (DT.dominates(NewBB, NewBBSucc)) { + DomTreeNode *NewBBNode = DT.getNode(NewBB); + DomTreeNode *NewBBSuccNode = DT.getNode(NewBBSucc); + if (DT.dominates(NewBBNode, NewBBSuccNode)) { DominanceFrontier::iterator DFI = find(NewBBSucc); if (DFI != end()) { DominanceFrontier::DomSetType Set = DFI->second; @@ -157,7 +148,7 @@ bool DominatesPred = false; for (pred_iterator PI = pred_begin(*SetI), E = pred_end(*SetI); PI != E; ++PI) - if (DT.dominates(NewBB, *PI)) { + if (DT.dominates(NewBBNode, DT.getNode(*PI))) { DominatesPred = true; break; } @@ -185,50 +176,71 @@ NewDFSet.insert(NewBBSucc); addBasicBlock(NewBB, NewDFSet); } - - // Now we must loop over all of the dominance frontiers in the function, - // replacing occurrences of NewBBSucc with NewBB in some cases. All - // blocks that dominate a block in PredBlocks and contained NewBBSucc in - // their dominance frontier must be updated to contain NewBB instead. - // - for (Function::iterator FI = NewBB->getParent()->begin(), - FE = NewBB->getParent()->end(); FI != FE; ++FI) { - DominanceFrontier::iterator DFI = find(FI); - if (DFI == end()) continue; // unreachable block. - - // Only consider nodes that have NewBBSucc in their dominator frontier. - if (!DFI->second.count(NewBBSucc)) continue; - // Verify whether this block dominates a block in predblocks. If not, do - // not update it. - bool BlockDominatesAny = false; - for (SmallVectorImpl::const_iterator BI = PredBlocks.begin(), - BE = PredBlocks.end(); BI != BE; ++BI) { - if (DT.dominates(FI, *BI)) { - BlockDominatesAny = true; + // Now update dominance frontiers which either used to contain NewBBSucc + // or which now need to include NewBB. + + // Collect the set of blocks which dominate a predecessor of NewBB or + // NewSuccBB and which don't dominate both. This is an initial + // approximation of the blocks whose dominance frontiers will need updates. + SmallVector AllPredDoms; + + // Compute the block which dominates both NewBBSucc and NewBB. This is + // the immediate dominator of NewBBSucc unless NewBB dominates NewBBSucc. + // The code below which climbs dominator trees will stop at this point, + // because from this point up, dominance frontiers are unaffected. + DomTreeNode *DominatesBoth = 0; + if (NewBBSuccNode) { + DominatesBoth = NewBBSuccNode->getIDom(); + if (DominatesBoth == NewBBNode) + DominatesBoth = NewBBNode->getIDom(); + } + + // Collect the set of all blocks which dominate a predecessor of NewBB. + SmallPtrSet NewBBPredDoms; + for (pred_iterator PI = pred_begin(NewBB), E = pred_end(NewBB); PI != E; ++PI) + for (DomTreeNode *DTN = DT.getNode(*PI); DTN; DTN = DTN->getIDom()) { + if (DTN == DominatesBoth) break; - } + if (!NewBBPredDoms.insert(DTN)) + break; + AllPredDoms.push_back(DTN); } - // If NewBBSucc should not stay in our dominator frontier, remove it. - // We remove it unless there is a predecessor of NewBBSucc that we - // dominate, but we don't strictly dominate NewBBSucc. - bool ShouldRemove = true; - if ((BasicBlock*)FI == NewBBSucc || !DT.dominates(FI, NewBBSucc)) { - // Okay, we know that PredDom does not strictly dominate NewBBSucc. - // Check to see if it dominates any predecessors of NewBBSucc. - for (pred_iterator PI = pred_begin(NewBBSucc), - E = pred_end(NewBBSucc); PI != E; ++PI) - if (DT.dominates(FI, *PI)) { - ShouldRemove = false; - break; - } + // Collect the set of all blocks which dominate a predecessor of NewSuccBB. + SmallPtrSet NewBBSuccPredDoms; + for (pred_iterator PI = pred_begin(NewBBSucc), + E = pred_end(NewBBSucc); PI != E; ++PI) + for (DomTreeNode *DTN = DT.getNode(*PI); DTN; DTN = DTN->getIDom()) { + if (DTN == DominatesBoth) + break; + if (!NewBBSuccPredDoms.insert(DTN)) + break; + if (!NewBBPredDoms.count(DTN)) + AllPredDoms.push_back(DTN); } - - if (ShouldRemove) - removeFromFrontier(DFI, NewBBSucc); - if (BlockDominatesAny && (&*FI == NewBB || !DT.dominates(FI, NewBB))) + + // Visit all relevant dominance frontiers and make any needed updates. + for (SmallVectorImpl::const_iterator I = AllPredDoms.begin(), + E = AllPredDoms.end(); I != E; ++I) { + DomTreeNode *DTN = *I; + iterator DFI = find((*I)->getBlock()); + + // Only consider nodes that have NewBBSucc in their dominator frontier. + if (DFI == end() || !DFI->second.count(NewBBSucc)) continue; + + // If the block dominates a predecessor of NewBB but does not properly + // dominate NewBB itself, add NewBB to its dominance frontier. + if (NewBBPredDoms.count(DTN) && + !DT.properlyDominates(DTN, NewBBNode)) addToFrontier(DFI, NewBB); + + // If the block does not dominate a predecessor of NewBBSucc or + // properly dominates NewBBSucc itself, remove NewBBSucc from its + // dominance frontier. + if (!NewBBSuccPredDoms.count(DTN) || + DT.properlyDominates(DTN, NewBBSuccNode)) + removeFromFrontier(DFI, NewBBSucc); } } From resistor at mac.com Mon Jul 26 12:56:43 2010 From: resistor at mac.com (Owen Anderson) Date: Mon, 26 Jul 2010 17:56:43 -0000 Subject: [llvm-commits] [llvm] r109409 - /llvm/trunk/README.txt Message-ID: <20100726175643.225AA2A6C12C@llvm.org> Author: resistor Date: Mon Jul 26 12:56:42 2010 New Revision: 109409 URL: http://llvm.org/viewvc/llvm-project?rev=109409&view=rev Log: Test commit for new post-commit hooks. Modified: llvm/trunk/README.txt Modified: llvm/trunk/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/README.txt?rev=109409&r1=109408&r2=109409&view=diff ============================================================================== --- llvm/trunk/README.txt (original) +++ llvm/trunk/README.txt Mon Jul 26 12:56:42 2010 @@ -13,3 +13,4 @@ If you're writing a package for LLVM, see docs/Packaging.html for our suggestions. + From dpatel at apple.com Mon Jul 26 12:57:29 2010 From: dpatel at apple.com (Devang Patel) Date: Mon, 26 Jul 2010 10:57:29 -0700 Subject: [llvm-commits] [llvm] r109302 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp In-Reply-To: <8701F036-6C65-4803-AFA8-824E74CD9AB8@apple.com> References: <20100724005322.9283F2A6C12C@llvm.org> <8701F036-6C65-4803-AFA8-824E74CD9AB8@apple.com> Message-ID: On Jul 26, 2010, at 10:05 AM, Chris Lattner wrote: > Completely agreed. With a compiler server (for example) the individual compiler instances and the backend may be running in completely different directories. OK. I'll use another approach. - Devang > > -Chris > > On Jul 26, 2010, at 8:28 AM, Daniel Dunbar wrote: > >> Hi Devang, >> >> The backend should not be introducing dependencies on the current >> working directory. This kind of stuff needs to be in the frontend. >> >> - Daniel >> >> On Fri, Jul 23, 2010 at 5:53 PM, Devang Patel wrote: >>> Author: dpatel >>> Date: Fri Jul 23 19:53:22 2010 >>> New Revision: 109302 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=109302&view=rev >>> Log: >>> Use current working directory when Dirname is empty. This only happens when absolute source file path is used on compiler command line. >>> >>> Modified: >>> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp >>> >>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=109302&r1=109301&r2=109302&view=diff >>> ============================================================================== >>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) >>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Jul 23 19:53:22 2010 >>> @@ -1753,6 +1753,11 @@ >>> /// maps as well. >>> unsigned DwarfDebug::GetOrCreateSourceID(StringRef DirName, StringRef FileName){ >>> unsigned DId; >>> + if (DirName.empty()) { >>> + llvm::sys::Path CWD = llvm::sys::Path::GetCurrentDirectory(); >>> + DirName = StringRef(CWD.c_str(), CWD.size()); >>> + } >>> + >>> StringMap::iterator DI = DirectoryIdMap.find(DirName); >>> if (DI != DirectoryIdMap.end()) { >>> DId = DI->getValue(); >>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From ggreif at gmail.com Mon Jul 26 12:58:32 2010 From: ggreif at gmail.com (Gabor Greif) Date: Mon, 26 Jul 2010 19:58:32 +0200 Subject: [llvm-commits] [llvm] r109220 - /llvm/trunk/include/llvm/Use.h In-Reply-To: References: <20100723083607.9183D2A6C12C@llvm.org> <4B1D9A59-3530-4C93-8436-F0F1A4B947F3@apple.com> <730b40a2-8a73-4301-8f29-58b09716509a@z10g2000yqb.googlegroups.com> Message-ID: I could not reproduce a build failure in llvm-gcc. What error did you get? Gabor On 7/23/10, Eric Christopher wrote: > > On Jul 23, 2010, at 2:08 AM, Gabor Greif wrote: > >> Alright, thanks! >> >> Sorry for the damage, I'll take care of llvm-gcc this week. > > Clang too please. > >> Will write up a small blurb for the release notes too. >> > > Thanks! I'm also tracking down a miscompile that's going on after one of > these patches. It's down to 109100(pass)-109104(fails) so I'm going to > probably revert whichever ones will make my miscompile go away also. It's a > bad stack smashing while jitting problem and I'm on vacation for a few days > so I want to get my builder clean before that. > > I'll work on a testcase of what went wrong after that if it's not clear when > I revert :) > >> Btw. why is the buildbot site down? > > No idea :) > > -eric From echristo at apple.com Mon Jul 26 12:59:59 2010 From: echristo at apple.com (Eric Christopher) Date: Mon, 26 Jul 2010 10:59:59 -0700 Subject: [llvm-commits] [llvm] r109220 - /llvm/trunk/include/llvm/Use.h In-Reply-To: References: <20100723083607.9183D2A6C12C@llvm.org> <4B1D9A59-3530-4C93-8436-F0F1A4B947F3@apple.com> <730b40a2-8a73-4301-8f29-58b09716509a@z10g2000yqb.googlegroups.com> Message-ID: On Jul 26, 2010, at 10:58 AM, Gabor Greif wrote: > I could not reproduce a build failure in llvm-gcc. What error did you get? >> >> Thanks! I'm also tracking down a miscompile that's going on after one of >> these patches. It's down to 109100(pass)-109104(fails) so I'm going to >> probably revert whichever ones will make my miscompile go away also. It's a >> bad stack smashing while jitting problem and I'm on vacation for a few days >> so I want to get my builder clean before that. This was a different patch, it was the virtual register one (the only one in the range you didn't do actually) and I reverted it Friday morning. Thanks! -eric From gohman at apple.com Mon Jul 26 13:00:43 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 26 Jul 2010 18:00:43 -0000 Subject: [llvm-commits] [llvm] r109410 - /llvm/trunk/test/Transforms/LCSSA/2006-06-03-IncorrectIDFPhis.ll Message-ID: <20100726180043.3A9922A6C12C@llvm.org> Author: djg Date: Mon Jul 26 13:00:43 2010 New Revision: 109410 URL: http://llvm.org/viewvc/llvm-project?rev=109410&view=rev Log: Avoid depending on LCSSA implicitly pulling in LoopSimplify. Modified: llvm/trunk/test/Transforms/LCSSA/2006-06-03-IncorrectIDFPhis.ll Modified: llvm/trunk/test/Transforms/LCSSA/2006-06-03-IncorrectIDFPhis.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LCSSA/2006-06-03-IncorrectIDFPhis.ll?rev=109410&r1=109409&r2=109410&view=diff ============================================================================== --- llvm/trunk/test/Transforms/LCSSA/2006-06-03-IncorrectIDFPhis.ll (original) +++ llvm/trunk/test/Transforms/LCSSA/2006-06-03-IncorrectIDFPhis.ll Mon Jul 26 13:00:43 2010 @@ -1,6 +1,6 @@ -; RUN: opt < %s -lcssa -S | \ +; RUN: opt < %s -loopsimplify -lcssa -S | \ ; RUN: grep {%%SJE.0.0.lcssa = phi .struct.SetJmpMapEntry} -; RUN: opt < %s -lcssa -S | \ +; RUN: opt < %s -loopsimplify -lcssa -S | \ ; RUN: grep {%%SJE.0.0.lcssa1 = phi .struct.SetJmpMapEntry} %struct.SetJmpMapEntry = type { i8*, i32, %struct.SetJmpMapEntry* } From resistor at mac.com Mon Jul 26 13:00:59 2010 From: resistor at mac.com (Owen Anderson) Date: Mon, 26 Jul 2010 18:00:59 -0000 Subject: [llvm-commits] [llvm] r109411 - /llvm/trunk/README.txt Message-ID: <20100726180059.AC7B02A6C12C@llvm.org> Author: resistor Date: Mon Jul 26 13:00:59 2010 New Revision: 109411 URL: http://llvm.org/viewvc/llvm-project?rev=109411&view=rev Log: Another test commit. Modified: llvm/trunk/README.txt Modified: llvm/trunk/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/README.txt?rev=109411&r1=109410&r2=109411&view=diff ============================================================================== --- llvm/trunk/README.txt (original) +++ llvm/trunk/README.txt Mon Jul 26 13:00:59 2010 @@ -13,4 +13,3 @@ If you're writing a package for LLVM, see docs/Packaging.html for our suggestions. - From gohman at apple.com Mon Jul 26 13:02:06 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 26 Jul 2010 18:02:06 -0000 Subject: [llvm-commits] [llvm] r109412 - /llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp Message-ID: <20100726180206.9CA9E2A6C12C@llvm.org> Author: djg Date: Mon Jul 26 13:02:06 2010 New Revision: 109412 URL: http://llvm.org/viewvc/llvm-project?rev=109412&view=rev Log: Preserve ScalarEvolution in the loop unroller. Modified: llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp Modified: llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp?rev=109412&r1=109411&r2=109412&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp Mon Jul 26 13:02:06 2010 @@ -24,6 +24,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/LoopPass.h" +#include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" @@ -127,6 +128,11 @@ return false; } + // Notify ScalarEvolution that the loop will be substantially changed, + // if not outright eliminated. + if (ScalarEvolution *SE = LPM->getAnalysisIfAvailable()) + SE->forgetLoop(L); + // Find trip count unsigned TripCount = L->getSmallConstantTripCount(); // Find trip multiple if count is not available From gohman at apple.com Mon Jul 26 13:11:16 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 26 Jul 2010 18:11:16 -0000 Subject: [llvm-commits] [llvm] r109413 - in /llvm/trunk: include/llvm/Support/StandardPasses.h lib/Transforms/Scalar/LoopDeletion.cpp lib/Transforms/Scalar/LoopUnrollPass.cpp lib/Transforms/Utils/LCSSA.cpp lib/Transforms/Utils/LoopSimplify.cpp Message-ID: <20100726181116.5345A2A6C131@llvm.org> Author: djg Date: Mon Jul 26 13:11:16 2010 New Revision: 109413 URL: http://llvm.org/viewvc/llvm-project?rev=109413&view=rev Log: Remove LCSSA's bogus dependence on LoopSimplify and LoopSimplify's bogus dependence on DominanceFrontier. Instead, add an explicit DominanceFrontier pass in StandardPasses.h to ensure that it gets scheduled at the right time. Declare that loop unrolling preserves ScalarEvolution, and shuffle some getAnalysisUsages. This eliminates one LoopSimplify and one LCCSA run in the standard compile opts sequence. Modified: llvm/trunk/include/llvm/Support/StandardPasses.h llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp llvm/trunk/lib/Transforms/Utils/LCSSA.cpp llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Modified: llvm/trunk/include/llvm/Support/StandardPasses.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/StandardPasses.h?rev=109413&r1=109412&r2=109413&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/StandardPasses.h (original) +++ llvm/trunk/include/llvm/Support/StandardPasses.h Mon Jul 26 13:11:16 2010 @@ -20,6 +20,7 @@ #define LLVM_SUPPORT_STANDARDPASSES_H #include "llvm/PassManager.h" +#include "llvm/Analysis/Dominators.h" #include "llvm/Analysis/Passes.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Transforms/Scalar.h" @@ -128,6 +129,8 @@ PM->add(createTailCallEliminationPass()); // Eliminate tail calls PM->add(createCFGSimplificationPass()); // Merge & remove BBs PM->add(createReassociatePass()); // Reassociate expressions + // Explicitly schedule this to ensure that it runs before any loop pass. + PM->add(new DominanceFrontier()); // Calculate Dominance Frontiers PM->add(createLoopRotatePass()); // Rotate Loop PM->add(createLICMPass()); // Hoist loop invariants PM->add(createLoopUnswitchPass(OptimizeSize || OptimizationLevel < 3)); Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp?rev=109413&r1=109412&r2=109413&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Mon Jul 26 13:11:16 2010 @@ -38,9 +38,9 @@ bool &Changed, BasicBlock *Preheader); virtual void getAnalysisUsage(AnalysisUsage& AU) const { - AU.addRequired(); AU.addRequired(); AU.addRequired(); + AU.addRequired(); AU.addRequiredID(LoopSimplifyID); AU.addRequiredID(LCSSAID); Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp?rev=109413&r1=109412&r2=109413&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp Mon Jul 26 13:11:16 2010 @@ -17,6 +17,7 @@ #include "llvm/Transforms/Scalar.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/InlineCost.h" +#include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" @@ -55,17 +56,19 @@ /// loop preheaders be inserted into the CFG... /// virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(); + AU.addPreserved(); AU.addRequiredID(LoopSimplifyID); + AU.addPreservedID(LoopSimplifyID); AU.addRequiredID(LCSSAID); - AU.addRequired(); AU.addPreservedID(LCSSAID); - AU.addPreserved(); // FIXME: Loop unroll requires LCSSA. And LCSSA requires dom info. // If loop unroll does not preserve dom info then LCSSA pass on next // loop will receive invalid dom info. // For now, recreate dom info, if loop is unrolled. AU.addPreserved(); AU.addPreserved(); + AU.addPreserved(); } }; } Modified: llvm/trunk/lib/Transforms/Utils/LCSSA.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LCSSA.cpp?rev=109413&r1=109412&r2=109413&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LCSSA.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LCSSA.cpp Mon Jul 26 13:11:16 2010 @@ -64,17 +64,12 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesCFG(); - AU.addRequiredTransitive(); + AU.addRequired(); AU.addPreserved(); AU.addPreserved(); - AU.addRequiredTransitive(); + AU.addRequired(); AU.addPreserved(); - - // LCSSA doesn't actually require LoopSimplify, but the PassManager - // doesn't know how to schedule LoopSimplify by itself. - AU.addRequiredID(LoopSimplifyID); AU.addPreservedID(LoopSimplifyID); - AU.addPreserved(); } private: Modified: llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp?rev=109413&r1=109412&r2=109413&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Mon Jul 26 13:11:16 2010 @@ -77,22 +77,17 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { // We need loop information to identify the loops... - AU.addRequiredTransitive(); + AU.addRequired(); AU.addPreserved(); - // Request DominanceFrontier now, even though LoopSimplify does - // not use it. This allows Pass Manager to schedule Dominance - // Frontier early enough such that one LPPassManager can handle - // multiple loop transformation passes. - AU.addRequired(); - AU.addPreserved(); - - AU.addRequiredTransitive(); + AU.addRequired(); AU.addPreserved(); AU.addPreserved(); AU.addPreserved(); AU.addPreservedID(BreakCriticalEdgesID); // No critical edges added. + AU.addPreserved(); + AU.addPreservedID(LCSSAID); } /// verifyAnalysis() - Verify LoopSimplifyForm's guarantees. From resistor at mac.com Mon Jul 26 13:13:21 2010 From: resistor at mac.com (Owen Anderson) Date: Mon, 26 Jul 2010 18:13:21 -0000 Subject: [llvm-commits] [llvm] r109414 - /llvm/trunk/README.txt Message-ID: <20100726181321.855852A6C131@llvm.org> Author: resistor Date: Mon Jul 26 13:13:21 2010 New Revision: 109414 URL: http://llvm.org/viewvc/llvm-project?rev=109414&view=rev Log: Hopefully the last test commit. Modified: llvm/trunk/README.txt Modified: llvm/trunk/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/README.txt?rev=109414&r1=109413&r2=109414&view=diff ============================================================================== --- llvm/trunk/README.txt (original) +++ llvm/trunk/README.txt Mon Jul 26 13:13:21 2010 @@ -13,3 +13,4 @@ If you're writing a package for LLVM, see docs/Packaging.html for our suggestions. + From gohman at apple.com Mon Jul 26 13:15:42 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 26 Jul 2010 18:15:42 -0000 Subject: [llvm-commits] [llvm] r109415 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <20100726181542.1C0CE2A6C131@llvm.org> Author: djg Date: Mon Jul 26 13:15:41 2010 New Revision: 109415 URL: http://llvm.org/viewvc/llvm-project?rev=109415&view=rev Log: Handle Values with no value in getCopyFromRegs. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=109415&r1=109414&r2=109415&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Jul 26 13:15:41 2010 @@ -530,6 +530,10 @@ FunctionLoweringInfo &FuncInfo, DebugLoc dl, SDValue &Chain, SDValue *Flag) const { + // A Value with type {} or [0 x %t] needs no registers. + if (ValueVTs.empty()) + return SDValue(); + const TargetLowering &TLI = DAG.getTargetLoweringInfo(); // Assemble the legal parts into the final values. From scanon at apple.com Mon Jul 26 13:17:00 2010 From: scanon at apple.com (Stephen Canon) Date: Mon, 26 Jul 2010 18:17:00 -0000 Subject: [llvm-commits] [compiler-rt] r109416 - /compiler-rt/trunk/lib/fp_lib.h Message-ID: <20100726181700.737F42A6C130@llvm.org> Author: scanon Date: Mon Jul 26 13:17:00 2010 New Revision: 109416 URL: http://llvm.org/viewvc/llvm-project?rev=109416&view=rev Log: Fix error in rep_clz on non-LP64 targets. Patch by Christoph Gerum Modified: compiler-rt/trunk/lib/fp_lib.h Modified: compiler-rt/trunk/lib/fp_lib.h URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fp_lib.h?rev=109416&r1=109415&r2=109416&view=diff ============================================================================== --- compiler-rt/trunk/lib/fp_lib.h (original) +++ compiler-rt/trunk/lib/fp_lib.h Mon Jul 26 13:17:00 2010 @@ -57,9 +57,9 @@ return __builtin_clzl(a); #else if (a & REP_C(0xffffffff00000000)) - return 32 + __builtin_clz(a >> 32); + return __builtin_clz(a >> 32); else - return __builtin_clz(a & REP_C(0xffffffff)); + return 32 + __builtin_clz(a & REP_C(0xffffffff)); #endif } From dpatel at apple.com Mon Jul 26 13:23:40 2010 From: dpatel at apple.com (Devang Patel) Date: Mon, 26 Jul 2010 11:23:40 -0700 Subject: [llvm-commits] [llvm] r109413 - in /llvm/trunk: include/llvm/Support/StandardPasses.h lib/Transforms/Scalar/LoopDeletion.cpp lib/Transforms/Scalar/LoopUnrollPass.cpp lib/Transforms/Utils/LCSSA.cpp lib/Transforms/Utils/LoopSimplify.cpp In-Reply-To: <20100726181116.5345A2A6C131@llvm.org> References: <20100726181116.5345A2A6C131@llvm.org> Message-ID: On Jul 26, 2010, at 11:11 AM, Dan Gohman wrote: > Author: djg > Date: Mon Jul 26 13:11:16 2010 > New Revision: 109413 > > URL: http://llvm.org/viewvc/llvm-project?rev=109413&view=rev > Log: > Remove LCSSA's bogus dependence on LoopSimplify and LoopSimplify's bogus > dependence on DominanceFrontier. Instead, add an explicit DominanceFrontier > pass in StandardPasses.h to ensure that it gets scheduled at the right > time. If a Pass breaks because DominanceFrontier was not explicitly added in pass manager queue then the pass is broken. A pass is supposed to request all the required analysis itself. $ opt -mypass should just work even if mypass needs DominanceFrontier. It is mypass's responsibility to request dominance frontier. Enforcing `$ opt -domfrontier -mypass` requirement completely goes against getAnalysisUsage() mechanism. - Devang -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100726/45ed2411/attachment.html From evan.cheng at apple.com Mon Jul 26 13:27:30 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 26 Jul 2010 11:27:30 -0700 Subject: [llvm-commits] [llvm] r109047 - in /llvm/trunk: lib/Target/ARM/ARMFastISel.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMISelLowering.h lib/Target/ARM/CMakeLists.txt lib/Target/ARM/Makefile test/CodeGen/ARM/fast-isel.ll In-Reply-To: <20100721222611.E758A2A6C12C@llvm.org> References: <20100721222611.E758A2A6C12C@llvm.org> Message-ID: <795C641C-8137-416C-BEC8-5F65A16C1C8B@apple.com> This is breaking ARM -O0. e.g. unsigned FastEmit_ISD_Constant_MVT_i32_i(MVT RetVT, uint64_t imm0) { if (RetVT.SimpleTy != MVT::i32) return 0; if ((!Subtarget->isThumb()) && (Subtarget->hasV6T2Ops())) { return FastEmitInst_i(ARM::MOVi32imm, ARM::GPRRegisterClass, imm0); } if ((Subtarget->isThumb2())) { => return FastEmitInst_i(ARM::t2MOVi32imm, ARM::GPRRegisterClass, imm0); } return 0; } But FastISel::FastEmitInst_i isn't creating the right instructions for ARM since it doesn't add the default predicate operands. I'm going to disable fastisel for ARM for now. Evan On Jul 21, 2010, at 3:26 PM, Eric Christopher wrote: > Author: echristo > Date: Wed Jul 21 17:26:11 2010 > New Revision: 109047 > > URL: http://llvm.org/viewvc/llvm-project?rev=109047&view=rev > Log: > Baby steps towards ARM fast-isel. > > Added: > llvm/trunk/lib/Target/ARM/ARMFastISel.cpp > llvm/trunk/test/CodeGen/ARM/fast-isel.ll > Modified: > llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp > llvm/trunk/lib/Target/ARM/ARMISelLowering.h > llvm/trunk/lib/Target/ARM/CMakeLists.txt > llvm/trunk/lib/Target/ARM/Makefile > > Added: llvm/trunk/lib/Target/ARM/ARMFastISel.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFastISel.cpp?rev=109047&view=auto > ============================================================================== > --- llvm/trunk/lib/Target/ARM/ARMFastISel.cpp (added) > +++ llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Wed Jul 21 17:26:11 2010 > @@ -0,0 +1,71 @@ > +//===-- ARMFastISel.cpp - ARM FastISel implementation ---------------------===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open Source > +// License. See LICENSE.TXT for details. > +// > +//===----------------------------------------------------------------------===// > +// > +// This file defines the ARM-specific support for the FastISel class. Some > +// of the target-specific code is generated by tablegen in the file > +// ARMGenFastISel.inc, which is #included here. > +// > +//===----------------------------------------------------------------------===// > + > +#include "ARM.h" > +#include "ARMRegisterInfo.h" > +#include "ARMTargetMachine.h" > +#include "ARMSubtarget.h" > +#include "llvm/CallingConv.h" > +#include "llvm/DerivedTypes.h" > +#include "llvm/GlobalVariable.h" > +#include "llvm/Instructions.h" > +#include "llvm/IntrinsicInst.h" > +#include "llvm/CodeGen/Analysis.h" > +#include "llvm/CodeGen/FastISel.h" > +#include "llvm/CodeGen/FunctionLoweringInfo.h" > +#include "llvm/CodeGen/MachineConstantPool.h" > +#include "llvm/CodeGen/MachineFrameInfo.h" > +#include "llvm/CodeGen/MachineRegisterInfo.h" > +#include "llvm/Support/CallSite.h" > +#include "llvm/Support/ErrorHandling.h" > +#include "llvm/Support/GetElementPtrTypeIterator.h" > +#include "llvm/Target/TargetOptions.h" > +using namespace llvm; > + > +namespace { > + > +class ARMFastISel : public FastISel { > + > + /// Subtarget - Keep a pointer to the ARMSubtarget around so that we can > + /// make the right decision when generating code for different targets. > + const ARMSubtarget *Subtarget; > + > + public: > + explicit ARMFastISel(FunctionLoweringInfo &funcInfo) : FastISel(funcInfo) { > + Subtarget = &TM.getSubtarget(); > + } > + > + virtual bool TargetSelectInstruction(const Instruction *I); > + > + #include "ARMGenFastISel.inc" > + > + }; > + > +} // end anonymous namespace > + > +// #include "ARMGenCallingConv.inc" > + > +bool ARMFastISel::TargetSelectInstruction(const Instruction *I) { > + switch (I->getOpcode()) { > + default: break; > + } > + return false; > +} > + > +namespace llvm { > + llvm::FastISel *ARM::createFastISel(FunctionLoweringInfo &funcInfo) { > + return new ARMFastISel(funcInfo); > + } > +} > > Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=109047&r1=109046&r2=109047&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Wed Jul 21 17:26:11 2010 > @@ -694,6 +694,12 @@ > return TargetLowering::getRegClassFor(VT); > } > > +// Create a fast isel object. > +FastISel * > +ARMTargetLowering::createFastISel(FunctionLoweringInfo &funcInfo) const { > + return ARM::createFastISel(funcInfo); > +} > + > /// getFunctionAlignment - Return the Log2 alignment of this function. > unsigned ARMTargetLowering::getFunctionAlignment(const Function *F) const { > return getTargetMachine().getSubtarget().isThumb() ? 1 : 2; > > Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.h?rev=109047&r1=109046&r2=109047&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/ARM/ARMISelLowering.h (original) > +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.h Wed Jul 21 17:26:11 2010 > @@ -17,6 +17,7 @@ > > #include "ARMSubtarget.h" > #include "llvm/Target/TargetLowering.h" > +#include "llvm/CodeGen/FastISel.h" > #include "llvm/CodeGen/SelectionDAG.h" > #include "llvm/CodeGen/CallingConvLower.h" > #include > @@ -261,6 +262,10 @@ > /// getFunctionAlignment - Return the Log2 alignment of this function. > virtual unsigned getFunctionAlignment(const Function *F) const; > > + /// createFastISel - This method returns a target specific FastISel object, > + /// or null if the target does not support "fast" ISel. > + virtual FastISel *createFastISel(FunctionLoweringInfo &funcInfo) const; > + > Sched::Preference getSchedulingPreference(SDNode *N) const; > > bool isShuffleMaskLegal(const SmallVectorImpl &M, EVT VT) const; > @@ -387,6 +392,10 @@ > unsigned BinOpcode) const; > > }; > + > + namespace ARM { > + FastISel *createFastISel(FunctionLoweringInfo &funcInfo); > + } > } > > #endif // ARMISELLOWERING_H > > Modified: llvm/trunk/lib/Target/ARM/CMakeLists.txt > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/CMakeLists.txt?rev=109047&r1=109046&r2=109047&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/ARM/CMakeLists.txt (original) > +++ llvm/trunk/lib/Target/ARM/CMakeLists.txt Wed Jul 21 17:26:11 2010 > @@ -11,6 +11,7 @@ > tablegen(ARMGenCallingConv.inc -gen-callingconv) > tablegen(ARMGenSubtarget.inc -gen-subtarget) > tablegen(ARMGenEDInfo.inc -gen-enhanced-disassembly-info) > +tablegen(ARMFastISel.inc -gen-fast-isel) > > add_llvm_target(ARMCodeGen > ARMAsmPrinter.cpp > > Modified: llvm/trunk/lib/Target/ARM/Makefile > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Makefile?rev=109047&r1=109046&r2=109047&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/ARM/Makefile (original) > +++ llvm/trunk/lib/Target/ARM/Makefile Wed Jul 21 17:26:11 2010 > @@ -17,7 +17,8 @@ > ARMGenInstrInfo.inc ARMGenAsmWriter.inc \ > ARMGenDAGISel.inc ARMGenSubtarget.inc \ > ARMGenCodeEmitter.inc ARMGenCallingConv.inc \ > - ARMGenDecoderTables.inc ARMGenEDInfo.inc > + ARMGenDecoderTables.inc ARMGenEDInfo.inc \ > + ARMGenFastISel.inc > > DIRS = AsmPrinter AsmParser Disassembler TargetInfo > > > Added: llvm/trunk/test/CodeGen/ARM/fast-isel.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/fast-isel.ll?rev=109047&view=auto > ============================================================================== > --- llvm/trunk/test/CodeGen/ARM/fast-isel.ll (added) > +++ llvm/trunk/test/CodeGen/ARM/fast-isel.ll Wed Jul 21 17:26:11 2010 > @@ -0,0 +1,15 @@ > +; RUN: llc < %s -fast-isel -fast-isel-abort -march=arm > + > +; Very basic fast-isel functionality. > + > +define i32 @add(i32 %a, i32 %b) nounwind ssp { > +entry: > + %a.addr = alloca i32, align 4 > + %b.addr = alloca i32, align 4 > + store i32 %a, i32* %a.addr > + store i32 %b, i32* %b.addr > + %tmp = load i32* %a.addr > + %tmp1 = load i32* %b.addr > + %add = add nsw i32 %tmp, %tmp1 > + ret i32 %add > +} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From gohman at apple.com Mon Jul 26 13:28:14 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 26 Jul 2010 18:28:14 -0000 Subject: [llvm-commits] [llvm] r109419 - in /llvm/trunk: lib/Analysis/ScalarEvolutionExpander.cpp test/Transforms/IndVarSimplify/crash.ll Message-ID: <20100726182815.24A702A6C12F@llvm.org> Author: djg Date: Mon Jul 26 13:28:14 2010 New Revision: 109419 URL: http://llvm.org/viewvc/llvm-project?rev=109419&view=rev Log: Fix SCEVExpander::visitAddRecExpr so that it remembers the induction variable it inserted rather than using LoopInfo::getCanonicalInductionVariable to rediscover it, since that doesn't work on non-canonical loops. This fixes infinite recurrsion on such loops; PR7562. Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp llvm/trunk/test/Transforms/IndVarSimplify/crash.ll Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=109419&r1=109418&r2=109419&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Mon Jul 26 13:28:14 2010 @@ -1112,21 +1112,13 @@ SE.getUnknown(expand(Rest)))); } - // {0,+,1} --> Insert a canonical induction variable into the loop! - if (S->isAffine() && S->getOperand(1)->isOne()) { - // If there's a canonical IV, just use it. - if (CanonicalIV) { - assert(Ty == SE.getEffectiveSCEVType(CanonicalIV->getType()) && - "IVs with types different from the canonical IV should " - "already have been handled!"); - return CanonicalIV; - } - + // If we don't yet have a canonical IV, create one. + if (!CanonicalIV) { // Create and insert the PHI node for the induction variable in the // specified loop. BasicBlock *Header = L->getHeader(); - PHINode *PN = PHINode::Create(Ty, "indvar", Header->begin()); - rememberInstruction(PN); + CanonicalIV = PHINode::Create(Ty, "indvar", Header->begin()); + rememberInstruction(CanonicalIV); Constant *One = ConstantInt::get(Ty, 1); for (pred_iterator HPI = pred_begin(Header), HPE = pred_end(Header); @@ -1135,40 +1127,45 @@ if (L->contains(HP)) { // Insert a unit add instruction right before the terminator // corresponding to the back-edge. - Instruction *Add = BinaryOperator::CreateAdd(PN, One, "indvar.next", - HP->getTerminator()); + Instruction *Add = BinaryOperator::CreateAdd(CanonicalIV, One, + "indvar.next", + HP->getTerminator()); rememberInstruction(Add); - PN->addIncoming(Add, HP); + CanonicalIV->addIncoming(Add, HP); } else { - PN->addIncoming(Constant::getNullValue(Ty), HP); + CanonicalIV->addIncoming(Constant::getNullValue(Ty), HP); } } } + // {0,+,1} --> Insert a canonical induction variable into the loop! + if (S->isAffine() && S->getOperand(1)->isOne()) { + assert(Ty == SE.getEffectiveSCEVType(CanonicalIV->getType()) && + "IVs with types different from the canonical IV should " + "already have been handled!"); + return CanonicalIV; + } + // {0,+,F} --> {0,+,1} * F - // Get the canonical induction variable I for this loop. - Value *I = CanonicalIV ? - CanonicalIV : - getOrInsertCanonicalInductionVariable(L, Ty); // If this is a simple linear addrec, emit it now as a special case. if (S->isAffine()) // {0,+,F} --> i*F return expand(SE.getTruncateOrNoop( - SE.getMulExpr(SE.getUnknown(I), + SE.getMulExpr(SE.getUnknown(CanonicalIV), SE.getNoopOrAnyExtend(S->getOperand(1), - I->getType())), + CanonicalIV->getType())), Ty)); // If this is a chain of recurrences, turn it into a closed form, using the // folders, then expandCodeFor the closed form. This allows the folders to // simplify the expression without having to build a bunch of special code // into this folder. - const SCEV *IH = SE.getUnknown(I); // Get I as a "symbolic" SCEV. + const SCEV *IH = SE.getUnknown(CanonicalIV); // Get I as a "symbolic" SCEV. // Promote S up to the canonical IV type, if the cast is foldable. const SCEV *NewS = S; - const SCEV *Ext = SE.getNoopOrAnyExtend(S, I->getType()); + const SCEV *Ext = SE.getNoopOrAnyExtend(S, CanonicalIV->getType()); if (isa(Ext)) NewS = Ext; Modified: llvm/trunk/test/Transforms/IndVarSimplify/crash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/crash.ll?rev=109419&r1=109418&r2=109419&view=diff ============================================================================== --- llvm/trunk/test/Transforms/IndVarSimplify/crash.ll (original) +++ llvm/trunk/test/Transforms/IndVarSimplify/crash.ll Mon Jul 26 13:28:14 2010 @@ -1,4 +1,5 @@ ; RUN: opt -indvars %s -disable-output +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" declare i32 @putchar(i8) nounwind @@ -17,3 +18,38 @@ ;